Eric Thrall

Position-independent code for 5211/5212/5213

Discussion created by Eric Thrall on Mar 19, 2008
Latest reply on Feb 17, 2009 by David Crose
Hi -

I had another thread going here a while ago about a bootloader and we had some discussion about position-independent code going.  I thought I'd start a new thread focusing on that to see if anyone has input.

I want to generate position-independent code so I can have multiple images in the flash that can run independently and not have to compile for a particular position within the flash.  To do this, I apparently have to add .picdynrel and .piddynrel sections to my LCF (I assume that I'll also need to have the position-independent data as well) and I need to define the start, end and size of the pictable and pidtable.  I can't find any information that would tell me what these values should be.

Also, according to the help, I may need to make changes to library code and recompile it.  I tried to follow the directions given, but when I try to compile the existing code even without making any changes I get far more errors than I want to try to track down.  First of all, do I actually need to make a change to the library to support the simple case of wanting the code to only use relative addressing?  If I do, what kind of changes need to be made?

Has anyone successfully used CodeWarrior to compile and use position-indepenent code?  Thanks!