[STM32F0] 解决 system_stm32f0xx.o(.data) type RW incompatible with main.o type ZI in ...

[复制链接]
 楼主| 51xlf 发表于 2021-6-1 17:30 | 显示全部楼层 |阅读模式
解决 system_stm32f0xx.o(.data) type RW incompatible with main.o type ZI in er RW_IRAM1.
在调试stm32f0xx时,碰到了一个这样的错误:

Error: L6971E: system_stm32f0xx.o(.data) type RW incompatible with main.o(.ARM.__AT_0x20000000) type ZI in er RW_IRAM1.

从字面上判断为编译system_stm32f0xx.c文件生成的目标文件system_stm32f0xx.o中的数据段(.data)内的RW数据与main.o中的数据在地址0x20000000产生冲突。

考虑到有以下代码

  1. #if   (defined ( __CC_ARM ))
  2.   __IO uint32_t VectorTable[48] __attribute__((at(0x20000000)));
  3. #elif (defined (__ICCARM__))
  4. #pragma location = 0x20000000
  5.   __no_init __IO uint32_t VectorTable[48];
  6. #elif defined   (  __GNUC__  )
  7.   __IO uint32_t VectorTable[48] __attribute__((section(".RAMVectorTable")));
  8. #elif defined ( __TASKING__ )
  9.   __IO uint32_t VectorTable[48] __at(0x20000000);
  10. #endif
也就是要将中断向量表VectorTable强制定义在内存0x20000000上,但是此地址与system_stm32f0xx.c定义的全局变量位置有冲突。于是,需要修改避免冲突。中断向量的地址是固定的,但其他全局变量的地址可以相应地移动下,并且APP的烧录位置为0x8003000,如下图:

8468960b5fe30402f2.png
再重新编译就可以了。



 楼主| 51xlf 发表于 2021-6-1 17:33 | 显示全部楼层
参考**:

http://www.stmcu.org.cn/module/forum/forum.php?mod=viewthread&tid=615966&highlight=an4065
您需要登录后才可以回帖 登录 | 注册

本版积分规则

547

主题

9919

帖子

24

粉丝
快速回复 在线客服 返回列表 返回顶部

547

主题

9919

帖子

24

粉丝
快速回复 在线客服 返回列表 返回顶部