Infineon XMC1xxx Cortex M0

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Tabulous
Posts: 518
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 18 times

Infineon XMC1xxx Cortex M0

Post by Tabulous »

I'm just doing a port to XMC1100 Cortex M0 devices from Infineon. Got the base port to build, next step see if it runs/debugs. Then start drivers :-)

If anyone is interested in this let me know, and i'll post the files.
Tabulous
Posts: 518
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 18 times

Re: Infineon XMC1xxx Cortex M0

Post by Tabulous »

Mmmm it seems we dont have any system tick, port is running but no task switching ?
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Infineon XMC1xxx Cortex M0

Post by Giovanni »

Hi,

In 3.0 you have to start SYSTICK yourself, may be this is the problem.

With an HAL, this is handled by the ST (systick) driver.

Giovanni
Tabulous
Posts: 518
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 18 times

Re: Infineon XMC1xxx Cortex M0

Post by Tabulous »

im not using 3.0 at the moment, dont want to complicate things. Just looping in _idle_thread(void *p)
Tabulous
Posts: 518
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 18 times

Re: Infineon XMC1xxx Cortex M0

Post by Tabulous »

Right im abit stuck now on this port.

So at the moment the software runs upto the point of __early_init(); call, then it just seems to run away with itself. It seems calls to anything from crt0.c end up running away.
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Infineon XMC1xxx Cortex M0

Post by Giovanni »

Strange, does the device have some custom flash relocation mechanism?

Giovanni
Tabulous
Posts: 518
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 18 times

Re: Infineon XMC1xxx Cortex M0

Post by Tabulous »

