当前位置:网站首页>Summary of hardfault problem in RTOS multithreading

Summary of hardfault problem in RTOS multithreading

2022-06-25 08:43:00 *_ Look up at the stars_*

problem

Use minIni With INI Save the system parameters in the form of a file littlefs Caused by reading and writing under multithreading hardfault problem

To solve the process

0、 adopt RT-Thread Customize hardfault Process function print hardfault Information , Find out hardfault It happened in lvgl gui Threads ;

1、 Using the debugger to hardfault Printed lr Register address minus 5 Backtracking the address to find the occurrence hardfault The sentence is STM32 HAL Library SPI Transfer function , The library function should be OK , Incomprehensible

2、 The thought of hardfault Most of the problems are caused by pointer out of bounds or stack overflow , increase lvgl GUI Thread stack , After debugging again, it is found that hardfault, however hardfault Occurs in the event processing thread

3、 Increase the event processing thread stack ,hardfault Problem solving


summary

Through the solution process, we can find and speculate the cause : It may be due to the use of littlefs Called HAL library ,minIni call littlefs The interface of , Multi level nested function calls require a lot of stack space , And give lvgl GUI The stack of threads and event processing threads 1K, So the stack allocated to the thread should not be too stingy .

RTOS Multithreading hardfault Most of the problems are caused by stack overflows .

increase lvgl gui After thread , Debugging again found hardfault Occurs in the event processing thread , Increase the stack of event processing threads ,hardfault Problem solving

原网站

版权声明
本文为[*_ Look up at the stars_*]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/176/202206250734028623.html