Linker GCC for Kinetis

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Linker GCC for Kinetis

2,493 次查看
jocelyn_massero
Contributor II

Hello,

Did anyone already tried to compiled application with GCC toolchain? I compiled a toolchain for ARM cortex M4 but I'm stucked with the linker. Did anyone already developped a linker GCC for kinetis target?

Regards

Jocelyn

0 项奖励
回复
2 回复数

1,095 次查看
deekay
Contributor I

Hi!

Did you get a linker script that works? I have the same problem. I was using CW and its script is not that compatible with GCC. Like WRITEW does not exists etc. See the file below. Some parts ar easy to adjust, like KEEP_SECTION is changed to KEEP at the correct place, but WRITEW and EXCEPTION stops me.... If I delete to much the linker will say "undefined referencce tp '__bss_start__ " and "__bss_end__".

In short: How to make the CW linker file working in GCC?

Very happy for answers. :smileyhappy:

MEMORY {

m_interrupts  (RX) : ORIGIN = 0x0000C000, LENGTH = 0x00000400

m_cfmprotrom  (RX) : ORIGIN = 0x0000C400, LENGTH = 0x00000010

m_text        (RX) : ORIGIN = 0x0000C410, LENGTH = 0x00040000-0x0000C410

m_data        (RW) : ORIGIN = 0x1FFF8400, LENGTH = 0x0000FC00

}

KEEP_SECTION { .vectortable }

KEEP_SECTION { .cfmconfig }

SECTIONS {

.interrupts :

{

    __vector_table = .;

    * (.vectortable)

    . = ALIGN (0x4);

} > m_interrupts

.cfmprotect :

{

    *(.cfmconfig)

    . = ALIGN (0x4);

} > m_cfmprotrom

.app_text:

{

    ALIGNALL(4);

       * (.init)   

       * (.text)

        .= ALIGN(0x8) ;

    * (.rodata)

        .= ALIGN(0x4) ;

    ___ROM_AT = .;

} > m_text

.app_data: AT(___ROM_AT)

{

       * (.sdata)

       * (.data)

        .= ALIGN(0x4) ;

       *(.ARM.extab)

        .= ALIGN(0x4) ;

       __exception_table_start__ = .;

       EXCEPTION

       __exception_table_end__ = .;

        .= ALIGN(0x4) ;

       __sinit__ = .;

       STATICINIT

    .= ALIGN(0x8) ;

} > m_data

.bss :

{

    .= ALIGN(0x4) ;

    __START_BSS = .;

    * (.bss)

    __END_BSS = .;

    .= ALIGN(0x8) ;

} >> m_data

_romp_at = ___ROM_AT + SIZEOF(.app_data);

.romp : AT(_romp_at)

{

    __S_romp = _romp_at;

    WRITEW(___ROM_AT);

    WRITEW(ADDR(.app_data));

    WRITEW(SIZEOF(.app_data));

    WRITEW(0);

    WRITEW(0);

    WRITEW(0);

}

__SP_INIT = . + 0x00004000;

__heap_addr = __SP_INIT;

__heap_size = 0x00004000;

}


0 项奖励
回复

1,095 次查看
admin
Specialist II

Jocelyn,

 

The CodeWarrior linker script file format is nearly identical to the GNU linker format, so you can use the existing code warrior linkerscripts in your GNU environment with little to no modifications.

 

Tom

0 项奖励
回复