Reply
Posts: 435
Registered: ‎07-13-2015
Accepted Solution

How to make sure that a flash page isn't used by my application?

I have an EFM32WG940 and use arm-none-eabi-gcc to compile and link my program. The application requires that I store some data in the MCU's non-volatile flash memory, which is the same memory that the application program code is in.

 

How do I make sure that a few flash pages are NOT used by my program, but instead are reserved for the data?

 

My first bet would be to somehow edit the linker script, but I'm not sure how to do that. Could someone please help me out?

Posts: 561
Registered: ‎09-18-2015

Re: How to make sure that a flash page isn't used by my application?

Hi @Timur,

 

Any reason you cannot use the USERDATA page? That's 2 KB in its own address space apart from the main flash array.

 

Are you using Simplicity Studio? Changing the memory regions in Studio is easy:

 

memory_map.png

 

John

 

Highlighted
Posts: 435
Registered: ‎07-13-2015

Re: How to make sure that a flash page isn't used by my application?

@JohnB

Hey John, thanks! The USERDATA page seems exactly like what I need. If I want to use it, do I need to change memory regions?

 

One more question: when I don't use Simplicity Studio, how can I edit the linker script to change the flash layout?

 

Thanks,

Timur

Posts: 561
Registered: ‎09-18-2015

Re: How to make sure that a flash page isn't used by my application?

Hi @Timur,

 

You'd need to read up on creating sections in a custom GCC linker script if you specifically want to allocate constants in the user data page.

 

Of course, you can just manage it directly, without modifying the linker behavior. I've provided some ideas about how to do this in this Knowledge Base article.

 

John