- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am recently trying to do the pure assembly programming for Nios II. I found from website that there is a tool call Debug Client is tailored for DE2 board for this purpose. However I am using the UP3 board which is not provided such kind of tool. I have tried to do it in Nios II IDE just like I did c programming before, but the only avaiable project type is c/c++ application. My assembly source file can not be compiled properly in that project. No matter what the source code is, the compiler always show the error message as below,
bj/aaa.o(.text+0x0): In function `_start': : multiple definition of `_start' D:/Design/Nios2Flash/software/asm_syslib/Debug/crt0.o(.text+0x0):/cygdrive/c/Altera/NioII/components/altera_nios2/HAL/src/crt0.S:236: first defined here D:/Design/Nios2Flash/software/asm_syslib/Debug/libasm_syslib.a(alt_main.o)(.text+0x60): In function `alt_main': /cygdrive/c/Altera/NioII/components/altera_hal/HAL/src/alt_main.c:149: undefined reference to `main' collect2: ld returned 1 exit status make: *** [asm.elf] Error 1 Could anyone give a proper solution for the assembly programming on UP3 board please? Thanks a million!!!Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You should define symbol "main", orelse you should override alt_main.c;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the reply. I am still not really sure how to add main in the assembly. I am expecting to use the assembler to reduce the size of the compile file which is to be downloaded to the processor. Will it make the download file bigger if I am using c code or file again?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As far as I know (not much) as soon as you enter the main.c function the C environment has to be created in the processor, this at least includes the creation of a stack. There is an option in the Nios IDE for creating assembly files of the compiled code, you can check it to see what the processor does before entering main.
If you are satisfied with about 6kB memory consumption for a simple hello world, you may use hello_alt_main and specify reduced driver size and simplified C library. iztok jeras- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you wanna reduce code size, you'd better study the following files:
crt0.S alt_main.c alt_sys_init.c crt0.S is the enter of processor when resets, then it will call alt_main, alt_main will call alt_sys_init and main.... FYI. David- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I just found that use the small c library and reduce device drivers can significantly reduce the size of code. And the assembly may improve it further. It is proved to be useful. Thanks very much for all above replies.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page