Forum: Mikrocontroller und Digitale Elektronik Win vs Linux: ARM Kompilat unterschiedlich groß


von Felix F. (wiesel8)


Lesenswert?

Hallo,
ich habe ein Programm für einen STM32 welches ich auf Windows mit EmBitz 
1.11 und auf Linux per Makefile (arm-none-eabi 4.9.3) kompiliere.

Flags aus der EmBitz ebp:
1
      <Target title="Release">
2
        <Option output="bin\Release\GRBL_Advanced.elf" />
3
        <Option object_output="obj\Release\" />
4
        <Option type="0" />
5
        <Option create_hex="1" />
6
        <Option compiler="armgcc_eb" />
7
        <Option projectDeviceOptionsRelation="0" />
8
        <Compiler>
9
          <Add option="-fdata-sections" />
10
          <Add option="-ffunction-sections" />
11
          <Add option="-O2" />
12
          <Add option="-g1" />
13
        </Compiler>
14
        <Cpp>
15
          <Add option="-fdata-sections" />
16
          <Add option="-ffunction-sections" />
17
          <Add option="-O2" />
18
          <Add option="-g2" />
19
        </Cpp>
20
        <Assembler>
21
          <Add option="-Wa,--no-warn" />
22
        </Assembler>
23
        <Linker>
24
          <Add option="-Wl,--gc-sections" />
25
        </Linker>
26
      </Target>
27
    </Build>
28
    <Device>
29
      <Add option="$device=cortex-m4" />
30
      <Add option="$fpu=fpv4-sp-d16" />
31
      <Add option="$lscript=./stm32f411re_flash.ld" />
32
      <Add option="$stack=0x0200" />
33
      <Add option="$heap=0x0000" />
34
    </Device>
35
    <Compiler>
36
      <Add option="-mfloat-abi=hard" />
37
      <Add option="-std=c99" />
38
      <Add option="-Wextra" />
39
      <Add option="-Wall" />
40
      <Add option="-fno-strict-aliasing" />
41
      <Add symbol="ARM_MATH_CM4" />
42
      <Add symbol="__FPU_USED" />
43
      <Add symbol="STM32F411RE" />
44
      <Add symbol="STM32F411xE" />
45
      <Add symbol="USE_STDPERIPH_DRIVER" />
46
      <Add directory=".\inc" />
47
      <Add directory=".\src" />
48
      <Add directory=".\cmsis" />
49
      <Add directory=".\SPL\inc" />
50
      <Add directory=".\SPL\src" />
51
    </Compiler>
52
    <Linker>
53
      <Add option="-eb_lib=n" />
54
      <Add option="-eb_start_files" />
55
      <Add option="-flto" />
56
      <Add option="-lm" />
57
    </Linker>

Makefile Flags:
1
FLAGS       :=   -mfloat-abi=hard -mcpu=cortex-m4 -gdwarf-2 -mfpu=fpv4-sp-d16 -mthumb
2
CFLAGS      :=   -O2 -g1 -std=c99 -Wall -Wextra $(INCLUDE) -fdata-sections -ffunction-sections -mlittle-endian -fomit-frame-pointer -DUSE_STDPERIPH_DRIVER -DSTM32F411xE -DSTM32F411RE -D__FPU_USED -DARM_MATH_CM4
3
CXXFLAGS    :=  $(CFLAGS)
4
5
LDFLAGS    :=  -lm -Wl,--gc-sections -T ../stm32f411re_flash.ld --specs=nosys.specs -nostartfiles -flto

Bei beiden funktioniert das Programm wie gewollt, aber die Größe (.text) 
ist sehr unterschiedlich.
Bei Windows etwa 42 KB
Bei Linux etwa 67 KB

Jetzt meine Frage. Wie kann es sein, dass die Größe hier so stark 
abweicht?? Hab ich was vergessen?

mfg

von Heiko L. (zer0)


Lesenswert?

>Hab ich was vergessen?
-fomit-frame-pointer z.B.

von Felix F. (wiesel8)


Lesenswert?

Hab das Problem gefunden. Man muss natürlich mit der newlib-nano linken.

mfg

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.