关于C语言【全局变量】与【全局常量】在STM32中储存方式的区别

2019-10-15 20:18发布

本人在使用 STM32液晶屏的时候,在工程里面 写入了一个 u16 a[]={这张图片的RGB565代码,1万个数据};
编译后 HEX文件有 88KB 1.png
后来 试着 在数组前面增加了一个 const修饰 , const u16 a[]={这张图片的RGB565代码,1万个数据};
编译后 HEX文件约200KB 2.png

3.png
4.png

搞不明白的是 这100多KB差别在哪里。
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
22条回答
777ai77
2019-10-18 19:33
jinggx 发表于 2016-12-29 16:13
把 u16改成u32 类型可能结果就一样大小了,我没有试,你可以去试一下。

原因:据我分析,stm32的FLASH ...

无const改成 u32  build不通过。 空间不够了
..OBJTOUCH.axf: Error: L6406E: No space in execution regions with .ANY selector matching interface.o(.data).
..OBJTOUCH.axf: Error: L6406E: No space in execution regions with .ANY selector matching startup_stm32f10x_hd.o(STACK).
..OBJTOUCH.axf: Error: L6406E: No space in execution regions with .ANY selector matching startup_stm32f10x_hd.o(HEAP).
..OBJTOUCH.axf: Error: L6406E: No space in execution regions with .ANY selector matching usart.o(.bss).
..OBJTOUCH.axf: Error: L6406E: No space in execution regions with .ANY selector matching libspace.o(.bss).
..OBJTOUCH.axf: Error: L6406E: No space in execution regions with .ANY selector matching touch.o(.data).
..OBJTOUCH.axf: Error: L6406E: No space in execution regions with .ANY selector matching system_stm32f10x.o(.data).
..OBJTOUCH.axf: Error: L6406E: No space in execution regions with .ANY selector matching stm32f10x_rcc.o(.data).
..OBJTOUCH.axf: Error: L6406E: No space in execution regions with .ANY selector matching lcd.o(.bss).
..OBJTOUCH.axf: Error: L6406E: No space in execution regions with .ANY selector matching usart.o(.data).
..OBJTOUCH.axf: Error: L6406E: No space in execution regions with .ANY selector matching lcd.o(.data).
..OBJTOUCH.axf: Error: L6406E: No space in execution regions with .ANY selector matching delay.o(.data).
..OBJTOUCH.axf: Error: L6406E: No space in execution regions with .ANY selector matching ft5206.o(.data).
..OBJTOUCH.axf: Error: L6407E: Sections of aggregate size 0x1673c bytes could not fit into .ANY selector(s).
Not enough information to list image symbols.
Not enough information to list the image map.

一周热门 更多>