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

NiosII & objcopy ? problem

Altera_Forum
Honored Contributor II
2,057 Views

Hi there, 

i do a migration to NiosII , for now nothing problem except one., 

 

why when i use objcopy to transform and .out file to Binary the bin files have an increasead size (it is filled with 1Mb of 00! ) , instead the same command on Nios I built an correct binary file? 

 

Thank's a lot 

 

JjLeto.
0 Kudos
11 Replies
Altera_Forum
Honored Contributor II
138 Views

Hi JjLeto, 

 

Has your memory map changed? Or have you moved your 

code to flash? You probably have a large "hole" between a few 

of your sections that's being filled with 0. Check your .out file 

with objdump: 

 

$ nios2-elf-objdump -h file.out 

 

You may need to provide a few load addresses in your linker script. 

 

Regards, 

--Scott
Altera_Forum
Honored Contributor II
138 Views

Thank's now i check,  

i using then default script.. 

 

Bye
Altera_Forum
Honored Contributor II
138 Views

Thank's Again i fix it 

 

Bye
Altera_Forum
Honored Contributor II
138 Views

I have run into the same problem. When I take the flash.flash file and run it thru my srec to flash utility the resulting binary is about half the size. When I run objdump on the .elf, stripping all symbols and debug, it is still much larger than the flash.flash file. 

 

What command parameters does the IDE use to produce the .flash file from the .elf, and where does the build message output go anyway? 

 

thanks
Altera_Forum
Honored Contributor II
138 Views

I see that if I do a command line make, I get to see the output. 

 

elf2flash is used by the IDE to produce the .flash file 

 

Which of the elf2x or flash2x can be used to get the binary instead?
Altera_Forum
Honored Contributor II
138 Views

elf2flash produces a .flash...but if you'll open the file you'll notice that its really a Motorola s-record. 

 

This can be converted to binary pretty easily via some scripting, google --> freeware download, or try out nios-convert (open an SDK shell and type nios-convert). I cannot remember if nios-convert supports binary but it converts between several other formats.
Altera_Forum
Honored Contributor II
138 Views

nios-convert does not appear to output plain binary format. The only altera tool that comes close is the quartus Convert Programming Files dialog, which can do sof to just about anything including rbf. It only seems to take sof as input so it is no help for srec or elf to bin. BTW, can the quartus converter be invoked from the command line?  

 

Kinda strange that there is no altera sw tool that will produce a plain binary file as output. It is the most common and necessary format after all. Must be one of those 'branding' things;0
Altera_Forum
Honored Contributor II
138 Views

Branding?.. no... I think its been that there has been no need for it to make our tools work as desired. 

 

The beauty of our tools is that its all open-source though; nios-convert calls format_conversion_utils.pm (located within the quartus installation); you could just add the necessary functionality to it and share it here for all to see ;-) 

 

Also I was serious about google -- while doing some recent work I came across an s-record to binary converter with 2-3 minutes of searching which I just downloaded and used for my needs at the time.... 

 

On your question about quartus conversions: yes, all (I believe) Quartus utilities are scriptable and available via the command line. quartus_cpf is "convert programming files".
Altera_Forum
Honored Contributor II
138 Views

Hi jjletodoc 

 

 

I meet the same problem.But I can't find the link script file. 

It is in the syslib folder? 

 

 

Thank you .
Altera_Forum
Honored Contributor II
138 Views

Hi 

 

The files is nios_build.ld in include directory of sdk 

 

i 've removed the line of : 

 

"Stabs debugging sections." 

 

and the binary go to normal size..
Altera_Forum
Honored Contributor II
138 Views

Sorry Errata Corrige 

 

i Remove the LINES after the Comment 

 

Stabs debugging sections..
Reply