This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LP-CC2652R7: Trying to dynamically adjusting bootloader

Part Number: LP-CC2652R7
Other Parts Discussed in Thread: CC2652R7

Hello,

So I've been trying to dynamic change the bootloader in flash memory by using various methods found on the forums. I've tried using the NVS stuff to save the current ccfg memory then writing it back to flash with the adjusted values. I also tried the writeFlash() method of the flash_interface_internal, the HapiProgramFlash() method and the HWREG all trying to change the bootloader configuration.

uint8_t* BLON = (uint8_t*)malloc(4 * sizeof(uint8_t));

HWREG(0x50004000 + 0x00000FD8) = 0xC5FE08C5;
HapiProgramFlash(BLON, 0x50004FD8, 4);
writeFlash(0x50004FD8, BLON, 4)

Thanks,
Kenneth  

  • Hello Kenneth,

    It is not recommended that you change the CCFG during run-time: https://e2e.ti.com/f/1/t/1263255

    If you were determined to change it, you should be attempting to modify the last page of flash.  For the CC2652R7 this is 0xAE000 to 0xB0000.  You would need to read, erase, modify, and write this area using flash operations.

    Regards,
    Ryan

  • Hey Ryan,

    I was wondering where you got the memory address 0xAE000 to 0xB0000 from? Also which flash operations would you recommend? 

    Thanks,
    Kenneth

  • 0xAE000 to 0xB0000 is the last page of flash for a 704 kB SimpleLink device where the CCFG is stored.  You can review your project's command linker file for more background.  

    tried the writeFlash() method of the flash_interface_internal

    This or this APIs underlying driverlib functionality could be suitable.

    Regards,
    Ryan

  • Hey Ryan,

    This is how I am currently trying to change the CCFG for the bootloader in Flash, each flash method call comes back successful however whenever I look at the flash it hasn't changed.

    flash_open();
    uint8_t status = -99;
    uint8_t* BLON = (uint8_t*)malloc(8192 * sizeof(uint8_t));

    status = readFlashPg(87, 0, BLON, 8192);
    printf("Status: %d \r\n", status);
    printf("BLON[0]: %d, BLON[1]: %d, BLON[2]: %d, BLON[3]: %d \r\n", BLON[8152], BLON[8153], BLON[8154], BLON[8155]);

    status = eraseFlashPg(87);
    printf("Status: %d \r\n", status);

    BLON[0] = 197;
    BLON[1] = 11;
    BLON[2] = 254;
    BLON[3] = 197;
    printf("BLON[0]: %d, BLON[1]: %d, BLON[2]: %d, BLON[3]: %d \r\n", BLON[0], BLON[1], BLON[2], BLON[3]);

    status = writeFlashPg(87, 0, BLON, 8192);
    printf("Status: %d \r\n", status);

    status = readFlashPg(87, 0, BLON, 8192);
    printf("Status: %d \r\n", status);
    printf("BLON[0]: %d, BLON[1]: %d, BLON[2]: %d, BLON[3]: %d \r\n", BLON[8152], BLON[8153], BLON[8154], BLON[8155]);

    flash_close();

    Thanks,
    Kenneth

  • Does this method work for other pages of flash which do not contain the CCFG?  Can you confirm that eraseFlashPg does nothing to the targeted flash memory area?  Is CCFG write protection enabled for this flash page?

    Regards,
    Ryan

  • Hey Ryan,

    I was able to get it to work. The first problem is that I was modifying the wrong values in the array (should've been 8152 to 8155) and the other problem was the use of all the printf statements. For some reason they prevent the write code from running. 

    Thanks again for your help,
    Kenneth