How to allocate a data block of more than 16KB into S912XHY128's paged flash?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

How to allocate a data block of more than 16KB into S912XHY128's paged flash?

跳至解决方案
1,206 次查看
zhangxuan
Contributor I

I have tried global accessing by adding  #pragma CONST_SEG __GPAGE_SEG XXX  in my code

But CodeWarrior 5.1 still report an error of  L1102: Out of allocation space in segment PAGE_F9 at address 0xF98000

标签 (1)
0 项奖励
回复
1 解答
1,063 次查看
zhangxuan
Contributor I

I will answer myself. The answer is found in S12X Examples.pdf.

1) Add #pragma statements in the source code that tell the compiler how to access these
variables and under what name (segment name) these variables can be referred to by the
linker:

a) #pragma DATA_SEG __GPAGE_SEG GLOBAL_RAM

and/or

b) #pragma CONST_SEG __GPAGE_SEG GLOBAL_FLASH


2) In the linker parameter file (extension .prm), place this segment into the correct
memory ranges.

a)

PLACEMENT
...
PAGED RAM_0F_GLOBAL = READ_WRITE 0x0F8000'G TO 0x0FBFFFF'G;
/* 16 kByte global address range covering RAM_F8 .. RAM_FB */
...
END

b)

PLACEMENT
...
FLASH_7E_GLOBAL=READ_ONLY 0x7E0000'G TO 0x7EFFFF'G;
/* 64 kByte global address range covering PAGE_F8..PAGE_FB */
...
END

Note: Make sure to delete of comment the corresponding definitions for the banks that
overlap this global addresses!

3) make sure to specify the option -D__FAR_DATA on the compiler command line. This
will enable the correct initialization in the startup code.

4) any pointer pointing to global data needs to be qualified with “__far”:
c
har *__far myPtr;

在原帖中查看解决方案

0 项奖励
回复
2 回复数
1,064 次查看
zhangxuan
Contributor I

I will answer myself. The answer is found in S12X Examples.pdf.

1) Add #pragma statements in the source code that tell the compiler how to access these
variables and under what name (segment name) these variables can be referred to by the
linker:

a) #pragma DATA_SEG __GPAGE_SEG GLOBAL_RAM

and/or

b) #pragma CONST_SEG __GPAGE_SEG GLOBAL_FLASH


2) In the linker parameter file (extension .prm), place this segment into the correct
memory ranges.

a)

PLACEMENT
...
PAGED RAM_0F_GLOBAL = READ_WRITE 0x0F8000'G TO 0x0FBFFFF'G;
/* 16 kByte global address range covering RAM_F8 .. RAM_FB */
...
END

b)

PLACEMENT
...
FLASH_7E_GLOBAL=READ_ONLY 0x7E0000'G TO 0x7EFFFF'G;
/* 64 kByte global address range covering PAGE_F8..PAGE_FB */
...
END

Note: Make sure to delete of comment the corresponding definitions for the banks that
overlap this global addresses!

3) make sure to specify the option -D__FAR_DATA on the compiler command line. This
will enable the correct initialization in the startup code.

4) any pointer pointing to global data needs to be qualified with “__far”:
c
har *__far myPtr;

0 项奖励
回复
1,063 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Xuan,

Thanks for your sharing.

Have a nice day!

Alice

0 项奖励
回复