Question
Compiler not checking ram overflow in local variables?
Stm32CubeIDE v1.6.1
STM32 F1 library v1.8.4
New, empty project.
Something simple as this comples without any error or warning in a stm32f103.
It has 20KB ram, but for some reason the compiler doesn't care that I'm allocating 64KB!
Of course, it causes a hard fault. Declaring variable as global throws an error like it should.
void test(void){
volatile uint8_t dat[65536];
for(uint32_t t=0;t<sizeof(dat);t++){
dat[t]=GPIOA->IDR;
}
for(uint32_t t=0;t<sizeof(dat);t++){
GPIOB->ODR=dat[t];
}
}