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

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

Jump to solution
560 Views
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

Labels (1)
0 Kudos
1 Solution
417 Views
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;

View solution in original post

0 Kudos
2 Replies
418 Views
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 Kudos
417 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Xuan,

Thanks for your sharing.

Have a nice day!

Alice

0 Kudos