Forum Discussion

Thierry29's avatar
Thierry29
Icon for New Contributor rankNew Contributor
6 months ago

Riscfree compilation error with message ".bss not within region onchip_mem"

Hi,

I'm working on a DE10 Lite board project integrating a NiosV/m microprocessor. The development tools are Quartus Prime Lite v23.1.1. The hardware has been correctly generated and also the BSP. The software application is a simple "hello world" program hello.c.

My problem concerns compilation with RiscFree. The compilation aborts at the link stage with the message "address 0x4022284 of hello.elf section '.bss' is not within region 'onchip_mem'".

In the hardware system an on-chip memory is used as unique memory for data and the program with addresses between 0x400_0000 and 0x402_7fff.

Furthermore I noticed that the compilation process corresponds to a gmake command that RiscFree found in a Matlab directory (Matlab is installed on my PC). I tried to find the same gmake program in the Quartus suite installation directory, but it does not exist (so it is not planned that riscfree will use it?).

I do not know if these two problems are related. Here are some screenshots to help you understand.


A part of the hardware system designed with Platform Designer, mainly NiosV/m and on-chip memoryAddress mappingBSP editor: Drivers viewCompilation aborts: gmake.exe is mentionned at the last lineCompilation aborts: message indicating that .bss is not within region 'onchip_mem'

Thank you very much in advance for your help

Thierry

