完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
大家好!我正在编程一个PIC32 MK0512GPE064,我已经有两个工作项目:BooLoad应用程序在MPLAB X i中创建了两个项目,作为“32位MPLAB和谐项目”。有了和谐,我没有选择“Bootloader库”选项。我只是把这两个项目编程为普通项目。在Bootloader中,我已经包含了一个跳转到应用程序,它应该被放置在一个定义的地址。现在,我想修改默认链接器脚本,以便将源代码分开,并将应用程序代码放置在一个定义的地址。这个想法如下:自己定义的内存区域大小应用休眠的可用内存储备0x1000数据区域3 0x1000数据区域2 0x1000 DAT区域1 0x1000引导加载程序0x400 0i将引导引导程序代码放在引导闪存区域,以避免引导程序可以被应用程序覆盖,但这不是必须的。两个项目的T和我保存在扩展名为“.LD”的文件中。我已经将文件添加到相应的项目中,并且我修改了以下内容来尝试执行上述任务(同时尝试在Bootloader和应用程序中设置程序Flash KSGE0)。在Bootloader内存中修改的行{/*******************,将KSG00SuffyTyMem的长度设置为0x4000,因为*是引导加载程序的保留长度。如果引导加载程序的大小超过这个长度,它将引发一个错误。***************************************************************************************************************************************************************************************************************************************************************************************************************:Orth= 0x9D90000,长度=0x8000×*/KSt00SudioMym(Rx):Orth= 0x9D00亿,长度=0x4000在应用程序/*中提供的修改行。000000);*/Provices(*eBaseAdvase= 0x9D000 A000);/*KSG00ProjyMeX(RX):Orth= 0x9D90000,长度=0x8000×*/KSe00ProjyMeX(Rx):Orth= 0x9D000 A000,长度=0x7600i,未提及两个项目的配置位相同。折叠工程作为可装载工程。如果我执行调试会话,引导加载程序工作,即使在引导程序跳转之后,我也可以在应用程序中进行调试。但是,在某一行上,它会再次意外地跳转到引导加载程序,并在某个函数上永远等待。如果我尝试编程PIC,我会得到以下错误:“创建统一的HEX文件”(944)地址XXXXXX之间的数据冲突在…/Appultual.HEX和…/BooLoad .HiXi怀疑另一个内存区域应该在闪存上移动,但是我已经尝试过没有成功地完成它。非常感谢您的帮助,谢谢您。
以上来自于百度翻译 以下为原文 Hello everyone! I am programming a PIC32MK0512GPE064 and I have already two working projects:
Now, I would like to modify the default linker script in order to separate both source codes and to place the application code at a defined address. The idea is the following: OWN DEFINED MEMORY REGION SIZE application rest of the available memory reserve 0x1000 data region 3 0x1000 data region 2 0x1000 data region 1 0x1000 bootloader 0x4000 I would like to place the bootloader code at the Boot Flash Area, in order to avoid that the bootloader can be overwritten by the application, but this is not a must. I used -verbose to see the default linker script of both projects and I saved it at files with extension ".ld". I have added the files to the corresponding projects and I have modified the following to try to do the mentioned task (while trying to place bootloader and application at programm flash kseg0). Modified lines at the bootloader MEMORY { /*************************************************************** * The length of kseg0_program_mem will be set to 0x4000, because * that is reserved length for the bootloader. It will throw * an error if the bootloader size exceedes this length. ****************************************************************/ /*kseg0_program_mem (rx) : ORIGIN = 0x9D000000, LENGTH = 0x80000*/ kseg0_program_mem (rx) : ORIGIN = 0x9D000000, LENGTH = 0x4000 Modified lines at the application /*PROVIDE(_ebase_address = 0x9D000000);*/ PROVIDE(_ebase_address = 0x9D00A000); /*kseg0_program_mem (rx) : ORIGIN = 0x9D000000, LENGTH = 0x80000*/ kseg0_program_mem (rx) : ORIGIN = 0x9D00A000, LENGTH = 0x76000 I have not mentioned that the configuration bits of both projects are identical. Then I add the bootloader project at the application project as a loadable project. If I execute a debug session, the bootloader works and I can debug even at the application after the jump from the bootloader. However, at a certain line, It makes an unexpected jump to the bootloader again and waits forever at a certain function. If I try to program the PIC, I get the following error: "Creating unified hex file" (944) data conflict at address XXXXXX between .../application.hex and .../bootloader.hex I suspect that another memory regions should be shifted at the flash memory, but I have already tried to do it without success. I would appreciate your help very much. Thank you in advance. |
|
相关推荐
13个回答
|
|
|
谷歌搜索指向我的Apttp://www. McCHIP.COM/FUMMS/FUNDSPAS/854 168
以上来自于百度翻译 以下为原文 google search points me at http://www.microchip.com/forums/FindPost/854168 |
|
|
|
|
|
我不熟悉MK家族,但它的整体记忆布局看起来非常像MZ家族。既然你有向量表(yeBasyAdvector)设置在9D0YA000上,这也是KSG00SuffyTyMeM区域的开始,那么你在哪里放置重置向量和C启动代码?如果您查看默认链接器脚本中的区段命令,您会看到。Read是复位向量,ReSET.START是C启动代码。
以上来自于百度翻译 以下为原文 I am not familiar with the MK family but its overall memory layout looks very like the MZ family. Since you have the vector table (_ebase_address) set at 9D00_A000, which is also the very beginning of the kseg0_program_mem region, then where do you place the reset vector and C startup code? If you look the SECTION command in the default linker script, you'll see SECTIONS { /* Boot Sections */ .reset _RESET_ADDR : { KEEP(*(.reset)) KEEP(*(.reset.startup)) } > kseg1_boot_mem .reset is the reset vector and .reset.startup is the C startup code. |
|
|
|
|
|
这取决于引导程序的大小。可以将较低的启动别名和上引导别名组合在一起。从图4-3的数据表,如果你结合这两个领域,它将给你一个范围之间1fc00000 -1fc2y4fff,减去预留区域之间1fc05000和1fc1fffff,你得到40K-ISBFM空间为你的Bootloader。
以上来自于百度翻译 以下为原文 It depends upon the size of your bootloader. It is possible to combine the Lower Boot Alias and the Upper Boot Alias together. From Figure 4-3 of the datasheep, if you combine both areas, it will give you a range between 1FC0_0000 - 1FC2_4FFF, subtracting the reserved region between 1FC0_5000 and 1FC1_FFFF, you get 40K-ish BFM space for your bootloader. |
|
|
|
|
|
谢谢你回答AsCH0866。我的引导装载器的大小小于0x4000。我想预订0x4000。
以上来自于百度翻译 以下为原文 Thank you for answering aschen0866. The size of my bootloader is smaller than 0x4000. I would like to reserve 0x4000 for it. |
|
|
|
|
|
非常感谢你的帮助。我认为这是一个很好的问题,答案很可能会解决我的问题。我不知道在哪里放置重置向量和启动代码,以及如何。当前冲突发生的地址是0x1FC000 028。如果我在图4-1查看数据表“PIC32 MKGP/MC系列”,这个地址位于“保留”区域。
以上来自于百度翻译 以下为原文 Thank you very much for your help. I think, that is a good question, and the answer would probably solve my problem. I do not know where should I place the reset vector and the startup code, and how. The address, where the current conflict occurs is 0x1FC00028. If I look at the data sheet "PIC32MK GP/MC Family" at Figure 4-1, this address is at a "reserved" region. |
|
|
|
|
|
您需要检查两个项目的.map文件。.map文件深深埋在这些项目文件夹中的一个文件夹中。但是,您可以转到ProjtProjks:G.XC32 LD和GT诊断,点击与“生成MAP文件”相关联的3个点的按钮,并将.map文件带到您想要的文件夹中。您可以将SyReStEdAdDR设置为9d00 yA000,并将yBaseX地址更改为9d00×B000(EBASE需要在4K边界),然后更改RESET输出部分的节命令,如果您已经在内存命令中定义了KSEG1XBOOTYMEM,则可以简单地将其位置和大小调整为0xBD00。A000和0x1000。
以上来自于百度翻译 以下为原文 You need to check the .map file for both of your projects. The .map file is buried deep inside one of those project folders. However, you can go to Project Properties ->xc32-ld -> Diagnostics, click on the button with 3 dots associated with "Generate map file" and bring the .map file to the folder you want it to be. Use your current application linker script as an example. You could set _RESET_ADDR to 9D00_A000 and change _ebase_address to 9D00_B000 (ebase needs to be at 4K boundary), then change the SECTION command for the .reset output section to SECTIONS { /* Boot Sections */ .reset _RESET_ADDR : { KEEP(*(.reset)) KEEP(*(.reset.startup)) } > kseg0_program_mem ... If you already have kseg1_boot_mem defined in the MEMORY command, you could simply adjust its location and size to 0xBD00A000 and 0x1000. |
|
|
|
|
|
在您指出的更改之后,我在地址0x1fc00中找到了一个错误,您可以在其中找到“.*Debug”异常。我不知道为什么在这里找到这个部分,因为我已经在应用程序链接器脚本中写下了这一部分:因为它的属性与内存区域“KSt00SudithMeMy”(Rx)不匹配,所以这个部分可能被放置在0x1FC0480。我在Bootloader链接器脚本和应用程序链接器脚本中进行了修改。您可以在附加文件中看到修改的链接器脚本(我修改了从LD到.txt的文件扩展名来上传文件)。SKE1IB BooToMeMm的SED改变从To如果“重置”部分被修改为放置在KSG00SuffyTym MEM上,为什么我要修改KSK1Y-BoToTuMeMm?总而言之,我在默认链接器脚本中做的更改行吗?如果不是,我做错了什么?非常感谢你。
BooTnCKScript .L.TXT(56.06 KB)-下载71次 以上来自于百度翻译 以下为原文 After the changes you have indicated, I get an error at address 0x1FC00488, where you can find the section "._debug_exception". I do not know why this section is found here, because I had written the following at the application linker script: _DBG_EXCPT_ADDR = 0x9D00A480; This section has been probably placed at 0x1FC00480 because of its attributes does not match the ones of the memory region "kseg0_program_mem", which are (rx). I have indicated the lines which I modified at the bootloader linker script and at the application linker script. You can see the modified linker scripts at the attached files (I modified the file extension from .ld to .txt to upload the files).
I was also wondering about the proposed change of kseg1_boot_mem from kseg1_boot_mem : ORIGIN = 0xBFC20000, LENGTH = 0x490 to kseg1_boot_mem : ORIGIN = 0xBD00A000, LENGTH = 0x1000 If the SECTION ".reset" is modified to be placed at kseg0_program_mem, why should I modify kseg1_boot_mem? To sum up, are the changes that I did at the default linker scripts ok? If not, what am I doing wrong? Thank you very much in advance. Attachment(s) appLinkerScript.ld.txt (57.19 KB) - downloaded 64 times bootLinkerScript.ld.txt (56.06 KB) - downloaded 71 times |
|
|
|
|
|
试试这两个。请记住,不能像应用程序一样使用应用程序链接器脚本调试应用程序。
AppLin Script Stulp.L.D.TXT(55.68 KB)-下载87次 以上来自于百度翻译 以下为原文 Give these two a try. Keep in mind that you can't debug your application using the application linker script as-is. Attachment(s) bootLinkerScript_example.ld.txt (55.95 KB) - downloaded 106 times appLinkerScript_example.ld.txt (55.68 KB) - downloaded 87 times |
|
|
|
|
|
你的文件工作得很好!非常感谢你!让我来解释一下这些更改,如果我错了请纠正我。在默认的引导加载程序链接器脚本中更改:内存区域KSG00SypLyMy的大小已经从0x8000变为0x4000,以便为引导装载程序代码设置一个限制,并且确保它不会增长更多。内存区域Debug GoEXECUMYMEM的起源已经从0x9FC20490变成了0xBFC0490(这是主要原因吗?)默认应用程序链接器脚本中的更改:地址“yReSeTyAdDR”已从0xbfc000改为0x9d000 A000,以便在KSG00SudithMeMy内存区域的开始处放置Seop.Read,以避免与该节重叠。引导加载程序的重置。(是否也可以放置部分?在Bootloader之后重置应用程序?)地址“Y-BeViExpPTIADDR”已从0xBFC0380改为0x9DA3A80,只是将其与默认链接器脚本的“yReSeTyAdDr”匹配。地址“ydBgxExpPTIADDR”已从0xBFC0480改为0x9DAA480,只是匹配到默认链接器SCR的“yReSeTyAdDr”的距离。IPTT.内存区域KSt00SudithMeM已从0x9D900M0移动到0x9D000 A000,以保留引导程序和其他应用程序数据的某个地方。由于这个“移位”,它的长度已经减少到0x76000。KSK1Y-Bootmim被删除,因为它将不被使用。章节。Read和BevExExpTh已经从KSK1Y-BOOTTYMEM移动到KSK00SUPLE程序MMEM,以避免与引导加载程序的重叠。非常感谢。你的时间。
以上来自于百度翻译 以下为原文 Your files work great! Thank you ver much!! Just let me try to explain the changes and please correct me if I am wrong.
Thank you very much for your time. |
|
|
|
|
|
1)B-编译器提供的PIC32 MK0512GPE064默认链接器脚本看起来有点奇怪,因为它偏离了Microchip通常的做法。它使用BF1地址,而不是较低的启动别名/上引导别名地址,用于内存命令中的Debug GoReXixMym和KSe11BooToMeMm。2)-BFC0UL000始终是硬件重置地址。在任何重置时,您希望引导加载程序首先运行,因此您将“真实”重置地址提供给引导加载程序。9DYAYA000只是应用程序的入口点。重置(复位向量)输入部分执行到.RESET启动(启动代码)。在Bootloader的.RESET输出部分之后,您不想放置应用程序的.RESET输出部分(我想这就是您的意思)。这是因为每次运行更改项目时,C运行时启动代码都会发生更改。将这段代码放在与Bootloader相同的Flash页面中是不安全的。B,C -它们只是占位符。这些异常向量必须在BFC0A0380和BFC0Y0480上才能真正工作。在组合Bootloader +应用程序代码中,如果这些异常中的任何一个发生在应用程序中,代码将在Bootloader中而不是应用程序中着陆。D- I使用9DYAYA000作为应用程序的起点,基于您所张贴的应用程序链接器脚本。如果没有别的东西,你可以把它改为9D04000,这样它就在引导加载程序之后。E,F -这是因为,对于应用程序,KSK1Y-BooToMeMm和KSe00SuffyTym MEM都在PFM中,这是一个连续的存储空间。在Bootloader示例中,您希望使用BFM进行重置和启动代码,这就是为什么必须定义一个单独的内存区域。
以上来自于百度翻译 以下为原文 1) b - The default linker script for the PIC32MK0512GPE064 provided by the compiler looks a bit strange as it deviates from Microchip's usual practice. It uses the BF1 addresse, instead of the Lower Boot Alias/Upper Boot Alias address, for debug_exec_mem and kseg1_boot_mem in the MEMORY command. 2) a - BFC0_0000 is always the hardware reset address. Upon any reset, you want the bootloader to run first, so you give the "real" reset address to the bootloader. 9D00_A000 is just the application's entry point. The .reset (the reset vector) input section takes the execution to .reset.startup (the startup code). You wouldn't want to place the application's .reset output section (I think that's what you mean) right after the bootloader's .reset output section. This is because the C run time startup code changes each time you change your project. It would be unsafe to put this piece of code in the same Flash page as the bootloader. b, c - They are just placeholders. These exception vectors MUST be at BFC0_0380 and BFC0_0480 for them to really work. In the combined bootloader + application code, if any one of these exceptions happens in the application, the code would land in the bootloader not the application. d - I use 9D00_A000 as the starting point of the application based upon the application linker script you posted. If nothing else, you could change it to 9D00_4000 so that it is right after the bootloader. e, f - That's really because for the applicaiton, kseg1_boot_mem and kseg0_program_mem are all in the PFM, a contiguous memory space. In the bootloader example, you want to utilize the BFM for the reset and startup code, that's why you have to have a separate memory region defined. |
|
|
|
|
|
谢谢AsCH0866,这些信息对我和其他人都很有用。你知道是否可以同时调试引导加载程序和应用程序?我用我上传的链接器脚本完成了这个操作,但是应用程序在执行了一些指令之后,意外地跳转到引导加载程序。
以上来自于百度翻译 以下为原文 Thank you aschen0866, that information will be very useful for me and for other people. Do you know if it is possible to debug the bootloader and the application at the same time? I did it with linker scripts that I uploaded, but the application made an unexpected jump to the bootloader after executing successfully some instructions. |
|
|
|
|
|
我从来没有做过这个项目,因为我不使用MPLABX的可加载特性。假设Bootloader是主要项目,我想如果将应用程序的.elf文件(而不是.HEX文件)添加为可加载文件,则应该能够同时使用这两段代码运行调试会话。确保应用程序具有XC32 gcc-gt;通用& gt;在生产生成中有符号“检查”。
以上来自于百度翻译 以下为原文 I have never done this on projects I have worked on because I don't use MPLABX's loadable feature. Assuming the bootloader is the main project, I suppose if you add the application's .elf file (instead of the .hex file) as the loadable file, you should be able to run a debug session with both pieces of code together. Make sure the application has xc32-gcc->General->"Have symbols in production build" checked. |
|
|
|
|
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
473 浏览 0 评论
5793 浏览 9 评论
2334 浏览 8 评论
2224 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3530 浏览 3 评论
1124浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
1095浏览 1评论
我是Microchip 的代理商,有PIC16F1829T-I/SS 技术问题可以咨询我,微信:A-chip-Ti
873浏览 1评论
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
475浏览 0评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-2 04:51 , Processed in 1.331667 second(s), Total 96, Slave 79 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
1444