贫血打什么针效果最好| 酸辣粉的粉是什么粉| 吃完饭就打嗝是什么原因| 样板间是什么意思| 吃黑豆有什么好处和坏处| 中指麻木是什么原因引起的| 合肥什么时候出梅| 贫血不能吃什么| 不速之客的速是什么意思| 太阳绕着什么转| 什么是褪黑素| 大便发绿色是什么原因| save什么意思| vdr是什么意思| 高铁动车有什么区别| 梦见自己生小孩是什么征兆| 大学体检都检查什么| 92年属猴是什么命| 为什么心会痛| 死心塌地什么意思| 沙悟净的武器叫什么| 肌钙蛋白高说明什么| 明月对什么| 汇字五行属什么| 容易出汗是什么问题| 炸鸡用什么油| 婴儿湿疹不能吃什么| 送向日葵代表什么意思| 年少轻狂下一句是什么| 吃什么排毒| 戒烟有什么好处| 倒睫是什么意思| 流鼻涕吃什么药好得快| 木九十眼镜什么档次| 腰肌劳损是什么症状| 黑舌头的狗是什么狗| 偷梁换柱是什么意思| 肾气不固吃什么中成药| 除颤是什么意思| 老人走之前有什么预兆| svc是什么意思| 浙江有什么特产| 关节炎是什么症状| 虎头蛇尾是什么生肖| 梦见已故母亲预示什么| 反流性食管炎有什么症状| 79年出生属什么生肖| 黄色配什么颜色最搭| 螯合是什么意思| 膝盖疼痛吃什么药| 朝花夕拾什么意思| 苏打和小苏打有什么区别| 为什么经常流鼻血| 感冒发烧能吃什么水果| 7月12日是什么日子| 猴与什么属相相配最好| 什么叫211大学| 脑炎什么症状| 粉领是什么意思| cip是什么| 什么叫肽| 下头是什么意思| 有何特长一般填什么好| 什么的口水| 梦见洗车是什么意思| 乌鸡白凤丸男性吃治疗什么| 冲任失调是什么意思| 汝等是什么意思| 灭吐灵又叫什么名字| 起痱子是什么原因| 七个小矮人分别叫什么| 归来是什么意思| 铁观音是什么茶| 夜宵吃什么不会胖| 小孩一到晚上就发烧是什么原因| 山楂泡酒有什么功效| 镶是什么意思| 玛奇朵是什么意思| 暗财是什么意思| 无创什么时候做| 腿抽筋吃什么钙片好| 大同有什么好吃的| 产妇月子吃什么下奶多| 旗开得胜是什么意思| 控制欲是什么意思| 婴儿拉奶瓣是什么原因| 王安石号什么| 菠萝为什么要用盐水泡| 怀孕做无创是查什么| 寸脉弱是什么原因| 肠胃炎饮食要注意什么| 看乳腺挂什么科| 虎头虎脑是什么生肖| 心电图t波改变是什么意思| 做梦烧纸钱什么意思| 来月经同房有什么影响| 什么是粘胶纤维| 避孕套什么牌子好用又安全| 低密度脂蛋白偏高是什么意思| 粑粑是什么意思| 性格好是什么意思| 建档挂什么科| 口腔溃疡是什么原因| 汲水什么意思| 左肺上叶肺大泡是什么意思| 乳头湿疹用什么药| 亮相是什么意思| 内膜有炎症什么症状| 挂读是什么意思| 6969是什么意思| 避孕环是什么样子图片| 师公是什么意思| 经常手瘾吃什么药| 血尿酸偏高是什么原因| 睡莲什么时候开花| 4月8号什么星座| 肺挂什么科| 吃飞醋是什么意思| 风水宝地是什么意思| 血粘稠吃什么药最好| 派出所什么时候上班| 血小板为0意味着什么| se是什么意思| 妇科臭氧治疗的作用是什么| 黄油可以用什么代替| 无菌敷贴是干什么用的| 生不如死什么意思| 地格是什么意思| 达英35是什么| 手莫名其妙的肿了因为什么| 孜孜不倦是什么意思| 用眼过度用什么眼药水| 凿壁偷光形容什么| 舌苔发白是什么问题| 什么是天丝面料| 四月十五是什么星座| 吃什么东西化痰| 蜂蜜和柠檬一起喝有什么作用| 血小板低是什么病| 我国的国花是什么| 小便失禁是什么原因| 1992年属猴的是什么命| 脂肪肝挂什么科| 胎盘埋在什么地方最好| 心梗做什么检查| 布衣蔬食是什么意思| 你是什么意思| 房间里放什么阳气旺| 闭口粉刺是什么原因引起的| hbcab偏高是什么意思| 水晶是什么材质| 院长是什么级别| 剪舌系带挂什么科| 有头皮屑用什么洗发水| 冰心原名是什么| 检验科是做什么的| 媳妇是什么意思| 铁树是什么生肖| 土鳖是什么意思| 1221是什么星座| 兔子可以吃什么蔬菜| 什么清什么楚| c2驾照可以开什么车| 阿波罗是什么神| 橙色加蓝色是什么颜色| 槟榔肝是由什么引起的| f代表什么| 汉城为什么改名叫首尔| 梦见花蛇是什么预兆| 29是什么生肖| 为什么会出现眼袋| 脑供血不足吃什么中成药好| 艾滋病中期有什么症状| pr医学上什么意思| 贝壳吃什么| 看肾挂什么科| 做梦结婚是什么征兆| 尿酸高看什么科| 石榴花是什么季节开的| 剪刀石头布什么意思| 肾钙化是什么意思| 西米是什么字| 五指毛桃有什么用| 霜降是什么意思| 脚底疼是什么原因引起的| 宝宝半夜咳嗽是什么原因| 脚干脚裂用什么药| 培根是什么肉做的| 心力衰竭吃什么药最好| app是什么缩写| 病毒感染咳嗽吃什么药| 五福临门是什么生肖| 属蛇的人适合佩戴什么| 深蹲有什么好处| 惊弓之鸟告诉我们什么道理| 什么是三宝| 爱放屁是什么原因| 不怀孕是什么原因引起的| 吃饭后肚子疼是什么原因| 歇夏是什么意思| 学无止境是什么意思| 女性看乳房应该挂什么科| 男生适合养什么小型犬| 被子什么材质的好| pd是什么意思| 女人左下腹部疼痛什么原因| 补维生素吃什么药最好| 小猫为什么会踩奶| 阴部痒痒的是什么原因| 肉蒲团是什么意思| 社保跟医保有什么区别| 九月二十四号是什么星座| 合财是什么意思| 头上长了个包挂什么科| 10015是什么电话| 尼日利亚说什么语言| 胸胀疼是什么原因| 吐痰带血丝是什么原因| 什么是包皮过长| 轻微手足口病吃什么药| 夏天适合种植什么蔬菜| 什么什么泪下| 红花有什么功效| 胎盘成熟度1级是什么意思| revive是什么意思| 12月11号是什么星座| jf是什么警察| 卡拉胶是什么| 下面痒是什么原因女性| 什么牌子的蜂胶最好| 5月13日什么星座| 男人练臀桥有什么用| 高职本科是什么意思| 全身发痒是什么原因| 被隐翅虫咬了涂什么药| 1983是什么年| 吃什么补肾| 朝鲜为什么闭关锁国| 鸡蛋炒什么菜好吃| 两个菱形是什么牌子| 有冬瓜西瓜南瓜为什么没有北瓜| 南方有什么水果| 什么叫县级以上的医院| 脑供血不足什么原因引起的| 速度等于什么| 海拔是什么| 充电宝什么品牌好| 病毒感染发烧吃什么药| 为什么会得焦虑症| 冬至穿什么衣服| 厦门为什么叫厦门| cs是什么元素| 龙虾和什么不能一起吃| 属猴男和什么属相最配| 什么血型是万能血型| 1月13日是什么星座| 乳腺化疗期间吃什么| 吉和页念什么| dunk是什么牌子| 吃什么对脾胃有好处| 涤纶是什么| 吃黄瓜有什么好处和坏处| 什么烟危害最小| 氮肥是什么肥| 百度
打印
[STM32H7]

