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

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

Thierry29
Beginner
1,271 Views

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 memoryA part of the hardware system designed with Platform Designer, mainly NiosV/m and on-chip memoryAddress mappingAddress mappingBSP editor: Drivers viewBSP editor: Drivers viewCompilation aborts: gmake.exe is mentionned at the last lineCompilation aborts: gmake.exe is mentionned at the last lineCompilation aborts: message indicating that .bss is not within region 'onchip_mem'Compilation aborts: message indicating that .bss is not within region 'onchip_mem'

Thank you very much in advance for your help

Thierry

0 Kudos
9 Replies
RolandoS_Altera
Employee
1,205 Views

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

 

0 Kudos
Thierry29
Beginner
1,147 Views

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

0 Kudos
RolandoS_Altera
Employee
1,090 Views

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).

RolandoS_Altera_0-1751659996518.png

 

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

 

Thanks

Rolando

0 Kudos
Thierry29
Beginner
1,053 Views

Hi Rolando,

I have attached the app and bsp directories that I generated (located in the "soft2" directory) so you can verify their accuracy. The next step is to import the project into Riscfree. The version of Riscfree I am using (v23.4.1, 3rd Nov 2023 installed with Quartus 23.1.1) does not implement the "Import Nios V CMake Project" option that is used in the application note 985.

Could you please tell me exactly how to import the project with this version of Riscfree?

Best regards,

Thierry

0 Kudos
RolandoS_Altera
Employee
1,042 Views

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.

0 Kudos
Thierry29
Beginner
912 Views

Hi Rolando,

