|
本帖最后由 zhaoqi 于 2019-12-18 00:32 编辑
前言
------------------
STM32H750 系列官方宣传为 128K, 而且后续的 "V" 版本将频率提高到 480M , FLASH 回到 128K, 所以后续将只能使用 QSPI, 程序烧写到 32M 的 W25Q256 中。
烧写算法的使用
------------------
J-FLASH
在 JLINK 软件的安装目录下, 找到 Devices/ST , 将附件中的 STM32H743_H7-TOOLS.FLM 放到此目录中。如下图所示:
<Device>
<ChipInfo Vendor="ST" Name="STM32H743XI_H7-TOOLS" WorkRAMAddr="0x24000000" WorkRAMSize="0x80000"Core="JLINK_CORE_CORTEX_M7" />
<FlashBankInfo Name="QSPI Flash" BaseAddr="0x90000000" MaxSize="0x01000000" Loader="Devices/ST/STM32H743_H7-TOOLS.FLM" LoaderType="FLASH_ALGO_TYPE_OPEN" />
</Device>
将上面的 xml 片段加入到 JLinkDevices.xml 中,让 JLink 可以找到烧写算法。然后打开 J-Flash , 新建工程, 找到 STM32H743XI_H7-TOOLS
至此, 烧写算法就成功的添加到了 JLink , 可以在 JFlash、GDBServer 中成功识别。
类似的,JLink 的使用是跨平台的,经测试,此烧写算法可以在 MACOS (14.2)、Linux(Ubuntu16.04、Deepin(15.11))、上使用。
KEIL
在 github 上的代码中,修改
- #define INTERNAL_FALSH ((uint32_t)0x08000000)
- #define QSPI_FLASH ((uint32_t)0x90000000)
- /*
- *********************************************************************************************************
- * 函 数 名: main
- * 功能说明: c程序入口
- * 形 参:无
- * 返 回 值: 错误代码(无需处理)
- *********************************************************************************************************
- */
- int main(void)
- {
- if( (uint32_t )&main >= QSPI_FLASH) {
- SCB->VTOR = QSPI_FLASH;
- } else {
- SCB->VTOR = INTERNAL_FALSH;
- }
复制代码- // bsp_InitQSPI_W25Q256(); /* 初始化QSPI */
复制代码
需要注意的是,当前的方式不能操作 W25Q256 , 需要将其操作 W25Q256 的函数加载到 RAM 中,使其在 RAM 操作W25Q256,这一操作应该是可行的,将在后续支持。
修改 Flash->Configure Flash Tools ->Target ,将 IROM1 设置为:
Start: 0x90000000
Size: 0x200000
修改sct文件:
- ; *************************************************************
- ; *** Scatter-Loading Description File generated by uVision ***
- ; *************************************************************
- LR_IROM1 0x90000000 0x001E0000 { ; load region size_region
- ER_IROM1 0x90000000 0x001E0000 { ; load address = execution address
- *.o (RESET, +First)
- *(InRoot$Sections)
- .ANY (+RO)
- }
- RW_IRAM2 0x24000000 0x00080000 { ; RW data
- .ANY (+RW +ZI)
- }
-
- RW_DMARxDscrTab 0x30040000 0x60 {
- *(.RxDecripSection)
- }
- RW_DMATxDscrTab 0x30040060 0x140 {
- *(.TxDecripSection)
- }
- RW_Rx_Buffb 0x30040200 0x1800 {
- *(.RxArraySection)
- }
-
- ; RW_IRAM1 0x20000000 0x00020000 { ; RW data - 128KB DTCM
- ; .ANY (+RW +ZI)
- ; }
- ;
- ; RW_IRAM2 0x24000000 0x00080000 { ; RW data - 512KB AXI SRAM
- ; *(.RAM_D1)
- ; }
- ;
- ; RW_IRAM3 0x30000000 0x00048000 { ; RW data - 128KB SRAM1(0x30000000) + 128KB SRAM2(0x3002 0000) + 32KB SRAM3(0x30040000)
- ; *(.RAM_D2)
- ; }
- ;
- ; RW_IRAM4 0x38000000 0x00010000 { ; RW data - 64KB SRAM4(0x38000000)
- ; *(.RAM_D3)
- ; }
- }
复制代码
修改 JLink 设置
烧录bootloader,附件中提供了一个bootloader,请将其烧录到 0x08000000。
至此,就可以在 Keil中,对QSPI中的程序在线调试了。下图为调试效果。
SES
SES 请自行下载,首先导入一个完整的工程,然后进行如下设置:
完成上述的设置后,进入debug。
eclipse
在 eclipse 上调试,需要安装 SEGGER 的插件,如下图所示:
这部分请自行搜索安装解决。也可以使用打包好的 eclipse 环境,下载地址在文章末尾给出。
具体设置如下图所示:
调试效果:
ld文件:
- /*
- *****************************************************************************
- **
- ** File : LinkerScript.ld
- **
- ** Abstract : Linker script for STM32H743XIHx Device with
- ** 2048KByte FLASH, 128KByte RAM
- **
- ** Set heap size, stack size and stack location according
- ** to application requirements.
- **
- ** Set memory bank area and size if external memory is used.
- **
- ** Target : STMicroelectronics STM32
- **
- **
- ** Distribution: The file is distributed as is, without any warranty
- ** of any kind.
- **
- ** (c)Copyright Ac6.
- ** You may use this file as-is or modify it according to the needs of your
- ** project. Distribution of this file (unmodified or modified) is not
- ** permitted. Ac6 permit registered System Workbench for MCU users the
- ** rights to distribute the assembled, compiled & linked contents of this
- ** file as part of an application binary file, provided that it is built
- ** using the System Workbench for MCU toolchain.
- **
- *****************************************************************************
- */
- /* Entry Point */
- ENTRY(Reset_Handler)
- /* Highest address of the user mode stack */
- _estack = 0x24080000; /* end of RAM */
- /* Generate a link error if heap and stack don't fit into RAM */
- _Min_Heap_Size = 0x400; /* required amount of heap */
- _Min_Stack_Size = 0x800; /* required amount of stack */
- /* Specify the memory areas */
- MEMORY
- {
- DTCMRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
- RAM_D1 (xrw) : ORIGIN = 0x24000000, LENGTH = 512K
- RAM_D2 (xrw) : ORIGIN = 0x30000000, LENGTH = 288K
- RAM_D3 (xrw) : ORIGIN = 0x38000000, LENGTH = 64K
- ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K
- FLASH (rx) : ORIGIN = 0x90000000, LENGTH = 32M
- }
- /* Define output sections */
- SECTIONS
- {
- /* The startup code goes first into FLASH */
- .isr_vector :
- {
- . = ALIGN(4);
- KEEP(*(.isr_vector)) /* Startup code */
- . = ALIGN(4);
- } >FLASH
- /* The program code and other data goes into FLASH */
- .text :
- {
- . = ALIGN(4);
- *(.text) /* .text sections (code) */
- *(.text*) /* .text* sections (code) */
- *(.glue_7) /* glue arm to thumb code */
- *(.glue_7t) /* glue thumb to arm code */
- *(.eh_frame)
- KEEP (*(.init))
- KEEP (*(.fini))
- . = ALIGN(4);
- _etext = .; /* define a global symbols at end of code */
- } >FLASH
- /* Constant data goes into FLASH */
- .rodata :
- {
- . = ALIGN(4);
- *(.rodata) /* .rodata sections (constants, strings, etc.) */
- *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
- . = ALIGN(4);
- } >FLASH
- .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
- .ARM : {
- __exidx_start = .;
- *(.ARM.exidx*)
- __exidx_end = .;
- } >FLASH
- .preinit_array :
- {
- PROVIDE_HIDDEN (__preinit_array_start = .);
- KEEP (*(.preinit_array*))
- PROVIDE_HIDDEN (__preinit_array_end = .);
- } >FLASH
-
- .init_array :
- {
- PROVIDE_HIDDEN (__init_array_start = .);
- KEEP (*(SORT(.init_array.*)))
- KEEP (*(.init_array*))
- PROVIDE_HIDDEN (__init_array_end = .);
- } >FLASH
-
- .fini_array :
- {
- PROVIDE_HIDDEN (__fini_array_start = .);
- KEEP (*(SORT(.fini_array.*)))
- KEEP (*(.fini_array*))
- PROVIDE_HIDDEN (__fini_array_end = .);
- } >FLASH
- /* used by the startup to initialize data */
- _sidata = LOADADDR(.data);
- /* Initialized data sections goes into RAM, load LMA copy after code */
- .data :
- {
- . = ALIGN(4);
- _sdata = .; /* create a global symbol at data start */
- *(.data) /* .data sections */
- *(.data*) /* .data* sections */
- . = ALIGN(4);
- _edata = .; /* define a global symbol at data end */
- } >RAM_D1 AT> FLASH
-
- /* Uninitialized data section */
- . = ALIGN(4);
- .bss :
- {
- /* This is used by the startup in order to initialize the .bss secion */
- _sbss = .; /* define a global symbol at bss start */
- __bss_start__ = _sbss;
- *(.bss)
- *(.bss*)
- *(COMMON)
- . = ALIGN(4);
- _ebss = .; /* define a global symbol at bss end */
- __bss_end__ = _ebss;
- } >RAM_D1
- /* User_heap_stack section, used to check that there is enough RAM left */
- ._user_heap_stack :
- {
- . = ALIGN(8);
- PROVIDE ( end = . );
- PROVIDE ( _end = . );
- . = . + _Min_Heap_Size;
- . = . + _Min_Stack_Size;
- . = ALIGN(8);
- } >RAM_D1
-
- .lwip_sec (NOLOAD) : {
- . = ABSOLUTE(0x30040000);
- *(.RxDecripSection)
-
- . = ABSOLUTE(0x30040060);
- *(.TxDecripSection)
-
- . = ABSOLUTE(0x30040200);
- *(.RxArraySection)
- } >RAM_D2 AT> FLASH
- /* Remove information from the standard libraries */
- /DISCARD/ :
- {
- libc.a ( * )
- libm.a ( * )
- libgcc.a ( * )
- }
- .ARM.attributes 0 : { *(.ARM.attributes) }
- }
复制代码
后续计划
- 将官方的 STMH743XI 烧录算法加入到 TOOLS 的烧录算法中,使得可以使用一个烧录算法,不用切换
- 调试时, 直接从 QSPI FLASH 启动, 不需要bootloader
eclipse一键环境(win7-win10)
eclipse一键环境(winxp)
同步站点
源码
|
评分
-
查看全部评分
|