测试了一下,外部变量使用的是SRAM,起始地址0x2000 0000,但是应该不是堆栈中吧,应该是静态存储区,而且栈是0x400,堆是0x200,一共才1536个字节,放不下这好几千。当外部数组5000的时候会提示错误信息,4500的时候还不会提示错误信息。
u32 array[4500]={50000};
这时候5000*4=20000个字节,SRAM是20KB,20480个字节,还剩480个字节估计当作别用了。
错误信息如下:
.\output\template.axf: Error: L6406E: No space in execution regions with .ANY selector matching startup_stm32f10x_md.o(STACK).
.\output\template.axf: Error: L6406E: No space in execution regions with .ANY selector matching startup_stm32f10x_md.o(HEAP).
.\output\template.axf: Error: L6406E: No space in execution regions with .ANY selector matching libspace.o(.bss).
.\output\template.axf: Error: L6406E: No space in execution regions with .ANY selector matching system_stm32f10x.o(.data).
.\output\template.axf: Error: L6406E: No space in execution regions with .ANY selector matching stm32f10x_rcc.o(.data).
.\output\template.axf: Error: L6407E: Sections of aggregate size 0x688 bytes could not fit into .ANY selector(s).