Skip to content

Commit e0877e4

Browse files
committed
STM32G0: align code with CubeUpdate script
1 parent 4cfbea4 commit e0877e4

File tree

66 files changed

+348
-455
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+348
-455
lines changed
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
# Copyright (c) 2020 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
add_subdirectory(TARGET_STM32G030xx EXCLUDE_FROM_ALL)
5-
add_subdirectory(TARGET_STM32G031xx EXCLUDE_FROM_ALL)
6-
add_subdirectory(TARGET_STM32G041xx EXCLUDE_FROM_ALL)
7-
add_subdirectory(TARGET_STM32G070xx EXCLUDE_FROM_ALL)
8-
add_subdirectory(TARGET_STM32G071xx EXCLUDE_FROM_ALL)
9-
add_subdirectory(TARGET_STM32G081xx EXCLUDE_FROM_ALL)
4+
add_subdirectory(TARGET_STM32G030x8 EXCLUDE_FROM_ALL)
5+
add_subdirectory(TARGET_STM32G031x8 EXCLUDE_FROM_ALL)
6+
add_subdirectory(TARGET_STM32G041x8 EXCLUDE_FROM_ALL)
7+
add_subdirectory(TARGET_STM32G070xB EXCLUDE_FROM_ALL)
8+
add_subdirectory(TARGET_STM32G071xB EXCLUDE_FROM_ALL)
9+
add_subdirectory(TARGET_STM32G081xB EXCLUDE_FROM_ALL)
1010
add_subdirectory(STM32Cube_FW EXCLUDE_FROM_ALL)
1111

1212
add_library(mbed-stm32g0 INTERFACE)
1313