搞事情 小小地球这里有拨动孩子命运开关的力量

[复制链接]
1530|1
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
     STM32H7R7/S7系列是一款基于bootflash的MCU,具有Cortex?-M7内核,运行频率高达600 MHz,拥有64 KB用户bootflash、可灵活配置的620 KB SRAM以及带Flex ECC的32 x 32 KB缓存。STM32H7R7/S7系列支持高速外部存储器接口和XiP,提供5种不同封装,以在极低成本下实现出色性能。专用图形系列可利用NeoChrom GPU、JPEG编解码器和LTDC实现类似MPU的GUI,最大程度减少CPU的介入。
  • Bootflash闪存 STM32H7R7/S7系列MCU配备了64KB的Bootflash(用户Flash),可用于存储用户代码或外部存储器配置。这种设计提供了更大的灵活性和可扩展性。
  • SRAM:MCU还集成了高达620KB的SRAM(其中部分可配置为TCM),支持实时应用中所需的零等待访问。这确保了高速的数据处理能力。
  • 外部存储器接口:MCU提供了高速外部存储器接口,如FMC(支持NAND、NOR、SDRAM的并行接口)和xSPI接口,允许连接任何类型的外部存储器。这种设计使得MCU能够灵活匹配未来不同的应用需求。

Bootflash的MCU具有以下特点:
  • 内置Bootflash存储器:这是Bootflash MCU的核心特色,它提供了可靠的存储空间,用于保存启动代码、配置参数或其他关键数据。这种存储器通常具有较长的数据保持时间,即使在断电的情况下也能保持数据不丢失。
  • 高性能:Bootflash的MCU通常采用高性能的处理器核心,如ARM Cortex-M系列等,具有强大的处理能力和丰富的外设接口。这使得它们能够处理复杂的任务,并满足各种应用需求。
  • 安全性:由于Bootflash存储器中存储了启动代码和其他关键数据,因此Bootflash的MCU通常具有较高的安全性。它们可能采用各种安全机制来保护这些数据,如加密、解密、认证等,以防止未经授权的访问或篡改。
  • 灵活性:Bootflash的MCU提供了灵活的启动选项。例如,它们可能支持从内部存储器(如Bootflash)或外部存储器(如SD卡、eMMC等)启动系统。这种灵活性使得它们能够适应不同的应用场景和需求。
  • 广泛的应用领域:由于Bootflash的MCU具有高性能、安全性和灵活性等特点,它们被广泛应用于各种领域,如工业自动化、智能家居、医疗设备、汽车电子等。在这些领域中,Bootflash的MCU能够发挥重要作用,提高系统的可靠性和稳定性。
   STM32的XIP(eXecute In Place,原地执行)是一种允许代码直接在非易失性存储器(如Flash)中执行的技术,而无需将代码复制到易失性存储器(如SRAM)中。这种执行方式具有一些独特的优点和特性,下面将对其进行详细解释:
