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.

MSPM0G3507: how to reserve a block on FLASH

Part Number: MSPM0G3507

Tool/software:

based on freertos_builds_LP_MSPM0G3507_release_ticlang_2_00_00_03, we want to reserve a specific block on FLASH to save
product critical data, and this block can't be erased on flashing image.

Is MSMP0G3507 support this feature to allow us access a reserved FLASH block, any example for reference?

Thanks.

  • Hi Roi,

    Yes, it could.

    We give the options in the NONMAIN Flash to block flash writing with specific flash region, the minimum size is 1KB.

    If enable it, then it can not be erased by the flashing image. I think there is no example for this, but you can check the NONMAIN region with the static write protection feature.

    A simpler way is that you can assign the flash image erasing address range and let it avoid the product critical data range.

    B.R.

    Sal

  • Hi Sal,

    I check the NONMAIN region on technical document said this region is used by BCR and BSL, so the way of your suggestion is to 'append' a custom data to

    the BCR_Config or BSL_Config but not create a new NONMAIN region?

    If my understanding is correct above, then I found an example from TI resource - flashctl_nonmain_memory_write_LP_MSPM0G3507_nortos_ticlang

    but there shows error log as below, is there any config wrong on my CCS?

    CORTEX_M0P: GEL Output: Memory Map Initialization Complete
    CORTEX_M0P: File Loader: Memory write failed: Flash Programmer: Error, Attempting NONMAIN write without erasing!
    CORTEX_M0P: GEL: File: C:\projects\workspace_v12\flashctl_nonmain_memory_write_LP_MSPM0G3507_nortos_ticlang\Debug\flashctl_nonmain_memory_write_LP_MSPM0G3507_nortos_ticlang.out: Load failed.

    Thanks.

    Roi

  • Hi Roi,

    FLASH should erase firstly and then load new data to FLASH. So, you should erase NONMAIN fitstly. Or, the old data will be retained, which may lead to unexpected results.

    Meanwhile, NONMAIN is a special reigon which controls the task of the device interface access authority, so if user erase the NONMAIN and not load a new data, then the device will be permanently locked and cannot be unlocked.

    As for the error in CCS, you should change the debug behavior to erase NOMAIN flash area. Below is a exapmle:

    B.R.

    Sal

  • By the way, I suggest a simpler way to finish this.

    Using cmd file to reserve a special FLASH for some critial data. Then select "Erase MAIN memory sectors by range" to avoid the reserved FLASH region.

    By the way, the minimum erase size is 1KB, so you should reserve at least 1KB for this.

    B.R.

    Sal

  • Hi Sal,

      I check the cmd file on my project as shown below.

      If I want to reserve 1KB for critical data, do I need to modify cmd file to change the FLASH length from 0x00020000 to 0x0001FC00 first?

    cmd file:  

    MEMORY
    {
    FLASH (RX) : origin = 0x00000000, length = 0x00020000  -> 0x0001FC00
    SRAM (RWX) : origin = 0x20200000, length = 0x00008000
    BCR_CONFIG (R) : origin = 0x41C00000, length = 0x00000080
    BSL_CONFIG (R) : origin = 0x41C00100, length = 0x00000080

    }

    Thanks.

    Roi

  • Hi Roi,

    Yes, correct. Then you can assign 0x1FC00 -0x20000 as a new FLASH region to install some data you want to keep.

    There is guide for the complier grammer which could help you to implement them.

    https://www.ti.com/tool/ARM-CGT?keyMatch=TI%20CLANG 

    B.R.

    Sal