CW 10.1 (Kinetis) - How to place functions and variables in .data section?

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

CW 10.1 (Kinetis) - How to place functions and variables in .data section?

ソリューションへジャンプ
1,847件の閲覧回数
Focon
Contributor II

Hi,

 

Since CW 10.1 should be GCC based, i thought that this should work:

 

void

FuncInRam(void) __attribute__ ((section(".data")));

 

 

 

int

main()

{

   FuncInRam();

}

 

void

FuncInRam(void)

{

...

}

 

But it doesn't. First of all, i wonder why the compiler complains about __attribute__ line. Secondly both going through the MAP-file and a debug session, shows me that the function is actually placed in .text section.

 

I have tried what was surgested in this thread:

https://community.freescale.com/thread/89042

 

With the same result, but this time the compiler complains about the #pragma line.

 

I am using CW 10.1 for microcontrollers (windows hosted) Standard Edition.

 

Also, I am unable to activate the GCC extensions, through the compiler settings. It says it doesn't know the -gcc flag.

 

Any help is appreciated, thank you.

0 件の賞賛
返信
1 解決策
1,327件の閲覧回数
Focon
Contributor II

Further study at the infocenter and MCU_Kinetis_Compiler.pdf let me com to this solution:

 

#pragma define_section FUNCRAM ".data" far_abs RX

 

#pragma section FUNCRAM begin

void

FuncInRam(void)

{

   ...

}

#pragma section FUNCRAM end

 

 

int

user_main()

{

   FuncInRam();

}

 

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
1,328件の閲覧回数
Focon
Contributor II

Further study at the infocenter and MCU_Kinetis_Compiler.pdf let me com to this solution:

 

#pragma define_section FUNCRAM ".data" far_abs RX

 

#pragma section FUNCRAM begin

void

FuncInRam(void)

{

   ...

}

#pragma section FUNCRAM end

 

 

int

user_main()

{

   FuncInRam();

}

 

0 件の賞賛
返信
1,327件の閲覧回数
Focon
Contributor II

For the variables part, I ofcourse mean, how to place variables in custom defined sections.

0 件の賞賛
返信