Selectively flash erase with MCUXpresso

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Selectively flash erase with MCUXpresso

2,149 Views
pasqualebarrega
Contributor II

I'm using an LPC845 and in debug mode I need to not erase the last flash sector. As debug probe I use LPClink-2, then is there any way to preserve a flash sector by using the integrated flash gui or I have to modify the debugger script?

In case of script modify how can I do it? Is there any guide?

Thanks.

Labels (1)
3 Replies

1,629 Views
lpcxpresso_supp
NXP Employee
NXP Employee

The one approach is to reserve the last flash sector by truncating the flash size in the IDE memory configuration editor by the size of the last sector. Be sure to erase by sector using the GUI Flash Tool.

Thanks and regards,

MCUXpresso Support

0 Kudos

1,629 Views
victorjimenez
NXP TechSupport
NXP TechSupport

Hello Pasquale Barrega,

I think that the best option to achieve what you are trying to do is if you separate the region of the flash you don't want to erase with the MCU settings.

I took the example gpio_led_output of the SDK for the LPC845 to made an example. By default the project has the following  MCU settings: 

pastedImage_1.png

When you compiled the program you can see the following information in the console of MCUXpresso. 

pastedImage_2.png

At this point we only have one block of Flash but if you go to the MCU settings and you separate the block named PROGRAM_FLASH to have a "reserved block" you will have a block of FLASH that can't be erased while programming the other region of the FLASH. The good thing about this is that when you separate the flash in different regions the debugger script changes automatically.

In the next image you can see that I separated the flash named PROGRAM_FLASH, I created a new block named NEW_FLASH_PROTECTED. 

pastedImage_3.png

When I compiled the program the new block of the flash remains intact: 

pastedImage_5.png

You can read more of the MCU settings option in the user manual of MCUXpresso (https://www.nxp.com/docs/en/user-guide/MCUXpresso_IDE_User_Guide.pdf) chapter 16. 

Also I think you may find useful the following community post: Relocating Code and Data Using the MCUXpresso IDE 

Hope it helps!

Victor.

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,629 Views
pasqualebarrega
Contributor II

Dear Victor,

thank you for your response you suggestion was helpful.

Best regards.

Pasquale Barrega.

Da: victorjimenez <admin@community.nxp.com>

Inviato: mercoledì 8 agosto 2018 23:15

A: Pasquale Barrega <p.barrega@mechatronicslabs.it>

Oggetto: Re: - Re: Selectively flash erase with MCUXpresso

<https://community.freescale.com/resources/statics/1000/35400-NXP-Community-Email-banner-600x75.jpg> NXP Community

Re: Selectively flash erase with MCUXpresso

reply from Victor Jimenez <https://community.nxp.com/people/victorjimenez?et=watches.email.thread> in MCUXpresso Software and Tools - View the full discussion <https://community.nxp.com/message/1043840?commentID=1043840&et=watches.email.thread#comment-1043840>