一、XIP的基本概念
  XIP技术允许CPU直接从存储代码的存储器(如Flash)中读取并执行指令,而无需先将代码加载到RAM中。这对于资源受限的单片机系统来说尤其重要,因为它可以减少对RAM的需求,从而降低成本并优化系统性能。
二、STM32中的XIP实现
在STM32单片机中,XIP通常通过特定的存储器映射和启动配置来实现。以下是一些关键点:
存储器映射:STM32的存储器架构允许将外部或内部Flash存储器映射到CPU可以访问的地址空间。当使用XIP时,代码被存储在Flash中,并通过存储器映射直接由CPU访问和执行。
启动配置:STM32的启动配置可以通过设置BOOT引脚来选择不同的启动模式。例如,可以选择从主闪存(Flash)启动,或者从系统存储器(通常包含Bootloader)启动。在XIP模式下,通常是从包含代码的Flash区域启动。
中断向量表:在XIP模式下,中断向量表(IVT)通常也存储在Flash中。当CPU响应中断时,它会从IVT中读取中断处理程序的地址,并跳转到相应的处理程序执行。因此,在XIP模式下,IVT的地址必须与Flash中的代码地址相匹配。
三、XIP的优点
减少RAM需求:由于代码直接在Flash中执行,因此无需将代码复制到RAM中。这可以显著减少对RAM的需求,从而降低系统成本。
快速启动:由于代码已经存储在Flash中,并且可以直接执行,因此系统可以更快地启动并运行。
易于更新:由于代码存储在Flash中,因此可以通过简单的编程操作来更新代码,而无需拆卸硬件或更换存储器芯片。
四、XIP的应用场景
XIP技术特别适用于以下场景:
   资源受限的系统:在这些系统中,RAM的容量有限,而Flash存储器则相对充裕。使用XIP可以减少对RAM的需求,从而优化系统性能。
需要快速启动的系统:在这些系统中,启动时间是一个关键因素。使用XIP可以加快启动速度,从而缩短系统的响应时间。
需要频繁更新代码的系统:在这些系统中,代码需要经常更新以修复漏洞或添加新功能。使用XIP可以通过简单的编程操作来更新代码,而无需拆卸硬件。
代码分析:
  STM32CubeH7RS软件包中提供了XIP项目模板,项目专有文件位于子目录。Projects\STM32H7S78-DK\Templates\Template_XIP


