cancel
Showing results for 
Search instead for 
Did you mean: 

IAP & IAR trouble

ikrovyakov
Associate II
Posted on September 04, 2006 at 13:07

IAP & IAR trouble

7 REPLIES 7
ikrovyakov
Associate II
Posted on August 21, 2006 at 10:09

Hi.

I've tried to use IAP 2.0 example from

http://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=false
ikrovyakov
Associate II
ikrovyakov
Associate II
Posted on August 22, 2006 at 10:19

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=false

flash_erase_wrapper.JPG : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I1OV&d=%2Fa%2F0X0000000bmU%2FJl5MYo89AZlYP4Q0jLXubfEBEdZdineJ227c4wx5xfg&asPdf=false

IAP_Driver.map : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I118&d=%2Fa%2F0X0000000bmR%2FQtKXdnvyWYe2GE19t5_XrvupzEwcOTXMJGvBikn_yQg&asPdf=false
ikrovyakov
Associate II
Posted on August 22, 2006 at 11:22

Yes, sorry, the problem is solved for now :)

In original version initialization code was also linked to RAM and therefore wasn't initialized itself :-?

goran2
Associate
Posted on August 30, 2006 at 09:18

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.

bingo_2046
Associate II
Posted on September 01, 2006 at 19:07

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.cn

heribert
Associate II
Posted on September 04, 2006 at 13:07

Hello vanez,

i have similar the same problem. I am on work to this.

Greetings , Heribert