MCUXpresso : create NOLOAD section

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

MCUXpresso : create NOLOAD section

1,810 Views
EugeneHiihtaja
Senior Contributor I

Hi !

Does it possible to specify via IDE in MCU setting, RAM section what is not initialised at all ?

.data_SRAM4 0x30040000 (NOLOAD) : ALIGN(32)

{

}

Regards,

Eugene

Labels (1)
0 Kudos
Reply
5 Replies

1,692 Views
converse
Senior Contributor V

If there is no data defined in that section, it will not be initialised or zero'd. In fact, if it is not defined at all, then the startup code will not even know about it.

What are you trying to achieve?

0 Kudos
Reply

1,692 Views
EugeneHiihtaja
Senior Contributor I

Hi Con !

I would like to reserve some area of SRAM memory what is persist over MCU reboot.

So no any startup initialization shouldn't  touch those area.

But I still would like to allocate some variables in this section and initialize those from my code.

Does it possible to have some trick or manual modification of exported linker files are only option ?

Regards,

Eugene

0 Kudos
Reply

1,692 Views
converse
Senior Contributor V

I think you want a NOINIT rather than a NOLOAD. And fortunately, MCUXpresso automatically creates .noinit sections in every RAM region you define. So, using the cr_section_macros.h and assuming your memory region is called SRAM_NOINIT, you can simply write 

#include <cr_section_macros.h>

__NOINIT(SRAM_NOINIT) unsigned int preserved_across_boot;

... etc

and this will place preserved_across_boot into SRAM_NOINIT that is not initialised or zero filled.

0 Kudos
Reply

1,692 Views
EugeneHiihtaja
Senior Contributor I

Hi Con !

Looks like I should study this automatic linker file generation in more details.

Could you point me to the latest documentation about it.

I should be able to put some code to SRAMX area for execution and a lot of other advanced staff.

I think it should be some semiautomatic solution . Now I'm manually modify original files.

where tthose templates #include <cr_section_macros.h> are located ?

Looks like they depends from MCU type and other configurations.

Regards,

Eugene

0 Kudos
Reply

1,692 Views
converse
Senior Contributor V

Look in the User Manual - "Memory Configuration and linker scripts". Especially subsection on "Placing data into different RAM blocks using Macros" and "Freemarker Linker Script Templates"

The section macros are in the standard search path for include files. Just #include it.

The macros are not MCU type dependent. You can use YOUR names as defined in the memory configuration editor

0 Kudos
Reply