完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
本帖最后由 一只耳朵怪 于 2018-6-11 12:00 编辑
大家好: 最近我发现我在BootLoader里面写入数据到程序的运行期间。发现写入全部失败。代码: while(ui32FlashAddr > len + TFTP_BLOCK_SIZE) [ ui32FlashAddr = ((g_ui32TFTPBlock - 1) * TFTP_BLOCK_SIZE) + APP_START_ADDRESS; W25QXX_Read(pui8Packet,UPGRADE_FLASH_ADDR + TFTP_BLOCK_SIZE,TFTP_BLOCK_SIZE); if(ui32FlashAddr < g_ui32FlashEnd) [ // // If this is the first block and we have been provided with a start // hook function, call it here to indicate that we are about to begin // flashing a new image. // #ifdef BL_START_FN_HOOK if(g_ui32TFTPBlock == 1) [ BL_START_FN_HOOK(); ] #endif // // Clear any flash error indicator. // BL_FLASH_CL_ERR_FN_HOOK(); // // If this is the first data packet and code protection is enabled, // then erase the entire flash. // #ifdef FLASH_CODE_PROTECTION if(g_ui32TFTPBlock == 1) [ // // Loop through the pages in the flash, excluding the pages that // contain the boot loader and the optional reserved space. // for(ui32Idx = APP_START_ADDRESS; ui32Idx < g_ui32FlashEnd; ui32Idx += FLASH_PAGE_SIZE) [ // // Erase this block of the flash. // BL_FLASH_ERASE_FN_HOOK((ui32Idx); ] ] #else // // Flash code protection is not enabled, so see if the data in this // packet will be programmed to the beginning of a flash block. We // assume that the flash block size is always a multiple of 1KB so, // since each TFTP packet is 512 bytes and that the start must always // be on a flash page boundary, we can be sure that we will hit the // start of each page as we receive packets. // if(!(ui32FlashAddr & (FLASH_PAGE_SIZE - 1))) [ // // Erase this block of the flash. // BL_FLASH_ERASE_FN_HOOK(ui32FlashAddr); ] #endif // // Decrypt the data if required. // #ifdef BL_DECRYPT_FN_HOOK BL_DECRYPT_FN_HOOK(pui8Packet + 4, uip_len - 4); #endif // // Program this block of data into flash. // BL_FLASH_PROGRAM_FN_HOOK(ui32FlashAddr, (pui8Packet), TFTP_BLOCK_SIZE); ] g_ui32TFTPBlock ++; ] ((void (*)(void))APP_START_ADDRESS)(); |
|
相关推荐
2个回答
|
|
|
BootLoader里面写flash的时候校验了没有,是否写入成功呢?
|
|
|
|
|
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
549 浏览 0 评论
1613 浏览 0 评论
2047 浏览 0 评论
为啥BQ7693003DBTR芯片在和BQ769X0盒子通讯时收不到信号?
1513 浏览 0 评论
DSP 28027F 开发板 XDS100v2调试探针诊断日志显示了 Error -150 (SC_ERR_FTDI_FAIL)如何解决
1337 浏览 0 评论
AT32F407在USART2 DMA发送数据时,接包接到了要发送的数据,程序还是处于等待传输完成的标识判断中,为什么?
1757浏览 29评论
2781浏览 23评论
请问下tpa3220实际测试引脚功能和官方资料不符,哪位大佬可以帮忙解答下
1724浏览 20评论
请教下关于TAS5825PEVM评估模块原理图中不太明白的地方,寻求答疑
1634浏览 14评论
两个TMP117传感器一个可以正常读取温度值,一个读取的值一直是0,为什么?
1645浏览 13评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-2 05:39 , Processed in 0.745435 second(s), Total 75, Slave 58 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
899