eabi initialization for powerpc embedded application


I'm cross compiling an embedded image to run on the IBM 4xx processors using the gnu toolchain.

Linker options are as follows: make -f my_makefile CODE=0x007e0000 IMG_END=0x007fffff \ DATA=0x007f8000 IMAGE=images/my_image

My startup code sets r1 to 0x40000 (stack pointer) and loads the address of main() into the link register and does a blr.

The problem while looping in ram.

If I call a function to read characters(when available) from the uart and write them back out the code crashes because the stack gets out of whack. (This code is working fine on other platforms so I'm sure there isn't a bug in it)

When I take the _exact_ code out of the function and put it inline and constantly loop it work fine. Essentially removing the pushing/popping of variables to/from the stack.

I know there is something I'm missing about relocating the code from rom to ram but after researching I'm still stuck.

The code lives at 0xff800000 in rom and is relocated to

0x7e0000 after initializing the sdram.

Any help is greatly appreciated.

Thanks, james

Reply to
Loading thread data ...

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.