infineon4engineers Facebook

infineon@google+ Google+

infineon@linkedin linkedin

infineon4engi@twitter twitter

infineon@youtube youtube

+ Reply to Thread
Results 1 to 3 of 3

Thread: Debugging ASCLoader

  1. #1
    New Member New Member badeto is on a distinguished road
    Join Date
    Jun 2019
    Posts
    2
    Points
    17.5

    Debugging ASCLoader/Bug in Flash Erase

    Hello

    In our Project we would like to use the ASCLoader to flash our application over UART (ASC BSL) to our custom XMC4800-2048 board.

    During debugging the source (Infineon-XMC4000_Bootloader_ASC_example_code-AN-v01_03-EN.zip) for XMC4800 we came to the conclusion that the loader
    will not erase a Flash sector if the first 4 bytes are blank. In EraseSector the dwSectorAddr is incremented till we hit a memory address with double word != 0.
    In the routine this INCREMENTED Adress is then given to XMC4000_PFLASH_EraseSector as sector base adress for erase (see line 106 of xmc4000_flasher.c.
    I tried to confirm my hypothesis so I produced a binary file where the first 4 bytes of every sector is 0 and the remaining bytes of the sector are 0xFF.

    I programmed this file (attached) with XMCLink (Segger J-Flash-Lite v6.34h) to the device and since then the device shows signs as it is proteced from any debug access.
    However I do not know why my device is no bricked! Reading the documentation I am confused what is located at 0x0C00 0000:
    - is it the UCB0 content (p8-7, Reference Manual V1.13, PMU v1.13)
    - or the Vector Table of the code (p 7-4, Reference Manual V1.3, Memory Organization V2.12)
    How can I unbrick my device?
    I would be greatful for any hint to resolve my problem with the bricked device, why it is bricked ...

    Tobias
    ?????
    Last edited by badeto; Jun 5th, 2019 at 01:55 AM.

  2. #2

    Infineon Employee
    Infineon Employee
    jferreira will become famous soon enough
    Join Date
    Oct 2012
    Posts
    586
    Hi,

    At 0x0C00 0000 should be located the vector table. The first 4 bytes are the stack pointer. According to your vector table the microcontroller will jump to the address stored in the reset vector, 0xFFFFFFFF. This most probably will cause an HardFault exception.
    You should be able to recover your device by reprograming (erasing the flash).

    Regards,
    Jesus
    The views expressed here are my personal opinions, have not been reviewed or authorized by Infineon and do not necessarily represent the views of Infineon.

  3. #3
    New Member New Member badeto is on a distinguished road
    Join Date
    Jun 2019
    Posts
    2
    Points
    17.5

    Bug in ASCLoader

    Yes I know, that the attached binary is not a programm and will result in a Hard fault. However flashing this binay with XMCLink to the device resulted in a bricked device!
    I could not recover the device and the first 8 bytes of each sector can not be read anymore.


    Further I would like to propose, that Infineon fixes the Bug in the ASCLoader project:
    1. I tried to produce my own ASCLoader.bin by compiling the ASCLoader Project out of the box for XMC4800 in DAVE 4.4.2. However uploading this produced binary by the protocol described in the project pdf resulted NOT in a system answering my requests. However uploading the binary PROVIDED BY INFINEON/INCLUDED IN THE PROJECT worked!
    2. In the EraseSector function in main.c we use as input parameter to the function the base address of a sector to erase (attached image). This parameter is incremented if the first (few) uint32 values in a sector are zero. If there is a non zero entry in the sector detected this INCREMETED address is give as parameter to the XMC4000_PFLASH_EraseSector function. In this function this incremeted sector address is used as "SA: Absolute start address of a Flash sector. Allowed are the PFLASH sectors Sx" - which is obvious agains the spec (RefMan V1.3, p8-10/11). Therefore a sector where the first uint32 value is 0 is not erased by the official Infinenon ASCLoader! I tried to modify the Project to fix this issue and check my bug fix which failed due to issue 1.
    ?????? ?????? XMC4800_ASCLoader_main_c.png‎  

+ Reply to Thread

Tags for this Thread

Disclaimer

All content and materials on this site are provided “as is“. Infineon makes no warranties or representations with regard to this content and these materials of any kind, whether express or implied, including without limitation, warranties or representations of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. No license, whether express or implied, is granted by Infineon. Use of the information on this site may require a license from a third party, or a license from Infineon.


Infineon accepts no liability for the content and materials on this site being accurate, complete or up- to-date or for the contents of external links. Infineon distances itself expressly from the contents of the linked pages, over the structure of which Infineon has no control.


Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Usage Terms of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Usage Terms of this site. Infineon reserves the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.