How can S32K define a variable in a specified address?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How can S32K define a variable in a specified address?

1,263件の閲覧回数
zhengjianfei
Contributor II

Sometimes we need to define a variable in a specified address,but how to do this?The MCU is S32K144 and IDE is S32DS V2.0. I have tried to use the following method :1.unsigned char temp_A@0x00.  2.u8 sram[200] __attribute__((at(0x20002000)));   ,but it did not work!So dose anyone have any idea about this problem,thanks very much!

ラベル(1)
0 件の賞賛
2 返答(返信)

829件の閲覧回数
jiri_kral
NXP Employee
NXP Employee

Hi, 

you need to create custom section in linker file and add your variable like this:

__attribute__ ((section(".your_section"))) unsigned char your_variable;

You can look at this thread - https://community.nxp.com/message/971236 

Jiri

0 件の賞賛

829件の閲覧回数
zhengjianfei
Contributor II

Hi Jiri,thanks! 
 

0 件の賞賛