Microchip
直播中

宫昊

7年用户 237经验值
私信 关注
[问答]

怎么从应用程序更新Bootloader?

嗨,我正在使用PIC32 MZ2048 EFH064,我有一个Bootloader位于BFM中。以及PFM中的应用固件。-第一次上电设备将处于主引导加载模式,并将下载应用固件。在应用程序中,我集成了二次Bootloader,以便我的应用固件可以作为辅助引导加载程序来更新主引导加载程序,或者它可以运行正常的应用程序任务。-我强制应用到二次引导加载模式来下载主引导加载程序。从主引导加载程序复制到我的应用程序的完全相同的源文件,只有我做的更改是使用NVBWP相关函数来禁用BFM WP的附加函数,将区域的地址更改为擦除/编程。主引导加载程序链接器:-KSK1Y-BootmiMe:Ont= 0xBFC000,长度=0x480/*C启动代码*/-KSG00SudioMym(Rx):Orthase= 0x9FC01000,长度=0xFF00 -0x1000 - KSG00BooToMeM:原点=0x9FC04B0,长度=0x00兆-kSe1BoObMyMy4B0:Orth= 0xBFC000 4B0,长度=0x1000~0x4B0-组态BFC0FF40:Orth= 0xBFC0FF40,长度=0x4-……(所有配置)我的应用程序链接器:-KSGE1XBoToMeMe:Orth= 0x9D900M,长度=0x480/*C启动代码*/-KSG00SudithMeX(Rx):Orthase= 0x9D900M+0x480,长度=0x20000 -0x480/*所有C文件将位于这里*/-KSG00BooToMeMe:Orth= 0x9D900M,长度=0x0i被混淆消除擦除启动闪存在地址0x1fc01000或0x1fc000?我需要擦除C启动代码,配置位吗?如果我擦除配置比特,时钟将如何执行?

以上来自于百度翻译


      以下为原文

    Hi,
     - I am using PIC32MZ2048EFH064, I am having Primary bootloader located in BFM. And application firmware in PFM.
     - On first power ON device will be in Primary bootloader mode, and it will download application firmware.
     - In application, I integrated Secondary bootloader so that my application firmware can either run as Secondary bootloader to update primary bootloader, or it can run normal application tasks.
- I force application to secondary bootloader mode to download primary bootloader.
- Here comes problem :
    I copied exact same source files from Primary bootloader to my application,Only changes I made are - Added function to disable BFM WP using NVMBWP related functions, changed addresses of area to erase/program.

Primary Bootloader linker :
- kseg1_boot_mem          : ORIGIN = 0xBFC00000, LENGTH = 0x480   /*C Startup code */
- kseg0_program_mem (rx) : ORIGIN = 0x9fc01000, LENGTH = 0xFF00 - 0x1000
- kseg0_boot_mem : ORIGIN = 0x9fc004b0, LENGTH = 0x00000000
- kseg1_boot_mem_4B0 : ORIGIN = 0xBFC004B0, LENGTH = 0x1000 - 0x4B0
- config_BFC0FF40 : ORIGIN = 0xBFC0FF40, LENGTH = 0x4
- ....... (all configs)

My application linker :
- kseg1_boot_mem : ORIGIN = 0x9D000000, LENGTH = 0x480 /*C Startup code */
- kseg0_program_mem (rx) : ORIGIN = 0x9D000000 + 0x480, LENGTH = 0x200000 - 0x480 /* All C files will be located here */
- kseg0_boot_mem : ORIGIN = 0x9D000000, LENGTH = 0x0

I am confused whether to erase Boot flash starting at address 0x1FC01000 or 0x1FC00000 ? Do I need to erase C startup code, config bits? If I erase config bits how the clock will execute?

回帖(8)

张珊珊

2019-4-9 10:40:39
我已经提到了这些论坛链接,但我仍然不满意:1)在PIC32 MZ设备上分段引导闪存?2)PIC32 MZ-如何切换BFM映射3)如何使用TyrPrimaMac配置、配置BF1、CONTIONBF2等?4)PIC32 MZ如何从程序存储器5启动内存编程,当启动闪存写保护(BWP)时,无法写入程序Flash!6)放置在引导闪存存储器中的程序代码)PIC32 MZ写入NVBWP8)TSEQ/BSEQ是否实际用于引导库选择?9)如何闪存到启动闪存2(PIC32 MZ)10)通过应用程序代码更新引导加载程序

以上来自于百度翻译


      以下为原文

    I have referred these forum links but I am still unsatisfied:
1) Segmented Boot Flash on PIC32MZ devices?
2) PIC32MZ - How to switch BFM mapping 
3) How to use #pragma config, config_bf1, config_bf2, etc.?
4) PIC32MZ how to program Boot memory from Program memory
5) Can't write to Program Flash when Boot Flash Write Protect (BWP) is enabled!?
6) Program code placed in boot flash memory
7) PIC32MZ writing to NVMBWP
8) Does TSEQ/BSEQ actually work for boot bank selection?
9) How to flash into boot flash 2 (PIC32MZ)
10) Update bootloader through application code
举报

刘涛

2019-4-9 10:49:12
您不希望触摸配置位,而是确保它们在引导加载程序和应用程序之间是相同的。您是否擦除了BootFlash取决于链接器和您。链接器告诉PIC,在重置后,如果在正确的情况下跳转到0xBFC10000,它会转到哪里。除了BFC地址是被执行的第一个地址之外,它实际上是BooFlash实际上是无关紧要的。

以上来自于百度翻译


      以下为原文

    You don't want to touch the config bits, rather make sure they are the same across the bootloader and the application.
 
Whether or not you erase your bootflash is up to your linker and you.  The linker tells the pic where it goes to after reset by putting a jump at 0xBFC000000 if I have it right.  The fact that it is bootflash really is irrelevant other than that the BFC address is the first address that gets executed.
举报

陈刚

2019-4-9 11:08:45
更新BootLooloader 5月1日的整个原因是由于配置位不正确。将配置比特限制到我们认为在发射日是正确的是有点限制性的……似乎有很多关于引导装载机和一些人在经历了让他们工作的折磨中幸存下来的困惑……有没有人愿意加入一个开源项目来解决这个问题?

以上来自于百度翻译


      以下为原文

   


The whole reason for updating bootloader #1 may be due to config bits being incorrect.  Limiting the config bits to what we think is proper on launch day is a bit restrictive...
 
It seems like there's a lot of confusion about bootloaders and a few people who have survived the ordeal of getting them to work...  Is anyone up for joining an open source project to get a robust solution to this problem? 
举报

陈杰

2019-4-9 11:16:08
在我阅读手册时,PIC32 MZ有一个“Live Update”功能,可以让你改变配置比特。在我的系统中,在和谐包“D:Microchip HyralV2Y02Y0.0BAppBootloader Live Update”中有一个示例应用程序。这可以让你了解所涉及的内容。在我的PIC32 MX中,我只做过。能够用外部程序员改变配置位,否则它会跳过配置位失配异常,需要一个电源周期来恢复。

以上来自于百度翻译


      以下为原文

    As I read the manual the PIC32MZ has a "Live Update" feature will enable you to change the config bits.
There is an example app in the Harmony package "D:microchipharmonyv2_02_00bappsbootloaderLiveUpdate" on my system.
This may give you an idea of what is involved.
In my PIC32MX I have only been able to change the config bits with an external programmer otherwise it trips the config bits mismatch exception requiring a power cycle to recover.
举报

更多回帖

发帖
×
20
完善资料,
赚取积分