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

Nios2 Helloworld project Memory Overflow

anonimcs
New Contributor I
1,058 Views

Hi guys,

I'm pretty new to Intel's environment for FPGA development and I need to use the Nios2 core for one of my designs. The design is implemented on MAX10 and I'm using Quartus 21.1 Standard edition on Ubuntu 20.04.

To keep things simple, I have created a Nios 2 application & BSP from template, and used Hello World template for that. In Eclipse, I have pointed to the .sopcinfo file of my Quartus project after I generated HDL and then compiled the design in Quartus for using the template helloworld project for my Nios application. After programming the FPGA; I have first generated the BSP, then Build the BSP and then trying to get a successful build from the helloworld application in order to run it.

The problem I'm having here is an overflow on 2 different addresses of the .elf's sections. I'm using an on-chip RAM of 32K and already included that in my Platform Designer with the correct offset (Base = 0x0000_0000, End = 0x0000_7FFF). As this is the template project and I have changed absolutely nothing, I would expect this to work just out of the box, so not sure what I'm doing wrong / missing. The error messages are given below. 

 

 

/home/anonimcs/intelFPGA_s21/21.1/nios2eds/bin/gnu/H-x86_64-pc-linux-gnu/bin/../lib/gcc/nios2-elf/10.3.1/../../../../../H-x86_64-pc-linux-gnu/nios2-elf/bin/ld: test_flash_10M25.elf section `.text' will not fit in region `onchip_RAM32k'
/home/anonimcs/intelFPGA_s21/21.1/nios2eds/bin/gnu/H-x86_64-pc-linux-gnu/bin/../lib/gcc/nios2-elf/10.3.1/../../../../../H-x86_64-pc-linux-gnu/nios2-elf/bin/ld: address 0xa2c4 of test_flash_10M25.elf section `.rwdata' is not within region `onchip_RAM32k'
/home/anonimcs/intelFPGA_s21/21.1/nios2eds/bin/gnu/H-x86_64-pc-linux-gnu/bin/../lib/gcc/nios2-elf/10.3.1/../../../../../H-x86_64-pc-linux-gnu/nios2-elf/bin/ld: address 0xbfe4 of test_flash_10M25.elf section `.bss' is not within region `onchip_RAM32k'
/home/anonimcs/intelFPGA_s21/21.1/nios2eds/bin/gnu/H-x86_64-pc-linux-gnu/bin/../lib/gcc/nios2-elf/10.3.1/../../../../../H-x86_64-pc-linux-gnu/nios2-elf/bin/ld: address 0xa2c4 of test_flash_10M25.elf section `.rwdata' is not within region `onchip_RAM32k'
/home/anonimcs/intelFPGA_s21/21.1/nios2eds/bin/gnu/H-x86_64-pc-linux-gnu/bin/../lib/gcc/nios2-elf/10.3.1/../../../../../H-x86_64-pc-linux-gnu/nios2-elf/bin/ld: address 0xbfe4 of test_flash_10M25.elf section `.bss' is not within region `onchip_RAM32k'
/home/anonimcs/intelFPGA_s21/21.1/nios2eds/bin/gnu/H-x86_64-pc-linux-gnu/bin/../lib/gcc/nios2-elf/10.3.1/../../../../../H-x86_64-pc-linux-gnu/nios2-elf/bin/ld: region `onchip_RAM32k' overflowed by 16356 bytes

 

 

Just out of curiosity, I had a look at the file 'settings.bsp' and I have seen that the memory's sections (such as heap & stack) have set within LinkerSection blocks that's outside the Setting for the memory itself. I was wondering if this is the usual case. However, just as I mentioned above, I should not have to edit any BSP files when running a template project.

Any help would be appreciated.

Cheers!

0 Kudos
12 Replies
EBERLAZARE_I_Intel
1,012 Views

Hi,


Yea, you should not edit the addresses in the BSP linker script.


You may try to increase your OCRAM IP size , in the Platform Designer and re-generate your HDL. And check again with the new .sopcinfo.


You should see in the BSP linker script that your OCRAM size have increase and generate your BSP and build your project again.


0 Kudos
EBERLAZARE_I_Intel
984 Views

Hi,


Any update from your side?


0 Kudos
anonimcs
New Contributor I
975 Views

Yes, when I enabled the small C library in the BSP editor, then I got rid off these errors.

 

But now I have a different issue, that I have missing Software Packages in the BSP editor. Is there a way to install them without uninstalling Eclipse ? I'm specificly interested in "altera_safeclib" package as I want to use the "Generic Quad SPI controller II Intel FPGA IP" to communicate with the external flash we use "MT25QL512ABA". Since that package is missing and I cannot enable it in my BSP settings, when I run "alt_flash_open_dev(NAME_OF_FLASH_IN_SYSTEMH_FILE)" it always returns zero, meaning that it fails to open the device in order to read/write. I have followed the instructions for having Nios2 support in Eclipse (https://www.intel.com/content/www/us/en/support/programmable/articles/000086893.html?wapkw=installation+guides&erpm_id=13401520_ts1708675042469) but this guide is wrong, in step 2 when I extract the tar.gz file, it creates a folder with a name "<downloaded_file_name>" which includes an "eclipse" folder in it. So I supposed I needed to take that "eclipse" folder to one level above and then rename it. Even after that, the extraction in step 4 also ends up pretty much the same, with an additional parent folder above "eclipse_nios2" and therefore it cannot overwrite the renamed folder. I rtied copying it manually into the renamed folder, but then the whole Eclipse crashed and I couldn't run it again anymore. I had to uninstall and re-install the whole Quartus Prime software...

 

After reinstalling, the steps in the link didn't end in a different result, I still don't have the software packages I want for the BSP settings. I'd appreciate if you (or another colleague of yours) can assist me with that @EBERLAZARE_I_Intel .

 

Note: During the Quartus 21.1 Std's installation, Eclipse Development Software (EDS) for Nios2 was already installed, by using the files/packages Intel provided. I couldn't find any plugin SW packages on the internet either...

0 Kudos
anonimcs
New Contributor I
923 Views

PS: I have tried replacing the Quad SPI IP with "Generic Serial Flash Interface Intel FPGA IP" with checking the option "Enable SPI pins interface" on the Platform Designer, but also that didn't have the BSP package "altera_safeclib". So the proposed solution on the other posts regarding this topic by the employees did not work. Is there another way to get that BSP package somehow ? @EBERLAZARE_I_Intel 

0 Kudos
anonimcs
New Contributor I
903 Views

Other notes:

1) I've also tried the configuration device type "EPCQL512-Micron Compatible" and the device type "MT25QL512ABA" (this is the one I'm using as an external Flash on my board) when using the Quad SPI IP of Intel, but I couldn't open any of them. The function "alt_flash_open_dev(NAME_OF_FLASH_IN_SYSTEMH_FILE)" always returns zero. And when I try reading the ID of the flash with the function "IORD_ALTERA_QSPI_CONTROLLER2_RDID(CSR_BASE_OF_FLASH_IN_SYSTEMH_FILE)" it returns 0xFFFFFFFF instead of the actual ID of the device, in my case 0x00000020 (ALTERA_QSPI_CONTROLLER2_RDID_QSPI512 in the generated file altera_generic_quad_spi_controller2_regs.h). I also tried getting the device ID with "alt_qspi_controller2_get_info" function, but I got invalid args error for some reason, since I'm sure that the arguments I give are not wrong. Below you can see how I called the function and got -22 as return value.

 

	alt_flash_fd* flash_handle;
	flash_region  *regions;
	int           numRegions = 0;
	int           device_id = -1;
	flash_handle = alt_flash_open_dev(FLASH_CONTROLLER_AVL_MEM_NAME);
	device_id = alt_qspi_controller2_get_info(flash_handle, &regions, &numRegions);

 

2) I've seen that in the System.h file in the generated BSP, I see the part number for the Quad SPI as N25Q512 even though I select MT25QL512ABA on Platform Designer. But when I selected EPCQL512-Micron Compatible option for the Quad SPI, I saw that the part number in system.h was correct, being EPCQL512. Not sure if this has anything to do with being able to open the device though, both devices N25.. and MT25.. seem quite similar in the documentation "Technical Note, Micron N25Q to Micron MT25Q Migration" written by Micron.

 

 @EBERLAZARE_I_Intel any recommendations ? It seems there's something basic is wrong, so it doesn't help if I try reading any of the flash registers as I cannot open the device successfully. Waiting for your (or any other Intel employee's fast support).

0 Kudos
EBERLAZARE_I_Intel
882 Views

Hi,


Let me check on my side on the altera_safeclib. In the mean time could you send the latest Quartus project file along with the software and BSP? You can archive them all together.


0 Kudos
anonimcs
New Contributor I
861 Views

Hi, which Quartus project files do you want ? It would be more clear if you specify the file extensions of the files.

0 Kudos
anonimcs
New Contributor I
833 Views

Hi @EBERLAZARE_I_Intel ,

I've archived some of the files that are not confidential and might be useful for you. In addition, I've added all sw and bsp files. You can view them all in the attached zip file.

0 Kudos
EBERLAZARE_I_Intel
788 Views

Hi,


Thanks, allow me some time to check it out.


0 Kudos
EBERLAZARE_I_Intel
710 Views

Hi,


By default, the BSP driver should be enable and disable in the BSP settings such as the "altera_safeclib", which depends on the IP in your .qsys design. I am double checking your design. I shall get back to you.


0 Kudos
EBERLAZARE_I_Intel
589 Views

Hi,


My apologies, I am a bit caught up on my side, I shall get the replies and update for your later today.


Thanks again for your patience.


0 Kudos
EBERLAZARE_I_Intel
553 Views

Hi,


We regret to inform you that, unfortunately the HAL API is only available in the Quartus Pro version:

https://www.intel.com/content/www/us/en/docs/programmable/683419/23-1-20-2-3/hal-driver.html

Note: The Intel HAL Driver is supported in Intel® Quartus® Prime Pro Edition software only.


Since this ticket initial issue is solved, I now transition this thread to community support. If you have a new question, Please login to ‘https://supporttickets.intel.com’, 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.



p/s: If any answer from the community or Intel Support are helpful, please feel free to give best answer or rate 4/5 survey.


0 Kudos
Reply