完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我在PIC30F5015上运行,我想为我的API设置一个引导加载程序。然而,我的问题是它是否能够告诉编译器在闪存中从一个指定的地址开始运行引导加载。换句话说,我想保留内存的一部分,这样我就不会擦除我的引导加载程序。棘手的部分是,我希望保留一个完整的源文件(.c),其中引导引导器位于我的引导闪存中,并在启动过程开始时从它开始运行。我发现解决这个问题的最接近的方法是在Flash中使用宏FrimeMeor预留,但是这个MAR。Co(Sy-AtditType)只能保留一个特定的函数或变量,如代码Belo.ValueAyAtditTyx((空间(Prog),地址(StasdAdDrFlash程序))Bootloader()//DootBootloader玩意儿}如果有人想到如何使用宏在Maplab ProjestStutsServer中设置这个,请让我知道。谢谢你抽出时间/ Oskar
以上来自于百度翻译 以下为原文 I'm running on a pic30f5015 and I want to setup a bootloader for my api. However, my question is whether its possible to somehow tell the compiler start running the bootload from a specifik adress in the flash. In other words, I want to reserv some part of the memory so I don't erase my bootloading program. The tricky part is that I wish to reserv a whole source file (.c) where my bootloader is located and store into the reserved flash and start running from it when my booting process starts. The closest way I found to solve this problem was to use macros for memory reservation in the flash, but this marco (__attribute__) can only reserv a specific function or variable like the code below. void __attribute__ ((space(prog), address(START_ADDR_FLASH_PROGRAM))) bootloader(){ // do bootloader stuff } If anyone have an idea of how to setup this in Maplab project settings or using macros, please let me know. Thanks for taking your time// Oskar |
|
相关推荐
5个回答
|
|
你看过Microchip现有的Bootloader项目吗?为此需要自定义链接器文件。
以上来自于百度翻译 以下为原文 Have you looked at existing Bootloader projects by Microchip? You need custom linker files for this |
|
|
|
链接器方法很简单:在我的引导加载程序中,IVT是由程序控制的,发生的是BL被地址属性放置在IVT之后的页面上。为了防止IVT和页结束之间的空间使用一个const数组。因为在Bootloader中不使用中断,所以没有问题。-复位向量总是被改变为指向引导加载程序。然后引导加载程序在需要的地址(例如0x4000)下检查是否存在应用程序重置向量。如果不存在,则无限期地等待新的HEX下载,如果存在,则重置BL所使用的所有数据并跳转到应用程序重置向量。应用程序启动例程将删除剩余的剩余部分以使编译器不使用内存,最好的方法是告诉内存不在那里,最好是通过链接器脚本完成。您从项目中获取.gLD文件并创建它的副本。在新文件中,您必须找到一个包含“程序(XR)”的行,并将其更改为示例文件。将其添加到链接器文件FLDR.COMPILL上的项目上。这只是一种方式,如果您想在内存中间留一个孔,则可能创建多个部分。例如,我不知道…
以上来自于百度翻译 以下为原文 The linker method made simple: -in my bootloader the IVT is controlled by the program, what happens is that the BL is placed on the page after the IVT by the address attribute. to prevent the space between IVT and end of page from using an array of const is placed there. Since i don't use interrupts in the bootloader, no problems there. -the reset vector is always changed to be pointing at the bootloader. then the bootloader checks at the required address (for example 0x4000) if the application reset vector is present. -if not present, wait indefinetly for a new hex to download -if present, reset all data used by the BL and jump to the application reset vector. app startup routine will delete the rest of leftovers to make it so that the compiler doesn't use the memory, the best way is to tell it that the memory isn't there, and that's best accomplished by the linker script. you take the .gld file from your project and create a copy of it. in the new file you will have to find a line containing "program(xr)" and change it for example /* Original: program (xr) : ORIGIN = 0x200, LENGTH = 0x2A980 Modified: */ program (xr) : ORIGIN = 0x4000, LENGTH = 0x26B80 save the file. add it on your project on the linker file folder. compile. this is just one way to do it, it's probably possible to create multiple sections if you want to leave a hole in the middle of memory for example, i don't know.. |
|
|
|
Bootloader通常用两个独立的项目来完成,其中两个独立的非重叠链接器脚本,而在项目中作为一个特殊的功能来做它将在理论上是可能的,它会带来一些挑战。该功能需要在全Flash页面上。有一个引导加载应用程序注释,MCC有Bootloader支持。
以上来自于百度翻译 以下为原文 A Bootloader is normally Done as two separate projects with two separate non overlapping Linker scripts. While doing it as a special function in the project would be theoretically possible, it would present several challenges. Number one would be you could not use any shared C libraries 2. The function would need to be on full flash pages. There is a Bootloader app Note, and MCC has bootloader support. |
|
|
|
|
|
|
|
事实上,当Flash被擦除的时候,我也不确定调试器会完美地工作,甚至在其他领域…
以上来自于百度翻译 以下为原文 I am actually not "sure-sure" that debugger will work flawlessly when Flash is erased, even in (of course) other areas... |
|
|
|
只有小组成员才能发言,加入小组>>
5248 浏览 9 评论
2036 浏览 8 评论
1956 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3217 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2264 浏览 5 评论
786浏览 1评论
677浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
603浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
684浏览 0评论
581浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-27 05:38 , Processed in 1.641194 second(s), Total 88, Slave 71 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号