Forum: Compiler & IDEs GCC Ram Segmente


von J. V. (janvi)


Lesenswert?

Habe vom STM32 Cube erzeugte  Startup und Linker Script abgeguckt. Es 
gibt dort die (RAM) Segmente bss und data welche angeblich für nicht 
intialisierte und initialisierte RAM Variablen vorgesehen sind. Wenn ich 
eine (volatile) Variable anlege landet diese immer in bss unabhängig 
davon ob sie mit = Wert bei der Definition initialsiert wird. Im Startup 
werden übrigens beide Segment initialisiert, data mit 0 und bss mit 
Initialsierungswerten (Block Kopie). Wie muß ich eine Variable angeben 
damit sie ins data Segment gelinkt wird ?

von Niklas G. (erlkoenig) Benutzerseite


Lesenswert?

J. V. schrieb:
> Wenn ich
> eine (volatile) Variable anlege landet diese immer in bss unabhängig
> davon ob sie mit = Wert bei der Definition initialsiert wird.

Dann zeig doch mal deren Definition. Wie stellst du fest dass sie in 
.bss landet?

Wie sieht das Linker-Script aus?

J. V. schrieb:
> Wie muß ich eine Variable angeben
> damit sie ins data Segment gelinkt wird ?

Sie muss global und/oder "static" sein, constant-initialisierbar sein 
und einen Initialisierungswert haben der nicht aus Nullen besteht.

von pegel (Gast)


Lesenswert?

Dazu empfehle ich immer mein Lieblings-Kurz-Tutorial.

https://blog.atollic.com/using-gnu-gcc-on-arm-cortex-devices-placing-code-and-data-on-special-memory-addresses-using-the-gnu-ld-linker

Wenn man das verstanden hat, kann man Konstanten und Variablen aller Art 
gezielt im Speicher ablegen und im Map File die Folgen seiner Bemühungen 
ansehen.

von Niklas G. (erlkoenig) Benutzerseite


Lesenswert?

pegel schrieb:
> Wenn man das verstanden hat, kann man Konstanten und Variablen aller Art
> gezielt im Speicher ablegen und im Map File die Folgen seiner Bemühungen
> ansehen.

Das ist aber wahrscheinlich unnötig; solche Variablen sollten 
automatisch in .data landen und auch initialisiert werden, wenn man 
nicht gerade das Linkerscript verbastelt hat.

von pegel (Gast)


Lesenswert?

So oder so sollte man Variablen/Konstanten in allen möglichen Varianten 
in allen Bereichen initialisiert oder nicht, selbst einmal mit 
aussagekräftigen Namen anlegen und schauen was aus denen wird.

Das erspart vielleicht viele Fragen für die Zukunft.

von Bauform B. (bauformb)


Lesenswert?

Die sections mit den Namen .text .data .bss haben eine feste Bedeutung 
seit es Linker gibt. Alle anderen mit einem Punkt am Anfang gehören der 
Toolchain, selbst definierte sections sollen mit einem Buchstaben 
beginnen. Im Namen sind viele Sonderzeichen erlaubt, aber dann brauchen 
die eine Sonderbehandlung.

Andererseits: ohne Sonderzeichen kann der Name einer section mit dem 
Namen einer Funktion verwechselt werden; anscheinend hat der Linker nur 
eine Symboltabelle für alles.

Das gibt ziemlich überraschende Fehler, nach so einem hab' ich gerade 
lange gesucht. Also probiere ich es mit einem '$' am Anfang. Gibt's zu 
dem Thema Erfahrungen?

von Janvi (Gast)


Lesenswert?

ok, das _attribute_ section habe ich nicht gekannt und werde es mal 
probieren. Automatisch landet bei mir jedenfalls nichts im .data 
segement.

Soweit ich das mal gehört habe ist .text eben für den Code und .bss 
bedeute BaSeSegment und .daten sind eben für die Daten. Bei mir landen 
alle Daten im .bss und ich glaube mal irgendwo gehört zu haben, daß dies 
ein Relikt aus älteren Architekturen ist wo es eine Kurzadressierung 
fürs RAM gibt. Also z. Bsp. eine Seite 0 mit 256 byte die über einen 8 
bit Adresse gehen während das .data Segment dann für die restlichen 
Daten sein soll wo in die Seite 0 nicht mehr reingehen. Bei einem 32 bit 
Adressraum ist das aber definitiv nicht so und Banking wird man da bis 
auf Weiteres auch nie brauchen.

von Janvi (Gast)


Lesenswert?

>Wie stellst du fest dass sie in .bss landet?

ich habe Ozone und Segger J-Trace zum debuggen

von Niklas G. (erlkoenig) Benutzerseite


Lesenswert?

Janvi schrieb:
> und werde es mal
> probieren.

Das ist unnötig.

Janvi schrieb:
> Automatisch landet bei mir jedenfalls nichts im .data
> segement.

Dann ist dein Linkerscript kaputt.

Janvi schrieb:
> Bei mir landen
> alle Daten im .bss

Dito.

Janvi schrieb:
> und ich glaube mal irgendwo gehört zu haben, daß dies
> ein Relikt aus älteren Architekturen ist wo es eine Kurzadressierung
> fürs RAM gibt.

Das hat aber mit dem ARM-GCC nichts zu tun. Ich und viele andere haben 
schon Tausende Programme mit dem GCC für den STM32 geschrieben, bei 
denen Nicht-Null-Initialisierte Variablen ganz korrekt in .data landen 
und automatisch initialisiert wurden, ganz ohne _attribute_.

Aber ohne deinen Code, dein Linkerscript, deinen Startup-Code und deine 
Compiler & Linker-Aufrufe zu sehen kann man da nichts zu sagen,

Janvi schrieb:
> ich habe Ozone und Segger J-Trace zum debuggen

Und wo zeigt der an dass die Variable in ".bss" landet? Was sagt das 
Linker Map file?

von Carl D. (jcw2)


Lesenswert?

Niklas G. schrieb:
> pegel schrieb:
>> Wenn man das verstanden hat, kann man Konstanten und Variablen aller Art
>> gezielt im Speicher ablegen und im Map File die Folgen seiner Bemühungen
>> ansehen.
>
> Das ist aber wahrscheinlich unnötig; solche Variablen sollten
> automatisch in .data landen und auch initialisiert werden, wenn man
> nicht gerade das Linkerscript verbastelt hat.

Eine volatile Variable kann sich per Definition jederzeit ändern. Das 
würde z.B. bedeuten, daß die Initialisierung (=123) erst zur Laufzeit 
vorgenommen werden kann. Damit sind sie zuerst mal uninitialisiert, also 
.bss.
Mag spitzfindig sein, aber durchaus korrekt.

von Niklas G. (erlkoenig) Benutzerseite


Lesenswert?

Carl D. schrieb:
> daß die Initialisierung (=123) erst zur Laufzeit
> vorgenommen werden kann.

Alle Variablen sind erstmal uninitialisiert. und werden dann zur 
Laufzeit vom Startup-Code beschrieben.

Carl D. schrieb:
> Damit sind sie zuerst mal uninitialisiert, also
> .bss.
> Mag spitzfindig sein, aber durchaus korrekt.

Der GCC packt auch volatile-Variablen nach .bss. Aber das ist hier alles 
Kaffee-Satz-Lesen ohne Code & Linker-Script.

Mit "nm test.elf" kann man feststellen, in welche Section die Symbole 
gepackt wurden. Wenn man also z.B.
1
volatile int foo = 42;
2
volatile int bar = 0;
kompiliert, kommt
1
00000000 d $d
2
00000000 b $d
3
00000000 B bar
4
00000000 D foo
heraus - das "D" gibt an, dass "foo" in ".data" ist, und das "B" zeigt 
dass "bar" in ".bss" ist.

Wenn jetzt im Linker-Script sowas total cleveres wie
1
.bss : {
2
  *(.data)
3
}
steht, würde man die .data-Variablen nach .bss schicken, was dann 
natürlich nicht funktioniert. Bislang gibt es aber überhaupt keinen 
Hinweis, dass hier wirklich was in ".bss" landet - vielleicht sind die 
Variablen einfach nur 0? Dann ist vielleicht im Startup-Code was falsch, 
der RAM nicht richtig initialisiert, oder der bekannte Fehler aus den 
ST-Linkerscripten mit dem falsch definierten Symbol wurde übernommen, 
oder oder oder... Kaffeesatz halt. Fakt ist nur, dass bei korrekt 
eingestelltem Drumherum Nicht-0-initialisierte Variablen auch ohne das 
section-Attribut in ".data" landen.

Bauform B. schrieb:
> selbst definierte sections sollen mit einem Buchstaben
> beginnen.

Hast du dafür eine Quelle?

von Janvi (Gast)


Lesenswert?

Linkerskript mal hier. Der Debugger hat die Symbole _edata und _sdata 
über das ELF und da sieht man dass nix dazwischen liegt. Das Meiste im 
map file von ld verstehe ich zugegebenermassen nicht wirklich bzw. das 
was ich suche finde ich nicht. Vielleicht fehlen noch die passenden 
Schalter dazu. Diese sind für den Compiler:
-Wall -O0 -funsigned-char -xc -mlittle-endian -mthumb -c 
--function-sections -mcpu=cortex-m3 -gdwarf-2
und für den Linker
-gc-sections -M=map.txt -T./lscriptF107.txt

