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++
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.
12748 Discussions

Nios2 eclipse IDE, objcopy data segment

Altera_Forum
Honored Contributor II
1,220 Views

I want to add a large data section into a sdram executable file. 

 

I think objcopy is the way to do it. 

mydata.dat is my binary data file. 

 

nios2-elf-objcopy -I binary mydata.dat -O elf32-littlenios2 mydata.o 

 

objdump shows the contents of the file 

 

nios2-elf-objdump -s mydata.o mydata.o:     file format elf32-little Contents of section .data: 0000 6e756c6c 20746572 6d696e61 74656420  null terminated 0010 61736369 69207465 78742064 61746120  ascii text data 0020 66696c65                             file         

 

How to link mydata.o into the rest of the project, is it enough to copy it  

to the project folder?  

How to get a pointer to the .data section of the object file for the c code? 

 

I use the eclipse based nios2 ide.
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
464 Views

This topic has already been discussed at least in here: 

 

 

forum topic (http://forum.niosforum.com/forum/index.php?showtopic=1880&pid=7553&mode=threaded&show=&st=&#entry7553) 

 

I was able to link the object to the memory image file by adding the object file name to the linker command options.  

 

If the object file has been successfully linked, it should appear in the project.map file. 

How to tell the linker to make a map file is discussed here:  

 

map file entry (http://forum.niosforum.com/forum/index.php?showtopic=312&pid=1232&mode=threaded&show=&st=&#entry1232)  

 

And from the c/c++ code i can access the memory are by accessing it as an array type. 

_binary_test_txt_start is a symbol in the .map file.  

 

extern char _binary_test_txt_start[];
0 Kudos
Reply