TC397 LMURAM 使用

参考 RAM and ROM user sections - Infineon Developer Community

TC397用户自己能用的RAM:

  • DSRAM0: 240KB, Base: 0x70000000, End: 0x7003BFFF
  • DSRAM1: 240KB, Base: 0x60000000, End: 0x6003BFFF
  • DSRAM2: 96KB, Base: 0x50000000, End: 0x50017FFF
  • DSRAM3: 96KB, Base: 0x40000000, End: 0x40017FFF
  • DSRAM4: 96KB, Base: 0x30000000, End: 0x30017FFF
  • DSRAM5: 96KB, Base: 0x10000000, End: 0x10017FFF
  • LMURAM: 768KB, Base: 0x90040000, End: 0x900FFFFF

跑算法模型的时候, 通常会有特别大的数组或结构体, TC397的DSRAM经常不够用, 如

#include <stdint.h>
volatile uint8_t daisyChain_1_activeBank[1024*300];

编译就会报错

ltc E112: cannot locate 2 section(s):
cctc -lrt -lfp_fpu -lcs_fpu  -Wl-Oc -Wl-OL -Wl-Ot -Wl-Ox -Wl-Oy -Wl--map-file="lmu_test.map" ...
ltc I455:   requirement: 300K (0x4b004) bytes of RAM area in space mpe:vtc:linear
ltc I456:   section type: range restriction - range(s) 0x70000000-0x7003c000
ltc I456:   section type: group restriction - ordered
ltc I457:   .data.Cpu0_Main.g_cpuSyncEvent (16421) (0x4 bytes)
ltc I457:   .bss.Cpu0_Main.daisyChain_1_activeBank (16422) (0x4b000 bytes)
make: *** [makefile:78: lmu_test.elf] Error 1

如图

在这里插入图片描述

可以用 __attribute__((section (".data.lmudata"))) 指定到 LMURAM里面, 如

#include <stdint.h>
volatile __attribute__((section (".data.lmudata"))) uint8_t daisyChain_1_activeBank[1024*300];  //300KB
uint32_t __attribute__((section (".data.lmudata"))) daisyChain_1_cmd[0x100];    //0x100*4 B
uint8_t __attribute__((section (".data.lmudata"))) daisyChain_2_cmd[1024*400];  //400KB

这样编译就不会报错了, 在MAP文件中可以看到分配到了LMU里面

在这里插入图片描述

编译出来HEX大概 20000多行. 当然很多 :02000004 都是0, 说明编译器处于一个有点懵的状态

还有一种手动分配地址的方法

volatile __at(0x90040400) uint8_t daisyChain_1_activeBank[1024*300];  //300KB
uint32_t __at(0x90000000) daisyChain_1_cmd[0x100];    //0x100*4 B
uint8_t __at(0x9008b400) daisyChain_2_cmd[1024*400];  //400KB

编译出来HEX文件 500 多行. 但具体能不能跑起来没有测试.

具体使用哪种方法, 还要看实际效果, 特别是做Boot+APP的时候, 更要注意实际运行一下看程序到底能不能正常运行, 也有可能两种方法都不对.

欢迎扫描二维码关注微信公众号, 及时获取最新文章:
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值