Local Memory of the Microblaze overflowed

Hello,

I am working on a project where I instantiated Zynq and Microblaze in the hardware design along with a shared Block Memory Generator (using Vivado 2019.2 versioin). I am programming the Microblaze using Vitis 2019.2 version. The program on Microblaze should read and write from the shared Block memory.

When I build the program it issues an error saying the ‘Local Memory of the Microblaze overflowed by 13408 bytes’.

/home/deepak/Softwares/xilinx/Vitis/2019.2/gnu/microblaze/lin/bin/…/lib/gcc/microblaze-xilinx-elf/8.2.0/…/…/…/…/microblaze-xilinx-elf/bin/ld: Shared_Bram_Debug_AllReset_MB_512K_App.elf section .rodata' will not fit in region microblaze_0_local_memory_ilmb_bram_if_cntlr_Mem_microblaze_0_local_memory_dlmb_bram_if_cntlr_Mem’
makefile:48: recipe for target ‘Shared_Bram_Debug_AllReset_MB_512K_App.elf’ failed
/home/deepak/Softwares/xilinx/Vitis/2019.2/gnu/microblaze/lin/bin/…/lib/gcc/microblaze-xilinx-elf/8.2.0/…/…/…/…/microblaze-xilinx-elf/bin/ld: region `microblaze_0_local_memory_ilmb_bram_if_cntlr_Mem_microblaze_0_local_memory_dlmb_bram_if_cntlr_Mem’ overflowed by 13408 bytes
collect2: error: ld returned 1 exit status

From the board manual I found the maximum BRAM available in Pynq-Z2 board is 630KB. So, I edited my hardware design in Vivado increasing the Range of ‘microblaze_0_local_memory/dlmb_bram_if_cntlr’ and ‘microblaze_0_local_memory/ilmb_bram_if_cntlr’ to 512K. But still the error persists.

I noticed in the Report Utilization under Synthesis that the BRAM is used 94%. [attached screenshot]

Could someone please advise me in how I can increase the local memory of Microblaze or is there any other way to build my program and run on Microblaze.

Thanks for your time and consideration.

Best Regards
Deepak

1 Like

If I understand you post correctly, you had a design with a MicroBlaze with a small amount of RAM. You thenk got the overflow error. (by 13K)
You increased the BRAM in Vivado to the maximum you can fit in the chip, but you still get the overflow error.
If the overflow error is the same (13K) then the increase in BRAM size inthe hardware design has not propagated to the software development environment.
Did you export the Vivado project again?
The system.hdf file should have the updated MicroBlaze memory map.
I’m assuming you are using the auto generated makefiles and linker scripts?
If you did this, you could try clean your software projects, including the BSP and the hardware platform project.
If this doesn’t work, try delete your software projects and create them from scratch.

Cathal

1 Like

Hello Cathal,
Thanks for your reply.
Initially in the Vivado hardware design, I provided a local memory range of 128K to the Microblaze. For which I got the overflow error as 406744 bytes. So, I increased it to the maximum 512K and again exported the hardware to Vitis. When I compile the program now I get the overflow error of 13408 bytes.

Thanks and Regards
Deepak

OK, your compiled program is just too big. You need to try reduce it.
Did you try change optimisation settings?: -Os, -O1 , -O2 , -O3
Are you using “printf”? There is a smaller xil_printf
Check any allocated memory.and data types aren’t bigger than they need to be. E.g. int’s where char’s can be used etc.

This isn’t really anything to do with PYNQ, so you might be better posting or searching on XIlinx forums, or generally looking for tips on embedded software forums.

Cathal

2 Likes

I removed using printf() and few header files. Now I am able to build the project. I will try to optimize my code better.

Thank You

3 Likes

These input arrays are copied to a local array using the standard C library Memory Layout possible to write enough data to “ overflow ” the local array.