I’m using an F469I Disco board. F469 processor, 128 Mb external SDRAM.
It’s properly mapped, setup, functions, and has regions defined in the linker for LTDC, XXHEAP (memory manager related to the graphics tree), and FreeRTOS.
The FreeRTOS is where the problem is:
It can be mapped, Heap4.c (since I only want the FreeRTOS heap in this extended 32 bit memory) deals with it, everything gets placed where it needs to be.
However:
in CubeMXIDE, there is no way to select the configAPPLICATION_ALLOCATED_HEAP as an option in CubeMX. This is a topic that ST is going to have to address.
However, if I go into FreeRTOS.h, I can find the set point for the variable and change it to a 1. This of course is reset each time CubeMX regenerates code. Again, an ST fix.
Now for heap4c, which ST does not control:
The relevant section of code that I have to change is followed by the original code which is commented out:
/* Allocate the memory for the heap. */
#if( configAPPLICATION_ALLOCATED_HEAP == 1 )
/* The application writer has already defined the array used for the RTOS heap - probably so it can be placed in a special segment or address. */
extern uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];
uint8_t ucHeap[ configTOTAL_HEAP_SIZE ] __attribute__ ((section (".freertos_data")));
#else
static uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];
#endif /* configAPPLICATION_ALLOCATED_HEAP */
//#if( configAPPLICATION_ALLOCATED_HEAP == 1 )
// /* The application writer has already defined the array used for the RTOS
// heap - probably so it can be placed in a special segment or address. */
// extern uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];
//#else
// static uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];
//#endif /* configAPPLICATION_ALLOCATED_HEAP */
//
The problem I have (and so will anyone) is that this section of code is not placed in the “user code” area. So every time I regenerate code, it needs to be fixed.
If you could place this in the user code (or just link to a user section (i.e. add as standard)
#if( configAPPLICATION_ALLOCATED_HEAP == 1 )
// user code n
// user adds code
// end user code n
#endif
That, or add as a _weak_ variable the option of calling the config routine in a location where it won't be changed.
It would be appreciated. This is a valid setup when using heap4c, since it allows using the entire processor RAM while placing the FreeRTOS heap in extended memory.