|
本帖最后由 泰瑞宝 于 2016-8-19 19:11 编辑 目前需要做STM8L151G6的串口升级,flash工32K,boot分2K,应用程序(run_APP)占15K,升级程序(isp_APP)15K。正常情况下运行run_APP,与升级命令时通过串口接收数据并存放于isp_APP区域,接收成功后复位到boot,它将isp_APP的数据搬到run_APP中并运行。之前做过stm32和430的程序,总以为差不多,不过调试了两周多了,总是找不到问题。使用了IAR 1.41.1.boot的icf文件: define memory with size = 16M; define region TinyData = [from 0x00 to 0xFF]; define region NearData = [from 0x0000 to 0x07FF]; define region Eeprom = [from 0x1000 to 0x13FF]; define region BootROM = [from 0x6000 to 0x67FF]; define region NearFuncCode = [from 0x8000 to 0x87FF]; define region FarFuncCode = [from 0x8000 to 0x87FF]; define region HugeFuncCode = [from 0x8000 to 0x87FF]; run_APP的icf文件: define memory with size = 16M; define region TinyData = [from 0x00 to 0xFF]; define region NearData = [from 0x0000 to 0x07FF]; define region Eeprom = [from 0x1000 to 0x13FF]; define region BootROM = [from 0x6000 to 0x67FF]; define region NearFuncCode = [from 0x8800 to 0xC3FF]; define region FarFuncCode = [from 0x8800 to 0xC3FF]; define region HugeFuncCode = [from 0x8800 to 0xC3FF]; boot的main文件: __root const long reintvec[]@".intvec"= { 0x82008080,0x82008804,0x82008808,0x8200880C, //当应用程序地址不是0xB000时则要相应改掉除第一个 0x82008810,0x82008814,0x82008818,0x8200881C, //0x82008080以外的数值 0x82008820,0x82008824,0x82008828,0x8200882C, 0x82008830,0x82008834,0x82008838,0x8200883C, 0x82008840,0x82008844,0x82008848,0x8200884C, 0x82008850,0x82008854,0x82008858,0x8200885C, 0x82008860,0x82008864,0x82008868,0x8200886C, 0x82008870,0x82008874,0x82008878,0x8200887C, }; void main(void) { u8 i; Main_Init(); EEPROM_Read(IAPFlagAddr,&StartIAPFlag,1); if(StartIAPFlag==0x01) //如果存在升级标志 { //清空APP区的数据 FLASH_Unlock(FLASH_MemType_Program); for(i=0;i<TotalBlockNum;i++) { FLASH_EraseBlock((uint16_t)StartBlockNum+i,FLASH_MemType_Program); } FLASH_WaitForLastOperation(FLASH_MemType_Program); EEPROM_Read((uint16)TotalPackNumAddr,&TotalPackTrans,1); //装载总包数 LED_RF_First_ON(); for(i=0;i<TotalPackTrans;i++) //将Backup_APP区的数据搬移到Run_APP里来 { FLASH_ReadBlock((uint16_t)0x89+i,uctestbuffer); FLASH_WaitForLastOperation(FLASH_MemType_Program); FLASH_ProgramBlock((uint16_t)StartBlockNum+i,FLASH_MemType_Program,FLASH_ProgramMode_Standard,uctestbuffer); FLASH_WaitForLastOperation(FLASH_MemType_Program); } FLASH_Lock(FLASH_MemType_Program); LED_RF_First_OFF(); EEPROM_Write(IAPFlagAddr,0,1); //清空升级标志 asm("LDW X, SP "); asm("LD A, $FF"); asm("LD XL, A "); asm("LDW SP, X "); asm("JPF $8800"); } else { asm("LDW X, SP "); asm("LD A, $FF"); asm("LD XL, A "); asm("LDW SP, X "); asm("JPF $8800"); } } 现在确定run_APP接收到了正确完整的数据并且boot也正确的进行了更新,然后进行跳转。以后的现象就是一直跳转-复位-跳转循环下去。我比对过升级文件和写入flash的数据,都一致。现在不知道问题出在哪里了。也查了很多资料,惭愧的说该尝试的大多都试过了,但是没有找到问题点,还请有类似经验的帮忙一下,不胜感激~ |
STM8S103飞线外接芯片,I2C不能得到slaveAddress应答,通讯失败。
测试标签123
IAR FOR ARM和IAR FOR STM8无法共存,
STM8L052,液晶内部电源怎么用?
STM8S105C6T6 UART2串口,能接收数据,不能发送数据
STM8S105K4 串口2 无奇偶校验,也能接收 偶校验的 数据
在STM8S的IAP使用中断和APP使用中断问题
STM8L151 SMBUS设计
STM8S103F复位异常
STM8L的LCD调试时不亮
微信公众号
手机版
求助。。。