Volatile gibt nach meinem Wissen an, daß der Compiler nicht davon 
ausgehen kann das Gleiche zurückzulesen wie er zuletzt geschrieben hat 
und dafür darf er Schreibzugriffe (welche möglicherweise auch gar nicht 
mehr zurückgelesen werden) auch nicht wegoptimieren. Das sollte 
natürlich auch für die Initialisierung gelten.
1
/****************************************************************************
2
        Linker Script fuer STM32F107  auf arm-none-eabi-gcc
3
***************************************************************************/
4
5
/* Cortex  M0,1,        thumb/v6-m */
6
/* Cortex  M3           thumb/v7-m */
7
/* Cortex  M4 ohne FP   thumb/v7e-m */
8
/* Cortex  M4 Soft FP   thumb/v7e-m/fpv4-sp/softfp */
9
/* Cortex  M4 Hard FP   thumb/v7e-m/fpv4-sp/hard */
10
/* Cortex  M7 ohne FP   thumb/v7e-m */
11
/* Cortex  M7 Soft FP   thumb/v7e-m/fpv4-sp/softfp */
12
/* Cortex  M7 Hard FP   thumb/v7e-m/fpv4-sp/hard */
13
/* siehe auch newlib_nano readme.pdf */
14
15
SEARCH_DIR("/usr/lib/arm-none-eabi/newlib/thumb/v7-m/")
16
SEARCH_DIR("/usr/lib/gcc/arm-none-eabi/6.3.1/thumb/v7-m/")
17
18
ENTRY(Reset_Handler)                            /* Reset Symbol ins ELF fuer Segger Ozone */
19
20
__Stack_Size = 1024 ;
21
PROVIDE ( _Stack_Size = __Stack_Size ) ;        /* provide kann vom Objektfile ueberschrieben werden */
22
__Stack_Init = _estack  - __Stack_Size ;
23
PROVIDE ( _Stack_Init = __Stack_Init ) ;
24
_Minimum_Stack_Size = 0x100 ;
25
26
MEMORY
27
{
28
  RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K
29
  FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 256K
30
}
31
32
_estack = 0x20010000;  /* bei 64k RAM ist oberstes Stack Byte 0x2000ffff */
33
34
SECTIONS
35
{
36
    .isr_vector :
37
    {
38
        . = ALIGN(4);
39
        KEEP(*(.isr_vector))            
40
        . = ALIGN(4);
41
    } >FLASH                            /* Vektor Tabelle ins Flash */
42
 
43
    .text :
44
    {
45
            . = ALIGN(4);
46
        *(.text)                   /* remaining code */
47
        *(.text.*)                 /* remaining code */
48
        *(.rodata)                 /* read-only data (constants) */
49
        *(.rodata*)
50
        *(.glue_7)
51
        *(.glue_7t)
52
            . = ALIGN(4);
53
         _etext = .;            /*  zur .data Initialisierung in Startup */
54
         _sidata = _etext;
55
    } >FLASH                    /* Programmcode ins Flash */
56
    
57
    .data  : AT ( _sidata )
58
    {
59
            . = ALIGN(4);
60
        _sdata = . ;
61
        *(.data)
62
        *(.data.*)
63
            . = ALIGN(4);
64
         _edata = . ;   /* zur .data Initialisierung in Startup */
65
    } >RAM              /* Initialsierte Daten ins RAM */
66
    
67
    .bss :
68
    {
69
            . = ALIGN(4);
70
        _sbss = .;
71
        
72
        *(.bss)
73
        *(COMMON)
74
        
75
            . = ALIGN(4);
76
         _ebss = . ;
77
    } >RAM              /* uninitialisierte Daten ins Ram */
78
    
79
    PROVIDE ( end = _ebss );
80
    PROVIDE ( _end = _ebss );
81
    
82
    ._usrstack :                /* User Stack Fehlermeldung */
83
    {
84
            . = ALIGN(4);
85
        _susrstack = . ;
86
        . = . + _Minimum_Stack_Size ;
87
            . = ALIGN(4);
88
        _eusrstack = . ;
89
    } >RAM
90
}

von Niklas G. (erlkoenig) Benutzerseite


Lesenswert?

Janvi schrieb:
> Das Meiste im
> map file von ld verstehe ich zugegebenermassen nicht wirklich

Dann zeig es doch mal...

Janvi schrieb:
> _sidata = _etext;

Das ist falsch. Das ist der erwähnte Fehler aus dem ST-Linkerscript. So 
geht es richtig:
1
    .text :
2
    {
3
            . = ALIGN(4);
4
        *(.text)                   /* remaining code */
5
        *(.text.*)                 /* remaining code */
6
        *(.rodata)                 /* read-only data (constants) */
7
        *(.rodata*)
8
        *(.glue_7)
9
        *(.glue_7t)
10
            . = ALIGN(4);
11
         _etext = .;            /*  zur .data Initialisierung in Startup */
12
    } >FLASH                    /* Programmcode ins Flash */
13
    . = ALIGN(4);
14
    .data : {
15
        _sdata = . ;
16
        *(.data)
17
        *(.data.*)
18
            . = ALIGN(4);
19
         _edata = . ;   /* zur .data Initialisierung in Startup */
20
    } >RAM AT >FLASH             /* Initialsierte Daten ins RAM */
21
    _sidata = LOADADDR(.data);

von Janvi (Gast)


Lesenswert?

> Dann zeig es doch mal...
1
Allocating common symbols
2
Common symbol       size              file
3
4
TIM_BDTRInitStructure
5
                    0xe               ./o/cpuinit.o
6
j                   0x4               ./o/main.o
7
TIM_TimeBaseStructure
8
                    0xa               ./o/cpuinit.o
9
dbg                 0x4               ./o/main.o
10
ToTimer             0x2               ./o/main.o
11
i                   0x4               ./o/main.o
12
DAC_InitStructure   0x10              ./o/cpuinit.o
13
GPIO_InitStructure  0x4               ./o/cpuinit.o
14
TIM_ICInitStructure
15
                    0xa               ./o/cpuinit.o
16
NVIC_InitStructure  0x4               ./o/cpuinit.o
17
18
Discarded input sections
19
20
 .text          0x0000000000000000        0x0 ./o/system_stm32f10x.o
21
 .data          0x0000000000000000       0x14 ./o/system_stm32f10x.o
22
 .bss           0x0000000000000000        0x0 ./o/system_stm32f10x.o
23
 .text.SystemInit
24
                0x0000000000000000       0x7c ./o/system_stm32f10x.o
25
 .text.SystemCoreClockUpdate
26
                0x0000000000000000      0x140 ./o/system_stm32f10x.o
27
 .text.SetSysClock
28
                0x0000000000000000        0xc ./o/system_stm32f10x.o
29
 .text.SetSysClockTo72
30
                0x0000000000000000      0x138 ./o/system_stm32f10x.o
31
 .debug_info    0x0000000000000000      0x513 ./o/system_stm32f10x.o
32
 .debug_abbrev  0x0000000000000000      0x19b ./o/system_stm32f10x.o
33
 .debug_loc     0x0000000000000000      0x110 ./o/system_stm32f10x.o
34
 .debug_aranges
35
                0x0000000000000000       0x38 ./o/system_stm32f10x.o
36
 .debug_ranges  0x0000000000000000       0x28 ./o/system_stm32f10x.o
37
 .debug_line    0x0000000000000000      0x179 ./o/system_stm32f10x.o
38
 .debug_str     0x0000000000000000      0x2ed ./o/system_stm32f10x.o
39
 .comment       0x0000000000000000       0x32 ./o/system_stm32f10x.o
40
 .debug_frame   0x0000000000000000       0x98 ./o/system_stm32f10x.o
41
 .ARM.attributes
42
                0x0000000000000000       0x33 ./o/system_stm32f10x.o
43
 .text          0x0000000000000000        0x0 ./o/stm32f10x_dac.o
44
 .data          0x0000000000000000        0x0 ./o/stm32f10x_dac.o
45
 .bss           0x0000000000000000        0x0 ./o/stm32f10x_dac.o
46
 .text.DAC_DeInit
47
                0x0000000000000000       0x1c ./o/stm32f10x_dac.o
48
 .text.DAC_StructInit
49
                0x0000000000000000       0x2a ./o/stm32f10x_dac.o
50
 .text.DAC_DMACmd
51
                0x0000000000000000       0x4c ./o/stm32f10x_dac.o
52
 .text.DAC_DualSoftwareTriggerCmd
53
                0x0000000000000000       0x38 ./o/stm32f10x_dac.o
54
 .text.DAC_WaveGenerationCmd
55
                0x0000000000000000       0x4c ./o/stm32f10x_dac.o
56
 .text.DAC_SetChannel2Data
57
                0x0000000000000000       0x34 ./o/stm32f10x_dac.o
58
 .text.DAC_SetDualChannelData
59
                0x0000000000000000       0x58 ./o/stm32f10x_dac.o
60
 .text.DAC_GetDataOutputValue
61
                0x0000000000000000       0x30 ./o/stm32f10x_dac.o
62
 .text          0x0000000000000000        0x0 ./o/stm32f10x_rcc.o
63
 .data          0x0000000000000000       0x14 ./o/stm32f10x_rcc.o
64
 .bss           0x0000000000000000        0x0 ./o/stm32f10x_rcc.o
65
 .text.RCC_AdjustHSICalibrationValue
66
                0x0000000000000000       0x3c ./o/stm32f10x_rcc.o
67
 .text.RCC_HSICmd
68
                0x0000000000000000       0x20 ./o/stm32f10x_rcc.o
69
 .text.RCC_PREDIV2Config
70
                0x0000000000000000       0x38 ./o/stm32f10x_rcc.o
71
 .text.RCC_PLL2Config
72
                0x0000000000000000       0x38 ./o/stm32f10x_rcc.o
73
 .text.RCC_PLL2Cmd
74
                0x0000000000000000       0x20 ./o/stm32f10x_rcc.o
75
 .text.RCC_PLL3Config
76
                0x0000000000000000       0x38 ./o/stm32f10x_rcc.o
77
 .text.RCC_PLL3Cmd
78
                0x0000000000000000       0x20 ./o/stm32f10x_rcc.o
79
 .text.RCC_ITConfig
80
                0x0000000000000000       0x4c ./o/stm32f10x_rcc.o
81
 .text.RCC_OTGFSCLKConfig
82
                0x0000000000000000       0x1c ./o/stm32f10x_rcc.o
83
 .text.RCC_I2S2CLKConfig
84
                0x0000000000000000       0x1c ./o/stm32f10x_rcc.o
85
 .text.RCC_I2S3CLKConfig
86
                0x0000000000000000       0x1c ./o/stm32f10x_rcc.o
87
 .text.RCC_LSEConfig
88
                0x0000000000000000       0x40 ./o/stm32f10x_rcc.o
89
 .text.RCC_LSICmd
90
                0x0000000000000000       0x20 ./o/stm32f10x_rcc.o
91
 .text.RCC_RTCCLKConfig
92
                0x0000000000000000       0x24 ./o/stm32f10x_rcc.o
