Using VisualDBG 5.2, GCC 9.2.1, EFM32 5.9.1, device EFM32TG11B120F128, default linker file
When file level variable size is larger then 1000 bytes, the function variables are placed in the file level variable memory space. They overlap. No warning.
RAM memory is used only 2028 bytes (6.2%) from 32Kb available.
See the complete test code below.
buffer is placed 0x2000001c <buffer> “” {0 ‘\000’}
stack variable i is placed 0x200003f4 <buffer+984> {752}
How to resolve that file level variables does not overlap with function stack memory?
#include <stdint.h>
uint8_t buffer[2000];
void func(uint8_t param)
{
buffer[param] = param;
}
int main()
{
uint32_t i;
for (;;)
{
i++;
func(i & 0xFF);
}
return 0;
}
-
This topic was modified 4 years, 7 months ago by guntiss.