Hello,
i'am working with a MCF5280.
I build my programm and flash it on controller.
Now i want to know, is it possipble to copy a function (für example MAIN) to the internal ram an execute it from this place ?
friendly regards Peter
Hello
Please search for FAQ-27860 on www.freescale.com.
This FAQ should explain how to achieve that.
CrasyCat
Thanks a lot
Okay now i copy the code from FAQ-27860. But it will not work.
I copied this code in the main.c und the Main-Function
#pragma define_section CopyToRAM "CopyToRAM " far_code__declspec (CopyToRAM) unsigned int Fibonacci(unsigned int n) { for (int i = 0;i<100000;i++) { uart_putchar(0,0x3A); }}
further i did this code
.copyToRAM: AT(___DATA_ROM + SIZEOF(.data)){. = ALIGN (0x4);__START_COPYTORAM = .;*(CopyToRAM)__END_COPYTORAM = .;} >> userram
into the .lcf for the external_flash
and moify the _romp part in this way
.romp : AT(_romp_at){__S_romp = _romp_at;WRITEW(___DATA_ROM); #ROM start addressWRITEW(___DATA_RAM); #RAM start addressWRITEW(SIZEOF(.data) + SIZEOF(.copyToRAM)); #sizeWRITEW(0);WRITEW(0);WRITEW(0);}
now i dont know how to call the loop in the Fibonacci function.
does anyone know that problem ?
regards peter.
Try removing extraneous space in pragma line. "CopyToRAM " to "CopyToRAM".
Thanks but it make no difference.
i can call the function but when he try to enter the body it jumps into the exceptions.c
Hello
What is the address displayed in the disassembly listing for the function Fibonacci?
What is the address of the function according to the map file?
CrasyCat
Hello,
the address displayed in the disassembly listing for the function Fibonacci is 0x00000000
its the SDRAM iam using a MCF5282 EVB
What is the address of the function according to the map file?
the adress in .elf.xmap is 0xFFE013A2
Hello
I need the address of Fibonacci function in disassembly code inside of the debugger?
If you are using CodeWarrior V10.x there is a Disassembly view.
If you are using an earlier release, change the source pane in the Thread window to Mixed mode (instead of Source).
CrasyCat
But 00000000 is displayed in the disassembly window.
this is where i call the function. (displayed in disassembly)
jsr Fibonacci (0) ; 0x00000000
regards peter
now i get this warning.
Description Resource Path Location Type
_Fibonacci(CopyToRam) in file main_c.obj is referenced but has not been written. Check your linker command file.
Hello
This one indicates that the section CopyToRam was not allocated anywhere in your lcf file.
So it looks like you have an issue with your linker file.
This also explains why you cannot jump to your function in RAM.
CrasyCat.
I found the mistake.
its located in the linker file from faq-27860.
copyToRAM: AT(___DATA_ROM + SIZEOF(.data)){. = ALIGN (0x4);#Original from freescale#__START_COPYTORAM = .; #change to __START_copyToRAM = .; *(CopyToRAM)#Original from freescale#__END_COPYTORAM = .; #change to __END_copyToRAM = .;} >> userram
so now it works !
thanks a lot for yout help
regards peter
Thanks this example helped me.