How do I declare an array in a different segment?

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

How do I declare an array in a different segment?

ソリューションへジャンプ
2,083件の閲覧回数
dporada
Contributor III

In CodeWarrior, I did this:

 

#pragma define_section my_ram2 ".display" abs32 RW

__declspec(section "my_ram2") uint8 Display[511];

 

This does not work in KDS.  I get an error saying that Display is undeclared.

 

Please help.


ラベル(1)
0 件の賞賛
返信
1 解決策
1,524件の閲覧回数
dereksnell
NXP Employee
NXP Employee

Hi Don,

If you’d like to see how the GCC build tools in KDS can do this, you can use KDS to create a new project, and use it as an example. The interrupt vector table is forced to a specific memory section. I created a project with Processor Expert for the K64, and in vectors.c, the line below forces the vector table array into the .vectortable memory section. You can also review the linker file *.ld added to the project to see how .vectortable is used in the linker file.

__attribute__ ((section (".vectortable"))) const tVectorTable __vect_table = { /* Interrupt vector table */

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
1,524件の閲覧回数
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Donald:

The response by colleague Derek Snell is correct, you need __attribute__ ((section (...) )), and modify the linker file as necessary.

There are some tutorials and code examples about this:

Defining Variables at Absolute Addresses with gcc | MCU on Eclipse

Relocating Code and Data Using the CW GCC Linker File for Kinetis

Re: Controlling data and function placement in memory

Re: Re: Syntax to allocate memory assignments to faster memory

Regards!

Jorge_Gonzalez

1,525件の閲覧回数
dereksnell
NXP Employee
NXP Employee

Hi Don,

If you’d like to see how the GCC build tools in KDS can do this, you can use KDS to create a new project, and use it as an example. The interrupt vector table is forced to a specific memory section. I created a project with Processor Expert for the K64, and in vectors.c, the line below forces the vector table array into the .vectortable memory section. You can also review the linker file *.ld added to the project to see how .vectortable is used in the linker file.

__attribute__ ((section (".vectortable"))) const tVectorTable __vect_table = { /* Interrupt vector table */

0 件の賞賛
返信