Skip to content

Commit 24501df

Browse files
authored
Merge pull request ARMmbed#14042 from hugueskamba/hk_cmake_ambiq_micro_support
CMake: Add support for all Ambiq Micro Mbed targets
2 parents ae4a53e + 2e144e8 commit 24501df

File tree

8 files changed

+257
-12
lines changed

8 files changed

+257
-12
lines changed

connectivity/drivers/ble/FEATURE_BLE/TARGET_Ambiq_Micro/TARGET_Apollo3/CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
target_include_directories(mbed-ble
5-
PUBLIC
5+
INTERFACE
66
.
77
)
88

99
target_sources(mbed-ble
10-
PRIVATE
10+
INTERFACE
1111
AP3CordioHCIDriver.cpp
1212
AP3CordioHCITransportDriver.cpp
1313
)
1414

1515
target_link_libraries(mbed-ble
16-
mbed-core
16+
INTERFACE
17+
mbed-core
1718
)

connectivity/drivers/ble/FEATURE_BLE/TARGET_Ambiq_Micro/hal/apollo3/hci_drv_apollo3.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,7 @@ HciDrvRadioBoot(bool bColdBoot)
511511
CRITICAL_PRINT("INTEN: %d\n", BLEIF->INTEN_b.BLECSSTAT);
512512
CRITICAL_PRINT("INTENREG: %d\n", BLEIF->INTEN);
513513

514+
NVIC_SetVector(BLE_IRQn, HciDrvIntService);
514515
NVIC_EnableIRQ(BLE_IRQn);
515516

516517
//