93
 .text.RCC_RTCCLKCmd
94
                0x0000000000000000       0x20 ./o/stm32f10x_rcc.o
95
 .text.RCC_GetClocksFreq
96
                0x0000000000000000      0x1c8 ./o/stm32f10x_rcc.o
97
 .text.RCC_AHBPeriphResetCmd
98
                0x0000000000000000       0x3c ./o/stm32f10x_rcc.o
99
 .text.RCC_APB2PeriphResetCmd
100
                0x0000000000000000       0x3c ./o/stm32f10x_rcc.o
101
 .text.RCC_APB1PeriphResetCmd
102
                0x0000000000000000       0x3c ./o/stm32f10x_rcc.o
103
 .text.RCC_BackupResetCmd
104
                0x0000000000000000       0x20 ./o/stm32f10x_rcc.o
105
 .text.RCC_ClockSecuritySystemCmd
106
                0x0000000000000000       0x20 ./o/stm32f10x_rcc.o
107
 .text.RCC_MCOConfig
108
                0x0000000000000000       0x20 ./o/stm32f10x_rcc.o
109
 .text.RCC_ClearFlag
110
                0x0000000000000000       0x1c ./o/stm32f10x_rcc.o
111
 .text.RCC_GetITStatus
112
                0x0000000000000000       0x34 ./o/stm32f10x_rcc.o
113
 .text.RCC_ClearITPendingBit
114
                0x0000000000000000       0x20 ./o/stm32f10x_rcc.o
115
 .text          0x0000000000000000        0x0 ./o/stm32f10x_flash.o
116
 .data          0x0000000000000000        0x0 ./o/stm32f10x_flash.o
117
 .bss           0x0000000000000000        0x0 ./o/stm32f10x_flash.o
118
 .text.FLASH_HalfCycleAccessCmd
119
                0x0000000000000000       0x30 ./o/stm32f10x_flash.o
120
 .text.FLASH_Unlock
121
                0x0000000000000000       0x24 ./o/stm32f10x_flash.o
122
 .text.FLASH_UnlockBank1
123
                0x0000000000000000       0x24 ./o/stm32f10x_flash.o
124
 .text.FLASH_Lock
125
                0x0000000000000000       0x1c ./o/stm32f10x_flash.o
126
 .text.FLASH_LockBank1
127
                0x0000000000000000       0x1c ./o/stm32f10x_flash.o
128
 .text.FLASH_ErasePage
129
                0x0000000000000000       0x64 ./o/stm32f10x_flash.o
130
 .text.FLASH_EraseAllPages
131
                0x0000000000000000       0x5c ./o/stm32f10x_flash.o
132
 .text.FLASH_EraseAllBank1Pages
133
                0x0000000000000000       0x5c ./o/stm32f10x_flash.o
134
 .text.FLASH_EraseOptionBytes
135
                0x0000000000000000       0xd4 ./o/stm32f10x_flash.o
136
 .text.FLASH_ProgramWord
137
                0x0000000000000000       0x94 ./o/stm32f10x_flash.o
138
 .text.FLASH_ProgramHalfWord
139
                0x0000000000000000       0x5c ./o/stm32f10x_flash.o
140
 .text.FLASH_ProgramOptionByteData
141
                0x0000000000000000       0x78 ./o/stm32f10x_flash.o
142
 .text.FLASH_EnableWriteProtection
143
                0x0000000000000000      0x118 ./o/stm32f10x_flash.o
144
 .text.FLASH_ReadOutProtection
145
                0x0000000000000000       0xd4 ./o/stm32f10x_flash.o
146
 .text.FLASH_UserOptionByteConfig
147
                0x0000000000000000       0x94 ./o/stm32f10x_flash.o
148
 .text.FLASH_GetUserOptionByte
149
                0x0000000000000000       0x18 ./o/stm32f10x_flash.o
150
 .text.FLASH_GetWriteProtectionOptionByte
151
                0x0000000000000000       0x14 ./o/stm32f10x_flash.o
152
 .text.FLASH_GetReadOutProtectionStatus
153
                0x0000000000000000       0x30 ./o/stm32f10x_flash.o
154
 .text.FLASH_GetPrefetchBufferStatus
155
                0x0000000000000000       0x30 ./o/stm32f10x_flash.o
156
 .text.FLASH_ITConfig
157
                0x0000000000000000       0x3c ./o/stm32f10x_flash.o
158
 .text.FLASH_GetFlagStatus
159
                0x0000000000000000       0x50 ./o/stm32f10x_flash.o
160
 .text.FLASH_ClearFlag
161
                0x0000000000000000       0x1c ./o/stm32f10x_flash.o
162
 .text.FLASH_GetStatus
163
                0x0000000000000000       0x54 ./o/stm32f10x_flash.o
164
 .text.FLASH_GetBank1Status
165
                0x0000000000000000       0x54 ./o/stm32f10x_flash.o
166
 .text.FLASH_WaitForLastOperation
167
                0x0000000000000000       0x44 ./o/stm32f10x_flash.o
168
 .text.FLASH_WaitForLastBank1Operation
169
                0x0000000000000000       0x44 ./o/stm32f10x_flash.o
170
 .text          0x0000000000000000        0x0 ./o/cpuinit.o
171
 .data          0x0000000000000000        0x0 ./o/cpuinit.o
172
 .bss           0x0000000000000000        0x0 ./o/cpuinit.o
173
 .text          0x0000000000000000        0x0 ./o/flop.o
174
 .data          0x0000000000000000        0x0 ./o/flop.o
175
 .bss           0x0000000000000000        0x2 ./o/flop.o
176
 .text.SetFlop  0x0000000000000000       0x30 ./o/flop.o
177
 .text.TestFlop
178
                0x0000000000000000       0x38 ./o/flop.o
179
 .debug_info    0x0000000000000000      0x103 ./o/flop.o
180
 .debug_abbrev  0x0000000000000000       0x9d ./o/flop.o
181
 .debug_loc     0x0000000000000000       0xb8 ./o/flop.o
182
 .debug_aranges
183
                0x0000000000000000       0x28 ./o/flop.o
184
 .debug_ranges  0x0000000000000000       0x18 ./o/flop.o
185
 .debug_line    0x0000000000000000       0xa6 ./o/flop.o
186
 .debug_str     0x0000000000000000      0x145 ./o/flop.o
187
 .comment       0x0000000000000000       0x32 ./o/flop.o
188
 .debug_frame   0x0000000000000000       0x60 ./o/flop.o
189
 .ARM.attributes
190
                0x0000000000000000       0x33 ./o/flop.o
191
 .text          0x0000000000000000        0x0 ./o/misc.o
192
 .data          0x0000000000000000        0x0 ./o/misc.o
193
 .bss           0x0000000000000000        0x0 ./o/misc.o
194
 .text.NVIC_PriorityGroupConfig
195
                0x0000000000000000       0x24 ./o/misc.o
196
 .text.NVIC_SetVectorTable
197
                0x0000000000000000       0x2c ./o/misc.o
198
 .text.NVIC_SystemLPConfig
199
                0x0000000000000000       0x40 ./o/misc.o
200
 .text.SysTick_CLKSourceConfig
201
                0x0000000000000000       0x38 ./o/misc.o
202
 .text          0x0000000000000000        0x0 ./o/main.o
203
 .data          0x0000000000000000        0x0 ./o/main.o
204
 .bss           0x0000000000000000        0x3 ./o/main.o
205
 .rodata        0x0000000000000000       0x11 ./o/main.o
206
 .text          0x0000000000000000        0x0 ./o/stm32f10x_tim.o
207
 .data          0x0000000000000000        0x0 ./o/stm32f10x_tim.o
208
 .bss           0x0000000000000000        0x0 ./o/stm32f10x_tim.o
209
 .text.TIM_DeInit
210
                0x0000000000000000      0x22c ./o/stm32f10x_tim.o
211
 .text.TIM_OC1Init
212
                0x0000000000000000      0x118 ./o/stm32f10x_tim.o
213
 .text.TIM_OC2Init
214
                0x0000000000000000      0x110 ./o/stm32f10x_tim.o
215
 .text.TIM_OC3Init
216
                0x0000000000000000      0x10c ./o/stm32f10x_tim.o
217
 .text.TIM_OC4Init
218
                0x0000000000000000       0xd0 ./o/stm32f10x_tim.o
219
 .text.TIM_PWMIConfig
220
                0x0000000000000000       0xb8 ./o/stm32f10x_tim.o
221
 .text.TIM_BDTRConfig
222
                0x0000000000000000       0x4e ./o/stm32f10x_tim.o
223
 .text.TIM_TimeBaseStructInit
224
                0x0000000000000000       0x32 ./o/stm32f10x_tim.o
225
 .text.TIM_OCStructInit
226
                0x0000000000000000       0x42 ./o/stm32f10x_tim.o
227
 .text.TIM_ICStructInit
228
                0x0000000000000000       0x30 ./o/stm32f10x_tim.o
229
 .text.TIM_BDTRStructInit
230
                0x0000000000000000       0x3c ./o/stm32f10x_tim.o
231
 .text.TIM_CtrlPWMOutputs
232
                0x0000000000000000       0x4a ./o/stm32f10x_tim.o
233
 .text.TIM_GenerateEvent
234
                0x0000000000000000       0x1c ./o/stm32f10x_tim.o
235
 .text.TIM_DMAConfig
236
                0x0000000000000000       0x28 ./o/stm32f10x_tim.o
237
 .text.TIM_DMACmd
238
                0x0000000000000000       0x46 ./o/stm32f10x_tim.o
239
 .text.TIM_InternalClockConfig
240
                0x0000000000000000       0x22 ./o/stm32f10x_tim.o
241
 .text.TIM_ITRxExternalClockConfig
242
                0x0000000000000000       0x2e ./o/stm32f10x_tim.o
243
 .text.TIM_TIxExternalClockConfig
244
                0x0000000000000000       0x5c ./o/stm32f10x_tim.o
245
 .text.TIM_ETRClockMode1Config
246
                0x0000000000000000       0x5e ./o/stm32f10x_tim.o
247
 .text.TIM_ETRClockMode2Config
248
                0x0000000000000000       0x3e ./o/stm32f10x_tim.o
249
 .text.TIM_ETRConfig
