2006-09-04 04:07 AM
2006-08-21 01:09 AM
Hi.
I've tried to use IAP 2.0 example fromhttp://mcu.st.com/mcu/modules.php?mop=modload&name=Splatt_Forums&file=viewtopic&topic=3862&forum=17
, but it doesn't execute properly: my asm code in 71x_init.s is executed, but MCU hangs before main(). After spending few days to find the source of this problem I've found that the code which is expected to be in RAM (memset called from __segment_init) isn't initialized :( So there are random data there (and in C program code too) and program crashes. I've read all threads there about IAP using IAR, but it seems that nobody else had the same problem... Project source files are attached. ________________ Attachments : IAP_V2.0.rar : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HtGZ&d=%2Fa%2F0X0000000aKs%2FxhqHoWdgUmBofWl.PoQbQF9aAshbNk5GcrmV4Yt7FZY&asPdf=false2006-08-21 02:50 AM
Updated: I've also included generated map file and screenshot from debugger showing broken RAM. Screenshot with proper memset() from another example application with code in ROM is also attached.
________________ Attachments : IAP_Driver.map : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HtGj&d=%2Fa%2F0X0000000aKu%2FlS52LCyjh6xBs.ORYlmlOKyyaz6VoHbf7_ca_qEUuRM&asPdf=falsememset_broken.JPG : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HtGo&d=%2Fa%2F0X0000000aKv%2FX_A7dXpMY5OmGgEgVbk13RT2e1sliAo6svRUPxthFnA&asPdf=falsememset_example.JPG : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HtGy&d=%2Fa%2F0X0000000aKy%2Fan54USRUwrRr5b51LV1RJBN.QvLlVHJtAMvgsBhgXO0&asPdf=false2006-08-22 01:19 AM
Thanks for your answer. If I understand correctly, supplied files differ from mine only in copying to RAM only flash routines instead of all CODE segment.
I've tried it and get the same result with these flash routines. According to generated map file, these functions are called via some ''wrapper code'' (e.g. for FLASH_SectorErase in RAM exists FLASH_SectorErase::??rA in ROM, which calls it). But function in RAM isn't initialized properly again :( Some screenshots from debugger showing this problem are included. I've read all information about placing code in RAM manually here and in IAR documentation. This ''-Q'' directive SHOULD work. But it don't and I don't understand why... [ This message was edited by: vanez on 22-08-2006 13:50 ] ________________ Attachments : flash_erase_broken.JPG : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I1Oa&d=%2Fa%2F0X0000000bmT%2FzKZMp18LchhO6CJTGYVo_ggzaMLJwre_Ke94BspfG_g&asPdf=falseflash_erase_wrapper.JPG : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I1OV&d=%2Fa%2F0X0000000bmU%2FJl5MYo89AZlYP4Q0jLXubfEBEdZdineJ227c4wx5xfg&asPdf=falseIAP_Driver.map : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I118&d=%2Fa%2F0X0000000bmR%2FQtKXdnvyWYe2GE19t5_XrvupzEwcOTXMJGvBikn_yQg&asPdf=false2006-08-22 02:22 AM
Yes, sorry, the problem is solved for now :)
In original version initialization code was also linked to RAM and therefore wasn't initialized itself :-?2006-08-30 12:18 AM
I seem to have the same problem as you with getting the IAP code to work.
You say the initialization code was linked to RAM and therefore wasn't initialised. I understand that the issue is caused by the memset and memcopy library functions also being moved into RAM - and so cannot initialise themselves. Which I think come to the same end. So, how did you get around this problem? How do you stop the memset and memcopy functions from being moved into RAM? It appears to me that if you want to keep the initialization code in ROM, you cannot use any library functions in the code running in RAM? Any advice would be gratefully received!! Thank you.2006-09-01 10:07 AM
Reference :AN2078 ,But it discript simply.
First---IAP Driver:The IAP Driver must be downloaded to STR71X.You can get it from the websize of STR71X --AN2078 DEMO program.Do not any change!!!Directly download it!!! --I can give your *.bin file or you convert it,if you need it. Second--User program:As the AN2078 say ,there are two cases : 1�if your program dose not use interrupts ,just only map and program flash your user program from address 0x40002000.Then IAP it by Uart. 2�otherwise ,your program dose not use interrupts .We need do as following: 1)map and program flash your user program from address 0x40002000 2)exception vectors map to RAM,3)Copy exception vectors to RAM 4)software remap setting : ram of remap to 0x0. Try it ,if can not ,give me an E--mail :bingo_2046@yahoo.com.cn2006-09-04 04:07 AM
Hello vanez,
i have similar the same problem. I am on work to this. Greetings , Heribert