14+
target_include_directories(mbed-stm32g0
15+
INTERFACE
16+
.
17+
)
18+
1419
target_sources(mbed-stm32g0
1520
INTERFACE
1621
analogin_device.c
@@ -23,9 +28,4 @@ target_sources(mbed-stm32g0
2328
spi_api.c
2429
)
2530

26-
target_include_directories(mbed-stm32g0
27-
INTERFACE
28-
.
29-
)
30-
3131
target_link_libraries(mbed-stm32g0 INTERFACE mbed-stm mbed-stm32g0cube-fw)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,21 @@ typedef enum {
2525
ADC_1 = (int)ADC1_BASE
2626
} ADCName;
2727

28+
#if defined DAC_BASE
2829
typedef enum {
2930
DAC_1 = (int)DAC_BASE
3031
} DACName;
32+
#endif
3133

3234
typedef enum {
3335
UART_1 = (int)USART1_BASE,
3436
UART_2 = (int)USART2_BASE,
37+
#if defined USART3_BASE
3538
UART_3 = (int)USART3_BASE,
39+
#endif
40+
#if defined USART4_BASE
3641
UART_4 = (int)USART4_BASE,
42+
#endif
3743
LPUART_1 = (int)LPUART1_BASE
3844
} UARTName;
3945

@@ -53,7 +59,9 @@ typedef enum {
5359
PWM_2 = (int)TIM2_BASE,
5460
PWM_3 = (int)TIM3_BASE,
5561
PWM_14 = (int)TIM14_BASE,
62+
#if defined TIM15_BASE
5663
PWM_15 = (int)TIM15_BASE,
64+
#endif
5765
PWM_16 = (int)TIM16_BASE,
5866
PWM_17 = (int)TIM17_BASE
5967
} PWMName;

targets/TARGET_STM/TARGET_STM32G0/STM32Cube_FW/stm32g0xx_hal_conf.h

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -73,83 +73,63 @@ extern "C" {
7373
#if !defined (USE_HAL_ADC_REGISTER_CALLBACKS)
7474
#define USE_HAL_ADC_REGISTER_CALLBACKS 0u
7575
#endif
76-
7776
#if !defined (USE_HAL_CEC_REGISTER_CALLBACKS)
7877
#define USE_HAL_CEC_REGISTER_CALLBACKS 0u
7978
#endif
80-
8179
#if !defined (USE_HAL_COMP_REGISTER_CALLBACKS)
8280
#define USE_HAL_COMP_REGISTER_CALLBACKS 0u
8381
#endif
84-
8582
#if !defined (USE_HAL_CRYP_REGISTER_CALLBACKS)
8683
#define USE_HAL_CRYP_REGISTER_CALLBACKS 0u
8784
#endif
88-
8985
#if !defined (USE_HAL_DAC_REGISTER_CALLBACKS)
9086
#define USE_HAL_DAC_REGISTER_CALLBACKS 0u
9187
#endif
92-
9388
#if !defined (USE_HAL_FDCAN_REGISTER_CALLBACKS)
9489
#define USE_HAL_FDCAN_REGISTER_CALLBACKS 0u
9590
#endif
96-
9791
#if !defined (USE_HAL_I2C_REGISTER_CALLBACKS)
9892
#define USE_HAL_I2C_REGISTER_CALLBACKS 0u
9993
#endif
100-
10194
#if !defined (USE_HAL_I2S_REGISTER_CALLBACKS)
10295
#define USE_HAL_I2S_REGISTER_CALLBACKS 0u
10396
#endif
104-
10597
#if !defined (USE_HAL_IRDA_REGISTER_CALLBACKS)
10698
#define USE_HAL_IRDA_REGISTER_CALLBACKS 0u
10799
#endif
108-
109100
#if !defined (USE_HAL_LPTIM_REGISTER_CALLBACKS)
110101
#define USE_HAL_LPTIM_REGISTER_CALLBACKS 0u
111102
#endif
112-
113103
#if !defined (USE_HAL_HCD_REGISTER_CALLBACKS)
114104
#define USE_HAL_HCD_REGISTER_CALLBACKS 0u
115105
#endif
116-
117106
#if !defined (USE_HAL_PCD_REGISTER_CALLBACKS)
118107
#define USE_HAL_PCD_REGISTER_CALLBACKS 0u
119108
#endif
120-
121109
#if !defined (USE_HAL_RNG_REGISTER_CALLBACKS)
122110
#define USE_HAL_RNG_REGISTER_CALLBACKS 0u
123111
#endif
124-
125112
#if !defined (USE_HAL_RTC_REGISTER_CALLBACKS)
126113
#define USE_HAL_RTC_REGISTER_CALLBACKS 0u
127114
#endif
128-
129115
#if !defined (USE_HAL_SMARTCARD_REGISTER_CALLBACKS)
130116
#define USE_HAL_SMARTCARD_REGISTER_CALLBACKS 0u
131117
#endif
132-
133118
#if !defined (USE_HAL_SMBUS_REGISTER_CALLBACKS)
134119
#define USE_HAL_SMBUS_REGISTER_CALLBACKS 0u
135120
#endif
136-
137121
#if !defined (USE_HAL_SPI_REGISTER_CALLBACKS)
138122
#define USE_HAL_SPI_REGISTER_CALLBACKS 0u
139123
#endif
140-
141124
#if !defined (USE_HAL_TIM_REGISTER_CALLBACKS)
142125
#define USE_HAL_TIM_REGISTER_CALLBACKS 0u
143126
#endif
144-
145127
#if !defined (USE_HAL_UART_REGISTER_CALLBACKS)
146128
#define USE_HAL_UART_REGISTER_CALLBACKS 0u
147129
#endif
148-
149130
#if !defined (USE_HAL_USART_REGISTER_CALLBACKS)
150131
#define USE_HAL_USART_REGISTER_CALLBACKS 0u
151132
#endif
152-
153133
#if !defined (USE_HAL_WWDG_REGISTER_CALLBACKS)
154134
#define USE_HAL_WWDG_REGISTER_CALLBACKS 0u
155135
#endif
@@ -259,6 +239,7 @@ in voltage and temperature.*/
259239
#define USE_HAL_CRYP_SUSPEND_RESUME 1U
260240
#endif
261241

242+
262243
/* ########################## Assert Selection ############################## */
263244
/**
264245
* @brief Uncomment the line below to expanse the "assert_param" macro in the
@@ -394,17 +375,7 @@ in voltage and temperature.*/
394375

395376
/* Exported macro ------------------------------------------------------------*/
396377
#ifdef USE_FULL_ASSERT
397-
/**
398-
* @brief The assert_param macro is used for functions parameters check.
399-
* @param expr If expr is false, it calls assert_failed function
400-
* which reports the name of the source file and the source
401-
* line number of the call that failed.
402-
* If expr is true, it returns no value.
403-
* @retval None
404-
*/
405-
#define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
406-
/* Exported functions ------------------------------------------------------- */
407-
void assert_failed(uint8_t *file, uint32_t line);
378+
#include "stm32_assert.h" // MBED patch
408379
#else
409380
#define assert_param(expr) ((void)0U)
410381
#endif /* USE_FULL_ASSERT */

targets/TARGET_STM/TARGET_STM32G0/STM32Cube_FW/system_stm32g0xx.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,10 @@
166166
* @param None
167167
* @retval None
168168
*/
169-
void SystemInit(void)
169+
__WEAK void SystemInit(void)
170170
{
171-
/* Configure the Vector Table location add offset address ------------------*/
172-
#ifdef VECT_TAB_SRAM
173-
SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
174-
#else
175171
#include "nvic_addr.h" // MBED
176172
SCB->VTOR = NVIC_FLASH_VECTOR_ADDRESS; // MBED
177-
#endif
178173
}
179174

180175
/**

targets/TARGET_STM/TARGET_STM32G0/TARGET_STM32G030xx/CMakeLists.txt renamed to targets/TARGET_STM/TARGET_STM32G0/TARGET_STM32G030x8/CMakeLists.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,24 @@
33

44
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
55
set(STARTUP_FILE TOOLCHAIN_GCC_ARM/startup_stm32g030xx.S)
6-
set(LINKER_FILE TOOLCHAIN_GCC_ARM/stm32g030xx.ld)
6+
set(LINKER_FILE TOOLCHAIN_GCC_ARM/stm32g030x8.ld)
77
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
88
set(STARTUP_FILE TOOLCHAIN_ARM/startup_stm32g030xx.S)
9-
set(LINKER_FILE TOOLCHAIN_ARM/stm32g030xx.sct)
9+
set(LINKER_FILE TOOLCHAIN_ARM/stm32g030x8.sct)
1010
endif()
1111

12-
add_library(mbed-stm32g030xx INTERFACE)
12+
add_library(mbed-stm32g030x8 INTERFACE)
1313

14-
target_sources(mbed-stm32g030xx
14+
target_include_directories(mbed-stm32g030x8
1515
INTERFACE
16-
${STARTUP_FILE}
16+
.
1717
)
1818

19-
target_include_directories(mbed-stm32g030xx
19+
target_sources(mbed-stm32g030x8
2020
INTERFACE
21-
.
21+
${STARTUP_FILE}
2222
)
2323

24-
mbed_set_linker_script(mbed-stm32g030xx ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
24+
mbed_set_linker_script(mbed-stm32g030x8 ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
2525

26-
target_link_libraries(mbed-stm32g030xx INTERFACE mbed-stm32g0)
26+
target_link_libraries(mbed-stm32g030x8 INTERFACE mbed-stm32g0)

targets/TARGET_STM/TARGET_STM32G0/TARGET_STM32G031xx/TOOLCHAIN_ARM/stm32g031xx.sct renamed to targets/TARGET_STM/TARGET_STM32G0/TARGET_STM32G030x8/TOOLCHAIN_ARM/stm32g030x8.sct

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525
#define MBED_APP_SIZE MBED_ROM_SIZE
2626
#endif
2727

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

3737
/* Round up VECTORS_SIZE to 8 bytes */

0 commit comments

Comments
 (0)