硬汉嵌入式论坛

 找回密码
 立即注册
查看: 240|回复: 1
收起左侧

[STM32H7] ITCM使用方法请教

[复制链接]

6

主题

16

回帖

34

积分

新手上路

积分
34
发表于 7 天前 | 显示全部楼层 |阅读模式
论坛大神么


STM32H7系列芯片,想将部分代码放到ITCM中执行。修改了分散加载文件如下:
[C] 纯文本查看 复制代码
; *************************************************************

; *************************************************************
; *** Scatter-Loading Description File generated by uVision ***
; *************************************************************

LR_IROM1 0x08020000 0x001E0000          ; load region size_region
{
  ER_IROM1 0x08020000 0x001E0000  {  ; load address = execution address
   *.o (RESET, +First)
   *(InRoot$$Sections)
   .ANY (+RO)
   .ANY (+XO)
  }
  
  ; backup_buffer_section
  RW_STL_TM_RAM 0x20000000 0x20  {  ; place STL RAM TM backup buffer outside tested subsets (i.e. beginning of the RAM)
   *(backup_buffer_section)
  }
  
  ; 128KB DTCM
  DTCM_RAM 0x20000020 0x1FFE0  {  ; place STL RAM TM backup buffer outside tested subsets (i.e. beginning of the RAM)
   *(.dtcm_data*)    ; 匹配.dtcm_data开头的自定义段
   .ANY (+RW +ZI)
  }
  
  ; 64KB ITCM
  ITCM_ROM 0x00000000 0x00010000 {
        *(.itcm_code*)    ; 匹配.itcm_code开头的自定义段
  }
  

  RW_STL_CPU_TM12 0x24000020 0x20  {  ; place STL CPU TM12 data in DCache Set n? relative cacheable RAM area
   *(stl_cpu_tm12_section)
  }
  
  ; 512KB AXI SRAM
  AXI_SRAM 0x24000040 0x7FFC0  {
   .ANY (+RW +ZI)
  }
  
  ; 288KB SRAM1+SRAM2+SRAM3
  ;RW_IRAM3 0x30000000 0x00048000  {
  ; *(.RAM_D2)
  ;}
  
  ; 64KB SRAM4
  ;RW_IRAM4 0x38000000 0x00010000  {
  ; *(.RAM_D3)
  ;}
}


然后在代码中使用:
__attribute__((section(".itcm_code"))) void RingBufferInit(void)将RingBufferInit函数放在ITCM中。
想请问一下通过查看.map文件是否生效检索到如下字段:

Adding Veneers to the image

    Adding TT veneer (10 bytes, Long) for call to '__2printf' from ringbuffer.o(.itcm_code).
    Adding TT veneer (10 bytes, Long) for call to 'RingBufferInit' from init.o(.text).

2 Veneer(s) (total 20 bytes) added to the image.
123.png

为什么会是从1开始,不应该从0么?
回复

使用道具 举报

1万

主题

7万

回帖

11万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
115653
QQ
发表于 7 天前 | 显示全部楼层
函数跳转地址的最低位用于指示 Thumb 状态和ARM状态,但 Cortex-M 系列 仅支持 Thumb/Thumb-2 指令集。因此,使用M内核,函数指针的跳转地址必须强制设置最低位为 1,即使原始值不是 1,也要手动或自动调整
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2025-5-9 21:34 , Processed in 0.255650 second(s), 28 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表