cancel
Showing results for 
Search instead for 
Did you mean: 

Further question on the IAP application note

quentin239955
Associate II
Posted on May 02, 2007 at 12:31

Further question on the IAP application note

6 REPLIES 6
quentin239955
Associate II
Posted on April 30, 2007 at 14:37

Hi,

I had problem last week to compile the AN2078 IAP. Now it compile ok but I have trouble to adapt it to my application/hardware.

Here's my questions

1) In the AN2078 documentation, on page 3 there is noted that for the STR71x the code should take 7.2KByte. Compiled in release mode, my AXF file is 32.6 Kbytes. Is this normal ?

2) When I want to program my application from the IAP, should I use the AXF of my application program (and juste modify the load region in the scatter file?)

thanks in advance

quentin239955
Associate II
Posted on May 01, 2007 at 07:32

maybe some information about my case could help someone in helping me :-]

So currently, the IAP is booting ok on my hardware, I see the menu in hyperterminal. It seem that the flashing is ok, I can send file like explained in the documentation, but after the transfer there is some garbage in hyperterminal (after the downlad) :

Code:

Programming Completed Successfully!

--------------------------------

Name: debug.axf

Size: 102724 B================

DownloadJµ…â€¢To the STR71x Internal Flash ---------- 1

Execute The New Program ------------------------------ 2

After that, I can't run my program. The strange thing is that if I shutdown and restart my device, the IAP don't run anymore. So I suspect that I have messed up something with my modifications to make it run on my hardware.

As I said in my first post, the IAP axf file is about 32kb, but when I program it with the JTAG, it show that he program only the two first sector (0&1) of the bank 0. So I have modified the IAP to flash my program on the beginning of the third sector of bank 0 (0x40004000).

I have modified my application scatterfile like this :

Code:

USER_MODE 0x40004000 0x30000

{

FLASH 0x40004000

{

71x_init.o (Init, +First)

* (+RO)

}

RAM 0x00000000

{

71x_vect.o (Vect, +First)

* (+RW)

* (+ZI)

}

}

And modified 71x_init.s to do ram remapping.

If something writen above sound for you like an heresy, please put me on the right way 😉

najoua
Associate II
Posted on May 02, 2007 at 07:16

Hello tumnao,

In the IAP driver provided by ST, the user application will be loaded beginning from Bank0 sector1 base address. Before loading the application, a check of its size is done in the routine FLASH_SectorMask() in common.c source file (this routine is called in ymodem.c in Ymodem_Receive() routine):

if user_application size < 8kbytes --> sector1 will be erased

if user_application size < 16kbytes --> sectors 1 and 2 will be erased

if user application size < 24kbytes --> sectors 1, 2 and 3 will be erased

etc...

In your case, the IAP is located in Sectors 0&1 so sector1 shouldn't be erased.

So, the routine FLASH_SectorMask() in common.c source file should be updated as follow:

u32 FLASH_SectorMask(vu32 Size)

{

if (Size <= 0x2000)

return 0x4 // instead of return 0x2;

if (Size <= 0x4000)

return 0xC // instead of return 0x6;

if (Size <= 0x6000)

return 0x1C // instead of return 0xE;

if (Size <= 0xE000)

return 0x3C // instead of return 0x1E;

if (Size <= 0x1E000)

return 0x7C // instead of return 0x3E;

if (Size <= 0x2E000)

return 0xFC // instead return 0x7E;

//if (Size <= 0x3E000) this case is no longer valid because the user application size shouldn't exceed 256 - 16kbytes = 240kbytes.

//return 0xFE;

return 0;

}

You said ''The strange thing is that if I shutdown and restart my device, the IAP don't run anymore'' --> the IAP driver can be re-executed under a specific condition at RESET. This condition is a Low level on P1.8 pin. For more details, please refer to AN2078, the section 2.2 Triggering execution of the IAP driver, page 5.

Hope this helps you,

Best regards,

Najoua.

quentin239955
Associate II
Posted on May 02, 2007 at 10:47

Many thanks Najoua, you where right.

This explain me why my IAP didn't work after a programming, he was erasing himself...

And since my last post I also found answer to some of my question by activating the size report in the linker message option... My program is smaller that i thinked 🙂

And I also found the fromelf tool. By reading the RVDK linker guide I suspect that I need to convert my AXF to bin with it.

Still no working IAP, but closer than never :-]

najoua
Associate II
Posted on May 02, 2007 at 11:23

Just another point: in common.h header file, don't forget to replace the '' #define ApplicationAddress 0x40002000'' with ''#define ApplicationAddress 0x40004000 '' which corresponds to the user application location.

Good luck tumnao.

quentin239955
Associate II
Posted on May 02, 2007 at 12:31

Yeah, I didn't forget to do that, and after reading the fromelf doc, IAP is working ! :-]

My last problem is about interruption so I must have messed something up in the ram remapping process.

But this is a big step for me, as this is my first embedded project I have a lot to learn and each new working functionnality make me really happy. Thanks to all the helpfull people posting in this forum 😉