Move RTOS Stack and HEAP to other RAM Region?

Does any one know if it is possible to remap or move the stack and heap to another RAM Address?

I’m using a STM32L431CC microcontroller which has two RAM sections:
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K
RAM2 (xrw) : ORIGIN = 0x10000000, LENGTH = 16K

For my rtos configuration the 16K RAM2 would be sufficient.
I’m using heap4.

Does any one know how I can move the rtos into this ram region?

I don’t have a special reason to do this but I was wondering if it is possible to do.

That tends to be controlled by the linker control file. If using one of the FreeRTOS heap routines that define a static array for the heap, you will normally need to add an attribute to the definition of that array to put it into a special linker section.

Where do I find this definition of the array?
I know that the attribute should be:

__attribute__ ((used,section(".ram2")))

Heap4’s backing buffer is defined here: FreeRTOS-Kernel/heap_4.c at 1b8a4244bdd911f156ce5bc6f9f13dcde68228cb · FreeRTOS/FreeRTOS-Kernel · GitHub

To apply the attribute, you would define configAPPLICATION_ALLOCATED_HEAP to 1 in your FreeRTOSConfig.h, set configTOTAL_HEAP_SIZE to the size you want, and then define ucHeap.