完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
|
我正在为一个DSPIC33 EV128GM102编写一个自定义引导加载程序,它基本上运行良好,直到我在HEX文件中得到以下几行::020000 0402F8:10938、4000、F0500、000、000、000、000、000、000、000、000、000、000、000、000、000、000、000、000、000、000、000、000、000、000、000、000、000、000、000、000、0、85、0、0、0、0、0、2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 85,这些数据应从程序地址0x149C2(字节地址0x29 380)开始写入,但应改为它写在程序地址0x149c0。我已经通过了代码,所有的东西看起来都是正确的,直到它实际写入数据(我将在底部附加代码)。所以我有2个问题。首先,我是否遗漏了什么东西,或者在这个地址不可能开始双字写入操作?我想我可以从任何一个地址开始。其次,如果不可能,那么编译器为什么要从这个地址开始定位一个部分?有没有一种简单的方法来阻止它呢?这里是写函数。我正在通过地址0x149c2./*获取闪存位置的页面和偏移来写入*/ut1616t偏移=(Unt16-t)((地址)和0xFFFFU);Uti1616T页=(UTI1616T)((地址& gt;& 16t)和0xFFFFU);/*设置指针到NVM位置开始编程*/NVMADRU=页;NVMADR= OffSE具有写入值*/tBLPAG=0xFA的锁存器;γ-Bug TynIn TBLWTL(0,LSW1);γ-BuuTiTiNi TBLWTH(0,MSW1);γ-BuuTiTnIn TBLWTL(2U,LSW2);α-Bug TynIn TBLWTH(2U,MSW2);NVMCON=Studio Word;SETION和SaveSub CPUIL IPL(SaveDay-IPL,7);荷载;荷载
以上来自于百度翻译 以下为原文 I am writing a custom bootloader for a dsPIC33EV128GM102 and it is mostly working fine until I get to the following lines in the hex file: :020000040002F8 :109384004F05000000000000000000000000000085 Here, the data should be written starting at program address 0x149C2 (byte address 0x29380) but instead it writes it at program address 0x149C0. I've stepped through the code and everything looks right until it actually writes the data (I'll attach code at the bottom). So I have 2 questions. First, am I missing something or is it not possible to start a double word write operation at this address? I thought I could start at any even address. Second, If it's not possible then why does the compiler locate a section starting at this address? Is there a simple way to prevent it from doing this? Here is the write function. I am passing the address of 0x149C2. /* Get page and offset of Flash location to write */ uint16_t offset = (uint16_t)((address) & 0xFFFFu); uint16_t page = (uint16_t)((address >> 16u) & 0xFFFFu); /* Setup pointers to NVM location to start programming */ NVMADRU = page; NVMADR = offset; /* Load Latches with the write values */ TBLPAG = 0xFA; __builtin_tblwtl(0, lsw1); __builtin_tblwth(0, msw1); __builtin_tblwtl(2u, lsw2); __builtin_tblwth(2u, msw2); NVMCON = PROGRAM_WORD; SET_AND_SAVE_CPU_IPL(saved_ipl, 7); __builtin_write_NVM(); RESTORE_CPU_IPL(saved_ipl); |
|
相关推荐
3个回答
|
|
|
也许你错过了一些东西。我假设0x149c2(Word)等于0x9894(字节不是0x29 380)-这正是HEX记录中的内容。在引导加载程序的地址计算中有一些错误?
以上来自于百度翻译 以下为原文 Maybe you missed something. I assume 0x149C2 (word) equals 0x29384 (byte - not 0x29380) - and this is exactly what's in the hex records given. Some error in the address calculations of your boot loader ? |
|
|
|
|
|
是的,我弄错了。它应该是写在字节0x29 38(或字0x149c2),实际上是写入字节0x29 830(或字0x149c0)。当我通过时,地址似乎进入了正确的寄存器。整个程序的其余部分(除了这一部分是唯一一个与第四字节对齐的部分)正在正确编写。
以上来自于百度翻译 以下为原文 Yes, my mistake. It is supposed to be writing at byte 0x29384 (or word 0x149C2) and is in fact writing at byte 0x29830 (or word 0x149C0). The addresses seem to be going into the registers correctly when I step through. And the entire rest of the program (except for this one section that is the only one aligned to the 4th byte) is writing correctly. |
|
|
|
|
|
仍然在你的打字中交换数字。0x29 830应该是0x29 380。
以上来自于百度翻译 以下为原文 Still getting digits swapped in your typing. 0x29830 should have been 0x29380 |
|
|
|
|
只有小组成员才能发言,加入小组>>
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
503 浏览 0 评论
5812 浏览 9 评论
2350 浏览 8 评论
2237 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3544 浏览 3 评论
1161浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
1122浏览 1评论
我是Microchip 的代理商,有PIC16F1829T-I/SS 技术问题可以咨询我,微信:A-chip-Ti
890浏览 1评论
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
508浏览 0评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-14 13:33 , Processed in 1.064607 second(s), Total 78, Slave 61 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
3665