UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Explorer
Explorer
533 Views
Registered: ‎07-03-2014

[FreeRTOS] Differences between linker script's "HEAP SIZE" and BSP's "TOTAL_HEAP_SIZE"

Jump to solution

Hi,

 

As no forum is available for questions regarding FreeRTOS, I'll post my question here hoping to be luckly.

 

My application running over FreeRTOS needs a relative small heap which is allocated in 512Mbyte DDR3 RAM. I want to allocate 1Mbyte for heap, and the rest (511 MByte) for data buffers (mainly for DMAs).

Where should I set the 1MByte value, in the linker script "HEAP SIZE" or in the BSP property "Total_Heap_Size"?

According to FreeRTOS documentation, "Total_Heap_Size" is the amount of memory FreeRTOS will use when allocating memory dinamically (malloc). So then, what's "HEAP_SIZE" in linker script useful for?

What's the difference between both parameters?

 

Thanks!

0 Kudos
1 Solution

Accepted Solutions
Explorer
Explorer
503 Views
Registered: ‎07-03-2014

Re: [FreeRTOS] Differences between linker script's "HEAP SIZE" and BSP's "TOTAL_HEAP_SIZE"

Jump to solution

Ok, I checked where variables are allocated in memory and figured out the answer:

 

 * TOTAL_HEAP_SIZE is memory allocated to the FreeRTOS kernel, which is used internally to create semaphores, tasks, queues, etc. and can't be user by the application. As it is statically created, it is allocated in bss section.

 

 * Linker script's "Heap Size" is memory allocated to the application through malloc calls. In my application, that is DD3 RAM.

 

I got confused by figure 7 in book "Mastering the FreeRTOS RealTime Kernel - A Hands-On Tutorial Guide", where you can see how user data is allocated into kernel's heap, which still doesn't make sense to me.

 

For further information, see this link.

 

Regards.

0 Kudos
1 Reply
Explorer
Explorer
504 Views
Registered: ‎07-03-2014

Re: [FreeRTOS] Differences between linker script's "HEAP SIZE" and BSP's "TOTAL_HEAP_SIZE"

Jump to solution

Ok, I checked where variables are allocated in memory and figured out the answer:

 

 * TOTAL_HEAP_SIZE is memory allocated to the FreeRTOS kernel, which is used internally to create semaphores, tasks, queues, etc. and can't be user by the application. As it is statically created, it is allocated in bss section.

 

 * Linker script's "Heap Size" is memory allocated to the application through malloc calls. In my application, that is DD3 RAM.

 

I got confused by figure 7 in book "Mastering the FreeRTOS RealTime Kernel - A Hands-On Tutorial Guide", where you can see how user data is allocated into kernel's heap, which still doesn't make sense to me.

 

For further information, see this link.

 

Regards.

0 Kudos