Codewarrior - Coldfire V1, external code + data

cancel
Showing results for 
Search instead for 
Did you mean: 

Codewarrior - Coldfire V1, external code + data

1,068 Views
Sebastian_v1
Contributor I

Hi,

i use a coldfire V1 controller an would like place a data structure in to a external flash.

In the data structure is a list of pointers to some flash locations + constant data.

 

 

static const struct Character fontData[] = { {0x0000, 0x03}, {0x0006, 0x01}, {0x0008, 0x03},  {0x000E, 0x07}, {0x001C, 0x05}, {0x0026, 0x09},  {0x0038, 0x07}, {0x0046, 0x01}, {0x0048, 0x03},  {0x004E, 0x03}, {0x0054, 0x05}, {0x005E, 0x05},  {0x0068, 0x01}, {0x006A, 0x03}, {0x0070, 0x01},  {0x0072, 0x03}, {0x0078, 0x05}, {0x0082, 0x03},  {0x0088, 0x05}, {0x0092, 0x05}, {0x009C, 0x05},  {0x00A6, 0x05}, {0x00B0, 0x05}, {0x00BA, 0x05},  {0x00C4, 0x05}, {0x00CE, 0x05}, {0x00D8, 0x01},
}

This data have to be place in a external Flash memory. I use the the Codewarrior for Microcontroller compiler. I have try i with the section argument without a result.

The compiled data can place in a not used memory section -> i can extract it (from the s19 dile) to a external flash file to fill the data flash.

 

Best Regards

Sebastian

Labels (1)
0 Kudos
3 Replies

97 Views
Sebastian_v1
Contributor I
my problem is not read/write the external data. my problem is the linker, i dont know how to say the linker place my data to a address outside of flash memory.
0 Kudos

97 Views
CrasyCat
Specialist III

Hello

 

If you want the linker to allocate the object let us say at address 0x10000000 you can define it as follows:

 

static const struct Character fontData[] @ 0x10000000 = {
 {0x0000, 0x03}, {0x0006, 0x01}, {0x0008, 0x03},
 {0x000E, 0x07}, {0x001C, 0x05}, {0x0026, 0x09},
 {0x0038, 0x07}, {0x0046, 0x01}, {0x0048, 0x03},
 {0x004E, 0x03}, {0x0054, 0x05}, {0x005E, 0x05},
 {0x0068, 0x01}, {0x006A, 0x03}, {0x0070, 0x01},
 {0x0072, 0x03}, {0x0078, 0x05}, {0x0082, 0x03},
 {0x0088, 0x05}, {0x0092, 0x05}, {0x009C, 0x05},
 {0x00A6, 0x05}, {0x00B0, 0x05}, {0x00BA, 0x05},
 {0x00C4, 0x05}, {0x00CE, 0x05}, {0x00D8, 0x01},
 }  ;

Note this is working only for ColdFire V1 and might not be supported for V2, V3 or V4.

 

Additionally this only makes sure the variable is allocated there. It is your responsibility to make sure the address actually exist on your hardware.

 

If you have multiple objects you want to place there you may want to define them in a user defined section.

Please refer to FAQ-27638 (on www.freescale.com) for information on how to achieve that.

You then need to define a new memory area where you allocate the section in your .lcf file.

 

If the constant is not referenced in the application, make sure to disable dead striping using pragma 

#pragma force_active on

 

I hope this helps.

CrasyCat

0 Kudos

97 Views
PaoloRenzo
Contributor V

CW might use a reference to look for that array in an external memory but will not copy it for you. You have to do it by yourself. Additionally you are using an external flash memory, so well-known memcopy wont help you neither since flash memories need an specific algorithms to write into them. Since it's const, try to use a sizeof to know numebr of bytes and then write it at runtime using your flash algorithm (pages, alignments, delays, etc).

 

Good luck

0 Kudos