Compile under ARMCLANG without default startup code

56 Views Asked by At

I'm working with Keil v5 with ARM Compiler 6.21, for a cortex-m4 target. I'm trying to compile my software without using the default startup code that is added by the ARM Compiler (equivalent switch to GCC's -nostartfiles), but I can't find how to do this. Has someone already done this ? Thanks for your ideas !

The commands I'm using :

armclang.exe --version

Product: MDK-ARM Lite 5.39 Component: Arm Compiler for Embedded 6.21
Tool: armclang [5ec1fd00]
Target: unspecified-arm-none-unspecified

armclang.exe --target=arm-arm-none-eabi -mcpu=cortex-m4 main.c -o run/main.o -v

fromelf.exe -c run/main.o > run/main.lst

The listing file contains startup code, which I don't want to keep in my .o file:

/-----------------------------------------------------------------------/

$t
!!!main
__main
    0x00008000:    f000f802    ....    BL       __scatterload ; 0x8008
    0x00008004:    f000f844    ..D.    BL       __rt_entry ; 0x8090
!!!scatter
__scatterload
__scatterload_rt2
__scatterload_rt2_thumb_only
    0x00008008:    a614        ..      ADR      r6,{pc}+0x54 ; 0x805c
    0x0000800a:    e8960c00    ....    LDM      r6,{r10,r11}
    0x0000800e:    44b2        .D      ADD      r10,r10,r6
    0x00008010:    44b3        .D      ADD      r11,r11,r6
__scatterload_loop

/.../

.text
__semihosting_library_function
    0x00008146:    0000        ..      MOVS     r0,r0
.text
_sys_exit
    0x00008148:    4901        .I      LDR      r1,[pc,#4] ; [0x8150] = 0x20026
    0x0000814a:    2018        .       MOVS     r0,#0x18
    0x0000814c:    beab        ..      BKPT     #0xab
    0x0000814e:    e7fe        ..      B        0x814e ; _sys_exit + 6
$d
    0x00008150:    00020026    &...    DCD    131110
$t.0

/-----------------------------------------------------------------------/

I've looked at armclang.exe options but I don't find the equivalent to GCC's -notstartfiles switch

I've looked into DUI0774B_armclang_reference_guide.pdf but did not find what I need.

I've looked into DAI0241B_startup_code_for_arm_compiler.pdf which explains the contents of the default startup code, but does not explain how to not use it.

0

There are 0 best solutions below