完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,我想让它工作在一个SD引导程序中,我使用了一个叫做“BootLootsPIC32”的例子(我找不到下载它的链接)。它发生了一些奇怪的事情:在我删除Flash之后,它说在应用程序地址中有一个有效的应用程序。我使用了DSPIC33 EP512GP506MPLAB。X IDE V3.51、XC16 V1.26和MCC V3.23.2.EraseFlash和ValueAppHealthStudio BooDrad GLD FLIMEMAN APP GLD文件您有什么可能发生的想法?也许我错了GLD文件,我很困惑,当我不得不修改。提前感谢。
以上来自于百度翻译 以下为原文 Hi, I'm trying to make it working a sd bootloader and I'm using part of the example called "Bootloadders PIC32" (I can't find the link where I downloaded it). It happens something strange: After I erased the flash, it says there is a valid app present in the app address. I use dsPIC33EP512GP506 MPLAB X IDE v3.51, XC16 v1.26 and MCC v3.26.2. EraseFlash and ValidAppPresent functions #define PROGRAM_FLASH_END_ADRESS (0x8000+BMXPFMSZ-1) #define APP_FLASH_BASE_ADDRESS 0x8000 #define APP_FLASH_END_ADDRESS PROGRAM_FLASH_END_ADRESS #define USER_APP_RESET_ADDRESS 0xD000 void EraseFlash(void){ void * pFlash; UINT result; INT i; #define BMXPFMSZ 0xA000 // Program Flash Size Register pFlash = (void*)APP_FLASH_BASE_ADDRESS; for( i = 0; i < ((APP_FLASH_END_ADDRESS - APP_FLASH_BASE_ADDRESS + 1)/FLASH_PAGE_SIZE); i++ ){ result = NVMemErasePage( pFlash + (i*FLASH_PAGE_SIZE) ); // Assert on NV error. This must be caught during debug phase. if(result != 0){ // We have a problem. This must be caught during the debug phase. while(1); } } } BOOL ValidAppPresent(void){ volatile UINT32 *AppPtr; AppPtr = (UINT32*)USER_APP_RESET_ADDRESS; // If vector has some value other than 0xFFFFFFFF then is a valid app if(*AppPtr == 0xFFFFFFFF){ // <- Always TRUE return FALSE; }else{ return TRUE; } } Bootlader gld file MEMORY { data (a!xr) : ORIGIN = 0x1000, LENGTH = 0xC000 reset : ORIGIN = 0x0, LENGTH = 0x4 program (xr) : ORIGIN = 0x200, LENGTH = 0x6A9A FICD : ORIGIN = 0x557F0, LENGTH = 0x2 FPOR : ORIGIN = 0x557F2, LENGTH = 0x2 FWDT : ORIGIN = 0x557F4, LENGTH = 0x2 FOSC : ORIGIN = 0x557F6, LENGTH = 0x2 FOSCSEL : ORIGIN = 0x557F8, LENGTH = 0x2 FGS : ORIGIN = 0x557FA, LENGTH = 0x2 FUID0 : ORIGIN = 0x800FF8, LENGTH = 0x2 FUID1 : ORIGIN = 0x800FFA, LENGTH = 0x2 FUID2 : ORIGIN = 0x800FFC, LENGTH = 0x2 FUID3 : ORIGIN = 0x800FFE, LENGTH = 0x2 } Main app gld file MEMORY { data (a!xr) : ORIGIN = 0x1000, LENGTH = 0xC000 reset : ORIGIN = 0xD000, LENGTH = 0x4 ivt : ORIGIN = 0x4, LENGTH = 0x1FC program (xr) : ORIGIN = 0x8000, LENGTH = 0xB8BA FICD : ORIGIN = 0x557F0, LENGTH = 0x2 FPOR : ORIGIN = 0x557F2, LENGTH = 0x2 FWDT : ORIGIN = 0x557F4, LENGTH = 0x2 FOSC : ORIGIN = 0x557F6, LENGTH = 0x2 FOSCSEL : ORIGIN = 0x557F8, LENGTH = 0x2 FGS : ORIGIN = 0x557FA, LENGTH = 0x2 FUID0 : ORIGIN = 0x800FF8, LENGTH = 0x2 FUID1 : ORIGIN = 0x800FFA, LENGTH = 0x2 FUID2 : ORIGIN = 0x800FFC, LENGTH = 0x2 FUID3 : ORIGIN = 0x800FFE, LENGTH = 0x2 } Have you any idea of what can be happened? Maybe I'm wrong with the gld files, I was so confused when I had to modified. Thanks in advance. |
|
相关推荐
9个回答
|
|
|
|
|
|
|
|
|
|
在ValidAppPresent中,在调试时*APPPTR= 0x000 FFUL000当它必须是0xFFFFFFF时。
以上来自于百度翻译 以下为原文 In ValidAppPresent, in debug *AppPtr = 0x00FF0000 when it has to be 0xFFFFFFFF. |
|
|
|
|
|
|
|
没人?有人能告诉我如何擦除闪光灯吗?
以上来自于百度翻译 以下为原文 Nobody? Can someone tell me how to erase the flash? |
|
|
|
您好,我建议您检查来自微芯片的通用引导加载程序,称为EZBL,它能够为大多数16位设备生成引导加载程序(Pic24&Apple;DSPIC33):HTTP://www. MicroPC.COM/EZBLY,关于Flash编程,每个PIC/DSPIC都有一个称为编程规范的文档。详细说明如何编写Flash存储器
以上来自于百度翻译 以下为原文 Hi, I recommend you check the universal bootloader from Microchip called EZBL which is able to generate bootloaders for most 16 bits devices (PIC24 & dsPIC33) : http://www.microchip.com/EZBL Regarding flash Programming, each PIC/dsPIC has a document called Programming Specification which describes in details how to program the flash memory Regards |
|
|
|
嗨,RISC!谢谢你的回复。我有一点进步,我发现问题(或者其中之一)是来自NVMCON的WR位总是0。我用这个:有人知道为什么会这样吗?
以上来自于百度翻译 以下为原文 Hi RISC! Thanks for the reply. I have advance a little and I discovered that the problem (or one of them) is that WR bit from NVMCON is always 0. I use this: UINT NVMemErasePage(void* address){ UINT res; // Convert Address to Physical Address NVMADR = KVA_TO_PA((unsigned int)address); DWORD_VAL eraseAddress; eraseAddress.Val = address; TBLPAG = eraseAddress.byte.UB; NVMADRU = eraseAddress.word.HW; NVMADR = eraseAddress.word.LW; res = NVMemOperation(NVMOP_PAGE_ERASE); ///NVMOP_PAGE_ERASE defined as 0x4003 return res; } UINT __attribute__((nomips16)) NVMemOperation(UINT nvmop){ int int_status; // Disable DMA & Disable Interrupts #ifdef _DMAC int_status = INTDisableInterrupts(); susp = DmaSuspend(); #else int_status = DisableIntT1; //INTDisableInterrupts() #endif // _DMAC // Enable Flash Write/Erase Operations NVMCON = NVMCONbits.WREN | nvmop; // Data sheet prescribes 6us delay for LVD to become stable. // To be on the safer side, we shall set 7us delay. //delay_us(7); NVMKEY = 0xAA;//996655; NVMKEY = 0x55;//6699AA; NVMCONbits.WR = 1; //It doesn't work. WR is always 0 // Wait for WR bit to clear while(NVMCONbits.WR); // Disable Flash Write/Erase operations NVMCONbits.WREN = 0; #ifdef _DMAC DmaResume(susp); INTRestoreInterrupts(int_status); #else SetPriorityIntT1(int_status); //INTRestoreInterrupts #endif // _DMAC // Return Error Status return(NVMemIsError()); } Has anyone an idea why is this happening? |
|
|
|
你怎么知道的?它将只在操作发生时保持设置,因此不可能用调试器看到它高。操作将完成,并且在调试器再次读取之前,WR将返回到0。
以上来自于百度翻译 以下为原文 How do you know? It will only stay set while the operation is taking place, so it's impossible to see it high with a debugger. The operation will finish, and WR will return to 0 before the debugger reads it again. |
|
|
|
你怎么知道的?它将只在操作发生时保持设置,因此不可能用调试器看到它高。操作将完成,并且在调试器再次读取之前,WR将返回到0。然后我错了,我在使用调试器,但是我不知道我不能用它读WR。谢谢你的信息。
以上来自于百度翻译 以下为原文 How do you know? It will only stay set while the operation is taking place, so it's impossible to see it high with a debugger. The operation will finish, and WR will return to 0 before the debugger reads it again. Ops. Then I was wrong, I was using the debugger but I didn't know I can't read WR with it. Thank you for the information. |
|
|
|
只有小组成员才能发言,加入小组>>
5237 浏览 9 评论
2026 浏览 8 评论
1950 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3201 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2253 浏览 5 评论
771浏览 1评论
659浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
588浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
670浏览 0评论
571浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-20 22:37 , Processed in 1.394554 second(s), Total 94, Slave 78 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号