MCUXpresso : create NOLOAD section

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

MCUXpresso : create NOLOAD section

1,895 次查看
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

标签 (1)
0 项奖励
回复
5 回复数

1,777 次查看
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 项奖励
回复

1,777 次查看
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 项奖励
回复

1,777 次查看
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 项奖励
回复

1,777 次查看
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 项奖励
回复

1,777 次查看
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 项奖励
回复