嵌入式技术论坛
直播中

王秀兰

7年用户 1337经验值
私信 关注
[问答]

STM32H743从bootloader跳转到APP程序后不能正常运行咋办?

STM32H743的开发板移植了一个bootloader可以跳转到 0x08020000地址,打印以下内容后就卡死了

2.jpg

跳转代码

/*

Copyright (c) 2006-2018, RT-Thread Development Team

SPDX-License-Identifier: Apache-2.0

Change Logs:

Date Author Notes
2019-03-05 whj4674672 first version
/
#include <rtthread.h>
#include <rtdevice.h>
#include <board.h>
#define IAP_FLASH_SIZE 0X20000
/
defined the LED0 pin: PB1 /
#define LED0_PIN GET_PIN(B, 1)
int main(void)
{
int count = 1;
/
set LED0 pin mode to output /
rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT);
while (count++)
{
rt_pin_write(LED0_PIN, PIN_HIGH);
rt_thread_mdelay(500);
rt_pin_write(LED0_PIN, PIN_LOW);
rt_thread_mdelay(500);
}
return RT_EOK;
}
#include "stm32h7xx.h"
static int vtor_config(void)
{
/
Vector Table Relocation in Internal QSPI_FLASH */
SCB->VTOR = FLASH_BASE | IAP_FLASH_SIZE;
return 0;
}
INIT_BOARD_EXPORT(vtor_config);

回帖(3)

刘艳

2023-2-2 15:53:31
INIT_BOARD_EXPORT 初始化之前串口就已经开始用了
这句 SCB->VTOR = FLASH_BASE | IAP_FLASH_SIZE; 前应该已经有中断发生了
在这里执行太晚了,还要靠前;
需改在system_stm32h7xx.c中的函数 void SystemInit (void) 中使用的宏 VECT_TAB_OFFSET

/************************* Miscellaneous Configuration ************************/
/*!< Uncomment the following line if you need to use initialized data in D2 domain SRAM (AHB SRAM) */
/* #define DATA_IN_D2_SRAM */
/*!< Uncomment the following line if you need to relocate your vector Table in
     Internal SRAM. */
/* #define VECT_TAB_SRAM */
#define VECT_TAB_OFFSET  0x00000000UL /*!< Vector Table base offset field.
                                      This value must be a multiple of 0x200. */
举报

王秀兰

2023-2-2 15:53:40
确认了一下,还是不行,是不行 stm32h7 的中间文件不是最新导致的,应该是有一些bug在里面
举报

王秀兰

2023-2-2 15:53:45
查了一下是没有进入主函数
2.jpg
举报

更多回帖

发帖
×
20
完善资料,
赚取积分