项目表述
Templates_XIP Example Description</b>

- This project provides a reference template based on the STM32Cube HAL API that can be used
to build any firmware application to execute from external Flash (Sub-project Appli). It boots from internal Flash
and jumps to the application code in external Flash (Sub-project Boot).
- This project is targeted to run on STM32H7S7xx device on STM32H7S78-DK board from STMicroelectronics.
At the beginning of the main program, the HAL_Init() function is called to reset
all the peripherals and initialize the systick used as 1ms HAL timebase.
- This project runs from the external Flash memory. It is launched from a first boot stage and inherits from this boot project
configuration (caches, MPU regions [regions 0, 1 and 2 here], system clock at 600 MHz and external memory interface at the highest speed).
Note that the boot part is automatically downloaded from the IDE environment via the board project Templates/Template_XIP/Binary/Boot_XIP.hex file.
- The template project calls also SCB_EnableICache() and SCB_EnableDCache() functions in order to enable
the Layer 1 Core Instruction and Data Caches. This is provided as template implementation that the User may
integrate in his application in order to enhance the performance.

#### <b>Notes</b>

1. Care must be taken when using HAL_Delay(), this function provides accurate delay (in milliseconds)
    based on variable incremented in SysTick ISR. This implies that if HAL_Delay() is called from
    a peripheral ISR process, then the SysTick interrupt must have higher priority (numerically lower)
    than the peripheral interrupt. Otherwise the caller ISR process will be blocked.
    To change the SysTick interrupt priority you have to use HAL_NVIC_SetPriority() function.

2. The application needs to ensure that the SysTick time base is always set to 1 millisecond
    to have correct HAL operation.

3. Whenever the application is using ITCM/DTCM memories (@0x0000000 / @0x20000000: not cacheable and only accessible
    by the Cortex M7 and the GPDMA/HPDMA), there is no need for cache maintenance.
    If the application needs to put DMA buffers in AXI SRAM (starting from @0x24000000), the user has to:
    - either define a non-cacheable region in the MPU and linker configuration file to locate DMA buffers
      (a proposed noncacheable_buffer section is available from CMSIS Device linker template file and its size must
      be adapted to the application requirements)
    - or to ensure cache maintenance operations to ensure the cache coherence between the CPU and the DMAs.
    This is true also for any other data buffers accessed by the CPU and other masters (DMA2D, LTDC).
    The addresses and the size of cacheable buffers (shared between CPU and other masters)
    must be properly defined to be aligned to data cache line size (32 bytes) and of a size of being multiple
    of this cache line size.
    Please refer to the AN4838 "Managing memory protection unit (MPU) in STM32 MCUs".
    Please refer to the AN4839 "Level 1 cache on STM32F7 Series".

### <b>Keywords</b>

Reference, Template, Boot, Loader, XiP

### <b>Directory contents</b>

#### <b>Sub-project Boot</b>

File | Description
--- | ---
  Templates/Template_XIP/Boot/Inc/main.h                       |  Header for main.c module
  Templates/Template_XIP/Boot/Inc/extmem_manager.h             |  Header for extmem_manager.c module
  Templates/Template_XIP/Boot/Inc/stm32h7rsxx_hal_conf.h       |  HAL Configuration file
  Templates/Template_XIP/Boot/Inc/stm32h7rsxx_it.h             |  Interrupt handlers header file
  Templates/Template_XIP/Boot/Inc/stm32h7s78_discovery_conf.h  |  BSP Configuration file
  Templates/Template_XIP/Boot/Inc/stm32_extmem_conf.h          |  External memory manager Configuration file
  Templates/Template_XIP/Boot/Src/main.c                       |  Main program
  Templates/Template_XIP/Boot/Src/extmem_manager.c             |  code to initialize external memory
  Templates/Template_XIP/Boot/Src/stm32h7rsxx_hal_msp.c        |  HAL MSP module
  Templates/Template_XIP/Boot/Src/stm32h7rsxx_it.c             |  Interrupt handlers
  Templates/Template_XIP/Boot/Src/system_stm32h7rsxx.c         |  STM32H7RSxx system source file

#### <b>Sub-project Appli</b>

