Forum Discussion

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

NIOS2 EDS make error

I studied using the SOPC builder and NIOS2. I made the projects in both tutorials provided by altera. Along the way, I encountered errors but I searched about them and found solutions. I made the tutorials worked on my board so I decided to try on the tutorial on sd card interface using SOPC builder. At the end part, for the software, I used the HAL device driver but when I compiled it, there were errors. the last lines in my console are as follows: C:\Users\Jackie\Desktop\sdcard\nios\software\sdcar d_bsp/HAL/src/alt_main.c:154: undefined reference to `main' collect2: ld returned 1 exit status make: *** [sdcard.elf] Error 1 Do you have any idea on how to solve this? I already tried running my nios 2 eds as an administrator (from another forum’s answer) but it didn’t help me. THANKS IN ADVANCE!

5 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi,

    First, avoid using spaces in paths : c:\users\jackie\desktop\sdcard\nios\software\sdcar--> <--d_bsp/hal/src/alt_main.c. (Maybe a error inserted in Copy&Paste to the forum)

    Second, I had faced strange problems where main(), my_function().... were not found. It was because the [/B]files included with# include were bad[/B] (brackets are unbalanced in those files)

    Nios II make outputs in Nios II SBT are ugly to understand.

    Also you may "rebuild indexes", "clean project"...

    SOPC is replaced with QSYS since Quartus version 10.

    But in your screenshot I see "BSP (Board support package)", so you already use QSYS. Maybe the tutorial is for SOPC. It changes the hardware, the linker, but fortunately no big changes for software (just changes like "alt_irq..." to "alt_isr...", they are very similar)

    Regards
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    hi. thanks for the reply.

    the tutorial is for sopc builder so i remade the project in sopc builder, and used the altera monitor program for the software program.when compiled, i got the errors:

    c:/altera/11.1/nios2eds/bin/gnu/h-i686-mingw32/bin/../lib/gcc/nios2-elf/4.1.2/../../../../nios2-elf/bin/ld.exe: address 0x106a8 of c:/users/jackie/desktop/sdcard/altera_up_sd_card_avalon_interface.elf section `.rwdata' is not within region `onchip_memory2_0'

    c:/altera/11.1/nios2eds/bin/gnu/h-i686-mingw32/bin/../lib/gcc/nios2-elf/4.1.2/../../../../nios2-elf/bin/ld.exe: address 0x12808 of c:/users/jackie/desktop/sdcard/altera_up_sd_card_avalon_interface.elf section `.bss' is not within region `onchip_memory2_0'

    c:/altera/11.1/nios2eds/bin/gnu/h-i686-mingw32/bin/../lib/gcc/nios2-elf/4.1.2/../../../../nios2-elf/bin/ld.exe: address 0x12808 of c:/users/jackie/desktop/sdcard/altera_up_sd_card_avalon_interface.elf section `.onchip_memory2_0' is not within region `onchip_memory2_0'

    c:/altera/11.1/nios2eds/bin/gnu/h-i686-mingw32/bin/../lib/gcc/nios2-elf/4.1.2/../../../../nios2-elf/bin/ld.exe: address 0x106a8 of c:/users/jackie/desktop/sdcard/altera_up_sd_card_avalon_interface.elf section `.rwdata' is not within region `onchip_memory2_0'

    c:/altera/11.1/nios2eds/bin/gnu/h-i686-mingw32/bin/../lib/gcc/nios2-elf/4.1.2/../../../../nios2-elf/bin/ld.exe: address 0x12808 of c:/users/jackie/desktop/sdcard/altera_up_sd_card_avalon_interface.elf section `.bss' is not within region `onchip_memory2_0'

    c:/altera/11.1/nios2eds/bin/gnu/h-i686-mingw32/bin/../lib/gcc/nios2-elf/4.1.2/../../../../nios2-elf/bin/ld.exe: address 0x12808 of c:/users/jackie/desktop/sdcard/altera_up_sd_card_avalon_interface.elf section `.onchip_memory2_0' is not within region `onchip_memory2_0'

    my onchip-memory is 32kb. could you identify the problem here? does this have something to do with the address? im not really familiar with this since im a beginner but i really need to finish this.

    also, before these lines, there were warnings like:

    drivers/src/altera_up_sd_card_avalon_interface.c: in function 'find_first_empty_record_in_a_subdirectory':

    drivers/src/altera_up_sd_card_avalon_interface.c:1071: warning: pointer targets in passing argument 1 of 'find_first_empty_cluster' differ in signedness

    drivers/src/altera_up_sd_card_avalon_interface.c: in function 'create_file':

    drivers/src/altera_up_sd_card_avalon_interface.c:1200: warning: pointer targets in passing argument 2 of 'convert_filename_to_name_extension' differ in signedness

    drivers/src/altera_up_sd_card_avalon_interface.c:1200: warning: pointer targets in passing argument 3 of 'convert_filename_to_name_extension' differ in signedness

    drivers/src/altera_up_sd_card_avalon_interface.c: in function 'alt_up_sd_card_find_next':

    drivers/src/altera_up_sd_card_avalon_interface.c:1511: warning: pointer targets in passing argument 2 of 'get_cluster_flag' differ in signedness

    drivers/src/altera_up_sd_card_avalon_interface.c: in function 'alt_up_sd_card_fopen':

    drivers/src/altera_up_sd_card_avalon_interface.c:1570: warning: pointer targets in passing argument 2 of 'get_home_directory_cluster_for_file' differ in signedness

    what to do? thanks again.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    oh my! i tried making it again in nios2 and this time, i used the hello world small template and it worked!! yay! i'm able to write a text file on the sd card now!

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi aoi-kin,

    now I working with my NIOS II and I have a problem when to build a project. this error appeared when I build the project

    **** Build of configuration Nios II for project lights ****

    make all

    Info: Building ../lights_bsp

    make --no-print-directory -C ../lights_bsp

    [BSP build complete]

    Info: Linking lights.elf

    nios2-elf-g++ -T'../lights_bsp/linker.x' -msys-crt0='../lights_bsp/obj/HAL/src/crt0.o' -msys-lib=hal_bsp -L../lights_bsp -msmallc -Wl,-Map=lights.map -O0 -g -Wall -mno-hw-div -mno-hw-mul -mno-hw-mulx -o lights.elf obj/lights.o -lm

    /cygdrive/c/altera/91/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc/nios2-elf/3.4.6/../../../../nios2-elf/bin/ld: region onchip_memory2_0 is full (lights.elf section .rwdata). Region needs to be 244 bytes larger.

    /cygdrive/c/altera/91/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc/nios2-elf/3.4.6/../../../../nios2-elf/bin/ld: section .bss [00001020 -> 00001023] overlaps section .text [00001020 -> 00001e6f]

    ../lights_bsp/libhal_bsp.a(alt_close.o)(.text+0x128): In function `alt_get_errno':

    HAL/inc/sys/alt_errno.h:81: Unable to reach errno (at 0x00001020) from the global pointer (at 0x0000a0cc) because the offset (-37036) is out of the allowed range, -32678 to 32767.

    collect2: ld returned 1 exit status

    make: *** [lights.elf] Error 1

    do you have any idea regarding this problem? what the causes of this error actually?

    Thank you.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    You don't have enough memory on your board.

    Do you have an external RAM ? You should instantiate it in SOPC.

    Regards.