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.

MSPM0L1227: How to Erase/Write Flash by Application

Part Number: MSPM0L1227


Tool/software:

Hi,

 

My customer wants to update (Erase and Write) some data in Flash during user application running.

Could you tell them how to do that ?

 

In order to erase/write the data in Flash, they’re thinking to allocate the program for Erasing/Writing Flash onto the one bank in Flash and the erased/written data area onto another bank.

Could you tell them how to allocate the codes onto each different bank ?

 

Is the following procedure correct ?

At first, divide the addresses for Flash 1/2 and bank 0/1 at the MEMORY in “Device_Linker.cmd”.

After that, allocate the program (.text) to one bank and the data area which they want to update to the other bank.

 

But even if they modify the .cmd file, it will be automatically overwritten at building, so it would be helpful if you could tell them correct procedure.

 

Is there any example for erased/written one bank by erasing/writing program on another bank ?

 

Thanks and regards,

Hideaki

  • HI Hideaki,

    What data exactly is your customer trying to store in the flash bank? It is certainly possible to designate one flash bank as your application bank, and one as your data bank, you do just need to specify in the linker that one address range is reserved for the application, and then place the application there, and similarly specify that the address range for the other bank is for data, and then ensure that your application only writes data inside that memory area.

    So your process that you list above is generally correct. To prevent your .cmd file from being overwritten when building, you need to go to the .syscfg file, go to the project configuration files tab, and then de-select the linker file generation option. You'll then need to manually place your linker file into the main project directory.

    As for examples for writing and erasing flash, I'd recommend that you check out the FLASHCTL examples inside of our SDK. As long as the commands you issue to the flashctl use the "data" bank addresses, it will only interact with the data bank. So the examples we have do not explicitly outline using one bank as a data bank, but all you need to do is utilize addresses in one particular bank for data and this will work.