Hi,
I may have found an issue in the RT core linker script / memory layout used in the SDK, and I would like to check whether I am misunderstanding something or whether this is indeed a bug.
Development environment
In the linker scripts, the .data section is defined as a section that is copied from program memory to working memory at startup, which is fine and expected. In other words, .data is placed into RAM at runtime, while its initialization values are stored in program memory, using something like:
.data : AT(__DATA_ROM)
{
...
} > m_data
My concern is about what happens after that. As I understand GNU ld behavior, once an output section gets a load address via AT(...), the following allocatable sections in the same memory region may inherit a related LMA handling unless explicitly separated or marked otherwise. In this case, it appears that subsequent sections such as .bss, .heap, and .stack also end up reserving space in m_text / program memory, even though they should not require ROM initialization data.
This seems problematic because:
- .bss should normally only occupy RAM and be zero-initialized by the startup code
- .heap and .stack should also only reserve RAM space
- none of these sections should consume additional space in program memory
I can reproduce the behavior very easily with the standard Hello World example:
- Build the unmodified example and check the memory layout using the IMAGE INFO

- Add a large uninitialized global array, for example:
/*!
* @brief Task responsible for printing of "Hello world." message.
*/
volatile uint32_t test_array[10240]; /* 40KB array */
static void hello_task(void *pvParameters)
{
(void)test_array[0]; /* prevent optimization */
for (;;)
{
PRINTF("Hello world.\r\n");
vTaskSuspend(NULL);
}
}
- Rebuild and inspect the map file / memory usage

- It appears that increasing the size of this uninitialized object also increases the usage of m_text / program memory, as if .bss-type content were being accounted for there as well
My expectation would be that only .data consumes ROM image space, while .bss, .heap, and .stack only consume RAM.
Newer SDK does not solve this problem. Adding (NOLOAD) attributes to sections also does not solve the problem. Reordering the sections in m_data memory (for example moving the .bss before .data) resolves some of the issues but moving .heap and .stack introduces some other.
So my question is: Am I missing something in how this linker script is intended to work, or is this a bug in the SDK linker layout?