bluehhn 发表于 2019-7-31 00:38:49

warning: 'at' attribute directive ignored

用STM32CUBEIDE开发时在使用attribute at 属性时,编译提示warning: 'at' attribute directive ignored,各位大佬怎么解决???

wenyangzeng 发表于 2019-7-31 09:48:06

变量不应该分配在flash段,
buff[]分配的那个绝对地址出错(0x10001000)。
楼主其实不用给数组分配绝对地址,让编译器自己分配就可以了。
看看内存映像0x10001000的位置吧,0x08080000-0x1fffefff是保留区:


songshiqun2010 发表于 2019-7-31 08:39:43

看看下面这段代码

#if defined ( __ICCARM__ ) /*!< IAR Compiler */

#pragma location=0x30040000
ETH_DMADescTypeDefDMARxDscrTab; /* Ethernet Rx DMA Descriptors */
#pragma location=0x30040060
ETH_DMADescTypeDefDMATxDscrTab; /* Ethernet Tx DMA Descriptors */
#pragma location=0x30040200
uint8_t Rx_Buff; /* Ethernet Receive Buffers */

#elif defined ( __CC_ARM )/* MDK ARM Compiler */

__attribute__((at(0x30040000))) ETH_DMADescTypeDefDMARxDscrTab; /* Ethernet Rx DMA Descriptors */
__attribute__((at(0x30040060))) ETH_DMADescTypeDefDMATxDscrTab; /* Ethernet Tx DMA Descriptors */
__attribute__((at(0x30040200))) uint8_t Rx_Buff; /* Ethernet Receive Buffer */

#elif defined ( __GNUC__ ) /* GNU Compiler */

ETH_DMADescTypeDef DMARxDscrTab __attribute__((section(".RxDecripSection"))); /* Ethernet Rx DMA Descriptors */
ETH_DMADescTypeDef DMATxDscrTab __attribute__((section(".TxDecripSection")));   /* Ethernet Tx DMA Descriptors */
uint8_t Rx_Buff __attribute__((section(".RxArraySection"))); /* Ethernet Receive Buffers */

#endif

不同编译器,分散加载使用的关键字有区别的吧?

bluehhn 发表于 2019-8-1 15:40:51

我的那个截图只是一个示例,实际情况是用fmc外扩sdram做为显存,将存储显示数据的数组定位到sdram中的时候报的这个警告。然后看了一下stm32cubeide里面的C语言编译器的文档,确实没有at这个属性,看了下要用section这个属性,然后把链接脚本改一下就ok了。
页: [1]
查看完整版本: warning: 'at' attribute directive ignored