-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug fix: an interrupt may return to the end of function "rt_hw_context_switch_to" #5274
Conversation
… to perform the first thread switch
related: |
楼主指的是在返回task时,还是在使用MSP吗?可以详细讲一下复现流程嘛,这边按照上面步骤一直没有复现 |
可能和KEIL 版本有关系, 用uV4.03版本模拟仿真每次都能复现,不用RTOS只使用MSP就没问题,会让开发者觉得系统不稳定 |
@cndabai 用Keil5重复上述同样操作,不用keil4,测试例程可以选择stm32-blue-pill,这个bsp已经设置好仿真参数了,开箱就能仿真。 |
如果Keil5没有 但是Keil4出现,高度怀疑是keil自己的原因。 |
@hwang1024 建议升级到keil5再尝试复现一下,如果是keil本身的bug,我们是没有办法替他的bug来修改程序的 |
If it can't be reproduced, then temporarily close the current pr? |
如果keil5复现不出来这个问题的话,那么八成这个问题是由于keil4自己的问题导致的,我们的代码不会对keil4自己的问题负责。 |
[
Description:
In cortex-M uC, there is a tail-chain mechanism to fasen interrupt/exception response,
from simulation tool: KEIL V4, it shows that a mismatch of stack restore occours if: an interrupt/exception happens at the moment that returning from previous interrupt, and MSP will be restored instead of task's PSP, and it'll cause a return to the end of function: rt_hw_context_switch_to, causes a hard fault in the end.
Purpose:
To solve the issue in case an interrupt service is tail-chained by another interrupt, and return back to function rt_hw_context_switch_to
Tested Enviroment:
KEIL V4.03 with similator / STM32F103RC, with project "rt-thread-v4.0.2\rt-thread\bsp\stm32\stm32f103-yf-ufun\project.uvproj"
1> debug(simulator) => run => set breakpoint at end of function "void SysTick_Handler(void)"
2> peripherals => core peripherals => NVIC (nested vectored...) =>index 53 USART1 (Set pending bit manually)
3> run & check...
]
以下的内容不应该在提交PR时的message修改,修改下述message,PR会被直接关闭。请在提交PR后,浏览器查看PR并对以下检查项逐项check,没问题后逐条在页面上打钩。
The following content must not be changed in the submitted PR message. Otherwise, the PR will be closed immediately. After submitted PR, please use a web browser to visit PR, and check items one by one, and ticked them if no problem.
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0
代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up