[U-Boot-Users] static function pointers and reallocation

Mattias Bostrom mabos at spray.se
Fri Nov 2 14:19:06 CET 2007


Hi,
 
We have a custom board based on Lite5200B and started our development from Freescales BSP including U-Boot 1.1.5.
I have now added a U-Boot command that includes code from an earlier project. In that code there is a static vector declared at file scope with function pointers in it. When I recieve data via CAN I look up which function to start and uses the function pointer in the vector. Since the function pointers are set at compile time they point to flash memory and execution jumps to flash.
Is that as expected or? In binaries for ARM the linker has made all the reallocation. In my binary all adresses are in flash. I thought this would magically change after reallocation and my function pointer should point to the new ram adress. Do I need to do something special to get my function pointers to point to ram?
Or do I have to initialize the vector with function pointers in runtime to get the correct adress?
I guess the GOT has something to do with this but I'm not very good at assembler so I'm not sure what happens.
Is there a "best practice" for function pointers and U-Boot?
We're using gcc 4.1.1 and glibc 2.3.8.
 
Regards,
Mattias Bostrom

Hur träffade du din kärlek? Skicka in er historia och vinn biobiljetter. http://www.spraydate.se


More information about the U-Boot mailing list