Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Relocate ELF

Altera_Forum
Honored Contributor II
1,003 Views

Dear all, 

does anyone know how to relocate a Nios Executable, so it can be launched from addresses other than offset zero of memory? 

I think the best way should be the GCC option -pie (position independent executable) but it appears not supported by Nios. 

 

At this time I manually edit the generated.x file fixing memory start addresses and rebuild. However this approach appears too tricky and error prone to me . 

 

In addition (I tried to relocate the ELF by myself), looking at the Nios Processor reference I read: 

 

 

--- Quote Start ---  

 

In a Nios II object file, each relocatable address reference possesses a relocation type. The relocation type specifies how to calculate the relocated address.Table 7–3 lists the calculation for address relocation for each Nios II relocation type. The bit mask specifies where the address is found in the 

instruction. 

 

--- Quote End ---  

 

 

when it talks about object I assume it refers to "obj/*.o" file that is a "relocate elf". But in this file I can't retrieve enough relocation information, not all jumps are referred, neither those relative to HAL calls. 

 

Thank you, 

regards
0 Kudos
0 Replies
Reply