Toggle navigation
首页
问答
文章
积分商城
专家
专区
更多专区...
文档中心
返回主站
搜索
提问
会员
中心
登录
注册
STM32H743
Hardfault
RT-Thread一般讨论
ota_downloader软件包http_ota下载出现`FPU active!` 和 `SCB_CFSR_BFSR:0x04 IMPRECISERR`
发布于 2024-01-21 17:06:55 浏览:560
订阅该版
[tocm] ## 当前配置 - 软件包安装 ![002.png](https://oss-club.rt-thread.org/uploads/20240121/9647a000b062a6433ba96daa228e08f2.png) - 关键函数调用(main.c) > 创建8K线程并提高优先级,执行OTA升级指令 ```c void ota(void* p){ http_ota_fw_download("http://192.168.31.233:9000/rtthread.bin"); } int main() { //... rt_thread_t ota_ptr = rt_thread_create("OTA",ota,NULL,1024*8,2,20); if(ota_ptr != RT_NULL){ rt_kprintf("ota_start\n"); rt_thread_startup(ota_ptr); }else{ rt_kprintf("ota_error\n"); } //... return 0; } ``` - 串口报错 ```txt ota_start OTA file size is (300032)Start erase flash (download) partition!psr: 0x01000000 r00: 0x00000000 r01: 0xe000ed00 r02: 0x40000000 r03: 0x00000da0 r04: 0xdeadbeef r05: 0xdeadbeef r06: 0xdeadbeef r07: 0x2400fa98 r08: 0xdeadbeef r09: 0xdeadbeef r10: 0xdeadbeef r11: 0xdeadbeef r12: 0xffffffff lr: 0x0804aa87 pc: 0x0804a7b6 hard fault on thread: OTA pri status sp stack size max used left tick error -------- --- ------- ---------- ---------- ------ ---------- --- OTA 2 running 0x00000288 0x00002000 12% 0x0000000e 000 md_send_ 31 suspend 0x000000ac 0x00002800 01% 0x0000000a 000 md_poll_ 10 suspend 0x000000b0 0x00000200 34% 0x0000000a 000 master t 10 suspend 0x000000b8 0x00000200 35% 0x00000005 000 mqtt0 10 suspend 0x00000240 0x00001000 27% 0x00000001 000 at_clnt 9 ready 0x0000018c 0x00000600 75% 0x00000001 000 tshell 20 suspend 0x00000154 0x00001000 14% 0x0000000a 000 sys work 23 suspend 0x00000260 0x00000800 61% 0x00000001 000 tidle0 31 ready 0x0000006c 0x00000100 61% 0x0000000a 000 timer 4 suspend 0x00000080 0x00000200 34% 0x00000009 000 FPU active! ``` * 查阅`Debug`->`rtthread.map`文件中,在`PC: 0x08040a7b6`附近的文件内容如下:**问题文件位于`drv_flash_h7.c`,关于该文件详见本文备注** ```txt .text.esp8266_connect 0x0804a53c 0xd0 ./applications/src/WIFI.o 0x0804a53c esp8266_connect .text.freeModbus_Init 0x0804a60c 0xb0 ./applications/src/freeModbus.o 0x0804a60c freeModbus_Init .text.md_poll_thread 0x0804a6bc 0x18 ./applications/src/freeModbus.o 0x0804a6bc md_poll_thread .text.md_send_and_receice_thread 0x0804a6d4 0x14 ./applications/src/freeModbus.o 0x0804a6d4 md_send_and_receice_thread .text.SCB_EnableDCache 0x0804a6e8 0x80 ./applications/drv_flash_h7.o .text.SCB_DisableDCache 0x0804a768 0x80 ./applications/drv_flash_h7.o .text.stm32_flash_read 0x0804a7e8 0x78 ./applications/drv_flash_h7.o 0x0804a7e8 stm32_flash_read .text.stm32_flash_write 0x0804a860 0x178 ./applications/drv_flash_h7.o 0x0804a860 stm32_flash_write ``` * `0x0804a7b6`介于`0x0804a768`和`0x0804a7e8`之间,所以自认为问题应该出现在 ```txt .text.SCB_DisableDCache 0x0804a768 0x80 ./applications/drv_flash_h7.o ``` * `SCB_DisableDCache`函数位于`core_cm7.h`中,函数内容如下: ```c /** \brief Disable D-Cache \details Turns off D-Cache */ __STATIC_INLINE void SCB_DisableDCache (void) { #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) uint32_t ccsidr; uint32_t sets; uint32_t ways; SCB->CSSELR = 0U; /*(0U << 1U) | 0U;*/ /* Level 1 data cache */ __DSB(); SCB->CCR &= ~(uint32_t)SCB_CCR_DC_Msk; /* disable D-Cache */ __DSB(); ccsidr = SCB->CCSIDR; /* clean & invalidate D-Cache */ sets = (uint32_t)(CCSIDR_SETS(ccsidr)); do { ways = (uint32_t)(CCSIDR_WAYS(ccsidr)); do { SCB->DCCISW = (((sets << SCB_DCCISW_SET_Pos) & SCB_DCCISW_SET_Msk) | ((ways << SCB_DCCISW_WAY_Pos) & SCB_DCCISW_WAY_Msk) ); #if defined ( __CC_ARM ) __schedule_barrier(); #endif } while (ways-- != 0U); } while(sets-- != 0U); __DSB(); __ISB(); #endif } ``` ### 解决过程 > 查阅过一些`FPU active!`的问题,好像是结构体浮点数对齐的问题,由于才疏学浅还找不到具体问题以及解决办法。 ### 备注 * `drv_flash_h7.c`文件是`rt-threrad`->`fal`组件对于h7系列芯片的分区时的一些配置代码,源文件位于`https://gitee.com/rtthread/rt-thread/blob/master/bsp/stm32/libraries/HAL_Drivers/drivers/drv_flash/drv_flash_h7.c`。 ```c const struct fal_flash_dev stm32_onchip_flash_128k = { "onchip_flash_128k", 0x08020000, (2*1024-128) * 1024, (128 * 1024), {NULL, fal_flash_read_128k, fal_flash_write_128k, fal_flash_erase_128k}, 8}; ```
查看更多
1
个回答
默认排序
按发布时间排序
aozima
2024-01-21
调网络不抓包,调I2C等时序不上逻辑分析仪,就像电工不用万用表!多用整理的好的文字,比截图更省流量,还能在整理过程中思考。
>查阅过一些FPU active!的问题 这里仅表示:问题发生时,FPU是使能的,但并不表明问题和这个相关,甚至完全无关。 先按常规的[hardfault](https://club.rt-thread.org/ask/tag/32c779b3c4ce1bfd.html "hardfault")查就行的。
撰写答案
登录
注册新账号
关注者
0
被浏览
560
关于作者
暮色
weThinkWeKnowYou
提问
2
回答
0
被采纳
0
关注TA
发私信
相关问题
1
有关动态模块加载的一篇论文
2
最近的调程序总结
3
晕掉了,这么久都不见layer2的踪影啊
4
继续K9ii的历程
5
[GUI相关] FreeType 2
6
[GUI相关]嵌入式系统中文输入法的设计
7
20081101 RT-Thread开发者聚会总结
8
嵌入式系统基础
9
linux2.4.19在at91rm9200 上的寄存器设置
10
[转]基于嵌入式Linux的通用触摸屏校准程序
推荐文章
1
RT-Thread应用项目汇总
2
玩转RT-Thread系列教程
3
国产MCU移植系列教程汇总,欢迎查看!
4
机器人操作系统 (ROS2) 和 RT-Thread 通信
5
五分钟玩转RT-Thread新社区
6
【技术三千问】之《玩转ART-Pi》,看这篇就够了!干货汇总
7
关于STM32H7开发板上使用SDIO接口驱动SD卡挂载文件系统的问题总结
8
STM32的“GPU”——DMA2D实例详解
9
RT-Thread隐藏的宝藏之completion
10
【ART-PI】RT-Thread 开启RTC 与 Alarm组件
最新文章
1
[E/app.filesystem] SD card mount to '/sdcard' failed!
2
单片机也能聊天?RT-Thread上跑通大语言模型
3
【RT-Thread】【ci】【scons】将ci.attachconfig.yml和scons结合使用
4
Rt-thread中OTA下载后,bootloader不搬程序
5
ulog 日志 LOG_HEX 输出时间改为本地日期时间
热门标签
RT-Thread Studio
串口
Env
LWIP
SPI
AT
Bootloader
Hardfault
CAN总线
FinSH
ART-Pi
USB
DMA
文件系统
RT-Thread
SCons
RT-Thread Nano
线程
MQTT
STM32
RTC
FAL
rt-smart
I2C_IIC
ESP8266
UART
WIZnet_W5500
ota在线升级
cubemx
PWM
flash
freemodbus
BSP
packages_软件包
潘多拉开发板_Pandora
定时器
ADC
flashDB
GD32
socket
编译报错
中断
Debug
rt_mq_消息队列_msg_queue
SFUD
msh
keil_MDK
ulog
C++_cpp
MicroPython
本月问答贡献
出出啊
1518
个答案
343
次被采纳
小小李sunny
1444
个答案
290
次被采纳
张世争
813
个答案
177
次被采纳
crystal266
547
个答案
161
次被采纳
whj467467222
1222
个答案
149
次被采纳
本月文章贡献
出出啊
1
篇文章
3
次点赞
小小李sunny
1
篇文章
1
次点赞
张世争
1
篇文章
3
次点赞
crystal266
2
篇文章
2
次点赞
whj467467222
2
篇文章
2
次点赞
回到
顶部
发布
问题
分享
好友
手机
浏览
扫码手机浏览
投诉
建议
回到
底部