You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ja...@apache.org on 2026/09/08 12:48:49 UTC
(mynewt-core) 02/03: bsp/apollo3: Use common startup code and linker script
This is an automated email from the ASF dual-hosted git repository.
sjanc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
commit 2acc1bce5f935931e5ed54d9c5984b03c39a5b9b
Author: Wiktor Kwiatkowski <wi...@codecoup.pl>
AuthorDate: Mon Aug 31 11:46:06 2026 +0200
bsp/apollo3: Use common startup code and linker script
This removes local startup code and linker scripts
---
hw/bsp/apollo3_evb/apollo3.ld | 31 --
hw/bsp/apollo3_evb/boot-apollo3.ld | 35 ---
hw/bsp/apollo3_evb/bsp.yml | 9 +-
hw/bsp/apollo3_evb/pkg.yml | 1 +
.../src/arch/cortex_m4/gcc_startup_apollo3.s | 313 ---------------------
5 files changed, 2 insertions(+), 387 deletions(-)
diff --git a/hw/bsp/apollo3_evb/apollo3.ld b/hw/bsp/apollo3_evb/apollo3.ld
deleted file mode 100644
index 9c0f70d3e..000000000
--- a/hw/bsp/apollo3_evb/apollo3.ld
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Linker script for Nordic Semiconductor nRF5 devices
- *
- * Version: Sourcery G++ 4.5-1
- * Support: https://support.codesourcery.com/GNUToolchain/
- *
- * Copyright (c) 2007, 2008, 2009, 2010 CodeSourcery, Inc.
- *
- * The authors hereby grant permission to use, copy, modify, distribute,
- * and license this software and its documentation for any purpose, provided
- * that existing copyright notices are retained in all copies and that this
- * notice is included verbatim in any distributions. No written agreement,
- * license, or royalty fee is required for any of the authorized uses.
- * Modifications to this software may be copyrighted by their authors
- * and need not follow the licensing terms described here, provided that
- * the new terms are clearly indicated on the first page of each file where
- * they apply.
- */
-MEMORY
-{
- FLASH (rx) : ORIGIN = 0x00014000, LENGTH = 0x38000
-
- /* NOTE: The last 8 bytes of SRAM are intentionally excluded. The Apollo3's
- * in-ROM boot loader crashes when the initial stack pointer is at the end of
- * RAM. Reducing the size of RAM slightly forces the initial MSP down by 8
- * bytes.
- */
- RAM (rwx) : ORIGIN = 0x10000000, LENGTH = 0x5fff8
-}
-
-/* This linker script is used for images and thus contains an image header */
-_imghdr_size = 0x20;
diff --git a/hw/bsp/apollo3_evb/boot-apollo3.ld b/hw/bsp/apollo3_evb/boot-apollo3.ld
deleted file mode 100644
index 300deb80a..000000000
--- a/hw/bsp/apollo3_evb/boot-apollo3.ld
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Linker script for Nordic Semiconductor nRF5 devices
- *
- * Version: Sourcery G++ 4.5-1
- * Support: https://support.codesourcery.com/GNUToolchain/
- *
- * Copyright (c) 2007, 2008, 2009, 2010 CodeSourcery, Inc.
- *
- * The authors hereby grant permission to use, copy, modify, distribute,
- * and license this software and its documentation for any purpose, provided
- * that existing copyright notices are retained in all copies and that this
- * notice is included verbatim in any distributions. No written agreement,
- * license, or royalty fee is required for any of the authorized uses.
- * Modifications to this software may be copyrighted by their authors
- * and need not follow the licensing terms described here, provided that
- * the new terms are clearly indicated on the first page of each file where
- * they apply.
- */
-MEMORY
-{
- /*
- * Ambiq SBL cannot be removed by customers and will start programs at 0xc000
- * Ambiq customer bootloaders can be placed hereß
- */
- FLASH (rx) : ORIGIN = 0x0000c000, LENGTH = 0x8000
-
- /* NOTE: The last 8 bytes of SRAM are intentionally excluded. The Apollo3's
- * in-ROM boot loader crashes when the initial stack pointer is at the end of
- * RAM. Reducing the size of RAM slightly forces the initial MSP down by 8
- * bytes.
- */
- RAM (rwx) : ORIGIN = 0x10000000, LENGTH = 0x5fff8
-}
-
-/* The bootloader does not contain an image header */
-_imghdr_size = 0x0;
diff --git a/hw/bsp/apollo3_evb/bsp.yml b/hw/bsp/apollo3_evb/bsp.yml
index 6ed28b5ee..dadd4eaf0 100644
--- a/hw/bsp/apollo3_evb/bsp.yml
+++ b/hw/bsp/apollo3_evb/bsp.yml
@@ -17,19 +17,12 @@
# under the License.
#
-# Flash sector size: 8 kB.
-
bsp.name: "Apollo3 EVB"
bsp.url: https://ambiq.com/apollo3/
bsp.maker: "Ambiq Micro"
bsp.arch: cortex_m4
bsp.compiler: "@apache-mynewt-core/compiler/arm-none-eabi-m4"
-bsp.linkerscript:
- - "@apache-mynewt-core/hw/bsp/apollo3_evb/apollo3.ld"
- - "@apache-mynewt-core/hw/mcu/ambiq/apollo3/apollo3.ld"
-bsp.linkerscript.BOOT_LOADER.OVERWRITE:
- - "@apache-mynewt-core/hw/bsp/apollo3_evb/boot-apollo3.ld"
- - "@apache-mynewt-core/hw/mcu/ambiq/apollo3/apollo3.ld"
+bsp.linkerscript: autogenerated
bsp.downloadscript: "@apache-mynewt-core/hw/bsp/apollo3_evb/apollo3_evb_download.sh"
bsp.debugscript: "@apache-mynewt-core/hw/bsp/apollo3_evb/apollo3_evb_debug.sh"
diff --git a/hw/bsp/apollo3_evb/pkg.yml b/hw/bsp/apollo3_evb/pkg.yml
index f7ab3c0af..2305815ec 100644
--- a/hw/bsp/apollo3_evb/pkg.yml
+++ b/hw/bsp/apollo3_evb/pkg.yml
@@ -34,3 +34,4 @@ pkg.deps:
- "@apache-mynewt-core/hw/mcu/ambiq/apollo3"
- "@apache-mynewt-core/libc"
- '@apache-mynewt-core/sys/flash_map'
+ - '@apache-mynewt-core/boot/startup'
diff --git a/hw/bsp/apollo3_evb/src/arch/cortex_m4/gcc_startup_apollo3.s b/hw/bsp/apollo3_evb/src/arch/cortex_m4/gcc_startup_apollo3.s
deleted file mode 100644
index 34df6932d..000000000
--- a/hw/bsp/apollo3_evb/src/arch/cortex_m4/gcc_startup_apollo3.s
+++ /dev/null
@@ -1,313 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
- .syntax unified
- .arch armv7e-m
-
- .section .stack
- .align 3
- .equ Stack_Size, 432
- .globl __StackTop
- .globl __StackLimit
-__StackLimit:
- .space Stack_Size
- .size __StackLimit, . - __StackLimit
-__StackTop:
- .size __StackTop, . - __StackTop
-
- .section .heap
- .align 3
-#ifdef __HEAP_SIZE
- .equ Heap_Size, __HEAP_SIZE
-#else
- .equ Heap_Size, 0
-#endif
- .globl __HeapBase
- .globl __HeapLimit
-__HeapBase:
- .if Heap_Size
- .space Heap_Size
- .endif
- .size __HeapBase, . - __HeapBase
-__HeapLimit:
- .size __HeapLimit, . - __HeapLimit
-
- .section .isr_vector
- .align 2
- .globl __isr_vector
-__isr_vector:
- .long __StackTop /* Top of Stack */
- .long Reset_Handler /* Reset Handler */
- .long NMI_Handler /* NMI Handler */
- .long HardFault_Handler /* Hard Fault Handler */
- .long MemoryManagement_Handler /* Memory Fault */
- .long BusFault_Handler /* Bus Fault */
- .long UsageFault_Handler /* Usage Fault */
- .long SecureFault_Handler /* Secure Fault */
- .long 0 /* Reserved */
- .long 0 /* Reserved */
- .long 0 /* Reserved */
- .long SVC_Handler /* SVCall Handler */
- .long DebugMon_Handler /* Debug Monitor */
- .long 0 /* Reserved */
- .long PendSV_Handler /* PendSV Handler */
- .long SysTick_Handler /* SysTick Handler */
-
- /* External Interrupts */
- .long BROWNOUT_IRQHandler
- .long WATCHDOG_IRQHandler
- .long RTC_IRQHandler
- .long VCOMP_IRQHandler
- .long IOSLAVE_IOS_IRQHandler
- .long IOSLAVE_ACC_IRQHandler
- .long IOMASTER0_IRQHandler
- .long IOMASTER1_IRQHandler
- .long IOMASTER2_IRQHandler
- .long IOMASTER3_IRQHandler
- .long IOMASTER4_IRQHandler
- .long IOMASTER5_IRQHandler
- .long BLE_IRQHandler
- .long GPIO_IRQHandler
- .long CTIMER_IRQHandler
- .long UART0_IRQHandler
- .long UART1_IRQHandler
- .long SCARD_IRQHandler
- .long ADC_IRQHandler
- .long PDM_IRQHandler
- .long MSPI_IRQHandler
- .long SOFTWARE0_IRQHandler
- .long STIMER_IRQHandler
- .long STIMER_CMPR0_IRQHandler
- .long STIMER_CMPR1_IRQHandler
- .long STIMER_CMPR2_IRQHandler
- .long STIMER_CMPR3_IRQHandler
- .long STIMER_CMPR4_IRQHandler
- .long STIMER_CMPR5_IRQHandler
- .long STIMER_CMPR6_IRQHandler
- .long STIMER_CMPR7_IRQHandler
- .long CLKGEN_IRQHandler
-__ble_patch:
-/* The patch table should pad the vector table size to a total of 64 entries
- * (16 core + 48 periph) such that code begins at offset 0x100.
- */
- .long 0 /* Reserved */
- .long 0 /* Reserved */
- .long 0 /* Reserved */
- .long 0 /* Reserved */
- .long 0 /* Reserved */
- .long 0 /* Reserved */
- .long 0 /* Reserved */
- .long 0 /* Reserved */
- .long 0 /* Reserved */
- .long 0 /* Reserved */
- .long 0 /* Reserved */
- .long 0 /* Reserved */
- .long 0 /* Reserved */
- .long 0 /* Reserved */
- .long 0 /* Reserved */
- .long 0 /* Reserved */
-
- .size __isr_vector, . - __isr_vector
-
-/* Reset Handler */
-
- .text
- .thumb
- .thumb_func
- .align 1
- .globl Reset_Handler
- .type Reset_Handler, %function
-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__
-
- subs r3, r2
- ble .LC0
-
-.LC1:
- subs r3, 4
- ldr r0, [r1,r3]
- str r0, [r2,r3]
- bgt .LC1
-
-.LC0:
-
- ldr r0, =__StackTop
- msr psp, r0
- msr msp, r0
-
- LDR R0, =__HeapBase
- LDR R1, =__HeapLimit
- BL _sbrkInit
-
- LDR R0, =SystemInit
- BLX R0
-
- BL hal_system_init
-
- LDR R0, =_start
- BX R0
-
- .pool
- .cantunwind
- .fnend
- .size Reset_Handler,.-Reset_Handler
-
- .section ".text"
-
-
-/* Dummy Exception Handlers (infinite loops which can be modified) */
-
- .weak NMI_Handler
- .type NMI_Handler, %function
-NMI_Handler:
- B .
- .size NMI_Handler, . - NMI_Handler
-
-
- .weak HardFault_Handler
- .type HardFault_Handler, %function
-HardFault_Handler:
- B .
- .size HardFault_Handler, . - HardFault_Handler
-
-
- .weak MemoryManagement_Handler
- .type MemoryManagement_Handler, %function
-MemoryManagement_Handler:
- B .
- .size MemoryManagement_Handler, . - MemoryManagement_Handler
-
-
- .weak BusFault_Handler
- .type BusFault_Handler, %function
-BusFault_Handler:
- B .
- .size BusFault_Handler, . - BusFault_Handler
-
-
- .weak UsageFault_Handler
- .type UsageFault_Handler, %function
-UsageFault_Handler:
- B .
- .size UsageFault_Handler, . - UsageFault_Handler
-
-
- .weak SecureFault_Handler
- .type SecureFault_Handler, %function
-SecureFault_Handler:
- B .
- .size SecureFault_Handler, . - SecureFault_Handler
-
-
- .weak SVC_Handler
- .type SVC_Handler, %function
-SVC_Handler:
- B .
- .size SVC_Handler, . - SVC_Handler
-
-
- .weak DebugMon_Handler
- .type DebugMon_Handler, %function
-DebugMon_Handler:
- B .
- .size DebugMon_Handler, . - DebugMon_Handler
-
-
- .weak PendSV_Handler
- .type PendSV_Handler, %function
-PendSV_Handler:
- B .
- .size PendSV_Handler, . - PendSV_Handler
-
-
- .weak SysTick_Handler
- .type SysTick_Handler, %function
-SysTick_Handler:
- B .
- .size SysTick_Handler, . - SysTick_Handler
-
-
-/* IRQ Handlers */
-
- .globl Default_Handler
- .type Default_Handler, %function
-Default_Handler:
- B .
- .size Default_Handler, . - Default_Handler
-
- .macro IRQ handler
- .weak \handler
- .set \handler, Default_Handler
- .endm
-
- IRQ BROWNOUT_IRQHandler
- IRQ WATCHDOG_IRQHandler
- IRQ RTC_IRQHandler
- IRQ VCOMP_IRQHandler
- IRQ IOSLAVE_IOS_IRQHandler
- IRQ IOSLAVE_ACC_IRQHandler
- IRQ IOMASTER0_IRQHandler
- IRQ IOMASTER1_IRQHandler
- IRQ IOMASTER2_IRQHandler
- IRQ IOMASTER3_IRQHandler
- IRQ IOMASTER4_IRQHandler
- IRQ IOMASTER5_IRQHandler
- IRQ BLE_IRQHandler
- IRQ GPIO_IRQHandler
- IRQ CTIMER_IRQHandler
- IRQ UART0_IRQHandler
- IRQ UART1_IRQHandler
- IRQ SCARD_IRQHandler
- IRQ ADC_IRQHandler
- IRQ PDM_IRQHandler
- IRQ MSPI_IRQHandler
- IRQ SOFTWARE0_IRQHandler
- IRQ STIMER_IRQHandler
- IRQ STIMER_CMPR0_IRQHandler
- IRQ STIMER_CMPR1_IRQHandler
- IRQ STIMER_CMPR2_IRQHandler
- IRQ STIMER_CMPR3_IRQHandler
- IRQ STIMER_CMPR4_IRQHandler
- IRQ STIMER_CMPR5_IRQHandler
- IRQ STIMER_CMPR6_IRQHandler
- IRQ STIMER_CMPR7_IRQHandler
- IRQ CLKGEN_IRQHandler
-
- .end