250
                0x0000000000000000       0x52 ./o/stm32f10x_tim.o
251
 .text.TIM_PrescalerConfig
252
                0x0000000000000000       0x26 ./o/stm32f10x_tim.o
253
 .text.TIM_CounterModeConfig
254
                0x0000000000000000       0x36 ./o/stm32f10x_tim.o
255
 .text.TIM_SelectInputTrigger
256
                0x0000000000000000       0x36 ./o/stm32f10x_tim.o
257
 .text.TIM_ForcedOC1Config
258
                0x0000000000000000       0x36 ./o/stm32f10x_tim.o
259
 .text.TIM_ForcedOC2Config
260
                0x0000000000000000       0x3a ./o/stm32f10x_tim.o
261
 .text.TIM_ForcedOC3Config
262
                0x0000000000000000       0x36 ./o/stm32f10x_tim.o
263
 .text.TIM_ForcedOC4Config
264
                0x0000000000000000       0x3a ./o/stm32f10x_tim.o
265
 .text.TIM_ARRPreloadConfig
266
                0x0000000000000000       0x3e ./o/stm32f10x_tim.o
267
 .text.TIM_SelectCOM
268
                0x0000000000000000       0x3e ./o/stm32f10x_tim.o
269
 .text.TIM_SelectCCDMA
270
                0x0000000000000000       0x3e ./o/stm32f10x_tim.o
271
 .text.TIM_CCPreloadControl
272
                0x0000000000000000       0x3e ./o/stm32f10x_tim.o
273
 .text.TIM_OC1PreloadConfig
274
                0x0000000000000000       0x36 ./o/stm32f10x_tim.o
275
 .text.TIM_OC2PreloadConfig
276
                0x0000000000000000       0x3a ./o/stm32f10x_tim.o
277
 .text.TIM_OC3PreloadConfig
278
                0x0000000000000000       0x36 ./o/stm32f10x_tim.o
279
 .text.TIM_OC4PreloadConfig
280
                0x0000000000000000       0x3a ./o/stm32f10x_tim.o
281
 .text.TIM_OC1FastConfig
282
                0x0000000000000000       0x36 ./o/stm32f10x_tim.o
283
 .text.TIM_OC2FastConfig
284
                0x0000000000000000       0x3a ./o/stm32f10x_tim.o
285
 .text.TIM_OC3FastConfig
286
                0x0000000000000000       0x36 ./o/stm32f10x_tim.o
287
 .text.TIM_OC4FastConfig
288
                0x0000000000000000       0x3a ./o/stm32f10x_tim.o
289
 .text.TIM_ClearOC1Ref
290
                0x0000000000000000       0x36 ./o/stm32f10x_tim.o
291
 .text.TIM_ClearOC2Ref
292
                0x0000000000000000       0x3a ./o/stm32f10x_tim.o
293
 .text.TIM_ClearOC3Ref
294
                0x0000000000000000       0x36 ./o/stm32f10x_tim.o
295
 .text.TIM_ClearOC4Ref
296
                0x0000000000000000       0x3a ./o/stm32f10x_tim.o
297
 .text.TIM_OC1PolarityConfig
298
                0x0000000000000000       0x36 ./o/stm32f10x_tim.o
299
 .text.TIM_OC1NPolarityConfig
300
                0x0000000000000000       0x36 ./o/stm32f10x_tim.o
301
 .text.TIM_OC2PolarityConfig
302
                0x0000000000000000       0x3a ./o/stm32f10x_tim.o
303
 .text.TIM_OC2NPolarityConfig
304
                0x0000000000000000       0x3a ./o/stm32f10x_tim.o
305
 .text.TIM_OC3PolarityConfig
306
                0x0000000000000000       0x3a ./o/stm32f10x_tim.o
307
 .text.TIM_OC3NPolarityConfig
308
                0x0000000000000000       0x3a ./o/stm32f10x_tim.o
309
 .text.TIM_OC4PolarityConfig
310
                0x0000000000000000       0x3a ./o/stm32f10x_tim.o
311
 .text.TIM_CCxCmd
312
                0x0000000000000000       0x54 ./o/stm32f10x_tim.o
313
 .text.TIM_CCxNCmd
314
                0x0000000000000000       0x54 ./o/stm32f10x_tim.o
315
 .text.TIM_SelectOCxM
316
                0x0000000000000000       0xac ./o/stm32f10x_tim.o
317
 .text.TIM_UpdateDisableConfig
318
                0x0000000000000000       0x3e ./o/stm32f10x_tim.o
319
 .text.TIM_UpdateRequestConfig
320
                0x0000000000000000       0x3e ./o/stm32f10x_tim.o
321
 .text.TIM_SelectHallSensor
322
                0x0000000000000000       0x3e ./o/stm32f10x_tim.o
323
 .text.TIM_SelectOnePulseMode
324
                0x0000000000000000       0x36 ./o/stm32f10x_tim.o
325
 .text.TIM_SelectOutputTrigger
326
                0x0000000000000000       0x36 ./o/stm32f10x_tim.o
327
 .text.TIM_SelectSlaveMode
328
                0x0000000000000000       0x36 ./o/stm32f10x_tim.o
329
 .text.TIM_SelectMasterSlaveMode
330
                0x0000000000000000       0x36 ./o/stm32f10x_tim.o
331
 .text.TIM_SetCounter
332
                0x0000000000000000       0x1c ./o/stm32f10x_tim.o
333
 .text.TIM_SetAutoreload
334
                0x0000000000000000       0x1c ./o/stm32f10x_tim.o
335
 .text.TIM_SetCompare1
336
                0x0000000000000000       0x1c ./o/stm32f10x_tim.o
337
 .text.TIM_SetCompare2
338
                0x0000000000000000       0x1c ./o/stm32f10x_tim.o
339
 .text.TIM_SetCompare3
340
                0x0000000000000000       0x1c ./o/stm32f10x_tim.o
341
 .text.TIM_SetCompare4
342
                0x0000000000000000       0x1e ./o/stm32f10x_tim.o
343
 .text.TIM_SetClockDivision
344
                0x0000000000000000       0x36 ./o/stm32f10x_tim.o
345
 .text.TIM_GetCapture1
346
                0x0000000000000000       0x18 ./o/stm32f10x_tim.o
347
 .text.TIM_GetCapture2
348
                0x0000000000000000       0x18 ./o/stm32f10x_tim.o
349
 .text.TIM_GetCapture3
350
                0x0000000000000000       0x18 ./o/stm32f10x_tim.o
351
 .text.TIM_GetCapture4
352
                0x0000000000000000       0x1a ./o/stm32f10x_tim.o
353
 .text.TIM_GetCounter
354
                0x0000000000000000       0x18 ./o/stm32f10x_tim.o
355
 .text.TIM_GetPrescaler
356
                0x0000000000000000       0x18 ./o/stm32f10x_tim.o
357
 .text.TIM_GetFlagStatus
358
                0x0000000000000000       0x36 ./o/stm32f10x_tim.o
359
 .text.TIM_ClearFlag
360
                0x0000000000000000       0x20 ./o/stm32f10x_tim.o
361
 .text.TIM_GetITStatus
362
                0x0000000000000000       0x52 ./o/stm32f10x_tim.o
363
 .text          0x0000000000000000        0x0 ./o/stm32f10x_gpio.o
364
 .data          0x0000000000000000        0x0 ./o/stm32f10x_gpio.o
365
 .bss           0x0000000000000000        0x0 ./o/stm32f10x_gpio.o
366
 .text.GPIO_DeInit
367
                0x0000000000000000       0xe4 ./o/stm32f10x_gpio.o
368
 .text.GPIO_AFIODeInit
369
                0x0000000000000000       0x18 ./o/stm32f10x_gpio.o
370
 .text.GPIO_StructInit
371
                0x0000000000000000       0x26 ./o/stm32f10x_gpio.o
372
 .text.GPIO_ReadInputDataBit
373
                0x0000000000000000       0x32 ./o/stm32f10x_gpio.o
374
 .text.GPIO_ReadInputData
375
                0x0000000000000000       0x18 ./o/stm32f10x_gpio.o
376
 .text.GPIO_ReadOutputDataBit
377
                0x0000000000000000       0x32 ./o/stm32f10x_gpio.o
378
 .text.GPIO_ReadOutputData
379
                0x0000000000000000       0x18 ./o/stm32f10x_gpio.o
380
 .text.GPIO_SetBits
381
                0x0000000000000000       0x1c ./o/stm32f10x_gpio.o
382
 .text.GPIO_ResetBits
383
                0x0000000000000000       0x1c ./o/stm32f10x_gpio.o
384
 .text.GPIO_Write
385
                0x0000000000000000       0x1c ./o/stm32f10x_gpio.o
386
 .text.GPIO_PinLockConfig
387
                0x0000000000000000       0x42 ./o/stm32f10x_gpio.o
388
 .text.GPIO_EventOutputConfig
389
                0x0000000000000000       0x4c ./o/stm32f10x_gpio.o
390
 .text.GPIO_EventOutputCmd
391
                0x0000000000000000       0x20 ./o/stm32f10x_gpio.o
392
 .text.GPIO_EXTILineConfig
393
                0x0000000000000000       0x84 ./o/stm32f10x_gpio.o
394
 .text.GPIO_ETH_MediaInterfaceConfig
395
                0x0000000000000000       0x1c ./o/stm32f10x_gpio.o
396
 .text          0x0000000000000000       0x14 ./o/startup.o
397
 .data          0x0000000000000000        0x0 ./o/startup.o
398
 .bss           0x0000000000000000        0x0 ./o/startup.o
399
400
Memory Configuration
401
402
Name             Origin             Length             Attributes
403
RAM              0x0000000020000000 0x0000000000010000 xrw
404
FLASH            0x0000000008000000 0x0000000000040000 xr
405
*default*        0x0000000000000000 0xffffffffffffffff
406
407
Linker script and memory map
408
409
                0x0000000000000400                __Stack_Size = 0x400
410
                [!provide]                        PROVIDE (_Stack_Size, __Stack_Size)
411
                0x000000002000fc00                __Stack_Init = (_estack - __Stack_Size)
412
                [!provide]                        PROVIDE (_Stack_Init, __Stack_Init)
