回复于:如何配置程序在ram中运行?

Home 论坛 SDK支持 如何配置程序在ram中运行? 回复于:如何配置程序在ram中运行?

#1598
HowardHoward
参与者

把你想要在RAM中运行的代码(函数、文件)在定义时说明放到指定的section中去,

__attribute__((section(“your_section_name”)))  void f () { /* your code */};

然后修改Linker script文件,把 your_section_name section放到RAM中去:

.data : AT(__DATA_ROM)
{
. = ALIGN(4);
__DATA_RAM = .;
__data_start__ = .; /* create a global symbol at data start */
*(your_section_name);
*(.data) /* .data sections */
*(.data*) /* .data* sections */
*(.sdata .sdata.*)
*(.heapsram*) /* This is only for the pulpino official test code. */
__noncachedata_start__ = .; /* create a global symbol at ncache data start */
*(NonCacheable)
__noncachedata_end__ = .; /* define a global symbol at ncache data end */
KEEP(*(.jcr*))
. = ALIGN(4);
__data_end__ = .; /* define a global symbol at data end */
} > m_data