罗德林 发表于 2024-4-4 15:50:31

STM32U5如何把数据保存到SRAM2中

stm32u575xx可以在StandBy模式下保留SRAM2,那我应该如何把数据保留在SRAM2呢?直接使用绝对地址吗?或者有更优雅的形式?

lugl 发表于 2024-4-6 15:50:32

stm32U5有MPU,你需要配置一下MPU,这样才能正常的运行。

xmshao 发表于 2024-4-7 12:08:24

这个不同IDE写法稍有不同,给些参考写法:

ARM MDK:

uint32_t myArray   __attribute((section(".sram2)));

IAR:

#pragma location ="sram2"

uint32_t myArray;

STM32CubeIDE:

uint32_t myArray__attribute((section(".sram2)));

另外,保证链接脚本里有相关内存定义。

罗德林 发表于 2024-4-8 16:24:06

lugl 发表于 2024-4-6 15:50
stm32U5有MPU,你需要配置一下MPU,这样才能正常的运行。


多谢老哥
页: [1]
查看完整版本: STM32U5如何把数据保存到SRAM2中