413
                0x0000000000000100                _Minimum_Stack_Size = 0x100
414
                0x0000000020010000                _estack = 0x20010000
415
416
.isr_vector     0x0000000008000000      0x1e4
417
                0x0000000008000000                . = ALIGN (0x4)
418
 *(.isr_vector)
419
 .isr_vector    0x0000000008000000      0x1e4 ./o/startup.o
420
                0x0000000008000000                g_pfnVectors
421
                0x00000000080001e4                . = ALIGN (0x4)
422
423
.text           0x00000000080001e4     0x13c4
424
                0x00000000080001e4                . = ALIGN (0x4)
425
 *(.text)
426
 *(.text.*)
427
 .text.DAC_Init
428
                0x00000000080001e4       0x64 ./o/stm32f10x_dac.o
429
                0x00000000080001e4                DAC_Init
430
 .text.DAC_Cmd  0x0000000008000248       0x48 ./o/stm32f10x_dac.o
431
                0x0000000008000248                DAC_Cmd
432
 .text.DAC_SoftwareTriggerCmd
433
                0x0000000008000290       0x4c ./o/stm32f10x_dac.o
434
                0x0000000008000290                DAC_SoftwareTriggerCmd
435
 .text.DAC_SetChannel1Data
436
                0x00000000080002dc       0x34 ./o/stm32f10x_dac.o
437
                0x00000000080002dc                DAC_SetChannel1Data
438
 .text.RCC_DeInit
439
                0x0000000008000310       0x70 ./o/stm32f10x_rcc.o
440
                0x0000000008000310                RCC_DeInit
441
 .text.RCC_HSEConfig
442
                0x0000000008000380       0x5c ./o/stm32f10x_rcc.o
443
                0x0000000008000380                RCC_HSEConfig
444
 .text.RCC_WaitForHSEStartUp
445
                0x00000000080003dc       0x50 ./o/stm32f10x_rcc.o
446
                0x00000000080003dc                RCC_WaitForHSEStartUp
447
 .text.RCC_PLLConfig
448
                0x000000000800042c       0x3c ./o/stm32f10x_rcc.o
449
                0x000000000800042c                RCC_PLLConfig
450
 .text.RCC_PLLCmd
451
                0x0000000008000468       0x20 ./o/stm32f10x_rcc.o
452
                0x0000000008000468                RCC_PLLCmd
453
 .text.RCC_PREDIV1Config
454
                0x0000000008000488       0x40 ./o/stm32f10x_rcc.o
455
                0x0000000008000488                RCC_PREDIV1Config
456
 .text.RCC_SYSCLKConfig
457
                0x00000000080004c8       0x38 ./o/stm32f10x_rcc.o
458
                0x00000000080004c8                RCC_SYSCLKConfig
459
 .text.RCC_GetSYSCLKSource
460
                0x0000000008000500       0x1c ./o/stm32f10x_rcc.o
461
                0x0000000008000500                RCC_GetSYSCLKSource
462
 .text.RCC_HCLKConfig
463
                0x000000000800051c       0x38 ./o/stm32f10x_rcc.o
464
                0x000000000800051c                RCC_HCLKConfig
465
 .text.RCC_PCLK1Config
466
                0x0000000008000554       0x38 ./o/stm32f10x_rcc.o
467
                0x0000000008000554                RCC_PCLK1Config
468
 .text.RCC_PCLK2Config
469
                0x000000000800058c       0x38 ./o/stm32f10x_rcc.o
470
                0x000000000800058c                RCC_PCLK2Config
471
 .text.RCC_ADCCLKConfig
472
                0x00000000080005c4       0x38 ./o/stm32f10x_rcc.o
473
                0x00000000080005c4                RCC_ADCCLKConfig
474
 .text.RCC_AHBPeriphClockCmd
475
                0x00000000080005fc       0x3c ./o/stm32f10x_rcc.o
476
                0x00000000080005fc                RCC_AHBPeriphClockCmd
477
 .text.RCC_APB2PeriphClockCmd
478
                0x0000000008000638       0x3c ./o/stm32f10x_rcc.o
479
                0x0000000008000638                RCC_APB2PeriphClockCmd
480
 .text.RCC_APB1PeriphClockCmd
481
                0x0000000008000674       0x3c ./o/stm32f10x_rcc.o
482
                0x0000000008000674                RCC_APB1PeriphClockCmd
483
 .text.RCC_GetFlagStatus
484
                0x00000000080006b0       0x74 ./o/stm32f10x_rcc.o
485
                0x00000000080006b0                RCC_GetFlagStatus
486
 .text.FLASH_SetLatency
487
                0x0000000008000724       0x38 ./o/stm32f10x_flash.o
488
                0x0000000008000724                FLASH_SetLatency
489
 .text.FLASH_PrefetchBufferCmd
490
                0x000000000800075c       0x30 ./o/stm32f10x_flash.o
491
                0x000000000800075c                FLASH_PrefetchBufferCmd
492
 .text.NVIC_SetPriority
493
                0x000000000800078c       0x54 ./o/cpuinit.o
494
 .text.SysTick_Config
495
                0x00000000080007e0       0x44 ./o/cpuinit.o
496
 .text.cpuinit  0x0000000008000824      0x268 ./o/cpuinit.o
497
                0x0000000008000824                cpuinit
498
 .text.NVIC_Init
499
                0x0000000008000a8c       0xc4 ./o/misc.o
500
                0x0000000008000a8c                NVIC_Init
501
 .text.main     0x0000000008000b50       0x18 ./o/main.o
502
                0x0000000008000b50                main
503
 .text.TIM_TimeBaseInit
504
                0x0000000008000b68       0xf8 ./o/stm32f10x_tim.o
505
                0x0000000008000b68                TIM_TimeBaseInit
506
 .text.TIM_ICInit
507
                0x0000000008000c60       0xa8 ./o/stm32f10x_tim.o
508
                0x0000000008000c60                TIM_ICInit
509
 .text.TIM_Cmd  0x0000000008000d08       0x3e ./o/stm32f10x_tim.o
510
                0x0000000008000d08                TIM_Cmd
511
 .text.TIM_ITConfig
512
                0x0000000008000d46       0x46 ./o/stm32f10x_tim.o
513
                0x0000000008000d46                TIM_ITConfig
514
 .text.TIM_EncoderInterfaceConfig
515
                0x0000000008000d8c       0x96 ./o/stm32f10x_tim.o
516
                0x0000000008000d8c                TIM_EncoderInterfaceConfig
517
 .text.TIM_SetIC1Prescaler
518
                0x0000000008000e22       0x36 ./o/stm32f10x_tim.o
519
                0x0000000008000e22                TIM_SetIC1Prescaler
520
 .text.TIM_SetIC2Prescaler
521
                0x0000000008000e58       0x3a ./o/stm32f10x_tim.o
522
                0x0000000008000e58                TIM_SetIC2Prescaler
523
 .text.TIM_SetIC3Prescaler
524
                0x0000000008000e92       0x36 ./o/stm32f10x_tim.o
525
                0x0000000008000e92                TIM_SetIC3Prescaler
526
 .text.TIM_SetIC4Prescaler
527
                0x0000000008000ec8       0x3a ./o/stm32f10x_tim.o
528
                0x0000000008000ec8                TIM_SetIC4Prescaler
529
 .text.TIM_ClearITPendingBit
530
                0x0000000008000f02       0x20 ./o/stm32f10x_tim.o
531
                0x0000000008000f02                TIM_ClearITPendingBit
532
 *fill*         0x0000000008000f22        0x2 
533
 .text.TI1_Config
534
                0x0000000008000f24       0xe0 ./o/stm32f10x_tim.o
535
 .text.TI2_Config
536
                0x0000000008001004       0xf4 ./o/stm32f10x_tim.o
537
 .text.TI3_Config
538
                0x00000000080010f8       0xec ./o/stm32f10x_tim.o
539
 .text.TI4_Config
540
                0x00000000080011e4       0xf8 ./o/stm32f10x_tim.o
541
 .text.GPIO_Init
542
                0x00000000080012dc      0x178 ./o/stm32f10x_gpio.o
543
                0x00000000080012dc                GPIO_Init
544
 .text.GPIO_WriteBit
545
                0x0000000008001454       0x2e ./o/stm32f10x_gpio.o
546
                0x0000000008001454                GPIO_WriteBit
547
 *fill*         0x0000000008001482        0x2 
548
 .text.GPIO_PinRemapConfig
549
                0x0000000008001484       0xe0 ./o/stm32f10x_gpio.o
550
                0x0000000008001484                GPIO_PinRemapConfig
551
 .text.Reset_Handler
552
                0x0000000008001564       0x40 ./o/startup.o
553
                0x0000000008001564                Reset_Handler
554
 .text.Default_Handler
555
                0x00000000080015a4        0x2 ./o/startup.o
556
                0x00000000080015a4                EXTI2_IRQHandler
557
                0x00000000080015a4                DebugMon_Handler
558
                0x00000000080015a4                TIM1_CC_IRQHandler
559
                0x00000000080015a4                HardFault_Handler
560
                0x00000000080015a4                TIM6_IRQHandler
561
                0x00000000080015a4                SysTick_Handler
562
                0x00000000080015a4                PVD_IRQHandler
563
                0x00000000080015a4                PendSV_Handler
564
                0x00000000080015a4                NMI_Handler
565
                0x00000000080015a4                CAN2_RX1_IRQHandler
566
                0x00000000080015a4                EXTI3_IRQHandler
567
                0x00000000080015a4                EXTI0_IRQHandler
568
                0x00000000080015a4                I2C2_EV_IRQHandler
569
                0x00000000080015a4                CAN1_RX0_IRQHandler
570
                0x00000000080015a4                UsageFault_Handler
571
                0x00000000080015a4                CAN2_SCE_IRQHandler
572
                0x00000000080015a4                ADC1_2_IRQHandler
573
                0x00000000080015a4                SPI1_IRQHandler
574
                0x00000000080015a4                TAMPER_IRQHandler
575
                0x00000000080015a4                CAN2_RX0_IRQHandler
576
                0x00000000080015a4                DMA2_Channel2_IRQHandler
577
                0x00000000080015a4                DMA1_Channel4_IRQHandler
