Running FreeRTOS on Basys3 Board (Artix-7 FPGA) with MicroBlaze

droz wrote on Friday, October 27, 2017:

I’m trying to run FreeRTOS on the Basys3 board, which features the Artix-7 FPGA, with the MicroBlaze soft processor, but I’ve had issues with the lack of enough ILMB memory. The Basys3 has 1800Kb of BRAM on it, so the MicroBlaze can only have a maximum 128 KB memory configuration. When I try making a new FreeRTOS “Hello World” application in Xilinx SDK, gives me the error:
“lab8bf.elf section .bss' will not fit in region microblaze_0_local_memory_ilmb_bram_if_cntlr_Mem_microblaze_0_local_memory_dlmb_bram_if_cntlr_Mem’”
`microblaze_0_local_memory_ilmb_bram_if_cntlr_Mem_microblaze_0_local_memory_dlmb_bram_if_cntlr_Mem’ overflowed by 61744 bytes

My question is: how much memory does a basic FreeRTOS application need? Is there any way to decrease the size of the .bss region of a FreeRTOS .elf, or to allow MicroBlaze to increase its ILMB size further?

rtel wrote on Friday, October 27, 2017:

My question is: how much memory does a basic FreeRTOS application need?

If you are talking about the application that uses FreeRTOS, then I have
no idea, as its not my application and I’ve never seen it. If you mean
to ask how much RAM does FreeRTOS need then in itself it is very little
(about 200 bytes), but you also need RAM for the stack of each task
created. The RAM for task stacks comes from the FreeRTOS heap, and the
size of the FreeRTOS heap is set by the linker script if you are using
heap_3.c, or configTOTAL_HEAP_SIZE if you are using any of the other
four heap implementations. I would recommend trying to reduce the heap

rocco-matano wrote on Sunday, October 29, 2017:

The standard projects that the Xilinx SDK (version 2017) creates request a heap size of 64k. That is done by creating a FreeRTOSConfig.h with the line
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 65536 ) )
I think this can be changed by editing the properties of the generated BSP.

While 64k is more than a simple application needs, you still need some heap space. Since the linker reports 61744 missing bytes, just reducing the heap size probably won’t be the only thing you have to change in order to fit your application into 128k.

droz wrote on Sunday, November 05, 2017:

Thanks for the additional information. I have a follow-up question, then. I’m willing to use any FreeRTOS application for a class example. What is the smallest possible application that I can make that uses FreeRTOS on the MicroBlaze processor? For now, I’m willing to use any sample program that will build in this 128 KB space. If the “FreeRTOS Hello World” application built into Xilinx SDK is too large, what could I do to bring it down to a more reasonable size?

rtel wrote on Sunday, November 05, 2017:

I would be very surprised if a ‘hello world’ application that just sat
in a loop, delaying and toggling an LED every second, or whatever, would
not fit. It must be building something else too.