Repository: incubator-mynewt-core Updated Branches: refs/heads/develop e92318291 -> fded8a353
No jira ticket for this commit. The nordic startup code was not zeroing BSS. We now zero the BSS in the gcc_startup_nrfxx.s file to insure that it is zeroed. This was not an issue previously as the c startup code was doing this. Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/fded8a35 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/fded8a35 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/fded8a35 Branch: refs/heads/develop Commit: fded8a353024770f591b39bb4508bb9fafc99352 Parents: e923182 Author: William San Filippo <[email protected]> Authored: Mon Jan 9 16:27:16 2017 -0800 Committer: William San Filippo <[email protected]> Committed: Mon Jan 9 16:28:44 2017 -0800 ---------------------------------------------------------------------- .../src/arch/cortex_m4/gcc_startup_nrf52.s | 10 ++++++++++ .../bmd300eval/src/arch/cortex_m4/gcc_startup_nrf52.s | 10 ++++++++++ .../src/arch/cortex_m0/gcc_startup_nrf51.s | 12 +++++++++++- .../src/arch/cortex_m0/gcc_startup_nrf51.s | 12 +++++++++++- .../src/arch/cortex_m0/gcc_startup_nrf51.s | 14 ++++++++++++-- hw/bsp/nrf51dk/src/arch/cortex_m0/gcc_startup_nrf51.s | 12 +++++++++++- .../src/arch/cortex_m4/gcc_startup_nrf52840.s | 10 ++++++++++ hw/bsp/nrf52dk/src/arch/cortex_m4/gcc_startup_nrf52.s | 12 +++++++++++- .../rb-nano2/src/arch/cortex_m4/gcc_startup_nrf52.s | 10 ++++++++++ 9 files changed, 96 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/fded8a35/hw/bsp/arduino_primo_nrf52/src/arch/cortex_m4/gcc_startup_nrf52.s ---------------------------------------------------------------------- diff --git a/hw/bsp/arduino_primo_nrf52/src/arch/cortex_m4/gcc_startup_nrf52.s b/hw/bsp/arduino_primo_nrf52/src/arch/cortex_m4/gcc_startup_nrf52.s index fb804fd..4a9417c 100755 --- a/hw/bsp/arduino_primo_nrf52/src/arch/cortex_m4/gcc_startup_nrf52.s +++ b/hw/bsp/arduino_primo_nrf52/src/arch/cortex_m4/gcc_startup_nrf52.s @@ -138,6 +138,16 @@ __isr_vector: Reset_Handler: .fnstart + /* Clear BSS */ + mov r0, #0 + ldr r2, =__bss_start__ + ldr r3, =__bss_end__ +.bss_zero_loop: + cmp r2, r3 + itt lt + strlt r0, [r2], #4 + blt .bss_zero_loop + /* Loop to copy data from read only memory to RAM. The ranges * of copy from/to are specified by following symbols evaluated in * linker script. http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/fded8a35/hw/bsp/bmd300eval/src/arch/cortex_m4/gcc_startup_nrf52.s ---------------------------------------------------------------------- diff --git a/hw/bsp/bmd300eval/src/arch/cortex_m4/gcc_startup_nrf52.s b/hw/bsp/bmd300eval/src/arch/cortex_m4/gcc_startup_nrf52.s index fb804fd..4a9417c 100755 --- a/hw/bsp/bmd300eval/src/arch/cortex_m4/gcc_startup_nrf52.s +++ b/hw/bsp/bmd300eval/src/arch/cortex_m4/gcc_startup_nrf52.s @@ -138,6 +138,16 @@ __isr_vector: Reset_Handler: .fnstart + /* Clear BSS */ + mov r0, #0 + ldr r2, =__bss_start__ + ldr r3, =__bss_end__ +.bss_zero_loop: + cmp r2, r3 + itt lt + strlt r0, [r2], #4 + blt .bss_zero_loop + /* Loop to copy data from read only memory to RAM. The ranges * of copy from/to are specified by following symbols evaluated in * linker script. http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/fded8a35/hw/bsp/nrf51-arduino_101/src/arch/cortex_m0/gcc_startup_nrf51.s ---------------------------------------------------------------------- diff --git a/hw/bsp/nrf51-arduino_101/src/arch/cortex_m0/gcc_startup_nrf51.s b/hw/bsp/nrf51-arduino_101/src/arch/cortex_m0/gcc_startup_nrf51.s index 89fcf6d..e6d9fe0 100755 --- a/hw/bsp/nrf51-arduino_101/src/arch/cortex_m0/gcc_startup_nrf51.s +++ b/hw/bsp/nrf51-arduino_101/src/arch/cortex_m0/gcc_startup_nrf51.s @@ -149,13 +149,23 @@ Reset_Handler: ORRS R2, R1 STR R2, [R0] + /* Clear BSS */ + subs r0, r0 + ldr r2, =__bss_start__ + ldr r3, =__bss_end__ +.bss_zero_loop: + cmp r2, r3 + bhs .data_copy_loop + stmia r2!, {r0} + b .bss_zero_loop + /* Loop to copy data from read only memory to RAM. The ranges * of copy from/to are specified by following symbols evaluated in * linker script. * __etext: End of code section, i.e., begin of data sections to copy from. * __data_start__/__data_end__: RAM address range that data should be * copied to. Both must be aligned to 4 bytes boundary. */ - +.data_copy_loop: ldr r1, =__etext ldr r2, =__data_start__ ldr r3, =__data_end__ http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/fded8a35/hw/bsp/nrf51-blenano/src/arch/cortex_m0/gcc_startup_nrf51.s ---------------------------------------------------------------------- diff --git a/hw/bsp/nrf51-blenano/src/arch/cortex_m0/gcc_startup_nrf51.s b/hw/bsp/nrf51-blenano/src/arch/cortex_m0/gcc_startup_nrf51.s index e4a887b..e58e8bc 100755 --- a/hw/bsp/nrf51-blenano/src/arch/cortex_m0/gcc_startup_nrf51.s +++ b/hw/bsp/nrf51-blenano/src/arch/cortex_m0/gcc_startup_nrf51.s @@ -149,13 +149,23 @@ Reset_Handler: ORRS R2, R1 STR R2, [R0] + /* Clear BSS */ + subs r0, r0 + ldr r2, =__bss_start__ + ldr r3, =__bss_end__ +.bss_zero_loop: + cmp r2, r3 + bhs .data_copy_loop + stmia r2!, {r0} + b .bss_zero_loop + /* Loop to copy data from read only memory to RAM. The ranges * of copy from/to are specified by following symbols evaluated in * linker script. * __etext: End of code section, i.e., begin of data sections to copy from. * __data_start__/__data_end__: RAM address range that data should be * copied to. Both must be aligned to 4 bytes boundary. */ - +.data_copy_loop: ldr r1, =__etext ldr r2, =__data_start__ ldr r3, =__data_end__ http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/fded8a35/hw/bsp/nrf51dk-16kbram/src/arch/cortex_m0/gcc_startup_nrf51.s ---------------------------------------------------------------------- diff --git a/hw/bsp/nrf51dk-16kbram/src/arch/cortex_m0/gcc_startup_nrf51.s b/hw/bsp/nrf51dk-16kbram/src/arch/cortex_m0/gcc_startup_nrf51.s index 73c6265..3ece57c 100755 --- a/hw/bsp/nrf51dk-16kbram/src/arch/cortex_m0/gcc_startup_nrf51.s +++ b/hw/bsp/nrf51dk-16kbram/src/arch/cortex_m0/gcc_startup_nrf51.s @@ -1,4 +1,4 @@ -/* +/* Copyright (c) 2015, Nordic Semiconductor ASA All rights reserved. @@ -149,13 +149,23 @@ Reset_Handler: ORRS R2, R1 STR R2, [R0] + /* Clear BSS */ + subs r0, r0 + ldr r2, =__bss_start__ + ldr r3, =__bss_end__ +.bss_zero_loop: + cmp r2, r3 + bhs .data_copy_loop + stmia r2!, {r0} + b .bss_zero_loop + /* Loop to copy data from read only memory to RAM. The ranges * of copy from/to are specified by following symbols evaluated in * linker script. * __etext: End of code section, i.e., begin of data sections to copy from. * __data_start__/__data_end__: RAM address range that data should be * copied to. Both must be aligned to 4 bytes boundary. */ - +.data_copy_loop: ldr r1, =__etext ldr r2, =__data_start__ ldr r3, =__data_end__ http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/fded8a35/hw/bsp/nrf51dk/src/arch/cortex_m0/gcc_startup_nrf51.s ---------------------------------------------------------------------- diff --git a/hw/bsp/nrf51dk/src/arch/cortex_m0/gcc_startup_nrf51.s b/hw/bsp/nrf51dk/src/arch/cortex_m0/gcc_startup_nrf51.s index fbc88bd..8a4ec2f 100755 --- a/hw/bsp/nrf51dk/src/arch/cortex_m0/gcc_startup_nrf51.s +++ b/hw/bsp/nrf51dk/src/arch/cortex_m0/gcc_startup_nrf51.s @@ -149,13 +149,23 @@ Reset_Handler: ORRS R2, R1 STR R2, [R0] + /* Clear BSS */ + subs r0, r0 + ldr r2, =__bss_start__ + ldr r3, =__bss_end__ +.bss_zero_loop: + cmp r2, r3 + bhs .data_copy_loop + stmia r2!, {r0} + b .bss_zero_loop + /* Loop to copy data from read only memory to RAM. The ranges * of copy from/to are specified by following symbols evaluated in * linker script. * __etext: End of code section, i.e., begin of data sections to copy from. * __data_start__/__data_end__: RAM address range that data should be * copied to. Both must be aligned to 4 bytes boundary. */ - +.data_copy_loop: ldr r1, =__etext ldr r2, =__data_start__ ldr r3, =__data_end__ http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/fded8a35/hw/bsp/nrf52840pdk/src/arch/cortex_m4/gcc_startup_nrf52840.s ---------------------------------------------------------------------- diff --git a/hw/bsp/nrf52840pdk/src/arch/cortex_m4/gcc_startup_nrf52840.s b/hw/bsp/nrf52840pdk/src/arch/cortex_m4/gcc_startup_nrf52840.s index a7a9c96..f43a77c 100755 --- a/hw/bsp/nrf52840pdk/src/arch/cortex_m4/gcc_startup_nrf52840.s +++ b/hw/bsp/nrf52840pdk/src/arch/cortex_m4/gcc_startup_nrf52840.s @@ -147,6 +147,16 @@ __isr_vector: Reset_Handler: .fnstart + /* Clear BSS */ + mov r0, #0 + ldr r2, =__bss_start__ + ldr r3, =__bss_end__ +.bss_zero_loop: + cmp r2, r3 + itt lt + strlt r0, [r2], #4 + blt .bss_zero_loop + /* Loop to copy data from read only memory to RAM. The ranges * of copy from/to are specified by following symbols evaluated in * linker script. http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/fded8a35/hw/bsp/nrf52dk/src/arch/cortex_m4/gcc_startup_nrf52.s ---------------------------------------------------------------------- diff --git a/hw/bsp/nrf52dk/src/arch/cortex_m4/gcc_startup_nrf52.s b/hw/bsp/nrf52dk/src/arch/cortex_m4/gcc_startup_nrf52.s index fb804fd..b45a73c 100755 --- a/hw/bsp/nrf52dk/src/arch/cortex_m4/gcc_startup_nrf52.s +++ b/hw/bsp/nrf52dk/src/arch/cortex_m4/gcc_startup_nrf52.s @@ -138,13 +138,23 @@ __isr_vector: Reset_Handler: .fnstart + /* Clear BSS */ + mov r0, #0 + ldr r2, =__bss_start__ + ldr r3, =__bss_end__ +.bss_zero_loop: + cmp r2, r3 + itt lt + strlt r0, [r2], #4 + blt .bss_zero_loop + + /* Loop to copy data from read only memory to RAM. The ranges * of copy from/to are specified by following symbols evaluated in * linker script. * __etext: End of code section, i.e., begin of data sections to copy from. * __data_start__/__data_end__: RAM address range that data should be * copied to. Both must be aligned to 4 bytes boundary. */ - ldr r1, =__etext ldr r2, =__data_start__ ldr r3, =__data_end__ http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/fded8a35/hw/bsp/rb-nano2/src/arch/cortex_m4/gcc_startup_nrf52.s ---------------------------------------------------------------------- diff --git a/hw/bsp/rb-nano2/src/arch/cortex_m4/gcc_startup_nrf52.s b/hw/bsp/rb-nano2/src/arch/cortex_m4/gcc_startup_nrf52.s index fb804fd..4a9417c 100755 --- a/hw/bsp/rb-nano2/src/arch/cortex_m4/gcc_startup_nrf52.s +++ b/hw/bsp/rb-nano2/src/arch/cortex_m4/gcc_startup_nrf52.s @@ -138,6 +138,16 @@ __isr_vector: Reset_Handler: .fnstart + /* Clear BSS */ + mov r0, #0 + ldr r2, =__bss_start__ + ldr r3, =__bss_end__ +.bss_zero_loop: + cmp r2, r3 + itt lt + strlt r0, [r2], #4 + blt .bss_zero_loop + /* Loop to copy data from read only memory to RAM. The ranges * of copy from/to are specified by following symbols evaluated in * linker script.
