Skip to content

Commit

Permalink
STM32F0xx: GCC_ARM remove zero bss, in startup.
Browse files Browse the repository at this point in the history
zero bss is done in libc init after call to _start.
  • Loading branch information
jamike committed Oct 27, 2016
1 parent 9f20c46 commit 702f64a
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 119 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ defined in linker script */
.word _sdata
/* end address for the .data section. defined in linker script */
.word _edata
/* start address for the .bss section. defined in linker script */
.word _sbss
/* end address for the .bss section. defined in linker script */
.word _ebss

.section .text.Reset_Handler
.weak Reset_Handler
Expand All @@ -83,19 +79,6 @@ LoopCopyDataInit:
adds r2, r0, r1
cmp r2, r3
bcc CopyDataInit
ldr r2, =_sbss
b LoopFillZerobss
/* Zero fill the bss segment. */
FillZerobss:
movs r3, #0
str r3, [r2]
adds r2, r2, #4


LoopFillZerobss:
ldr r3, = _ebss
cmp r2, r3
bcc FillZerobss

/* Call the clock system intitialization function.*/
bl SystemInit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ defined in linker script */
.word _sdata
/* end address for the .data section. defined in linker script */
.word _edata
/* start address for the .bss section. defined in linker script */
.word _sbss
/* end address for the .bss section. defined in linker script */
.word _ebss

.section .text.Reset_Handler
.weak Reset_Handler
Expand All @@ -83,19 +79,6 @@ LoopCopyDataInit:
adds r2, r0, r1
cmp r2, r3
bcc CopyDataInit
ldr r2, =_sbss
b LoopFillZerobss
/* Zero fill the bss segment. */
FillZerobss:
movs r3, #0
str r3, [r2]
adds r2, r2, #4


LoopFillZerobss:
ldr r3, = _ebss
cmp r2, r3
bcc FillZerobss

/* Call the clock system intitialization function.*/
bl SystemInit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ defined in linker script */
.word _sdata
/* end address for the .data section. defined in linker script */
.word _edata
/* start address for the .bss section. defined in linker script */
.word _sbss
/* end address for the .bss section. defined in linker script */
.word _ebss

.section .text.Reset_Handler
.weak Reset_Handler
Expand All @@ -83,19 +79,6 @@ LoopCopyDataInit:
adds r2, r0, r1
cmp r2, r3
bcc CopyDataInit
ldr r2, =_sbss
b LoopFillZerobss
/* Zero fill the bss segment. */
FillZerobss:
movs r3, #0
str r3, [r2]
adds r2, r2, #4


LoopFillZerobss:
ldr r3, = _ebss
cmp r2, r3
bcc FillZerobss

/* Call the clock system intitialization function.*/
bl SystemInit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ defined in linker script */
.word _sdata
/* end address for the .data section. defined in linker script */
.word _edata
/* start address for the .bss section. defined in linker script */
.word _sbss
/* end address for the .bss section. defined in linker script */
.word _ebss

/**
* @brief This is the code that gets called when the processor first
Expand Down Expand Up @@ -115,19 +111,6 @@ LoopCopyDataInit:
adds r2, r0, r1
cmp r2, r3
bcc CopyDataInit
ldr r2, =_sbss
b LoopFillZerobss
/* Zero fill the bss segment. */
FillZerobss:
movs r3, #0
str r3, [r2]
adds r2, r2, #4


LoopFillZerobss:
ldr r3, = _ebss
cmp r2, r3
bcc FillZerobss

/* Call the clock system intitialization function.*/
bl SystemInit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,7 @@ defined in linker script */
.word _sdata
/* end address for the .data section. defined in linker script */
.word _edata
/* start address for the .bss section. defined in linker script */
.word _sbss
/* end address for the .bss section. defined in linker script */
.word _ebss


.section .text.Reset_Handler
.weak Reset_Handler
Expand All @@ -83,19 +80,6 @@ LoopCopyDataInit:
adds r2, r0, r1
cmp r2, r3
bcc CopyDataInit
ldr r2, =_sbss
b LoopFillZerobss
/* Zero fill the bss segment. */
FillZerobss:
movs r3, #0
str r3, [r2]
adds r2, r2, #4


LoopFillZerobss:
ldr r3, = _ebss
cmp r2, r3
bcc FillZerobss

/* Call the clock system intitialization function.*/
bl SystemInit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ defined in linker script */
.word _sdata
/* end address for the .data section. defined in linker script */
.word _edata
/* start address for the .bss section. defined in linker script */
.word _sbss
/* end address for the .bss section. defined in linker script */
.word _ebss

.section .text.Reset_Handler
.weak Reset_Handler
Expand All @@ -83,19 +79,6 @@ LoopCopyDataInit:
adds r2, r0, r1
cmp r2, r3
bcc CopyDataInit
ldr r2, =_sbss
b LoopFillZerobss
/* Zero fill the bss segment. */
FillZerobss:
movs r3, #0
str r3, [r2]
adds r2, r2, #4


LoopFillZerobss:
ldr r3, = _ebss
cmp r2, r3
bcc FillZerobss

/* Call the clock system intitialization function.*/
bl SystemInit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ defined in linker script */
.word _sdata
/* end address for the .data section. defined in linker script */
.word _edata
/* start address for the .bss section. defined in linker script */
.word _sbss
/* end address for the .bss section. defined in linker script */
.word _ebss

.section .text.Reset_Handler
.weak Reset_Handler
Expand All @@ -83,19 +79,6 @@ LoopCopyDataInit:
adds r2, r0, r1
cmp r2, r3
bcc CopyDataInit
ldr r2, =_sbss
b LoopFillZerobss
/* Zero fill the bss segment. */
FillZerobss:
movs r3, #0
str r3, [r2]
adds r2, r2, #4


LoopFillZerobss:
ldr r3, = _ebss
cmp r2, r3
bcc FillZerobss

/* Call the clock system intitialization function.*/
bl SystemInit
Expand Down

3 comments on commit 702f64a

@markus-becker-tridonic-com

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @jamike .

Why is filling the BSS with zeroes not required? Is the BSS already zeroed?

Thanks,
Markus

FYI: @daniel-cesarini-tridonic-com @martin-tomasini-tridonic-com

@markus-becker-tridonic-com

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: @bcostm

@ChristianRinn
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The answer is in the commit message:

zero bss is done in libc init after call to _start.

Please sign in to comment.