IAR define memory region for custom data

血红的双手。 提交于 2019-12-24 11:28:05

问题


I want to define a specific memory region in the STM32 micro where to store some strings. I'm using IAR compiler but I don't find a simple example that can help me to create the region in the correct way using the icf file. How can I create the region and use this region in the code? Thanks


回答1:


I found this solution:

In the icf file I define the memory region in this way:

define region LANGUAGE_region   = mem:[from 0x080FB000 to 0x080FC000];
"LANGUAGE_PLACE":place at start of LANGUAGE_region  { section .LANGUAGE_PLACE.noinit };

I will fill this region with an external srec file using a programmer. To test the region with a simple program (using an integer) I use this declaration:

In the header:

extern const unsigned int mydata @".LANGUAGE_PLACE.noinit";

In the C file:

const unsigned int mydata;

In the debugger I can see the correct address of mydata constant at 0x0800FB000



来源:https://stackoverflow.com/questions/32046459/iar-define-memory-region-for-custom-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!