an unofficial tutorial explains how to import a Nios V project into Riscfree for versions that do not yet offer the automatic import option (https://malt.zendesk.com/hc/en-us/articles/9280647796761-Nios-V-Project-Development-Procedure-Using-Ashling-RiscFree-IDE , part 4.5.1). I was not able to follow this procedure, it may not exactly match the version I am using.

I would use the last version of Riscfree but it seems it has a bug : https://community.intel.com/t5/Nios-V-II-Embedded-Design-Suite/RiscFree-v25-1-1-no-longer-finds-BSP-and-compiler-headers-files/m-p/1676846#M53545 without a clear workaround.

 

Regards,

Thierry

 

0 Kudos
RolandoS_Altera
Employee
556 Views

Hi Thierry

I was able to build your application from Riscfree using the instructions provided in the Macnica application note. I also looked in to the case that reports the issue in Riscfree and I agree that the workaround is not clear. I am asking internally to see if the person who was supporting that case is able to provide the workaround.

 

Thanks

Rolando

0 Kudos
Thierry29
Beginner
367 Views

Hi Rolando,

it is good news that you were able to build the application using the Macnica application note. I tried to do the same thing and can detail where our paths seem to diverge.

 

I follow very scrupulously the tutorial up to the end of 4.5.1. The only difference is that I am using Riscfree v23.4.1 instead of v22.2.2. Everything seems normal until the "Finish" command to create the project in Risfree. Warnings are displayed in "Problems" tab with the informations below (by category):

Description:
File '/app/build/Debug/compile_commands.json' was not created in the build. Your workbench will not know all include paths and preprocessor defines.

Resource:
app

Location:
de.marw.cmake.cdt.language.settings.providers.CompileCommandsJsonParser

Type:
CMAKE_EXPORT_COMPILE_COMMANDS Parser Problem

 

Despite these warnings, I tried to build the application ("Build Project" command). As you can see below, the project is build (with no errors) with gmake not cmake. I do not understand why.

 

08:58:03 **** Build of configuration Debug for project app ****

"C:\\PROGRA~1\\MATLAB\\R2020b\\bin\\win64\\gmake.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/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

[100%] Creating hello.elf.objdump.

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

hello.elf

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

* 23.36 KB - Free for stack + heap.

[100%] Built target niosv-stack-report

[100%] Built target create-objdump

 

08:58:10 Build Finished. 0 errors, 0 warnings. (took 7s.9ms)

 

I join the app and bsp. You might want to check if the behavior is the same in your case.

 

Thank,

Thierry

0 Kudos
RolandoS_Altera
Employee
229 Views

Hi Thierry

 

I built this in RiscFree installed in Linux (same version as yours) and I see that it also uses gmake. The version of gmake that uses seems to be the version that is installed in the machine /usr/bin/gmake:

12:14:32 **** Clean-only build of configuration Debug for project app ****
/usr/bin/gmake -j clean
/bin/sh: /home/rolando/intelFPGA_pro/23.4b79/niosv/bin/../../quartus/linux64/libtinfo.so.6: no version information available (required by /bin/sh)

12:14:32 Build Finished. 0 errors, 0 warnings. (took 115ms)

12:14:32 **** Build of configuration Debug for project app ****
/usr/bin/gmake -j all
/bin/sh: /home/rolando/intelFPGA_pro/23.4b79/niosv/bin/../../quartus/linux64/libtinfo.so.6: no version information available (required by /bin/sh)
/bin/sh: /home/rolando/intelFPGA_pro/23.4b79/niosv/bin/../../quartus/linux64/libtinfo.so.6: no version information available (required by /bin/sh)
/bin/sh: /home/rolando/intelFPGA_pro/23.4b79/niosv/bin/../../quartus/linux64/libtinfo.so.6: no version information available (required by /bin/sh)
[ 1%] Building ASM object bsp/CMakeFiles/hal2_bsp.dir/HAL/src/alt_mcount.S.obj
/bin/sh: /home/rolando/intelFPGA_pro/23.4b79/niosv/bin/../../quartus/linux64/libtinfo.so.6: no version information available (required by /bin/sh)


/bin/sh: /home/rolando/intelFPGA_pro/23.4b79/niosv/bin/../../quartus/linux64/libtinfo.so.6: no version information available (required by /bin/sh)
/bin/sh: /home/rolando/intelFPGA_pro/23.4b79/niosv/bin/../../quartus/linux64/libtinfo.so.6: no version information available (required by /bin/sh)
[ 2%] Building ASM object bsp/CMakeFiles/hal2_bsp.dir/HAL/src/alt_log_macro.S.obj
/bin/sh: /home/rolando/intelFPGA_pro/23.4b79/niosv/bin/../../quartus/linux64/libtinfo.so.6: no version information available (required by /bin/sh)
/bin/sh: /home/rolando/intelFPGA_pro/23.4b79/niosv/bin/../../quartus/linux64/libtinfo.so.6: no version information available (required by /bin/sh)
[ 3%] Building ASM object bsp/CMakeFiles/hal2_bsp.dir/HAL/src/crt0.S.obj

:

[ 97%] Built target hello.elf
/bin/sh: /home/rolando/intelFPGA_pro/23.4b79/niosv/bin/../../quartus/linux64/libtinfo.so.6: no version information available (required by /bin/sh)
/bin/sh: /home/rolando/intelFPGA_pro/23.4b79/niosv/bin/../../quartus/linux64/libtinfo.so.6: no version information available (required by /bin/sh)
/bin/sh: /home/rolando/intelFPGA_pro/23.4b79/niosv/bin/../../quartus/linux64/libtinfo.so.6: no version information available (required by /bin/sh)
/bin/sh: /home/rolando/intelFPGA_pro/23.4b79/niosv/bin/../../quartus/linux64/libtinfo.so.6: no version information available (required by /bin/sh)
[ 98%] Creating hello.elf.objdump.
/bin/sh: /home/rolando/intelFPGA_pro/23.4b79/niosv/bin/../../quartus/linux64/libtinfo.so.6: no version information available (required by /bin/sh)
[100%] Reporting memory available for stack + heap in hello.elf.
sh: /home/rolando/intelFPGA_pro/23.4b79/niosv/bin/../../quartus/linux64/libtinfo.so.6: no version information available (required by sh)
/bin/bash: /home/rolando/intelFPGA_pro/23.4b79/niosv/bin/../../quartus/linux64/libtinfo.so.6: no version information available (required by /bin/bash)
/bin/sh: /home/rolando/intelFPGA_pro/23.4b79/niosv/bin/../../quartus/linux64/libtinfo.so.6: no version information available (required by /bin/sh)
[100%] Built target create-objdump
hello.elf
* 124.45 KB - Program size (code + initialized data).
* 24.35 KB - Free for stack + heap.
/bin/sh: /home/rolando/intelFPGA_pro/23.4b79/niosv/bin/../../quartus/linux64/libtinfo.so.6: no version information available (required by /bin/sh)
[100%] Built target niosv-stack-report

12:14:32 Build Finished. 0 errors, 0 warnings. (took 361ms)

 

When building manually, seems that it does it 2 stages:

* cmake: creates all the components needed to build through gmake

* gmake: builds the binaries

 

So I think that the gmake stage that you see is expected. What I am not sure about is why it uses gmake for Matlab. Perhaps in Windows, that's the gmake that it finds and then it uses that.

 

Thanks

Rolando

0 Kudos
Reply