在STM32 CubeIDE的项目中,我将一些存储区域分配到STM32H743ZITX_RAM.ld文件中定义的不同内存区域。
MEMORY{ DTCMRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K RAM_D1 (xrw) : ORIGIN = 0x24000000, LENGTH = 512K RAM_D3 (xrw) : ORIGIN = 0x38000000, LENGTH = 64K FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 2048K} /* Sections */SECTIONS/* snip .. */ .myD3memory (NOLOAD): { . = ALIGN(4); *(.myD3memory) . = ALIGN(4); } >RAM_D3/* etc .. */}然后我可以在main()中使用它,如下所示: uint16_t buffer16[32768] __attribute__ ((section(".myD3memory")));正Build Analyzer正确分配。但我想引用内存区域不是16位无符号短,而且是8位无符号字节,并尝试了以下方法: union{ uint8_t buffer8[65536] __attribute__ ((section(".myD3memory"))); uint16_t buffer16[32768] __attribute__ ((section(".myD3memory")));}产生错误: ../Core/Src/main.c: error: section attribute not allowed for 'buffer8' uint8_t buffer8[65536] __attribute__ ((section(".myD3memory"))); ../Core/Src/main.c: error: section attribute not allowed for 'buffer16' uint16_t buffer16[32768] __attribute__ ((section(".myD3memory"))); 请教如何解决
|