Skip to main content
brj
Associate III
June 23, 2008
Question

IAP example problem

  • June 23, 2008
  • 9 replies
  • 1429 views
Posted on June 23, 2008 at 11:07

IAP example problem

    This topic has been closed for replies.

    9 replies

    jilisegiar
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:24

    can you share the project you are using to generate a bin file >1024 bytes

    brj
    brjAuthor
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:24

    Hi,

    I have been testing the IAP example application, and find that it works fine as long as the file you are downloading is < 1024 bytes (like the example binary coming with the IAP) !!

    If the file is > 1024 bytes, the last 16 bytes in that block (1024) are programmed to 0x00 ???

    I havent been able to find the problem yet, has anyone else seen this problem ?

    Programming the same binary using the hardware built in bootloader or a J-link works fine.

    BR

    Brian

    brj
    brjAuthor
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:24

    no sorry, that project contains propetary code.

    But it should not be hard to generate lots of code, just place a lot of constant data in flash.

    brj
    brjAuthor
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:24

    Have debugged the application a bit more and found that:

    1. The error comes when copying a buffer using the memcpy function !

    In Ymodem.c function Ymodem_Receive (u8 *buf)

    memcpy(buf_ptr, packet_data + PACKET_HEADER, packet_length);

    The length parameter supplied to memcpy is 1024, but it only copies

    1008

    I have verified this using the j-link debugger.

    Changing the call to

    memcpy(buf_ptr, packet_data + PACKET_HEADER, packet_length+16);

    copies 1024 bytes !!

    Now the application works :-? But as I see it, there must be an error in the library cotaining memcpy ! I have contacted IAR about this.

    brj
    brjAuthor
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:24

    Hi again,

    I now find that using the IAR EWARM 4.42 along with the IAP example supplied by ST works fine (the Keil example also works :-)).

    However the example coming with new IAR EWARM 5.11 kickstart seems to be broken.

    Here the last 16 byte are set to 0x00 in every 1024 block.

    There is no source differences between the ST and IAR example, but (5.11)implements a new linker command file, which forces some new section assignments.

    And maybe this is the problem.

    Has anyone succesfully converted old IAR projects to the 5.11 version ?

    BR

    Brian

    jilisegiar
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:24

    first the size SysTick.bin coming with the IAP >1024 and it works fine and I tried another binary file with size >1024 and it works also fine.

    jilisegiar
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:24

    IAR has released a new patch fixing the problem with memcopy. It's available @ ''My Pages'' from IAR web site.

    brj
    brjAuthor
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:24

    IAR support have acknowledged the bug with memcpy

    They state that it will be fixed in the next release 5.20 (june 2008).

    Best solution in my opinion is to make my own memcpy function

    ;) when using IAR 5.11 !

    intrinsor
    Associate
    May 17, 2011
    Posted on May 17, 2011 at 12:24

    I finally know, that my problem is not related to problems with the toolchain.

    I used the startup script cortexm3_macro.s for the RIDE7 toolchain from the ST FWLIB. This got me somehow in trouble. I managed to kick some of the content out and compile a working firmware with working string operations.

    If I know what specifically went wrong, I will post it.