Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12600 Discussions

Link all my code beginning from address 0

Altera_Forum
Honored Contributor II
1,040 Views

Hello, 

 

may be, this is a simple question, but I can't find the answer as quickly as I wish. ;-) I just want to link all my code and the code of some (used) HAL functions starting from address 0. This question arises from the fact, that I have build custom memory controller that maps accesses on the avalon bus in the lower 1MB range to some external SRAM. There I want to place all my code. To download the code, I planned to use the GERMS Monitor for the NIOS II (found here in the forum). 

So all I now have to know is, how can I instruct the Linker to continously link the code starting from address 0? 

In the NIOS 2 IDE, it is only possible to specify some installed memories, where the linker section .text, .rodata, etc. shall be placed. In those pull-down-menus my memory controller doesn't appear. Can I change this? 

 

Thanks for any replies. 

 

Regards.
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
309 Views

Hi GrubenKarlo, 

 

> So all I now have to know is, how can I instruct the Linker to continously link the code starting 

> from address 0? 

 

There are several techniques you can use. The quickest (for experimenting) is to use objcopy 

to change the section addresses. E.g.: 

 

nios2-elf-objcopy --change-section-address .text=0 foo.elf 

 

You might need to move your other sections as well (.data, .bss, .sbss). 

 

In the long run, you will probably want to just pass the -Ttext option to ld. 

 

Regards, 

--Scott
0 Kudos
Reply