Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
15 years ago

assembly language in the nios ii ide

Hi

does the nios ii ide support assemble language?

why does my assemble codes occur errors?

my setup project proceed as follows:

1 Start the Nios II IDE. (Start->All Programs->Altera->NiosII EDS 9-> NiosII

9 IDE

2 Creat a new project. File->New->Project Nios II C/C++ Application

3 Select blankproject from templates

4 Set the project name

5 Select the target hardware( sopc builder system has been setup)

6 Click Next

7 Click New system libary

8 Click Finish

9 Add a file with name basics.s (File->New->Other

This opens a popup where you can pick File from under the General

Category, after selecting File, you need to specify the name at the bottom

(use basics.s)

10 enter the code:

.include"nios_macros.s"

.text

.equ TEST_NUM,0x90abcdef

.global _start

_start:

movia r7,TEST_NUM

mov r4,r7

STRING_COUNTER:

mov r2,r0

STRING_COUNTER_LOOP:

beq r4,r0,END_STRING_COUNTER

srli r5,r4,1

and r4,r4,r5

addi r2,r2,1

br STRING_COUNTER_LOOP

END_STRING_COUNTER:

mov r16,r2

END:

br END

.end

11 Use Debug As -> Nios II Instruction Set Simulator which will build the

project (assemble the file) and start the debugger.

then errors occur

errors: /cygdrive/d/altera/90/nios2eds/components/altera_hal/HAL/src/alt_main.c undefined reference to `main'

/cygdrive/d/altera/90/quartus/FPGA_code/computer_organization/lab_ex1/part1_1/software/asm_first_syslib/Debug/crt0.o(.text+0x0):/cygdrive/d/altera/90/ip/altera/nios2_ip/altera_nios2/HAL/src/crt0.S first defined here

/cygdrive/d/altera/90/quartus/FPGA_code/computer_organization/lab_ex1/part1_1/software/asm_first_syslib/Debug/libasm_first_syslib.a(alt_main.o) In function `alt_main':

Can't open nios_macros.s for reading: No such file or directory

obj/part2.o In function `_start':

Warning: end of file not at end of a line; newline inserted

ps:

1 i'm sure the codes are right(de2-70 labs exercises/computer organization/lab1)

2 the operator proceed is from duke.edu by google

forgive my ugly English,:D.

Best regards

hanshaohua

14 Replies