完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
您好,早些时候,我已经将PosioBootloader部署到PIC32 MZ微控制器中。但是,我需要写保护160kb引导块,这样就不会有意外重写或擦除这一部分。我注意到在PIC32上,BWP配置字位不存在。我已经在NVM上设置了引导区保护的寄存器——所有这些。当应用程序在主闪存中运行时,我如何完全防止引导块的重写?当用户输入正确的NVMKEY序列并关闭相关的寄存器时,他/她将立即拥有完全访问覆盖整个引导块的权限。
以上来自于百度翻译 以下为原文 Hello, Earlier on, I have deployed the HARMony bootloader into the PIC32MZ microcontroller. However, I need to write-protect the 160KB bootblock so that there will be no accidential overwrite or erase on that portion. I noticed that on PIC32, the BWP config word bit isn't present. And I had set the registers in the NVM on boot area protection too - all of it. How do I totally prevent any overwriting of the boot block when the application is running in the main flash? When the user enters the correct NVMKEY sequence and turn off the related registers, he/she would have immediately have full access to overwrite the whole boot block. |
|
相关推荐
5个回答
|
|
嗨,根据PIC32家庭参考手册,BFM写保护页在上下混叠区域可以单独使用NVBWP寄存器中的位来保护。由于这些位对应于在混叠区域中引用的页,所以它们在启动时受混叠映射的影响。在复位时,所有页处于写保护状态,并且必须在执行BFM区域上的任何编程操作之前被禁用。也有上区域和下区域解锁位,UBWPUROCK(NVBWP和LT;7和GT)和LBWPUROCK(NVBWP & LT;15和GT),它们在复位时被设置,并且可以被用户软件清除。清除后,不再为该区域写入保护的更改。一旦清除,UBWPUROCK和LBWPUROCK位只能通过重置来设置。当应用程序在主闪存中运行时,我如何完全防止引导块的任何重写?当用户输入正确的NVMKEY序列并关闭相关的寄存器时,他/她将立即有完全的访问覆盖整个引导块。在从Bootloader跳到应用程序之前,您可以清除这些位,以便在程序Flash中运行的应用程序不能写入引导块。希望这能解决。
以上来自于百度翻译 以下为原文 Hi, According to the PIC32 Family reference manual for BFM Write Protection Pages in the upper and lower aliased regions can be protected individually using bits in the NVMBWP register. Since these bits correspond to pages referenced in the aliased region, they are affected by the mapping of the aliasing at start-up. At reset, all pages are in a write-protected state and must be disabled prior to performing any programming operations on the BFM regions. There are also Upper Region and Lower Region unlock bits, UBWPULOCK (NVMBWP<7>) and LBWPULOCK (NVMBWP<15>), which are set at reset and can be cleared by user software. When cleared, changes to write protection for that region can no longer be made. Once cleared, the UBWPULOCK and LBWPULOCK bits can only be set by a reset. How do I totally prevent any overwriting of the boot block when the application is running in the main flash? When the user enters the correct NVMKEY sequence and turn off the related registers, he/she would have immediately have full access to overwrite the whole boot block. I think the Answer for this would be the text in Red above. You can clear these bits maybe before jumping to application from bootloader, so that application running in Program flash cannot write to boot block. Hope this works out. |
|
|
|
我不知道你的用户的意图是什么,但是他们也可以在你的程序开始运行之前用JTAG启动。
以上来自于百度翻译 以下为原文 I don't know what the intentions of your users are, but they also can boot with JTAG before your program starts running. |
|
|
|
你好,这也是我想知道的一件事。我已经关闭了配置标记中的JTAG,这样就足够了吗?:)
以上来自于百度翻译 以下为原文 Hello, that is also one thing I'm wondering about too. I have shut off the JTAG in the config bits - would that be sufficient? :) |
|
|
|
嗨,我们能保护某些页面(从引导闪存1或2)在Bootloader固件的链接脚本中写入/擦除吗?例如使用属性(R)-只读页。我想在Booflash 2的最后一页上写一些与设备相关的配置/信息(我使用PIC32 MZ2048 EFH064)。这将是终生的设备数据,因此它永远不会被擦除/重写。甚至Bootloader也不能删除它。
以上来自于百度翻译 以下为原文 Hi there, Can we protect certain page (from boot flash 1 or 2) from writing/erasing in linker script of bootloader firmware? For example using attribute (R) - Read only page. I want to write some device related configurations/information on last page of bootflash 2 (I'm using PIC32MZ2048EFH064). This will be once a lifetime of device data so that it will be never erased/re-written. Even bootloader can not erase it. |
|
|
|
也许更安全的方法是在运行BFM中的Bootloader时调整组权限。请看PIC32 MZ参考手册第48部分。如果我记得正确的话,它的工作方式是CPU作为组0启动(在引导加载程序中),引导加载程序设置组1或任何其他组可能拥有的权限。在跳转到应用程序之前,它将CPU设置为组1。在跳转到应用程序之前,请执行此操作。
以上来自于百度翻译 以下为原文 Perhaps a more secure approach is adjust the group permission when you are running bootloader that resides in BFM. Take a look PIC32MZ Reference Manual Section 48. If I remember correctly, the way it works is that CPU starts (in bootloader) as group 0, the bootloader sets up what permissions that group 1 or any other groups may have. Before jumping to the application, it sets CPU to group 1. /* Reset is always zero. CFGPG can only be set if the code that sets it is in Group 0 */ CFGPGbits.CPUPG = 0; /* System bus write permission is given to Group 0 only */ SBT0WR0 = 0x1; SBT0WR1 = 0x1; /* PFM Write Group Permission */ SBT1WR0 = 0x7; /* 0,1,1,1: Allows Group 0, 1 and 2 like other defaults */ /* BFM read/write permission */ SBT1REG3bits.BASE = 0x1FC00000 >> 10; /* Boot Flash start address */ SBT1REG3bits.SIZE = 0xA; /* Entire Boot Flash */ SBT1RD3 = 0x7; /* Allow read access by Group 0, 1 and 2 */ SBT1WR3 = 0x1; /* Allow write access by Group 0 only */ Before jumping to the application, do this CFGPGbits.CPUPG = 1; /* Set CPU to Group 1 */ |
|
|
|
只有小组成员才能发言,加入小组>>
5160 浏览 9 评论
1998 浏览 8 评论
1927 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3170 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2225 浏览 5 评论
729浏览 1评论
613浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
503浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
628浏览 0评论
526浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-22 12:10 , Processed in 1.282550 second(s), Total 86, Slave 69 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号