File | Description
--- | ---
  Templates/Template_XIP/Appli/Inc/main.h                      |  Header for main.c module
  Templates/Template_XIP/Appli/Inc/stm32h7rsxx_hal_conf.h      |  HAL Configuration file
  Templates/Template_XIP/Appli/Inc/stm32h7rsxx_it.h            |  Interrupt handlers header file
  Templates/Template_XIP/Appli/Inc/stm32h7s78_discovery_conf.h |  BSP Configuration file
  Templates/Template_XIP/Appli/Src/main.c                      |  Main program
  Templates/Template_XIP/Appli/Src/stm32h7rsxx_hal_msp.c       |  HAL MSP module
  Templates/Template_XIP/Appli/Src/stm32h7rsxx_it.c            |  Interrupt handlers
  Templates/Template_XIP/Appli/Src/system_stm32h7rsxx.c        |  STM32H7RSxx system source file

#### <b>Sub-project ExtMemLoader</b>

File | Description
--- | ---
  Templates/Template_XIP/ExtMemLoader/Inc/extmem_manager.h             |  Header for extmem_manager.c module
  Templates/Template_XIP/ExtMemLoader/Inc/extmemloader_init.h          |  Header for system initialization
  Templates/Template_XIP/ExtMemLoader/Inc/stm32_extmem_conf.h          |  External memory manager Configuration file
  Templates/Template_XIP/ExtMemLoader/Inc/stm32_extmemloader_conf.h    |  Header with externam memory device information
  Templates/Template_XIP/ExtMemLoader/Inc/stm32h7rsxx_hal_conf.h       |  HAL Configuration file
  Templates/Template_XIP/ExtMemLoader/Src/extmem_manager.c             |  code to initialize external memory
  Templates/Template_XIP/ExtMemLoader/Src/extmemloader_init.c          |  code to perform system initialization
  Templates/Template_XIP/ExtMemLoader/Src/stm32h7rsxx_hal_msp.c        |  HAL MSP module
  Templates/Template_XIP/ExtMemLoader/Src/system_stm32h7rsxx.c         |  STM32H7RSxx system source file
  Templates/Template_XIP/ExtMemLoader/Config/extmemloader.board        |  Configuration file
  Templates/Template_XIP/ExtMemLoader/Config/extmemloader.flash        |  Configuration file
  Templates/Template_XIP/ExtMemLoader/Config/extmemloader.mac          |  Configuration file

### <b>Hardware and Software environment</b>

  - This template runs on STM32H7S7xx devices.

  - This template has been tested with STMicroelectronics STM32H7S78-DK
    boards and can be easily tailored to any other supported device
    and development board.

  - On STM32H7S78-DK board, the BOOT0 mechanical slide switch must be set to SW1.

  - User Option Bytes requirement (with STM32CubeProgrammer tool):

    - XSPI1_HSLV=1     I/O XSPIM_P1 High speed option enabled
    - XSPI2_HSLV=1     I/O XSPIM_P2 High speed option enabled
    - VDDIO_HSLV=0     I/O speed optimized to operate at 3.3V

### <b>How to use it ?</b>

In order to make the program work, you must do the following:

#### <b>IAR</b>
  1. Open your toolchain
  2. Open Multi-projects workspace file Project.eww

> <b>Optional:</b>
>
> - Select first "Template_XIP_Boot" workspace
> - Rebuild all files from sub-project Boot
> - If no modification is done on boot project, this step could be skipped.

  3. Select then "Template_XIP_Appli" workspace
  4. Rebuild all files from sub-project Appli and load your images into memories: This sub-project
     will first load the Appli part in External memory available on STM32H7S78-DK board, then load
     the Template_XIP_Boot.hex in internal Flash.
  5. Run the example

NB: For this target, following switches are set in C/C++ preprocessor settings:

- STM32_EXTMEMLOADER_EWARMTARGET
- STM32_EXTMEMLOADER_STM32CUBETARGET_NA
- STM32_EXTMEMLOADER_STM32CUBEOPENBLTARGET_NA

#### <b>MDK-ARM</b>
  1. Open your toolchain
  2. Open Multi-projects workspace file Project.uvmpw

> <b>Optional:</b>
>
> - Select first "Template_XIP_Boot" workspace
> - Rebuild all files from sub-project Boot
> - If no modification is done on boot project, this step could be skipped.

  3. Select then "Template_XIP_Appli" workspace
  4. Rebuild all files from sub-project Appli and load your images into memories: This sub-project
     will first load the Appli part in External memory available on STM32H7S78-DK board, then load
     the Boot_XIP.hex in internal Flash.
  5. Run the example

NB: For this target, following switches are set in C/C++
preprocessor settings:

- STM32_EXTMEMLOADER_MDKARMTARGET
- STM32_EXTMEMLOADER_STM32CUBETARGET_NA
- STM32_EXTMEMLOADER_STM32CUBEOPENBLTARGET_NA