At the moment im using the linker file from the STM32F0(i'm assuming there is not much difference)


Here is the orginal Infineon Linker file, maybe this will tell you something ?

Code: Select all

/* Generated Linker Script file */
/*
 * Template Version 1.5 dated 05 May 2014
 */

OUTPUT_FORMAT("elf32-littlearm")
OUTPUT_ARCH(arm)
ENTRY(Reset_Handler)

MEMORY
{
   FLASH(RX) : ORIGIN = 0x10001000, LENGTH = 0x10000
   SRAM(!RX) : ORIGIN = 0x20000000, LENGTH = 0x4000
}

stack_size = 1024;

SECTIONS
{
    /* TEXT section */

    .text :
    {
        sText = .;
        KEEP(*(.reset));
        *(.text .text.* .gnu.linkonce.t.*);

        /* ARM <->THUMB interworking */
        *(.glue*)
        *(.v4*)
        *(.vfp11_veneer)

        /* C++ Support */
        KEEP(*(.init))
        __preinit_array_start = .;
        KEEP (*(.preinit_array))
        __preinit_array_end = .;
        __init_array_start = .;
        KEEP (*(SORT(.init_array.*)))
        KEEP (*(.init_array))
        __init_array_end = .;
        KEEP (*crtbegin.o(.ctors))
        KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
        KEEP (*(SORT(.ctors.*)))
        KEEP (*crtend.o(.ctors))
        KEEP(*(.fini))
        __fini_array_start = .;
        KEEP (*(.fini_array))
        KEEP (*(SORT(.fini_array.*)))
        __fini_array_end = .;

        KEEP (*crtbegin.o(.dtors))
        KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
        KEEP (*(SORT(.dtors.*)))
        KEEP (*crtend.o(.dtors))

        /* Exception handling support */
        __extab_start = .;
        *(.ARM.extab* .gnu.linkonce.armextab.*)
        . = ALIGN(4);
        __extab_end = ABSOLUTE(.);
    } > FLASH

    /* Exception handling, exidx needs a dedicated section */
    .ARM.exidx :
    {
        __exidx_start = .;
        *(.ARM.exidx* .gnu.linkonce.armexidx.*)
        . = ALIGN(4);
        __exidx_end = ABSOLUTE(.);
    } > FLASH

    /* CONST data section */
    .rodata :
    {
        *(.rodata .rodata.*)
        *(.gnu.linkonce.r*)
    } > FLASH

   . = ALIGN(16);
   
    /* End of RO-DATA and start of LOAD region for the veneers */
    eROData = . ;

    /* DSRAM layout (Lowest to highest)*/
    /* Veneer <-> Stack <-> DATA <-> BSS <-> HEAP */

    .VENEER_Code ABSOLUTE(0x2000000C): AT(eROData)
    {
        VeneerStart = .;
        KEEP(*(.XmcVeneerCode));
        . = ALIGN(4);
        VeneerEnd = .;
    } > SRAM

    VeneerSize = ABSOLUTE(VeneerEnd) - ABSOLUTE(VeneerStart);

    /* Dummy section for stack */
    Stack (NOLOAD) : AT(0)
    {
        . = ALIGN(8);
        . = . + stack_size;
        __initial_sp = .;
    } > SRAM

     /* Standard DATA and user defined DATA/BSS/CONST sections */
    DataLoadAddr = eROData + VeneerSize;
    .data : AT(DataLoadAddr)
    {
        __data_start = .;
        * (.data);
        * (.data*);
        *(*.data);
        *(.gnu.linkonce.d*)
        . = ALIGN(4);
        __data_end = .;
    } > SRAM
   __data_size = __data_end - __data_start;

    .ram_code : AT(DataLoadAddr + __data_size)
    {
        __ram_code_start = .;
        /* functions with __attribute__ ((section (".ram_code")))*/
        *(.ram_code)   
        . = ALIGN(4);       
        __ram_code_end = .;
    } > SRAM
    __ram_code_load = LOADADDR (.ram_code);
    __ram_code_size = __ram_code_end - __ram_code_start;
   
    /* BSS section */
    .bss (NOLOAD) :
    {
        __bss_start = .;
        * (.bss);
        * (.bss*);
        * (COMMON);
        *(.gnu.linkonce.b*)
        . = ALIGN(4);
        __bss_end = .;
        . = ALIGN(8);
        Heap_Bank1_Start = .;
    } > SRAM
    __bss_size = __bss_end - __bss_start;
   
    /* .no_init section */
    .no_init 0x20003FFC (NOLOAD) :
    {
        Heap_Bank1_End = .;
        * (.no_init);
    } > SRAM
   
    /* Heap - Bank1*/
    Heap_Bank1_Size  = Heap_Bank1_End - Heap_Bank1_Start;

    /DISCARD/ :
    {
        *(.comment)
    }

    .stab              0 (NOLOAD) : { *(.stab) }
    .stabstr           0 (NOLOAD) : { *(.stabstr) }

    /* DWARF 1 */
    .debug             0 : { *(.debug) }
    .line              0 : { *(.line) }

    /* GNU DWARF 1 extensions */
    .debug_srcinfo     0 : { *(.debug_srcinfo) }
    .debug_sfnames     0 : { *(.debug_sfnames) }

    /* DWARF 1.1 and DWARF 2 */
    .debug_aranges     0 : { *(.debug_aranges) }
    .debug_pubnames    0 : { *(.debug_pubnames) }
    .debug_pubtypes    0 : { *(.debug_pubtypes) }

    /* DWARF 2 */
    .debug_info        0 : { *(.debug_info .gnu.linkonce.wi.*) }
    .debug_abbrev      0 : { *(.debug_abbrev) }
    .debug_line        0 : { *(.debug_line) }
    .debug_frame       0 : { *(.debug_frame) }
    .debug_str         0 : { *(.debug_str) }
    .debug_loc         0 : { *(.debug_loc) }
    .debug_macinfo     0 : { *(.debug_macinfo) }

    /* DWARF 2.1 */
    .debug_ranges      0 : { *(.debug_ranges) }

    /* SGI/MIPS DWARF 2 extensions */
    .debug_weaknames   0 : { *(.debug_weaknames) }
    .debug_funcnames   0 : { *(.debug_funcnames) }
    .debug_typenames   0 : { *(.debug_typenames) }
    .debug_varnames    0 : { *(.debug_varnames) }

    /* Build attributes */
    .build_attributes  0 : { *(.ARM.attributes) }
}
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Infineon XMC1xxx Cortex M0

Post by Giovanni »

It tells me that the flash is at a strange address. Maybe only a part of the flash is mirrored at 0x00000000 this is why it stops when you jumps out of the initial code, you should look at manuals.

Giovanni
Tabulous
Posts: 518
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 18 times

Re: Infineon XMC1xxx Cortex M0

Post by Tabulous »

Moved on abit now, the code is running, but getting debug panic "stack overflow".

The test application does not create any threads, the only thread running is main.

In the linker ive up'd the stacks for good measure.

__main_stack_size__ = 0x1400;
__process_stack_size__ = 0x1400;


But still keeps hitting the panic.
Tabulous
Posts: 518
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 18 times

Re: Infineon XMC1xxx Cortex M0

Post by Tabulous »

any suggestions ?
Post Reply