578
                0x00000000080015a4                USART3_IRQHandler
579
                0x00000000080015a4                RTC_IRQHandler
580
                0x00000000080015a4                DMA1_Channel7_IRQHandler
581
                0x00000000080015a4                CAN1_RX1_IRQHandler
582
                0x00000000080015a4                UART5_IRQHandler
583
                0x00000000080015a4                TIM4_IRQHandler
584
                0x00000000080015a4                DMA2_Channel1_IRQHandler
585
                0x00000000080015a4                I2C1_EV_IRQHandler
586
                0x00000000080015a4                DMA1_Channel6_IRQHandler
587
                0x00000000080015a4                UART4_IRQHandler
588
                0x00000000080015a4                DMA2_Channel4_IRQHandler
589
                0x00000000080015a4                TIM3_IRQHandler
590
                0x00000000080015a4                RCC_IRQHandler
591
                0x00000000080015a4                TIM1_TRG_COM_IRQHandler
592
                0x00000000080015a4                DMA1_Channel1_IRQHandler
593
                0x00000000080015a4                Default_Handler
594
                0x00000000080015a4                EXTI15_10_IRQHandler
595
                0x00000000080015a4                TIM7_IRQHandler
596
                0x00000000080015a4                CAN2_TX_IRQHandler
597
                0x00000000080015a4                TIM5_IRQHandler
598
                0x00000000080015a4                EXTI9_5_IRQHandler
599
                0x00000000080015a4                ETH_WKUP_IRQHandler
600
                0x00000000080015a4                SPI2_IRQHandler
601
                0x00000000080015a4                MemManage_Handler
602
                0x00000000080015a4                CAN1_TX_IRQHandler
603
                0x00000000080015a4                SVC_Handler
604
                0x00000000080015a4                DMA2_Channel5_IRQHandler
605
                0x00000000080015a4                DMA1_Channel5_IRQHandler
606
                0x00000000080015a4                EXTI4_IRQHandler
607
                0x00000000080015a4                DMA1_Channel3_IRQHandler
608
                0x00000000080015a4                ETH_IRQHandler
609
                0x00000000080015a4                TIM1_UP_IRQHandler
610
                0x00000000080015a4                WWDG_IRQHandler
611
                0x00000000080015a4                TIM2_IRQHandler
612
                0x00000000080015a4                OTG_FS_WKUP_IRQHandler
613
                0x00000000080015a4                TIM1_BRK_IRQHandler
614
                0x00000000080015a4                EXTI1_IRQHandler
615
                0x00000000080015a4                RTCAlarm_IRQHandler
616
                0x00000000080015a4                USART2_IRQHandler
617
                0x00000000080015a4                I2C2_ER_IRQHandler
618
                0x00000000080015a4                DMA1_Channel2_IRQHandler
619
                0x00000000080015a4                CAN1_SCE_IRQHandler
620
                0x00000000080015a4                FLASH_IRQHandler
621
                0x00000000080015a4                BusFault_Handler
622
                0x00000000080015a4                USART1_IRQHandler
623
                0x00000000080015a4                OTG_FS_IRQHandler
624
                0x00000000080015a4                SPI3_IRQHandler
625
                0x00000000080015a4                I2C1_ER_IRQHandler
626
                0x00000000080015a4                DMA2_Channel3_IRQHandler
627
 *(.rodata)
628
 *(.rodata*)
629
 *(.glue_7)
630
 .glue_7        0x00000000080015a6        0x0 linker stubs
631
 *(.glue_7t)
632
 .glue_7t       0x00000000080015a6        0x0 linker stubs
633
                0x00000000080015a8                . = ALIGN (0x4)
634
 *fill*         0x00000000080015a6        0x2 
635
                0x00000000080015a8                _etext = .
636
                0x00000000080015a8                _sidata = _etext
637
638
.vfp11_veneer   0x00000000080015a8        0x0
639
 .vfp11_veneer  0x00000000080015a8        0x0 linker stubs
640
641
.v4_bx          0x00000000080015a8        0x0
642
 .v4_bx         0x00000000080015a8        0x0 linker stubs
643
644
.iplt           0x00000000080015a8        0x0
645
 .iplt          0x00000000080015a8        0x0 ./o/system_stm32f10x.o
646
647
.rel.dyn        0x00000000080015a8        0x0
648
 .rel.iplt      0x00000000080015a8        0x0 ./o/system_stm32f10x.o
649
650
.data           0x0000000020000000        0x0 load address 0x00000000080015a8
651
                0x0000000020000000                . = ALIGN (0x4)
652
                0x0000000020000000                _sdata = .
653
 *(.data)
654
 *(.data.*)
655
                0x0000000020000000                . = ALIGN (0x4)
656
                0x0000000020000000                _edata = .
657
658
.igot.plt       0x0000000020000000        0x0
659
 .igot.plt      0x0000000020000000        0x0 ./o/system_stm32f10x.o
660
661
.bss            0x0000000020000000       0x50
662
                0x0000000020000000                . = ALIGN (0x4)
663
                0x0000000020000000                _sbss = .
664
 *(.bss)
665
 *(COMMON)
666
 COMMON         0x0000000020000000       0x40 ./o/cpuinit.o
667
                0x0000000020000000                TIM_BDTRInitStructure
668
                0x0000000020000010                TIM_TimeBaseStructure
669
                0x000000002000001c                DAC_InitStructure
670
                0x000000002000002c                GPIO_InitStructure
671
                0x0000000020000030                TIM_ICInitStructure
672
                0x000000002000003c                NVIC_InitStructure
673
 COMMON         0x0000000020000040       0x10 ./o/main.o
674
                0x0000000020000040                j
675
                0x0000000020000044                dbg
676
                0x0000000020000048                ToTimer
677
                0x000000002000004c                i
678
                0x0000000020000050                . = ALIGN (0x4)
679
                0x0000000020000050                _ebss = .
680
                [!provide]                        PROVIDE (end, _ebss)
681
                [!provide]                        PROVIDE (_end, _ebss)
682
683
._usrstack      0x0000000020000050      0x100
684
                0x0000000020000050                . = ALIGN (0x4)
685
                0x0000000020000050                _susrstack = .
686
                0x0000000020000150                . = (. + _Minimum_Stack_Size)
687
 *fill*         0x0000000020000050      0x100 
688
                0x0000000020000150                . = ALIGN (0x4)
689
                0x0000000020000150                _eusrstack = .
690
LOAD ./o/system_stm32f10x.o
691
LOAD ./o/stm32f10x_dac.o
692
LOAD ./o/stm32f10x_rcc.o
693
LOAD ./o/stm32f10x_flash.o
694
LOAD ./o/cpuinit.o
695
LOAD ./o/flop.o
696
LOAD ./o/misc.o
697
LOAD ./o/main.o
698
LOAD ./o/stm32f10x_tim.o
699
LOAD ./o/stm32f10x_gpio.o
700
LOAD ./o/startup.o
701
OUTPUT(./o/out.elf elf32-littlearm)
702
703
.debug_info     0x0000000000000000     0x52be
704
 .debug_info    0x0000000000000000      0x513 ./o/stm32f10x_dac.o
705
 .debug_info    0x0000000000000513      0xb99 ./o/stm32f10x_rcc.o
706
 .debug_info    0x00000000000010ac      0x868 ./o/stm32f10x_flash.o
707
 .debug_info    0x0000000000001914      0xc54 ./o/cpuinit.o
708
 .debug_info    0x0000000000002568      0x55c ./o/misc.o
709
 .debug_info    0x0000000000002ac4      0x1af ./o/main.o
710
 .debug_info    0x0000000000002c73     0x1ea2 ./o/stm32f10x_tim.o
711
 .debug_info    0x0000000000004b15      0x76b ./o/stm32f10x_gpio.o
712
 .debug_info    0x0000000000005280       0x3e ./o/startup.o
713
714
.debug_abbrev   0x0000000000000000      0xc75
715
 .debug_abbrev  0x0000000000000000      0x18a ./o/stm32f10x_dac.o
716
 .debug_abbrev  0x000000000000018a      0x1d1 ./o/stm32f10x_rcc.o
717
 .debug_abbrev  0x000000000000035b      0x1a2 ./o/stm32f10x_flash.o
718
 .debug_abbrev  0x00000000000004fd      0x1a6 ./o/cpuinit.o
719
 .debug_abbrev  0x00000000000006a3      0x165 ./o/misc.o
720
 .debug_abbrev  0x0000000000000808       0xb7 ./o/main.o
721
 .debug_abbrev  0x00000000000008bf      0x1c5 ./o/stm32f10x_tim.o
722
 .debug_abbrev  0x0000000000000a84      0x1df ./o/stm32f10x_gpio.o
723
 .debug_abbrev  0x0000000000000c63       0x12 ./o/startup.o
724
725
.debug_loc      0x0000000000000000     0x44e4
726
 .debug_loc     0x0000000000000000      0x420 ./o/stm32f10x_dac.o
727
 .debug_loc     0x0000000000000420      0xe68 ./o/stm32f10x_rcc.o
728
 .debug_loc     0x0000000000001288      0x8f0 ./o/stm32f10x_flash.o
729
 .debug_loc     0x0000000000001b78       0xd8 ./o/cpuinit.o
730
 .debug_loc     0x0000000000001c50      0x1cc ./o/misc.o
731
 .debug_loc     0x0000000000001e1c       0x2c ./o/main.o
732
 .debug_loc     0x0000000000001e48     0x2060 ./o/stm32f10x_tim.o
733
 .debug_loc     0x0000000000003ea8      0x63c ./o/stm32f10x_gpio.o
734
735
.debug_aranges  0x0000000000000000      0x720
736
 .debug_aranges
737
                0x0000000000000000       0x78 ./o/stm32f10x_dac.o
738
 .debug_aranges
739
                0x0000000000000078      0x160 ./o/stm32f10x_rcc.o
740
 .debug_aranges
741
                0x00000000000001d8       0xf8 ./o/stm32f10x_flash.o
742
 .debug_aranges
743
                0x00000000000002d0       0x30 ./o/cpuinit.o
744
 .debug_aranges
745
                0x0000000000000300       0x40 ./o/misc.o
746
 .debug_aranges
747
                0x0000000000000340       0x20 ./o/main.o