#### <b>STM32CubeIDE</b>
  1. Open your toolchain
  2. Open Multi-projects workspace file .project

> <b>Optional:</b>
>
> - Select the "Template_XIP_Boot" project
> - Build the project
> - If the project is not compiled, Appli debugging will manage its compilation
>   for debugging
> - With the debug icon select the configuration “Template_XIP_Boot Debug”.
>   This operation loads the boot in internal Flash.

  3. Select the "Template_XIP_Appli" project
  4. Build the project
  5. With the Debug icon select the configuration “Template_XIP_Appli Debug”. This sub-project
     will first load the Boot binary in internal Flash, then load the Appli binary in
     External memory available on STM32H7S78-DK board
  6. Run the example


#### <b>STM32CubeProgrammer</b>

> The ExtMemLoader project uses an environment variable to copy the generated stdlr file inside
> the cube programmer tool.
> This variable is defined by the tool during its installation but if the version used does not
> include this functionality, the environment variable can be declared manually.
>
> STM32_PRG_PATH=C:/Program Files/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin

When targeting to build ExtMemLoader to be used in Cubepogrammer, please ensure the following switches are set in C/C++ preprocessor settings:

- STM32_EXTMEMLOADER_EWARMTARGET_NA
- STM32_EXTMEMLOADER_STM32CUBETARGET
- STM32_EXTMEMLOADER_STM32CUBEOPENBLTARGET_NA


#### <b>External memory programming using BootLoader Interfaces</b>

> When using a bootloader interface such as USB or USART, the standard ExtMemLoader cannot be used.
>Instead, a specific ExtMemLoader must be built for use with OpenBootloader. To accomplish this, you should carry out the following steps:
>
>- Modify the target switches in the C/C++ preprocessor settings to:
>
>   - STM32_EXTMEMLOADER_EWARMTARGET_NA
>   - STM32_EXTMEMLOADER_STM32CUBETARGET
>   - STM32_EXTMEMLOADER_STM32CUBEOPENBLTARGET
>- Choose the appropriate file for your linker script based on the file extension (.sct, .ld, or .icf). The file should be renamed to match the following pattern, depending on the extension:
>   * stm32h7rsxx_extmemloader_stm32cubeopenbl.sct
>   * stm32h7rsxx_extmemloader_stm32cubeopenbl.ld
>   * stm32h7rsxx_extmemloader_stm32cubeopenbl.icf
>- The initialization section of extmemloader_init() should be updated as follows:
>
>      #if !defined(STM32_EXTMEMLOADER_STM32CUBEOPENBLTARGET)
>
>      /* Init system */
>      SystemInit();
>
>      /* disable all the IRQ */
>
>      __disable_irq();
>
>      /* MCU Configuration--------------------------------------------------------*/
>
>      /* Enable the CPU Cache */
>
>      /* Enable I-Cache---------------------------------------------------------*/
>
>      SCB_EnableICache();
>
>      /* Enable D-Cache---------------------------------------------------------*/
>
>      SCB_EnableDCache();
>
>      /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
>
>      HAL_Init();
>
>      /* USER CODE BEGIN Init */
>
>      /* USER CODE END Init */
>
>      /* Configure the system clock  */
>
>      SystemClock_Config();
>
>      #else
>      /* Reset of all peripherals, Initializes the Flash interface. */
>
>      __HAL_RCC_SBS_CLK_ENABLE();
>
>      /* System interrupt init*/
>
>      /* Enable the XSPIM_P2 interface */
>
>      HAL_PWREx_EnableXSPIM2();
>
>      /* high speed low voltage config */
>
>      HAL_SBS_EnableIOSpeedOptimize(SBS_IO_XSPI1_HSLV);
>
>      HAL_SBS_EnableIOSpeedOptimize(SBS_IO_XSPI2_HSLV);
>
>      #endif
本项目提供了一个基于 STM32Cube HAL API 的参考模板,可用于构建任何固件应用程序以从外部闪存执行(子项目应用程序)。它从内部 Flash 启动,并跳转到外部 Flash 中的应用程序代码(子项目启动)。 本项目提供了一个基于 STM32Cube HAL API 的参考模板,可用于构建任何固件应用程序以从外部闪存执行(子项目应用程序)。它从内部 Flash 启动,并跳转到外部 Flash 中的应用程序代码(子项目启动)。

