Skip to content
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

二级boot跳转未复位MSPLIM #32

Open
HalfSweet opened this issue Feb 21, 2025 · 1 comment
Open

二级boot跳转未复位MSPLIM #32

HalfSweet opened this issue Feb 21, 2025 · 1 comment

Comments

@HalfSweet
Copy link
Member

HalfSweet commented Feb 21, 2025

在二级boot跳转到应用程序的过程中,并未设置MSPLIM的值

void run_img(uint32_t dest)
{
__asm("LDR SP, [%0]" :: "r"(dest));
__asm("LDR PC, [%0, #4]" :: "r"(dest));
}

导致可能在跳转到用户程序之后会触发堆栈溢出并跳转到HardFault

@decaday
Copy link
Contributor

decaday commented Feb 21, 2025

这主要在用户程序不使用SDK中的startup_bf0_hcpu.S的时候发生。

一些使用纯c编写的启动文件可能在一开始就压栈了一次,或者一些启动文件并没有重新设置msplim。

Hardfault发生后,如果使用cortex-debug来连接设备,会导致芯片挂死(相关issue:#30 ,不确定是否是同一个问题)

Image

连接指示灯熄灭,无法捕捉错误现场,无法烧录程序,需要复位芯片才能烧录。
这个问题导致当时很难排查原因(最终花了很长时间才找到原因)。

在我后面的尝试中,Jlink commander还是能正常连接的,但是未设置msplim会导致毫不相关的LSB位为偶数的fault,很奇怪

此外,Jlink commander无法读取MSPLIM的值

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants