Bootloader的用于Cortex M3 [英] Bootloader for Cortex M3

查看:355
本文介绍了Bootloader的用于Cortex M3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是LPC 1768板从mbed,(与皮质M3 CPU),我想在这里实现的东西,主要是升级从SD卡中的用户应用程序,我写两个方案,第一个引导程序/纳米内核和用户应用程序(的HelloWorld一开始会做):

I am using a LPC 1768 board from mbed, (with cortex M3 cpu) and I am trying to achieve something here, mainly upgrade the user application from the SD Card, I am writing two programs, first a bootloader/nano-kernel, and a user-app (helloworld will do for a start):


  • 的Bootloader / 0x00处地址运行纳米内核,它会做一些检查,并最终抓住SD卡上的二进制文件

  • 的Bootloader /纳米内核会在地址0×9000复制这个二进制文件(可能有改变以后,但这个空间不使用引导程序/纳米内核所以应确定)

  • 引导加载程序跳转到用户应用程序在0×9000 + 4

SD卡是很容易的工作,出去,我有跳跃的部分问题。这里是跳转功能的code。

The Sd card is quite easy to work-out, I am having issues with the jumping part. Here is the code of the jumping function.

void run(void) {

  void (*user_code_entry)(void);

  unsigned *p;   
  SCB->VTOR = (USER_FLASH_START & 0x1FFFFF80);

  // Load contents of second word of user flash - the reset handler address
  // in the applications vector table
  p = (unsigned *)(USER_FLASH_START +4); // USER_FLASH_START is 0x9000

  user_code_entry = (void (*)(void))p;

  // Jump to user application
  user_code_entry();

}

因此​​,我已编译(我使用的Keil uvision4)用户应用程序改变的起始地址为0×9000。如果我将板程序(用flashmagictool),然后手动跳(仍在使用flashmagictool)为0x9004(0×9000 + 4),用户应用程序将运行,所以我相信汇编已经制定好了,所以用户应用程序可以在0×9000上运行。

So I have compiled (I am using Keil uvision4) the user application changing the start address to 0x9000. If I program my board (using flashmagictool), and then manually jump (still using flashmagictool) to 0x9004 (0x9000 + 4), the user application will run so I believe the compilation has worked ok so user-app can run at 0x9000.

但是,如果我运行的bootloader /纳米内核,这一个不跳转到用户应用程序,如不幸的是,我不能调试,我不知道是怎么回事......我也试过不使用在SD复制的一部分,所以我基本上只是跳到0x9004先编程引导程序。然后我程序的用户应用程序将坐在×9000。如果我重新启动板,引导程序运行,但没有跳转到用户应用程序。我已经检查的内存,它似乎是两个程序(引导程序+用户应用程序)是正确的,并在正确的地方。

But If I run the bootloader/nano-kernel, this one does not jump to the user-application and unfortunately as I cannot debug, I am not sure of what is going on... I also have tried not to use the SD copy part, so I program the bootloader first with basically just the jump to 0x9004. I then program the user application that will sit at 0x9000. If I reboot the board, bootloader runs but does not jump to user-app. I have checked memory, and it seems that both programs (bootloader + user-app) are correct and at the right place.

我相信我在这里失去了一些东西,是没有任何低级code我应该看什么?我已阅读文档的色调网上,并从我已经找到了例子,他们跳转到用户code相同的方式,我做的......非常感谢任何帮助。

I am sure I am missing something here, is there any low-level code I should be looking at ? I have read tones of docs online, and from the examples I have found, they are jumping to user code the same way as I do... Thanks a lot for any help.

推荐答案

的Cortex M3只能在Thumb模式下运行。因此,你总要跳转到地址+1 ,否则会产生故障。

Cortex M3 can only run in Thumb mode. Thus you always have to jump to address +1, otherwise it will generate a fault.

刚刚尝试:

用户_ code_entry =(无效(*)(无效))(USER_FLASH_START +4 +1);

这篇关于Bootloader的用于Cortex M3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