如何为已经有效的电路板上的控制器编写引导加载程序? [英] How do i write a bootloader for a controller placed on a board which already works?

查看:99
本文介绍了如何为已经有效的电路板上的控制器编写引导加载程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的问题混淆之前,让我说清楚。我是一家电子本科生,为一家生产烤箱控制器的公司实习。我的第一个任务是在闪存中写一段代码,使该板上的LED闪烁。我通过代码项目中的第一个问题成功地做到了。现在我需要为该板上的Controller构建一个Bootloader。系统启动并执行了我的第一个代码,这意味着已经有一个与该板相关联的启动代码。现在,我将如何为已经正常工作的系统编写自己的引导加载程序代码?我不是要求整个代码。答案引用教程,视频,博客的链接就足够了。



我尝试了什么:



我使用的控制器是飞思卡尔Kinetis KE02Z控制器。我尝试使用Google搜索并在其他论坛中查看但没有任何帮助。

Before My question confuses, let me make it very clear. I am an electronics undergrad doing internship for a company which manufactures oven controllers. My 1st task was to write a piece of code in the flash memory to blink the led in that board. I did it successfully through my 1st question in the Code Project. Now comes the main task I have to build a Bootloader for the Controller in that board. The system started and executed my 1st code which implies there is a bootcode already associated with that board. Now, how will I write my own bootloader code for a system which is already working fine? I am not asking for the entire code. Answers quoting links to tutorials, videos, blogs are enough.

What I have tried:

The controller which I use is Freescale Kinetis KE02Z controller. I tried googling and checked in other forums but nothing helped.

推荐答案

Bootloader高度依赖于目标微控制器架构。您必须:

  • 搜索制造商的文档(例如应用说明)。
  • 查看专门针对目标微控制器的论坛。
Bootloaders highly depend on the target microcontroller architecture. You have to:
  • Search for manufacturer's documentation about (e.g. application notes).
  • Look at forums specialized on the target microcontroller.


通常不需要编写自己的启动加载程序。只需使用微控制器制造商提供的那个(通常有应用说明)。如有必要,您可以修改代码以满足您的需求。



因为您是第一次使用控制器而且可能是微控制器的新手,我强烈建议这样做,因为从头开始编写启动加载程序需要很好的知识控制器和它的编程。



我也不太确定你是否知道通常使用的引导加载程序以及引导加载程序的要求是什么。它们主要用于更新应用程序代码。当系统启动时,它们将检查特定条件,当不满足时,它们将跳转到正常的应用程序代码。否则,他们会在串行线路等接口上等待命令。使用更新命令,它们接收二进制数据并从应用程序代码地址开始将其写入闪存。
There is usually no need to write your own boot loader. Just use the one that is provided by the manufacturer of your microcontroller (there is often an application note). If necessary, you can modify the code to match your needs.

Because you are using your controller the first time and are probably new to microcontrollers, I highly recommend to do it this way because writing a boot loader from scratch requires good knowledge of the controller and it's programming.

I'm also not quite sure if you know what boot loaders are usually used for and what are the requirements for your boot loader. They are mainly used to allow updating the application code. When the system is powered on, they will check for a specific condition and when that is not met they will jump to the normal application code. Otherwise they wait for commands on an interface like a serial line. With an update command they receive the binary data and write that to the flash memory starting at the application code address.


这篇关于如何为已经有效的电路板上的控制器编写引导加载程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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