748
 .debug_aranges
749
                0x0000000000000360      0x2f0 ./o/stm32f10x_tim.o
750
 .debug_aranges
751
                0x0000000000000650       0xa8 ./o/stm32f10x_gpio.o
752
 .debug_aranges
753
                0x00000000000006f8       0x28 ./o/startup.o
754
755
.debug_ranges   0x0000000000000000      0x698
756
 .debug_ranges  0x0000000000000000       0x68 ./o/stm32f10x_dac.o
757
 .debug_ranges  0x0000000000000068      0x150 ./o/stm32f10x_rcc.o
758
 .debug_ranges  0x00000000000001b8       0xe8 ./o/stm32f10x_flash.o
759
 .debug_ranges  0x00000000000002a0       0x20 ./o/cpuinit.o
760
 .debug_ranges  0x00000000000002c0       0x30 ./o/misc.o
761
 .debug_ranges  0x00000000000002f0       0x10 ./o/main.o
762
 .debug_ranges  0x0000000000000300      0x2e0 ./o/stm32f10x_tim.o
763
 .debug_ranges  0x00000000000005e0       0x98 ./o/stm32f10x_gpio.o
764
 .debug_ranges  0x0000000000000678       0x20 ./o/startup.o
765
766
.debug_line     0x0000000000000000     0x1ade
767
 .debug_line    0x0000000000000000      0x1ce ./o/stm32f10x_dac.o
768
 .debug_line    0x00000000000001ce      0x46e ./o/stm32f10x_rcc.o
769
 .debug_line    0x000000000000063c      0x3b3 ./o/stm32f10x_flash.o
770
 .debug_line    0x00000000000009ef      0x1a8 ./o/cpuinit.o
771
 .debug_line    0x0000000000000b97      0x12a ./o/misc.o
772
 .debug_line    0x0000000000000cc1       0xcc ./o/main.o
773
 .debug_line    0x0000000000000d8d      0xa37 ./o/stm32f10x_tim.o
774
 .debug_line    0x00000000000017c4      0x2b7 ./o/stm32f10x_gpio.o
775
 .debug_line    0x0000000000001a7b       0x63 ./o/startup.o
776
777
.debug_str      0x0000000000000000     0x2236
778
 .debug_str     0x0000000000000000      0x338 ./o/stm32f10x_dac.o
779
                                        0x38b (size before relaxing)
780
 .debug_str     0x0000000000000338      0x57a ./o/stm32f10x_rcc.o
781
                                        0x73e (size before relaxing)
782
 .debug_str     0x00000000000008b2      0x3f4 ./o/stm32f10x_flash.o
783
                                        0x5c4 (size before relaxing)
784
 .debug_str     0x0000000000000ca6      0x905 ./o/cpuinit.o
785
                                        0xb00 (size before relaxing)
786
 .debug_str     0x00000000000015ab       0xda ./o/misc.o
787
                                        0x394 (size before relaxing)
788
 .debug_str     0x0000000000001685       0x3c ./o/main.o
789
                                        0x1aa (size before relaxing)
790
 .debug_str     0x00000000000016c1      0x95e ./o/stm32f10x_tim.o
791
                                        0xdb9 (size before relaxing)
792
 .debug_str     0x000000000000201f      0x217 ./o/stm32f10x_gpio.o
793
                                        0x4f5 (size before relaxing)
794
795
.comment        0x0000000000000000       0x31
796
 .comment       0x0000000000000000       0x31 ./o/stm32f10x_dac.o
797
                                         0x32 (size before relaxing)
798
 .comment       0x0000000000000031       0x32 ./o/stm32f10x_rcc.o
799
 .comment       0x0000000000000031       0x32 ./o/stm32f10x_flash.o
800
 .comment       0x0000000000000031       0x32 ./o/cpuinit.o
801
 .comment       0x0000000000000031       0x32 ./o/misc.o
802
 .comment       0x0000000000000031       0x32 ./o/main.o
803
 .comment       0x0000000000000031       0x32 ./o/stm32f10x_tim.o
804
 .comment       0x0000000000000031       0x32 ./o/stm32f10x_gpio.o
805
806
.ARM.attributes
807
                0x0000000000000000       0x31
808
 .ARM.attributes
809
                0x0000000000000000       0x33 ./o/stm32f10x_dac.o
810
 .ARM.attributes
811
                0x0000000000000033       0x33 ./o/stm32f10x_rcc.o
812
 .ARM.attributes
813
                0x0000000000000066       0x33 ./o/stm32f10x_flash.o
814
 .ARM.attributes
815
                0x0000000000000099       0x33 ./o/cpuinit.o
816
 .ARM.attributes
817
                0x00000000000000cc       0x33 ./o/misc.o
818
 .ARM.attributes
819
                0x00000000000000ff       0x33 ./o/main.o
820
 .ARM.attributes
821
                0x0000000000000132       0x33 ./o/stm32f10x_tim.o
822
 .ARM.attributes
823
                0x0000000000000165       0x33 ./o/stm32f10x_gpio.o
824
 .ARM.attributes
825
                0x0000000000000198       0x21 ./o/startup.o
826
827
.debug_frame    0x0000000000000000     0x1ec8
828
 .debug_frame   0x0000000000000000      0x1e4 ./o/stm32f10x_dac.o
829
 .debug_frame   0x00000000000001e4      0x65c ./o/stm32f10x_rcc.o
830
 .debug_frame   0x0000000000000840      0x410 ./o/stm32f10x_flash.o
831
 .debug_frame   0x0000000000000c50       0x78 ./o/cpuinit.o
832
 .debug_frame   0x0000000000000cc8       0xd8 ./o/misc.o
833
 .debug_frame   0x0000000000000da0       0x2c ./o/main.o
834
 .debug_frame   0x0000000000000dcc      0xe2c ./o/stm32f10x_tim.o
835
 .debug_frame   0x0000000000001bf8      0x2d0 ./o/stm32f10x_gpio.o

von Nop (Gast)


Lesenswert?

Niklas G. schrieb:

> Das ist falsch. Das ist der erwähnte Fehler aus dem ST-Linkerscript.

Merkwürdig, so ähnlich funktioniert das bei mir problemlos. Ich habe 
nach den Text-Segmenten (allerdings nicht IM Textsegment) ein etext auf 
die dort angelangte Adresse, und .data hat dann das AT auf dieses etext.

Vereinfacht so:
1
SECTIONS
2
{
3
  .text :
4
  {
5
    *(.text*)
6
    . = ALIGN(4);  
7
    *(.rodata*)
8
9
  } > FLASH 
10
  
11
  . = ALIGN(4);
12
  _etext = .;
13
  
14
  .data : AT (_etext)
15
  {
16
    . = ALIGN(4);
17
    _start_of_data = .;
18
    *(.data*)
19
    . = ALIGN(4);
20
    _end_of_data = .;
21
  } > RAM 
22
  
23
  .bss :
24
  {
25
    . = ALIGN(4);
26
    *(.bss*)
27
    *(COMMON)
28
    . = ALIGN(4);
29
  } > RAM 
30
}

von Carl D. (jcw2)


Lesenswert?

Niklas G. schrieb:
>
> Mit "nm test.elf" kann man feststellen, in welche Section die Symbole
> gepackt wurden. Wenn man also z.B.
>
1
volatile int foo = 42;
2
> volatile int bar = 0;
> kompiliert, kommt
>
1
00000000 d $d
2
> 00000000 b $d
3
> 00000000 B bar
4
> 00000000 D foo
> heraus - das "D" gibt an, dass "foo" in ".data" ist, und das "B" zeigt
> dass "bar" in ".bss" ist.

Na da ist doch eine einfache Erklärung zu sehen. Initialisierung mit 0 
wird eben nicht mit 4x0-Byte ins .data geschrieben, denn ins .bss 
gepackt kann man sich diese 4Byte sparen.

Ich gebe zu, meine Vermutung war komplizierter als nötig, aber da wir 
nicht wissen, ob der TO mit 0 oder !=0 initialisiert hat, wissen wir 
auch nicht, ob die simple Erklärung "nicht wegen volatile, sonder wegen 
=0" ausreicht.

von Bauform B. (bauformb)


Lesenswert?

Niklas G. schrieb:
> Bauform B. schrieb:
>> selbst definierte sections sollen mit einem Buchstaben
>> beginnen.
>
> Hast du dafür eine Quelle?

Hier https://refspecs.linuxfoundation.org/ gibt's den/die
Tool Interface Standard (TIS)
Executable and Linking Format (ELF) Specification
Version 1.2, TIS Committee May 1995
<<This appears to be the most current TIS specification.>>
1
Special Sections
2
  Various sections in ELF are pre-defined and hold program and control
3
  information.
4
(...)
5
  .bss   This section holds uninitialized data that contribute to the
6
         program's memory image. By definition, the system initializes
7
         the data with zeros when the program begins to run.
8
(...)
9
  .text  This section holds the "text,'' or executable instructions,
10
         of a program.
11
12
  Section names with a dot (.) prefix are reserved for the system,
13
  although applications may use these sections if their existing
14
  meanings are satisfactory. Applications may use names without the
15
  prefix to avoid conflicts with system sections. The object file
16
  format lets one define sections not in the list above. An object
17
  file may have more than one section with the same name.

von J. V. (janvi)


Lesenswert?

Was ich vom map File verstehe/vermute:

Zu den "discarded input sections" ist alles unrelevant bzw. sind das 
Teile der Periph-Lib welche weggeworfen werden da unbenutzt. Weil das 
kein Archiv ist braucht man dazu die Schalter --function-sections und 
für den Linker -gc-sections.

Ab "Linker Skript and Memory Map" wirds dann interessanter. Nach Section 
und Funktionsnamen steht in der ersten Spalte die Anfangsadresse und in 
der zweiten die Länge. Warum dann der gleiche Funktionsname nochmal?

Alle .debug Zeilen sind vermutlich nur mit gdb auszuwerten und für mich 
daher unrelevant bzw. die Informationen besser über ELF und Quellen 
erhältlich.

Eine Gesamtübersicht der Speicherbelegung bzw. Code und Ram Längen sehe 
ich genausowenig wie _sdata _edata

: Bearbeitet durch User
von Nop (Gast)


