Hi NXP Team,
I have an KINETIS-based application being developed with MCUXpresso (MCU-Link debug probe). Of 64k FLASH I use 4k to save data. FLASH_LOWER for the code and FLASH_HIGHER to save data (see next image). Two questions:
1. Whenever I debug the whole Flash is erase. But I want to preseve FLASH_UPPER (my data) during the debbuging process. How can I do that?
2. In the final product, I want to protect my code (FLASH_LOWER). Don' t care about FLASH_LOWER (my data). How do I do that?
I have read these articles:
17.8.2 Kinetis MCUs – Flash Config Blocks
I’ve looked through the documentation but I haven’t understood how I could use the MCUXpresso IDE to configure the flash accordingly. Any help is very welcome.
Thank you, Andre.
Solved! Go to Solution.
Hi @AndreVB ,
About 1): I don't see (at least with my IDE 11.4.1) the the LinkServer connection is erasing first all memory. I do have in many projects reserved a region at the end of the flash. But I simply reduce the flash size in the MCU settings:
I can confirm that way for all debug connections I use (Segger J-Link, LinkServer McuLink & P&E Multilink) the FLASH that way does not get touched, showing with MinINI and McuFlash below (from https://mcuoneclipse.com/2021/12/19/key-value-pairs-in-flash-memory-file-system-less-minini/ )
Maybe the thing you see is because you are using an older IDE? I remember (I think it was starting with 11.4) the LinkServer flashing has been optimized, not programming untouched sectors by default (something what J-Link always did, and P&E does now too, at least when I last checked). You could verify the flash operations in the Console view:
About 2): on the KL25Z there are the FPROTx registers which can be used to protect each of the 32 regions of the flash memory (see chapter 27.4.1 Flash Protection) in the KL25Z reference manual.
I hope this helps,
Erich
Hi @AndreVB ,
About 1): I don't see (at least with my IDE 11.4.1) the the LinkServer connection is erasing first all memory. I do have in many projects reserved a region at the end of the flash. But I simply reduce the flash size in the MCU settings:
I can confirm that way for all debug connections I use (Segger J-Link, LinkServer McuLink & P&E Multilink) the FLASH that way does not get touched, showing with MinINI and McuFlash below (from https://mcuoneclipse.com/2021/12/19/key-value-pairs-in-flash-memory-file-system-less-minini/ )
Maybe the thing you see is because you are using an older IDE? I remember (I think it was starting with 11.4) the LinkServer flashing has been optimized, not programming untouched sectors by default (something what J-Link always did, and P&E does now too, at least when I last checked). You could verify the flash operations in the Console view:
About 2): on the KL25Z there are the FPROTx registers which can be used to protect each of the 32 regions of the flash memory (see chapter 27.4.1 Flash Protection) in the KL25Z reference manual.
I hope this helps,
Erich
Hi Erich,
That´s works fine. Simpler than I thought. I was using IDE 11.4.1 and jut moved to IDE 11.5.0. Both working fine. For some reason using IDE 11.4.1, if I do not reduce the Flash size the appliction was mass erasing the memory prior debugging. With IDE 11.5.0, either reducing the flash size or keep it untouched the last sectors are preserved from one debug session to another.
Thank you,
AndreVB
Hi @AndreVB ,
The MCUXpresso IDE will only erase erase affected sector when downloading code by default. You data will not be erased if the last sector is not overlapped by code. If you want to erase everything when programming, you can set in GUI Flash Tool.
Regards,
Jing
Hi @jingpan ,
If I'm not wrong: the settings you show are not used for the download/programming/debugging operation. They are only used if you press that 'Run' button in that dialog, otherwise I think these settings are ignored.
Let me know if I have that wrong?
Erich