Toggle navigation
首页
问答
文章
积分商城
专家
专区
更多专区...
文档中心
返回主站
搜索
提问
会员
中心
登录
注册
STM32H743
Hardfault
RT-Thread一般讨论
ota_downloader软件包http_ota下载出现`FPU active!` 和 `SCB_CFSR_BFSR:0x04 IMPRECISERR`
发布于 2024-01-21 17:06:55 浏览:207
订阅该版
[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
被浏览
207
关于作者
暮色
weThinkWeKnowYou
提问
2
回答
0
被采纳
0
关注TA
发私信
相关问题
1
BSD的一些代码分析
2
RT-Thread文件系统
3
怎么文档,源码还是没有呀??
4
[ZT]嵌入式LwIP协议栈的内存管理
5
RTLinux/RTCore体系结构
6
RTLinux/RTCore局限性
7
怎样获取源码
8
[ZT]The lightest lightweight threads, Protothreads
9
[ZT]微内核操作系统及L4概述
10
关于操作系统对C++操作符的使用
推荐文章
1
RT-Thread应用项目汇总
2
玩转RT-Thread系列教程
3
机器人操作系统 (ROS2) 和 RT-Thread 通信
4
国产MCU移植系列教程汇总,欢迎查看!
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
[Vision Board创客营]RTC模块实践
2
AB32VG1 不同版本GCC CoreMark 测试
3
【RA8D1-Vision Board】SCI的SPI模式对接FAL
4
libc是什么?可以吃吗
5
[RA8D1-Vision Board] sd卡实践
热门标签
RT-Thread Studio
串口
LWIP
Env
SPI
Bootloader
AT
ART-Pi
Hardfault
CAN总线
FinSH
USB
文件系统
DMA
RT-Thread
SCons
线程
RT-Thread Nano
MQTT
STM32
RTC
FAL
rt-smart
ESP8266
ota在线升级
WIZnet_W5500
I2C_IIC
UART
flash
cubemx
packages_软件包
freemodbus
潘多拉开发板_Pandora
PWM
定时器
ADC
BSP
中断
编译报错
socket
keil_MDK
GD32
MicroPython
msh
Debug
ulog
SFUD
flashDB
SDIO总线
rt_mq_消息队列_msg_queue
本月问答贡献
用户名由3_15位
23
个答案
3
次被采纳
踩姑娘的小蘑菇
16
个答案
3
次被采纳
xiaorui
7
个答案
3
次被采纳
sakumisu
5
个答案
3
次被采纳
三世执戟
32
个答案
1
次被采纳
本月文章贡献
比特饼干
4
篇文章
11
次点赞
Z_Y
2
篇文章
5
次点赞
xusiwei1236
2
篇文章
3
次点赞
yinxiangxv
2
篇文章
3
次点赞
rvcore
2
篇文章
3
次点赞
回到
顶部
发布
问题
分享
好友
手机
浏览
扫码手机浏览
投诉
建议
回到
底部