该项目的目标是在 STMicroelectronics 的 STM32H7S78-DK 板上的 STM32H7S7xx 器件上运行。在主程序开始时,调用 HAL_Init() 函数来重置所有外围设备并初始化用作 1ms HAL 时基的系统。 该项目的目标是在 STMicroelectronics 的 STM32H7S78-DK 板上的 STM32H7S7xx 器件上运行。在主程序开始时,调用 HAL_Init() 函数来重置所有外围设备并初始化用作 1ms HAL 时基的系统。

此项目从外部 Flash 存储器运行。它从第一个引导阶段启动,并继承自此引导项目配置(缓存、MPU 区域 [此处为区域 0、1 和 2]、600 MHz 的系统时钟和最高速度的外部存储器接口)。请注意,引导部件是通过板项目 Templates/Template_XIP/Binary/Boot_XIP.hex 文件从 IDE 环境自动下载的。 此项目从外部 Flash 存储器运行。它从第一个引导阶段启动,并继承自此引导项目配置(缓存、MPU 区域 [此处为区域 0、1 和 2]、600 MHz 的系统时钟和最高速度的外部存储器接口)。请注意,引导部件是通过板项目 Templates/Template_XIP/Binary/Boot_XIP.hex 文件从 IDE 环境自动下载的。

模板项目还调用 SCB_EnableICache() 和 SCB_EnableDCache() 函数,以启用第 1 层内核指令和数据缓存。这是作为模板实现提供的,用户可以将其集成到其应用程序中以提高性能。 模板项目还调用 SCB_EnableICache() 和 SCB_EnableDCache() 函数,以启用第 1 层内核指令和数据缓存。这是作为模板实现提供的,用户可以将其集成到其应用程序中以提高性能。

Notes 注意
使用 HAL_Delay() 时必须小心,此函数根据 SysTick ISR 中递增的变量提供准确的延迟(以毫秒为单位)。这意味着,如果 HAL_Delay() 是从外围 ISR 进程调用的,则 SysTick 中断必须具有比外围中断更高的优先级(数值上更低)。否则,调用方 ISR 进程将被阻止。要更改 SysTick 中断优先级,您必须使用 HAL_NVIC_SetPriority() 函数。 使用 HAL_Delay() 时必须小心,此函数根据 SysTick ISR 中递增的变量提供准确的延迟(以毫秒为单位)。这意味着,如果 HAL_Delay() 是从外围 ISR 进程调用的,则 SysTick 中断必须具有比外围中断更高的优先级(数值上更低)。否则,调用方 ISR 进程将被阻止。要更改 SysTick 中断优先级,您必须使用 HAL_NVIC_SetPriority() 函数。
应用程序需要确保 SysTick 时基始终设置为 1 毫秒,才能执行正确的 HAL 操作。 应用程序需要确保 SysTick 时基始终设置为 1 毫秒,才能执行正确的 HAL 操作。
每当应用程序使用 ITCM/DTCM 内存(@0x0000000 / @0x20000000:不可缓存,只能由 Cortex M7 和 GPDMA/HPDMA 访问)时,就不需要缓存维护。如果应用程序需要将 DMA 缓冲区放入 AXI SRAM 中(从 @0x24000000 开始),用户必须: 每当应用程序使用 ITCM/DTCM 内存(@0x0000000 / @0x20000000:不可缓存,只能由 Cortex M7 和 GPDMA/HPDMA 访问)时,无需缓存维护。如果应用程序需要将 DMA 缓冲区放入 AXI SRAM 中(从 @0x24000000 开始),用户必须:
在 MPU 和链接器配置文件中定义不可缓存区域以查找 DMA 缓冲区(CMSIS 设备链接器模板文件中提供了建议的 noncacheable_buffer 部分,其大小必须适应应用程序要求) 在 MPU 和链接器配置文件中定义不可缓存区域以查找 DMA 缓冲区(CMSIS 设备链接器模板文件中提供了建议的 noncacheable_buffer 部分,其大小必须适应应用程序要求)
或确保缓存维护操作,以确保 CPU 和 DMA 之间的缓存一致性。这也适用于 CPU 和其他主站(DMA2D、LTDC)访问的任何其他数据缓冲区。地址和可缓存缓冲区的大小(在 CPU 和其他 masters之间共享)必须正确定义,以便与数据缓存行大小(32 字节)保持一致,并且大小是此缓存行大小的倍数。请参阅 AN4838“在 STM32 MCU 中管理内存保护单元 (MPU)”。请参阅 AN4839 “STM32F7 系列上的 1 级缓存”。 或确保缓存维护操作,以确保 CPU 和 DMA 之间的缓存一致性。这也适用于 CPU 和其他主站(DMA2D、LTDC)访问的任何其他数据缓冲区。地址和可缓存缓冲区的大小(在 CPU 和其他 masters之间共享)必须正确定义,以便与数据缓存行大小(32 字节)保持一致,并且大小是此缓存行大小的倍数。请参阅 AN4838“在 STM32 MCU 中管理内存保护单元 (MPU)”。请参阅 AN4839 “STM32F7 系列上的 1 级缓存”。
针对核心代码:
void MX_EXTMEM_MANAGER_Init(void)
{

  /* USER CODE BEGIN MX_EXTMEM_Init_PreTreatment */

  /* USER CODE END MX_EXTMEM_Init_PreTreatment */
  HAL_RCCEx_DisableClockProtection(RCC_CLOCKPROTECT_XSPI);

  /* Initialization of the memory parameters */
  memset(extmem_list_config, 0x0, sizeof(extmem_list_config));

  /* EXTMEMORY_1 */
  extmem_list_config[0].MemType = EXTMEM_NOR_SFDP;
  extmem_list_config[0].Handle = (void*)&hxspi2;
  extmem_list_config[0].ConfigType = EXTMEM_LINK_CONFIG_8LINES;

  EXTMEM_Init(EXTMEMORY_1, HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_XSPI2));

  /* USER CODE BEGIN MX_EXTMEM_Init_PostTreatment */

  /* USER CODE END MX_EXTMEM_Init_PostTreatment */
}




