placing data in flash

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

placing data in flash

1,929 Views
hek
Contributor I
Hi folks,
I have a question for you.
Im porting some code from AVR (the IAR compiler) to Freescale. For the avr there is a prefix '__flash' that tells the linker/compiler that the variable should be located in the flash, not the ram. For example:
__flash const char str[] = "abc";

Is there an equivalent way of doing it in CW witha prefix? or do I have to write something like
const char str[] @"DEFAULT_ROM" = "abc";

Best Regards
Henrik
https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Ftyda.se%2F%3Flang%3Dsv%26w%3Dekvivalen...
Labels (1)
0 Kudos
Reply
1 Reply

386 Views
CrasyCat
Specialist III
Hello
 
I assume you are using CodeWarrior for HC08 or CodeWarrior for HC12.
Is that right?
 
If this is the case, defining a variable as const will place it in a section called .rodata.
If you have created your project using the wizard, the section .rodata will automatically be allocated in flash.
 
So there is no need to specify any additional prefix to get it in there.
 
CrasyCat
0 Kudos
Reply