单片机的Bootloader,可以实现用户轻松升级程序
扫描二维码
随时随地手机看文章
01
什么是Bootloader
02
划分Flash区间
03
修改中断向量表
__root const long reintvec[]@".intvec"=
{
0x82008080,0x82008404,0x82008408,0x8200840c,
0x82008410,0x82008414,0x82008418,0x8200841c,
0x82008420,0x82008424,0x82008428,0x8200842c,
0x82008430,0x82008434,0x82008438,0x8200843c,
0x82008440,0x82008444,0x82008448,0x8200844c,
0x82008450,0x82008454,0x82008458,0x8200845c,
0x82008460,0x82008464,0x82008468,0x8200846c,
0x82008470,0x82008474,0x82008478,0x8200847c,
};
__root const long reintvec[]@".intvec"=
{
0x82008080,0x82009404,0x82009408,0x8200940c,
0x82009010,0x82009014,0x82009018,0x8200901c,
0x82009020,0x82009024,0x82009028,0x8200902c,
0x82009030,0x82009034,0x82009038,0x8200903c,
0x82009040,0x82009044,0x82009048,0x8200904c,
0x82009050,0x82009054,0x82009058,0x8200905c,
0x82009060,0x82009064,0x82009068,0x8200906c,
0x82009070,0x82009074,0x82009078,0x8200907c,
};
04
修改ICF文件
define region NearFuncCode = [from 0x8000 to 0x8FFF];
define block INTVEC with size = 0x80 { ro section .intvec };
place at start of NearFuncCode { block INTVEC };
05
跳转命令
asm("LDW X, SP ");
asm("LD A, $FF");
asm("LD XL, A ");
asm("LDW SP, X ");
asm("JPF $9000");
sm("LDW X, SP ");
asm("LD A, $FF");
asm("LD XL, A ");
asm("LDW SP, X ");
asm("JPF $8000");
06
编写交互代码
-END-
来源 | 玩转嵌入式
作者 | 刘小舒
| 整理文章为传播相关技术,版权归原作者所有 |
| 如有侵权,请联系删除 |
【1】嵌入式研发10多年,工程师悟出这些道理
【2】当谈起嵌入式工程师,究竟在谈些什么
【3】嵌入式工程师出路之我见:就业,技术,行业...
【4】为什么嵌入式工程师会对8位MCU有误解?
【5】嵌入式工程师结合经历聊硬件工程师和软件工程师哪个更有前途?
免责声明:本文内容由21ic获得授权后发布,版权归原作者所有,本平台仅提供信息存储服务。文章仅代表作者个人观点,不代表本平台立场,如有问题,请联系我们,谢谢!