This commit is contained in:
hathach 2023-01-30 17:07:06 +07:00
parent b464f91a6e
commit 63a6fd3689
4 changed files with 26 additions and 6 deletions

View File

@ -31,6 +31,7 @@ jobs:
- 'stm32f1'
- 'stm32f4'
- 'stm32f7'
- 'stm32g4'
- 'stm32h7'
steps:
- name: Clean workspace

View File

@ -2,9 +2,13 @@ CFLAGS += \
-DSTM32G474xx \
-DHSE_VALUE=24000000
LD_FILE = $(BOARD_PATH)/STM32G474RETx_FLASH.ld
# GCC
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32g474xx.s
GCC_LD_FILE = $(BOARD_PATH)/STM32G474RETx_FLASH.ld
SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32g474xx.s
# IAR
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32g474xx.s
IAR_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32g474xx_flash.icf
# For flash-jlink target
JLINK_DEVICE = stm32g474re

View File

@ -137,7 +137,8 @@ void board_init(void)
void board_led_write(bool state)
{
HAL_GPIO_WritePin(LED_PORT, LED_PIN, state ? LED_STATE_ON : (1-LED_STATE_ON));
GPIO_PinState pin_state = (GPIO_PinState) (state ? LED_STATE_ON : (1-LED_STATE_ON));
HAL_GPIO_WritePin(LED_PORT, LED_PIN, pin_state);
}
uint32_t board_button_read(void)
@ -177,7 +178,7 @@ uint32_t board_millis(void)
void HardFault_Handler (void)
{
asm("bkpt");
__asm("BKPT #0\n");
}
// Required by __libc_init_array in startup code if we are compiling using

View File

@ -7,7 +7,14 @@ ST_HAL_DRIVER = hw/mcu/st/stm32$(ST_FAMILY)xx_hal_driver
include $(TOP)/$(BOARD_PATH)/board.mk
# --------------
# Compiler Flags
# --------------
CFLAGS += \
-DCFG_TUSB_MCU=OPT_MCU_STM32G4
# GCC Flags
GCC_CFLAGS += \
-flto \
-mthumb \
-mabi=aapcs \
@ -15,10 +22,17 @@ CFLAGS += \
-mfloat-abi=hard \
-mfpu=fpv4-sp-d16 \
-nostdlib -nostartfiles \
-DCFG_TUSB_MCU=OPT_MCU_STM32G4
# suppress warning caused by vendor mcu driver
CFLAGS += -Wno-error=cast-align
GCC_CFLAGS += -Wno-error=cast-align
# IAR Flags
IAR_CFLAGS += --cpu cortex-m4 --fpu VFPv4
IAR_ASFLAGS += --cpu cortex-m4 --fpu VFPv4
# -----------------
# Sources & Include
# -----------------
SRC_C += \
src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c \