Hi,
Hi have a project which uses large arrays of constant data (14 arrays of 2048 bytes each and a bigger one, so the total object size of the arrays is 36082 bytes)
And I am a little bit lost on how to compile the application and make the PRM files.
By using the default settings generated by codewarrior I get the expected error that the data does not fit in ROM.
Link Error : L1102: Out of allocation space in segment ROM at address 0x7130
已解决! 转到解答。
Hello
If you want to place your constant tables in paged Flash, you can define the constants in a linear constant segment (#pragma CONST_SEG __LINEAR_SEG PAGED_ROM) and access the data using linear pointers.
Project {Install}\(CodeWarrior_Examples)\HCS08\Evaluation Board Examples\DEMOQE128\DEMOQE128_LAP_Dictionary on V6.x shows how this can be done.
CrasyCat
#pragma push#pragma CODE_SEG __FAR_SEG PAGED_ROM/* code to allocate to page 0/page2 */#pragma pop
If you allocated it as one single, massive array, it will not fit inside the flash pages. It isn't possible to allocate variables or code across several flash pages.
You might have to divide the array into several:
#define ARRAY1_SIZE ....
#define ARRAY2_SIZE ....
#define ARRAY3_SIZE ...
#define ARRAY_SIZE (ARRAY1_SIZE + ARRAY2_SIZE + ARRAY3_SIZE)
#pragma CONST_SEG SEG_ARRAY1
const uint8 array1[ARRAY1_SIZE] = ...;
#pragma CONST_SEG SEG_ARRAY2
const uint8 array2[ARRAY2_SIZE] = ...;
#pragma CONST_SEG SEG_ARRAY3
const uint8 array3[ARRAY3_SIZE] = ...;
#pragma INLINE
uint8 array (uint16 index)
{
uint8 result;
if(index < ARRAY1_SIZE)
{
result = array1 [index];
}
else if(index < (ARRAY1_SIZE + ARRAY2_SIZE) )
{
result = array2 [index - ARRAY1_SIZE];
}
else
{
result = array3 [index - ARRAY1_SIZE - ARRAY2_SIZE];
}
return result;
}
Then in the .prm file:
PLACEMENT
SEG_ARRAY1 INTO ROM1; // or whatever segment names you are using
SEG_ARRAY2 INTO ROM2;
SEG_ARRAY3 INTO ROM3;
END