Hi.
I make a ROM Version image using the CODEWARRIOR, it can print message very well .But I have two questions about the image.One is the "printf" function running in the FLASH, could it be moved to RAM? The other is the image is created booted high,the offset address write to flash is 0xfff00000, the nor flash address range is between 0xff800000 and 0xffffffff, it means the size of image must be smaller than 1Mbytes , if it was right, the size of image can't meet my demand。Could I make the boot low image to avoid the possible problem? if so,how to make it?
thanks!
Hello Li Rui,
I add more comments about CodeWarrior LCF file(Link command file), you could customize 8306_SOM_ROM.lcf to help you to implement your purpose.
For MPC8360, if MSR[IP] is 1, the base address is 0xfff00000, a system reset exception is executed using the
vector at offset 0x100 relative to the base, so you need to put .reset section at 0xfff00000.
If you require printf running in RAM, you could relocate .text section executing in RAM.
MEMORY {
ram : org = 0x00000000
rom_base : org = 0xfff00000
rom : org = 0xffe00000 //Your required Flash location
}
... ...
GROUP : { | |
.text (TEXT) : {} //Relocate .text in RAM | |
.data : {} | |
.sdata : {} | |
.sbss : {} | |
.sdata2 : {} | |
.sbss2 : {} | |
.bss : {} | |
.PPC.EMB.sdata0 : {} | |
.PPC.EMB.sbss0 : {} |
} > ram
GROUP : { | |
.=0xFFF00000; | |
.reset LOAD(0xFFF00000): {} | |
.init LOAD(.): {} | |
} > rom_base |
For more information about lcf, please refer to the document Freescale\CodeWarrior PA V8.8\Help\PDF\Power Arch Build Tools Reference.pdf.
In addition, you also need to specify the your ROM image base address from Edit->ROM Version Settings->Linker->EPPC Linker ->Generate ROM image.
Have a great day,
Yiping
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Not sure how moving printf function to RAM will help you, because after power-on the RAM is empty so you have to initialize it with valid data before executing anything from it. That is, printf function, if you wish to execute it from ram, should be copied from ROM to RAM before first call. Similar procedure is used to initialize exception table, please look and use as reference.
NOR flash size is usually equal to physical capacity of the NOR flash you have on board. Falsh is usually located at upper part of address space, so the last address of the flash is all ones. If you solder larger flash, you have to move starting address of your flash to lower value so the the end of this new flash is still all ones. Moving flash to the beginning of address space (so hat the starting address of the flash will be all zeros) is also possible, but typically we have RAM at this location.