15 Replies

  • RolandoS_Altera's avatar
    RolandoS_Altera
    Icon for Occasional Contributor rankOccasional Contributor

    Hello Thierry

    I am new on the Nios V area, but will try to help you on this asking to some of the experts on this.

    From the captures that you show, the settings that you have for the starting point of the .bss looks correct as this is inside of the On-chip memory.

    Now, do you know if the size of the .bss section is defined somewhere? I am trying to determine if this fully fits in the On-chip memory.

    Also, not sure if there is a link script available (a file with .ld or .icf extension). If this exist, here we also need to check that the .bss fits in On-chip memory.

    For the issue related to using gmake from Matlab, it is possible that in the Path environment variable the Matlab path is being used before that the path of Quartus which means that it has higher precedence than the one for Quartus. You can try to modify this variable to include the path of Quartus before than the path of Matlab.

    Thanks

    Rolando

    • Thierry29's avatar
      Thierry29
      Icon for New Contributor rankNew Contributor

      Hi Rolando,

      thanks for your help.

      Regarding the .bss section, I have no idea of the needed size. I am attaching an archive file of my software directory (after performing a build clean). You might find some interesting informations inside. For completeness I join also the .sopcinfo file (in DE10_LITE_Qsys.zip file) from which the bsp (hal_bsp) was generated.

      Regarding the gmake issue, I already have placed the Matlab path at the end of the PATH variable, but the behavior remains unchanged. I do not see a gmake.exe file in the Quartus installation tree directories. So, even though the Quartus variable takes precedence, no program is found. I deleted the gmake.exe file from Matlab directory. Riscfree throws an error saying that gmake is no longer available.

      Best regards,

      Thierry

      • RolandoS_Altera's avatar
        RolandoS_Altera
        Icon for Occasional Contributor rankOccasional Contributor

        Hi Thierry

        I exercised the tutorial at the following application note: https://cdrdv2-public.intel.com/784469/an-784468-784469.pdf

        At the section 1.2.2.4 there is an alternative to build the application .elf file from the command line instead for riscfree:

        $cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -B software/app/debug -S
        software/app
        $ make -C software/app/debug

        Have you tried this? You need to do it after entering into the niosv shell. I was told that everything that you need is already included as part of the Quartus installation, so no gmake from other application will be needed. I just tried with the software directory that you provided using Quartus Pro 25.1 and was able to generate the .elf (attaching this one compressed).

        So, I am guessing that the issue that you are seeing is from actually being using the gmake from Matlab.

        Thanks

        Rolando

  • RolandoS_Altera's avatar
    RolandoS_Altera
    Icon for Occasional Contributor rankOccasional Contributor

    I have tried with the Rsicfree version that you indicated but seems that this version doesn't support the direct import of the NiosV Cmake project. I will need to ask if there is a way to do it from Riscfree, but my guess is that you will need to build the application from the NiosV shell.

  • Thierry29's avatar
    Thierry29
    Icon for New Contributor rankNew Contributor

    Hi Rolando,

    thank you for your time.

    From your last post I understand that using gmake is normal with this version of Riscfree. My problem is that gmake exists only in the Matlab directory on my PC. I checked this point. There is no other gmake.exe files anywhere else on my hard drive. My os is Windows so this program would be normally installed in the riscfree directory (instead of /usr/bin/ for Linux). Could you please check point? I would like to make sure that the installation of riscfree is not corrupted.

    Best regards,

    Thierry

  • RolandoS_Altera's avatar
    RolandoS_Altera
    Icon for Occasional Contributor rankOccasional Contributor

    Hi Thierry

    Sorry, it took some time to get Quartus 24.3.1 installed in Windows. I did some testing in Windows

    Test 1: If I tried to build the project from Riscfree when I opened this just by doing a double-click on the Riscfree.exe file, the build fails, reporting this:

    Regardless of this, I see that the hello.elf file is created.

    Test2: If I opened RiscFree from a CMD window in which I initialized the Nios V Shell ( C:\intelFPGA_pro\23.4\riscfree\RiscFree\Riscfree.exe), I was able to build the project successfully.

    In both cases, I don't see the progress capture in the Console in which you observe the gmake command. The only text that I saw in these 2 tests is the following:

    20:41:07 Buildscript generation: app::Debug in C:\NiosVRiscFree_Test\soft2\app\build\Debug

    cmake -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON -G "Unix Makefiles" "C:\\NiosVRiscFree_Test\\soft2\\app"

    -- The ASM compiler identification is GNU

    -- Found assembler: C:/intelFPGA_pro/23.4/riscfree/toolchain/riscv32-unknown-elf/bin/riscv32-unknown-elf-gcc.exe

    -- The C compiler identification is GNU 12.1.0

    -- Detecting C compiler ABI info

    -- Detecting C compiler ABI info - done

    -- Check for working C compiler: C:/intelFPGA_pro/23.4/riscfree/toolchain/riscv32-unknown-elf/bin/riscv32-unknown-elf-gcc.exe - skipped

    -- Detecting C compile features

    -- Detecting C compile features - done

    -- The CXX compiler identification is GNU 12.1.0

    -- Detecting CXX compiler ABI info

    -- Detecting CXX compiler ABI info - done

    -- Check for working CXX compiler: C:/intelFPGA_pro/23.4/riscfree/toolchain/riscv32-unknown-elf/bin/riscv32-unknown-elf-c++.exe - skipped

    -- Detecting CXX compile features

    -- Detecting CXX compile features - done

    -- Configuring done (9.4s)

    -- Generating done (0.1s)

    -- Build files have been written to: C:/NiosVRiscFree_Test/soft2/app/build/Debug

    20:41:17 Buildscript generation finished (took 9939 ms)

    I did some additional test to see if in any of them I could see the progress capture to try to see if I can see what gmake uses. From several attemps I was able to do it:

    1) In a CMD window enter into the niosv shell: C:\intelFPGA_pro\23.4\niosv\bin\niosv-shell.exe

    2) In this CMD window, run the cmake command: cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -B soft2/app/debug -S soft2/app

    3) Open RiscFree by double-clicking on the .exe file (not under the niosV shell) and create the C/C++ Cmake project as indicated in the Macnica application note.

    4) In Riscfree, build the project. In this case, I see that this fails with the error seen in Test1 above. Close RiscFree.

    5) In this CMD window in which the niosv shell is running, open RiscFree using the same workspace used when the project was created.

    6) Build this project again. This time the build succeds and now it shows the progress capture as shown next:

    17:55:33 **** Incremental Build of configuration Debug for project app ****

    "C:\\intelFPGA_pro\\23.4\\riscfree\\build_tools\\bin\\make.exe" -j all

    [ 1%] Building ASM object bsp/CMakeFiles/hal2_bsp.dir/HAL/src/alt_log_macro.S.obj

    [ 3%] Building ASM object bsp/CMakeFiles/hal2_bsp.dir/HAL/src/crt0.S.obj

    [ 3%] Building ASM object bsp/CMakeFiles/hal2_bsp.dir/HAL/src/alt_mcount.S.obj

    [ 4%] Building ASM object bsp/CMakeFiles/hal2_bsp.dir/HAL/src/machine_trap.S.obj

    :

    [ 96%] Building C object CMakeFiles/hello.elf.dir/hello.c.obj

    [ 97%] Linking C executable hello.elf

    [ 97%] Built target hello.elf

    [ 98%] Creating hello.elf.objdump.

    [100%] Reporting memory available for stack + heap in hello.elf.

    [100%] Built target create-objdump

    hello.elf

    * 124.44 KB - Program size (code + initialized data).

    * 24.36 KB - Free for stack + heap.

    [100%] Built target niosv-stack-report

    Here I can see that it uses the make.exe that is included as part of the RiscFree installation at C:\intelFPGA_pro\23.4\riscfree\build_tools\\bin\\make.exe

    Repeating this in Linux, I see that it uses /usr/bin/gmake. I am guessing that perhaps it tries to find gmake and in case it doesn't exist it goes to find make. In Windows I don't have gmake so, perhaps it uses the make included in Riscfree.

    I think that you can try to remove the Matlab path from the Windows corresponding $PATH environment and see if this time it uses the make from the RiscFree installation.

    Hope these experiments could be helpful.

    Thanks

    Rolando

    • Thierry29's avatar
      Thierry29
      Icon for New Contributor rankNew Contributor

      Hi Rolando,

      yes, you're right. When the path to Matlab is removed, I can compile with make instead of gmake.

      I wonder if compiling with gmake is problematic since it is used in Linux systems? This is to avoid having to manage environment variables every time I need Risfree or Matlab.

      One last question: are you getting the same warnings "File '/app/build/Debug/compile_commands.json' was not created in the build. Your workbench will not know all include paths and preprocessor defines." (my post 07-08-2025)?

      Thank you for your help and thorough testing.

      Regards,

      Thierry

      • RolandoS_Altera's avatar
        RolandoS_Altera
        Icon for Occasional Contributor rankOccasional Contributor

        Hi Thierry

        Yes, I also see these warnings after I create the project with Riscfree:

        Let me ask around about the issue of using gmake vs make. Not really sure if it's true that it tries by default using gmake instead of make.

        Thanks

        Rolando

  • Hi @Thierry29,


    Greetings, just checking in to see if there is any further doubts in regards to this matter.

    Hope your doubts have been clarified.


    Best Wishes

    BB


  • Hi @Thierry29,


    Greetings, as we do not receive any further clarification/updates on the matter, hence would assume challenge are overcome.


    Please login to ‘ https://supporttickets.intel.com/s/?language=en_US’, view details of the desire request, and post a feed/response within the next 15 days to allow me to continue to support you. After 15 days, this thread will be transitioned to community support. The community users will be able to help you on your follow-up questions. For new queries, please feel free to open a new thread and we will be right with you. Pleasure having you here.


    Best Wishes

    BB