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++
12606 Discussions

how to get sheer machine code?

Altera_Forum
Honored Contributor II
1,069 Views

Dear NIOS2 Users, 

 

My last post seems to be not in the forum anymore. That's why I post it one more time. 

 

I would like to write code for NIOS2 processor in sheer assembler. Having the code compiled I can store it easily in my on-chip memory.  

However, when I try compiling example code: 

 

.section .reset, "ax" 

.section .exceptions, "ax" 

.global exception_handler 

.text 

.global _start 

_start: /* start function */ 

br _start 

.data 

.end 

 

instead of receiving only one jmp opcode (a few bytes) in my output file I receive around 900 bytes.  

 

I compile my code using: 

nios2-elf-as -ad %1.s -o a.out 

nios2-elf-ld a.out --strip-all --strip-debug -o %1.elf -b binary 

 

For x86 users: I would like to get the same result like using /t with tasm assembler. 

 

Please help me solving the problem. Thank you for your help in advance, 

Michał
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
330 Views

<div class='quotetop'>QUOTE (Koza @ Jul 3 2009, 09:03 AM) <{post_snapback}> (index.php?act=findpost&pid=22998)</div> 

--- Quote Start ---  

Please help me solving the problem. Thank you for your help in advance,[/b] 

--- Quote End ---  

 

 

Really no help with the issue? If something is not clear, please let me know. Altera support up to date is helpless... 

 

 

Best regards, 

Micha&#322;
0 Kudos
Altera_Forum
Honored Contributor II
330 Views

What does nios2-elf-size <your ELF> return? In this case, the size of the ELF (itself) is not really relevant since it contains more than what would be stored in memory. 

 

Cheers, 

 

- slacker
0 Kudos
Altera_Forum
Honored Contributor II
330 Views

You will need to use nios2-elf-objcopy tool to convert the ELF formatted file into raw machine code. Set the target format to raw. The help and manual for that tool probably contains an example, because that is a common operation. 

 

Reply if you have problems and the manual doesn&#39;t help enough.
0 Kudos
Reply