Lesenswert?

J. V. schrieb:
> genausowenig wie _sdata _edata

Steht doch da, mach einfach eine Volltextsuche im Mapfile:
1
0x0000000020000000                _sdata = .
2
...
3
0x0000000020000000                _edata = .

von Niklas G. (erlkoenig) Benutzerseite


Lesenswert?

Janvi schrieb:
> 0x0000000020000000                . = ALIGN (0x4)
>                 0x0000000020000000                _sdata = .
>  *(.data)
>  *(.data.*)
>                 0x0000000020000000                . = ALIGN (0x4)
>                 0x0000000020000000                _edata = .
>
> .igot.plt       0x0000000020000000        0x0
>  .igot.plt      0x0000000020000000        0x0 ./o/system_stm32f10x.o
>
> .bss            0x0000000020000000       0x50
>                 0x0000000020000000                . = ALIGN (0x4)
>                 0x0000000020000000                _sbss = .
>  *(.bss)
>  *(COMMON)
>  COMMON         0x0000000020000000       0x40 ./o/cpuinit.o
>                 0x0000000020000000                TIM_BDTRInitStructure
>                 0x0000000020000010                TIM_TimeBaseStructure
>                 0x000000002000001c                DAC_InitStructure
>                 0x000000002000002c                GPIO_InitStructure
>                 0x0000000020000030                TIM_ICInitStructure
>                 0x000000002000003c                NVIC_InitStructure
>  COMMON         0x0000000020000040       0x10 ./o/main.o
>                 0x0000000020000040                j
>                 0x0000000020000044                dbg
>                 0x0000000020000048                ToTimer
>                 0x000000002000004c                i
>                 0x0000000020000050                . = ALIGN (0x4)
>                 0x0000000020000050                _ebss = .

Das hier sieht tatsächlich so aus als würden die Variablen in .bss 
landen. Um welche Variable geht es denn genau? Zeig doch mal deren 
Definition. Zeig auch mal die Ausgabe von "nm" angewendet auf die 
Programm-ELF und die relevante .o-Datei.

Nop schrieb:
> Merkwürdig, so ähnlich funktioniert das bei mir problemlos.

Ah, ja je nach Verteilung der "ALIGN" geht es doch. Wenn man so etwas 
hat:

Nop schrieb:
>   _etext = .;
>
>   .data : AT (_etext)
>   {
>     . = ALIGN(4);
>     _start_of_data = .;

Dann zeigt _etext an den Anfang des RAM-Abbilds im Flash, aber dann 
kommen ggf. noch erst 1-3 Bytes Padding, während _start_of_data auf 
nach das Padding im RAM zeigt. Wenn man jetzt einfach so etwas wie 
"memcpy(_start_of_data, _etext, ...)" macht, kopiert man die "leeren" 
Padding-Bytes in die Variablen hinein. In deinem Fall tritt das nicht 
auf, weil davor nochmal ein "ALIGN" steht und das ALIGN am Anfang von 
".data" somit wirkungslos ist.
Man muss also sehr genau aufpassen welche Symbole auf was gesetzt sind 
und wo das Padding hinkommt. Ich finde es daher besser, das Align vor 
das ".data" zu machen und "LOADADDR" zu verwenden, damit sich alle 
Symbole auf die Adressen nach den Padding-Bytes beziehen.

Aber anscheinend ist das hier doch nicht das Problem, weil die Variablen 
wirklich nicht in ".data" landen.

Carl D. schrieb:
> Na da ist doch eine einfache Erklärung zu sehen. Initialisierung mit 0
> wird eben nicht mit 4x0-Byte ins .data geschrieben, denn ins .bss
> gepackt kann man sich diese 4Byte sparen.

Ja natürlich, darum geht es ja die ganze Zeit. Aber angeblich (wir 
wissen es nicht) ist die Variable ja eben nicht mit 0 definiert.

Bauform B. schrieb:
> Section names with a dot (.) prefix are reserved for the system,

Ich denke das bezieht sich darauf, wenn man ein Betriebssystem mit 
vordefiniertem Linkerscript verwendet. Da man mit eigenem Linkerscript + 
Startup-Code aber seine eigene Laufzeit-Umgebung baut, ist es 
unproblematisch hier eigene Section-Namen mit "." zu definieren. Damit 
hatte ich bisher keine Probleme... Man könnte auch in der Programm-ELF 
die Standard-Namen ".data" anders benutzen als üblich - nicht besonders 
wartbar, aber da es kein OS gibt was bestimmte Namen erwartet kann da 
eigentlich nicht viel schiefgehen. In den ".o" Files hingegen wäre das 
nicht so clever, weil es dann mit den vom Compiler genutzten Namen 
kollidiert.

von Jörg W. (dl8dtl) (Moderator) Benutzerseite


Lesenswert?

Janvi schrieb:

> Soweit ich das mal gehört habe ist .text eben für den Code und .bss
> bedeute BaSeSegment und .daten sind eben für die Daten.

"block starting symbols"

So muss mal historisch eine entsprechende Assembler-Anweisung auf gaaanz 
alten IBM-Systemen gehießen haben, und seither heißt diese section halt 
so. ;-)

> … glaube mal irgendwo gehört zu haben, daß dies
> ein Relikt aus älteren Architekturen ist wo es eine Kurzadressierung
> fürs RAM gibt.

Definitiv nicht.

Carl D. schrieb:
> Na da ist doch eine einfache Erklärung zu sehen. Initialisierung mit 0
> wird eben nicht mit 4x0-Byte ins .data geschrieben, denn ins .bss
> gepackt kann man sich diese 4Byte sparen.

Bei sehr alten GCCs (ich glaube bis Version 2.x) war es tatsächlich so, 
dass
1
int foo = 0;

in .data landete und
1
int foo;

in .bss (beide natürlich auf globalem Niveau bzw. static). Das wurde 
danach aufgegeben, nun sind beide äquivalent, und alles was 0 ist, 
landet in .bss.

von Janvi (Gast)


Lesenswert?

Besten Dank an Niklas für die richtige Antwort. Es funktioniert so wie
erwartet.

Summa Summarum hat .data in all meinen Programmen viele Jahre nicht
funktioniert. Dazu gab es weder eine Warnung noch irgendwelche Fehler 
(never
trust the IDE). Ich glaube der Teil des scripts stammt ursprünglich 
nicht von Cube sondern von der Hitex Hitop IDE welche zwischenzeitlich 
zu Recht nur noch unter "Legacy Products" aufgeführt ist. Selbst hab ich 
mir das nicht ausgedacht.
Das es nicht aufgefallen ist, liegt daran daß ich als Assembler 
Programmierer gewohnt bin selbst Code anzugeben wenn eine Variable 
initialsiert sein soll. Das merkt man sich  automatisch, wenn man mal 
Zeit damit verbracht hat in anderen Projekten Fehler zu suchen. Die 
Fertigung beanstandet dabei, daß ein Projekt nicht mehr funktioniert 
seit der RAM Baustein vom Hersteller X eingesetzt wird obwohl der 
vollständig kompatibel zum bisherigen vom Hersteller Y sein sollte. Das 
ist vielleicht auch nur manchmal so ...

Als Nebeneffekt habe ich gelernt, daß ein Compiler nicht zwischen
initialisierten und nicht initialsierten Daten sondern zwischen solchen 
die
mit 0 und solchen die mit anderen Daten initialisiert werden sollen
unterscheidet.

von Markus F. (mfro)


Lesenswert?

Janvi schrieb:
> Als Nebeneffekt habe ich gelernt, daß ein Compiler nicht zwischen
> initialisierten und nicht initialsierten Daten sondern zwischen solchen
> die
> mit 0 und solchen die mit anderen Daten initialisiert werden sollen
> unterscheidet.

eigentlich sind für den Compiler alle globalen Variablen 
initialisiert.

Die, die's nicht (explizit) sind, eben (implizit) mit 0.

Und die, die mit 0 initialisiert werden, "nullt" der Startupcode in 
einem Rutsch über's .bss-Segment.

von Niklas G. (erlkoenig) Benutzerseite


Lesenswert?

Janvi schrieb:
> Besten Dank an Niklas für die richtige Antwort. Es funktioniert so wie
> erwartet.

Äh, was war es denn jetzt genau?

Janvi schrieb:
> Das es nicht aufgefallen ist, liegt daran daß ich als Assembler
> Programmierer gewohnt bin selbst Code anzugeben wenn eine Variable
> initialsiert sein soll.

Selbst da muss das eigentlich nicht. Wie z.B. hier gezeigt, kann man 
sich in Assembler globale Variablen auf exakt die gleiche Art und Weise 
initialisieren lassen:

https://www.mikrocontroller.net/articles/ARM-ASM-Tutorial#Initializing_RAM

Eine solche memcpy-artige-Schleife dürfte auch effizienter (In Sachen 
Geschwindigkeit und Flash) sein als manuelles Initialisieren jeder 
Variablen. Nur bei großen Datenstrukturen mit generierbaren Inhalten 
(z.B. ein Array wo jedes Element den gleichen Wert != 0 hat) trifft das 
nicht zu.

von Nop (Gast)


Lesenswert?

Niklas G. schrieb:
> Nop schrieb:
>> Merkwürdig, so ähnlich funktioniert das bei mir problemlos.
>
> Ah, ja je nach Verteilung der "ALIGN" geht es doch.

Ja, ich hab da überall das align stehen, damit ich im Startup die 
Kopierschleife in Assembler einfach auf 32bit-Worte machen kann. 
Deswegen auch am Ende von Data nochmal, weil ich dann zwar 0-3 Padbytes 
aus dem Flash mitkopiere, die aber nichts ausmachen, weil die im RAM ja 
genauso reserviert werden, ohne daß sie mir ins zu nullende BSS 
reinragen.

von Niklas G. (erlkoenig) Benutzerseite


Lesenswert?

Nop schrieb:
> Ja, ich hab da überall das align stehen, damit ich im Startup die
> Kopierschleife in Assembler einfach auf 32bit-Worte machen kann.

Logisch, so machen das alle. Aber im Prinzip ist eines der beiden Aligns 
(vor .data und am Anfang von .data) überflüssig, aber wenn man eines 
entfernt kann der besagte Fehler auftreten.

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.