targets/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Copyright (c) 2020 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
if("Analog_Devices" IN_LIST MBED_TARGET_LABELS)
4+
if("Ambiq_Micro" IN_LIST MBED_TARGET_LABELS)
5+
add_subdirectory(TARGET_Ambiq_Micro)
6+
elseif("Analog_Devices" IN_LIST MBED_TARGET_LABELS)
57
add_subdirectory(TARGET_Analog_Devices)
68
elseif("ARM_FM" IN_LIST MBED_TARGET_LABELS)
79
add_subdirectory(TARGET_ARM_FM)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright (c) 2020 ARM Limited. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
if("Apollo3" IN_LIST MBED_TARGET_LABELS)
5+
add_subdirectory(TARGET_Apollo3)
6+
endif()
7+
8+
target_include_directories(mbed-core
9+
INTERFACE
10+
sdk/devices
11+
sdk/utils
12+
)
13+
14+
target_sources(mbed-core
15+
INTERFACE
16+
sdk/devices/am_devices_button.c
17+
sdk/devices/am_devices_led.c
18+
19+
sdk/utils/am_util_ble.c
20+
sdk/utils/am_util_debug.c
21+
sdk/utils/am_util_delay.c
22+
sdk/utils/am_util_id.c
23+
sdk/utils/am_util_stdio.c
24+
sdk/utils/am_util_string.c
25+
sdk/utils/am_util_time.c
26+
)
Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
# Copyright (c) 2020 ARM Limited. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
if("hm01b0" IN_LIST MBED_TARGET_LABELS)
5+
target_include_directories(mbed-core
6+
INTERFACE
7+
COMPONENT_hm01b0/hm01b0
8+
)
9+
10+
target_sources(mbed-core
11+
INTERFACE
12+
COMPONENT_hm01b0/hm01b0/HM01B0.c
13+
)
14+
endif()
15+
16+
if("lis2dh12" IN_LIST MBED_TARGET_LABELS)
17+
target_include_directories(mbed-core
18+
INTERFACE
19+
COMPONENT_lis2dh12/lis2dh12
20+
)
21+
22+
target_sources(mbed-core
23+
INTERFACE
24+
COMPONENT_lis2dh12/lis2dh12/lis2dh12_platform_apollo3.c
25+
COMPONENT_lis2dh12/lis2dh12/lis2dh12_reg.c
26+
)
27+
endif()
28+
29+
if("SFE_ARTEMIS" IN_LIST MBED_TARGET_LABELS)
30+
target_include_directories(mbed-core
31+
INTERFACE
32+
TARGET_SFE_ARTEMIS
33+
TARGET_SFE_ARTEMIS/bsp
34+
)
35+
36+
target_sources(mbed-core
37+
INTERFACE
38+
TARGET_SFE_ARTEMIS/bsp/am_bsp.c
39+
TARGET_SFE_ARTEMIS/bsp/am_bsp_pins.c
40+
)
41+
elseif("SFE_ARTEMIS_ATP" IN_LIST MBED_TARGET_LABELS)
42+
target_include_directories(mbed-core
43+
INTERFACE
44+
TARGET_SFE_ARTEMIS_ATP
45+
TARGET_SFE_ARTEMIS_ATP/bsp
46+
)
47+
48+
target_sources(mbed-core
49+
INTERFACE
50+
TARGET_SFE_ARTEMIS_ATP/bsp/am_bsp.c
51+
TARGET_SFE_ARTEMIS_ATP/bsp/am_bsp_pins.c
52+
)
53+
elseif("SFE_ARTEMIS_DK" IN_LIST MBED_TARGET_LABELS)
54+
target_include_directories(mbed-core
55+
INTERFACE
56+
TARGET_SFE_ARTEMIS_DK
57+
TARGET_SFE_ARTEMIS_DK/bsp
58+
)
59+
60+
target_sources(mbed-core
61+
INTERFACE
62+
TARGET_SFE_ARTEMIS_DK/bsp/am_bsp.c
63+
TARGET_SFE_ARTEMIS_DK/bsp/am_bsp_pins.c
64+
)
65+
elseif("SFE_ARTEMIS_MODULE" IN_LIST MBED_TARGET_LABELS)
66+
target_include_directories(mbed-core
67+
INTERFACE
68+
TARGET_SFE_ARTEMIS_MODULE
69+
TARGET_SFE_ARTEMIS_MODULE/bsp
70+
)
71+
72+
target_sources(mbed-core
73+
INTERFACE
74+
TARGET_SFE_ARTEMIS_MODULE/bsp/am_bsp.c
75+
TARGET_SFE_ARTEMIS_MODULE/bsp/am_bsp_pins.c
76+
)
77+
elseif("SFE_ARTEMIS_NANO" IN_LIST MBED_TARGET_LABELS)
78+
target_include_directories(mbed-core
79+
INTERFACE
80+
TARGET_SFE_ARTEMIS_NANO
81+
TARGET_SFE_ARTEMIS_NANO/bsp
82+
)
83+
84+
target_sources(mbed-core
85+
INTERFACE
86+
TARGET_SFE_ARTEMIS_NANO/bsp/am_bsp.c
87+
TARGET_SFE_ARTEMIS_NANO/bsp/am_bsp_pins.c
88+
)
89+
elseif("SFE_ARTEMIS_THING_PLUS" IN_LIST MBED_TARGET_LABELS)
90+
target_include_directories(mbed-core
91+
INTERFACE
92+
TARGET_SFE_ARTEMIS_THING_PLUS
93+
TARGET_SFE_ARTEMIS_THING_PLUS/bsp
94+
)
95+
96+
target_sources(mbed-core
97+
INTERFACE
98+
TARGET_SFE_ARTEMIS_THING_PLUS/bsp/am_bsp.c
99+
TARGET_SFE_ARTEMIS_THING_PLUS/bsp/am_bsp_pins.c
100+
)
101+
elseif("SFE_EDGE" IN_LIST MBED_TARGET_LABELS)
102+
target_include_directories(mbed-core
103+
INTERFACE
104+
TARGET_SFE_EDGE
105+
TARGET_SFE_EDGE/bsp
106+
)
107+
108+
target_sources(mbed-core
109+
INTERFACE
110+
TARGET_SFE_EDGE/bsp/am_bsp.c
111+
TARGET_SFE_EDGE/bsp/am_bsp_pins.c
112+
)
113+
elseif("SFE_EDGE2" IN_LIST MBED_TARGET_LABELS)
114+
target_include_directories(mbed-core
115+
INTERFACE
116+
TARGET_SFE_EDGE2
117+
TARGET_SFE_EDGE2/bsp
118+
)
119+
120+
target_sources(mbed-core
121+
INTERFACE
122+
TARGET_SFE_EDGE2/bsp/am_bsp.c
123+
TARGET_SFE_EDGE2/bsp/am_bsp_pins.c
124+
)
125+
endif()
126+
127+
if(${MBED_TOOLCHAIN} STREQUAL "ARM")
128+
set(LINKER_FILE TOOLCHAIN_ARM_STD/AMA3B1KK.sct)
129+
set(STARTUP_FILE TOOLCHAIN_ARM_STD/startup_keil.S)
130+
elseif(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
131+
set(LINKER_FILE TOOLCHAIN_GCC_ARM/AMA3B1KK.ld)
132+
set(STARTUP_FILE TOOLCHAIN_GCC_ARM/startup_gcc.c)
133+
endif()
134+
135+
set_property(GLOBAL PROPERTY MBED_TARGET_LINKER_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
136+
137+
target_include_directories(mbed-core
138+
INTERFACE
139+
device
140+
sdk/CMSIS/AmbiqMicro/Include
141+
sdk/mcu
142+
sdk/mcu/apollo3
143+
sdk/mcu/apollo3/hal
144+
sdk/mcu/apollo3/regs
145+
)
146+
147+
target_sources(mbed-core
148+
INTERFACE
149+
device/PeripheralPinConfigs.c
150+
device/PeripheralPins.c
151+
device/flash_api.c
152+
device/gpio_api.c
153+
device/gpio_irq_api.c
154+
device/i2c_api.c
155+
device/iom_api.c
156+
device/isr.c
157+
device/lp_ticker.c
158+
device/pinmap.c
159+
device/serial_api.c
160+
device/sleep.c
161+
device/spi_api.c
162+
device/us_ticker.c
163+
164+
sdk/CMSIS/AmbiqMicro/Source/system_apollo3.c
165+
166+
sdk/mcu/apollo3/hal/am_hal_adc.c
167+
sdk/mcu/apollo3/hal/am_hal_ble.c
168+
sdk/mcu/apollo3/hal/am_hal_ble_patch.c
169+
sdk/mcu/apollo3/hal/am_hal_ble_patch_b0.c
170+
sdk/mcu/apollo3/hal/am_hal_burst.c
171+
sdk/mcu/apollo3/hal/am_hal_cachectrl.c
172+
sdk/mcu/apollo3/hal/am_hal_clkgen.c
173+
sdk/mcu/apollo3/hal/am_hal_cmdq.c
174+
sdk/mcu/apollo3/hal/am_hal_ctimer.c
175+
sdk/mcu/apollo3/hal/am_hal_debug.c
176+
sdk/mcu/apollo3/hal/am_hal_flash.c
177+
sdk/mcu/apollo3/hal/am_hal_global.c
178+
sdk/mcu/apollo3/hal/am_hal_gpio.c
179+
sdk/mcu/apollo3/hal/am_hal_interrupt.c
180+
sdk/mcu/apollo3/hal/am_hal_iom.c
181+
sdk/mcu/apollo3/hal/am_hal_ios.c
182+
sdk/mcu/apollo3/hal/am_hal_itm.c
183+
sdk/mcu/apollo3/hal/am_hal_mcuctrl.c
184+
sdk/mcu/apollo3/hal/am_hal_mspi.c
185+
sdk/mcu/apollo3/hal/am_hal_pdm.c
186+
sdk/mcu/apollo3/hal/am_hal_pwrctrl.c
187+
sdk/mcu/apollo3/hal/am_hal_queue.c
188+
sdk/mcu/apollo3/hal/am_hal_reset.c
189+
sdk/mcu/apollo3/hal/am_hal_rtc.c
190+
sdk/mcu/apollo3/hal/am_hal_scard.c
191+
sdk/mcu/apollo3/hal/am_hal_secure_ota.c
192+
sdk/mcu/apollo3/hal/am_hal_security.c
193+
sdk/mcu/apollo3/hal/am_hal_stimer.c
194+
sdk/mcu/apollo3/hal/am_hal_sysctrl.c
195+
sdk/mcu/apollo3/hal/am_hal_systick.c
196+
sdk/mcu/apollo3/hal/am_hal_tpiu.c
197+
sdk/mcu/apollo3/hal/am_hal_uart.c
198+
sdk/mcu/apollo3/hal/am_hal_wdt.c
199+
200+
${STARTUP_FILE}
201+
)
202+
203+
target_link_libraries(mbed-core
204+
INTERFACE
205+
${CMAKE_CURRENT_SOURCE_DIR}/sdk/CMSIS/ARM/Lib/ARM/libarm_cortexM4lf_math.a
206+
)

targets/TARGET_Ambiq_Micro/TARGET_Apollo3/TOOLCHAIN_ARM_STD/AMA3B1KK.sct

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#! armcc -E
1+
#! armclang -E --target=arm-arm-none-eabi -x c -mcpu=cortex-m4
22

33
;
44
; Copyright (c) 2019-2020 SparkFun Electronics
@@ -23,6 +23,14 @@
2323
; SOFTWARE.
2424
;
2525

26+
#if !defined(MBED_CONF_TARGET_BOOT_STACK_SIZE)
27+
/* This value is normally defined by the tools to 0x1000 for bare metal and 0x400 for RTOS */
28+
#if defined(MBED_BOOT_STACK_SIZE)
29+
#define MBED_CONF_TARGET_BOOT_STACK_SIZE MBED_BOOT_STACK_SIZE
30+
#else
31+
#define MBED_CONF_TARGET_BOOT_STACK_SIZE 0x400
32+
#endif
33+
#endif
2634

2735
#define MBED_APP_START 0x0000C000
2836
#define MBED_APP_SIZE 0x000F4000
@@ -32,8 +40,8 @@
3240
#define MBED_RAM0_SIZE 0x100
3341
#define MBED_RAM1_START (MBED_RAM0_START + MBED_RAM0_SIZE)
3442
#define MBED_RAM1_SIZE (MBED_RAM_SIZE - (MBED_RAM0_SIZE))
35-
#define Stack_Size MBED_BOOT_STACK_SIZE
36-
#define RAM_FIXED_SIZE (MBED_BOOT_STACK_SIZE+MBED_RAM0_SIZE)
43+
#define Stack_Size MBED_CONF_TARGET_BOOT_STACK_SIZE
44+
#define RAM_FIXED_SIZE (MBED_CONF_TARGET_BOOT_STACK_SIZE+MBED_RAM0_SIZE)
3745

3846

3947
LR_IROM1 MBED_APP_START MBED_APP_SIZE {

targets/TARGET_Ambiq_Micro/TARGET_Apollo3/TOOLCHAIN_GCC_ARM/startup_gcc.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@ extern void am_iomaster2_isr(void) __attribute((weak, alias("am_default_isr")));
7777
extern void am_iomaster3_isr(void) __attribute((weak, alias("am_default_isr")));
7878
extern void am_iomaster4_isr(void) __attribute((weak, alias("am_default_isr")));
7979
extern void am_iomaster5_isr(void) __attribute((weak, alias("am_default_isr")));
80-
extern void HciDrvIntService(void); //__attribute((weak, alias("am_default_isr")));
81-
extern void am_gpio_isr(void); //__attribute((weak, alias("am_default_isr")));
82-
extern void am_ctimer_isr(void); //__attribute((weak, alias("am_default_isr")));
83-
extern void am_uart_isr(void); //__attribute((weak, alias("am_default_isr")));
84-
extern void am_uart1_isr(void); //__attribute((weak, alias("am_default_isr")));
80+
extern void HciDrvIntService(void) __attribute((weak, alias("am_default_isr")));
81+
extern void am_gpio_isr(void) __attribute((weak, alias("am_default_isr")));
82+
extern void am_ctimer_isr(void) __attribute((weak, alias("am_default_isr")));
83+
extern void am_uart_isr(void) __attribute((weak, alias("am_default_isr")));
84+
extern void am_uart1_isr(void) __attribute((weak, alias("am_default_isr")));
8585
extern void am_scard_isr(void) __attribute((weak, alias("am_default_isr")));
8686
extern void am_adc_isr(void) __attribute((weak, alias("am_default_isr")));
8787
extern void am_pdm0_isr(void) __attribute((weak, alias("am_default_isr")));

tools/cmake/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Only a limited set of targets is supported at the moment.
2020

2121
The following targets are supported:
2222
- NRF52840_DK
23+
- Ambiq Micro targets
2324
- Analog Devices targets
2425
- ARM FM targets
2526
- Cypress targets

0 commit comments

Comments
 (0)