Skip to main content
Knowledgebase
Home
Renesas Singapore - Knowledgebase

How do I keep Data Flash from being initialized upon debug entry?

Latest Updated:10/04/2016

Question:

I have an application that requires calibration data to be stored in Data Flash. It looks like the debugger is initializing the Data Flash when it is started, so I can't save data between runs, which I need to do. How do I keep the data Flash from being initialized by the debugger?

Answer:

If you have a section of Data Flash that contains data the default set-up of the linker script includes it in the load module and the debugger will download it into Data F;ash. You can mark a section as NOLOAD in the linker script so it will not be included in the load module so it will not be downloaded by the debugger. 

As an example, the .sdram section is currently marked as NOLOAD in the GNU linker script. This is what it looks like:

  /* SDRAM */

   .sdram (NOLOAD):

   {

       __SDRAM_Start = .;

       KEEP(*(.sdram*))

       KEEP(*(.frame*))

       __SDRAM_End = .;

   } > SDRAM

so you can use it as a template for 'protecting' your Data Flash section.