Intermec ck1 Guide De Référence

Page de 390
Appendix A — 
µClinux System 
312 
CK1 SDK Programmer’s Reference Manual 
Once the modified addresses has been calculated, the outcome is rather 
simple binary which can be fully relocated anywhere from the memory. 
In order to modify the code, the whole binary has to be loaded the 
RAM memory so that new relocations can be assigned. The relocation 
also means that multiple copies of text and data segments are required 
for each instance. 
•  The arm-elf tools also provide an option to generate position 
independent code (PIC). This can be achieved with a compiler option -
fpic/fPIC. The option differ with -fpic to be suitable for use in a shared 
library and with -fPIC option suitable for dynamic linking and avoiding 
any limit on the size of global offset table.  
Position independence is achieved by making the code addressing 
relative. Data access can be achieved with Global Offset Table (GOT). 
The data segment starts with a GOT that is a 16-bit look-up table 
containing 32-bit address pointers. The addresses in the table need to be 
relocated to point to the actual location of the data section. The GOT is 
terminated with a -1 (0xffffffff).  
The problem with this second approach is that the data segment has to 
follow the text segment. This occurs because the compilation is made 
against an origin of 0 and that the breaches can be safely made. The 
µClinux provides an ability to separate the data and text segments in a 
different area in the memory, to overcome this problem. This is done 
with the -msep-data options sent to the compiler. This improves the 
PIC by enabling it to take advantage of XIP (execute in place) 
functionality to increase the payload of the Flash. The code compiled 
with an -msep-data option needs less relocation and so saves the 
memory but is a little bit slower. Still, the main advantage of msep-data 
is the ability to do XIP.  
The XIP option allows text and data segments to be in separated 
memory regions. When the application is compiled to support XIP and 
the header is flagged with XIP option, they will be loaded and executed 
without duplications of the text segment. The advantages of XIP are 
that the text segment of the code can be located in the Flash/ROM 
memory, and for each running program the stack, bss and data segments 
are loaded into RAM, where the code can be modified. The XIP option 
comes especially useful when the application contains large program 
bodies with many executable instances running in the system. The 
disadvantages of XIP is that compression cannot be used. If the data is 
in compressed format, it cannot be used directly in place.