infineon4engineers Facebook

infineon@google+ Google+

infineon@linkedin linkedin

infineon4engi@twitter twitter

infineon@youtube youtube

Dave

+ Reply to Thread
Results 1 to 2 of 2

Thread: Using abm header with optimization

  1. #1
    New Member New Member TestJoe is on a distinguished road
    Join Date
    Apr 2017
    Posts
    2
    Points
    40

    Question Using abm header with optimization

    Hello,

    just trying to implement the example: USBD_MS_BOOTLOADER_IAP_XMC47
    Without any optimization level it seems to be working on my XMC4800.

    But if I'm using any of the given optimization levels, the abm header is no longer available.

    lst-file:

    With optimization (-Os)
    Code:
    Sections:
    Idx Name          Size      VMA       LMA       File off  Algn
      0 .text         00004744  08000000  0c000000  00008000  2**2
                      CONTENTS, ALLOC, LOAD, READONLY, CODE
      1 Stack         00000800  1ffe8000  1ffe8000  00018000  2**0
                      ALLOC
      2 .data         000000b8  1ffe8800  0c004744  00010800  2**2
                      CONTENTS, ALLOC, LOAD, DATA
      3 .bss          0000072c  1ffe88b8  0c0047fc  000108b8  2**2
    No optimization
    Code:
    Sections:
    Idx Name          Size      VMA       LMA       File off  Algn
      0 .text         000076dc  08000000  0c000000  00008000  2**2
                      CONTENTS, ALLOC, LOAD, READONLY, CODE
      1 .abm          00000014  0800ffe0  0c00ffe0  00017fe0  2**2
                      CONTENTS, ALLOC, LOAD, READONLY, DATA
      2 Stack         00000800  1ffe8000  1ffe8000  00018000  2**0
                      ALLOC
      3 .data         000000b8  1ffe8800  0c0076dc  00010800  2**2
                      CONTENTS, ALLOC, LOAD, DATA
      4 .bss          0000072c  1ffe88b8  0c007794  000108b8  2**2
    I think something needs to be protect if any optimization is active:

    main.c:
    Code:
    #define ABM_HEADER_MAGIC_KEY 0xA5C3E10F
    
    typedef struct ABM_Header {
    	uint32_t MagicKey; /**< Magic key. Always 0xA5C3E10F */
    	uint32_t StartAddress; /**< Start address of the programm to load */
    	uint32_t Length; /**< Length of the programm to load. */
    	uint32_t ApplicationCRC32; /**< CRC32 Sum of the complete application code */
    	uint32_t HeaderCRC32; /**< CRC32 Sum of the four fields before */
    } ABM_Header_t;
    
    static const ABM_Header_t __attribute__((section(".flash_abm")))
    ABM0_Header = {
        .MagicKey = ABM_HEADER_MAGIC_KEY,
        .StartAddress =   0x08020000,  /* Start Flash Physical Sector 8 */
        .Length = 0xFFFFFFFF,
        .ApplicationCRC32 = 0xFFFFFFFF,
        .HeaderCRC32 =  0xEF423163  // for .StartAddress =   0x08020000
    };
    linker_script.ld:
    Code:
    .abm ABSOLUTE(0x0800FFE0): AT(0x0800FFE0 | 0x04000000)
        {
            KEEP(*(.flash_abm)) 
        } > FLASH_1_cached
    Thanks for any hints.

    Regards,
    TestJoe

  2. #2
    Advanced Advanced
    Infineon Employee
    Infineon Employee
    jferreira will become famous soon enough
    Join Date
    Oct 2012
    Posts
    228
    Points
    4193.1640625
    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.

+ Reply to 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.