BootROM 模型基于从选定的易失性存储器中执行代码。当二进制数据存储在非内存映射模式的存储器(比SDCARD)中时,该执行模型非常适合。当二进制数据存储在低吞吐量的存储器(比如 SPI-NOR(使用单线 QSPI进行仿真))中时,此模型也适用。外部存储器启动应用程序基于 memory.h 文件中的用户配置对下列其中两个易失存储器进行配置:SDRAM、SRAM、PSRAM 或内部 SRAM。在该模型中,二进制数据从一个非易失性存储器复制到一个易失性存储器,然后由外部存储器启动应用程序执行。第二个易失性存储器用于数据。
下面的流程图说明了 BootROM 模型的操作流程:






附件文件为原理详细解读,会用即可,原理理解需要假以时日。
外部代码执行原理.pdf (1.32 MB)



沙发
星辰大海不退缩| | 2024-10-8 22:19 | 只看该作者
MCU还集成了高达620KB的SRAM
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

认证:项目经理
简介:资深嵌入式开发工程师

95

主题

181

帖子

3

粉丝
父亲节送爸爸什么礼物 蚕豆病是什么病有什么症状 孩子说话晚是什么原因是什么情况 不服气是什么意思 脑脊液白细胞高是什么原因
双肺纹理增强是什么意思 木耳菜又叫什么菜 随遇而安是什么生肖 草字头下面一个高字读什么 我想知道为什么
大便失禁吃什么药 瘦肉炒什么好吃 实体店是什么意思 营养师属于什么专业 下面潮湿是什么原因引起的
给花施肥用什么肥料 今天是什么节气 路人皆知的上一句歇后语是什么 两仪是什么意思 事业有成是什么意思
什么什么害命hcv8jop3ns7r.cn 姓兰的是什么民族hcv7jop5ns5r.cn 儿童水杯什么材质好hcv7jop6ns4r.cn 高中什么时候分文理科96micro.com 男人地盘是什么生肖hcv7jop9ns3r.cn
维生素e和维生素c一起吃有什么效果hcv8jop2ns2r.cn msv是什么单位hlguo.com 甲亢是一种什么病hcv8jop3ns0r.cn 嘴唇发红是什么原因hcv9jop7ns0r.cn 补气血用什么泡水喝zhongyiyatai.com
鸡精吃多了有什么危害aiwuzhiyu.com bae什么意思hcv8jop1ns0r.cn 舟可是什么字hcv8jop5ns0r.cn 洗头什么时间洗最好hcv8jop1ns3r.cn 子宫内膜薄是什么原因hcv8jop8ns4r.cn
干咳吃什么药最有效hcv8jop4ns7r.cn 生殖感染用什么消炎药效果好hcv9jop3ns1r.cn 美人鱼是什么动物zsyouku.com 阑尾炎打什么消炎针好hcv7jop9ns5r.cn 甲状腺结节有什么感觉hcv8jop4ns8r.cn
百度