This commit is contained in:
hathach 2023-01-30 20:11:59 +07:00
parent 63a6fd3689
commit 25603c7269
7 changed files with 46 additions and 19 deletions

View File

@ -33,6 +33,7 @@ jobs:
- 'stm32f7'
- 'stm32g4'
- 'stm32h7'
- 'stm32l4'
steps:
- name: Clean workspace
run: |

View File

@ -1,10 +1,13 @@
CFLAGS += \
-DSTM32L412xx \
# All source paths should be relative to the top level.
LD_FILE = $(BOARD_PATH)/STM32L412KBUx_FLASH.ld
# GCC
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32l412xx.s
GCC_LD_FILE = $(BOARD_PATH)/STM32L412KBUx_FLASH.ld
SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32l412xx.s
# IAR
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32l412xx.s
IAR_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32l412xx_flash.icf
# For flash-jlink target
JLINK_DEVICE = stm32l412kb

View File

@ -1,10 +1,13 @@
CFLAGS += \
-DSTM32L476xx \
# All source paths should be relative to the top level.
LD_FILE = $(BOARD_PATH)/STM32L476VGTx_FLASH.ld
# GCC
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32l476xx.s
GCC_LD_FILE = $(BOARD_PATH)/STM32L476VGTx_FLASH.ld
SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32l476xx.s
# IAR
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32l476xx.s
IAR_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32l476xx_flash.icf
# For flash-jlink target
JLINK_DEVICE = stm32l476vg

View File

@ -1,10 +1,13 @@
CFLAGS += \
-DSTM32L4P5xx \
# All source paths should be relative to the top level.
LD_FILE = $(BOARD_PATH)/STM32L4P5ZGTX_FLASH.ld
# GCC
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32l4p5xx.s
GCC_LD_FILE = $(BOARD_PATH)/STM32L4P5ZGTX_FLASH.ld
SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32l4p5xx.s
# IAR
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32l4p5xx.s
IAR_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32l4p5xx_flash.icf
# For flash-jlink target
JLINK_DEVICE = stm32l4p5zg

View File

@ -2,10 +2,13 @@ CFLAGS += \
-DHSE_VALUE=8000000 \
-DSTM32L4R5xx \
# All source paths should be relative to the top level.
LD_FILE = $(BOARD_PATH)/STM32L4RXxI_FLASH.ld
# GCC
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32l4r5xx.s
GCC_LD_FILE = $(BOARD_PATH)/STM32L4RXxI_FLASH.ld
SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32l4r5xx.s
# IAR
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32l4r5xx.s
IAR_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32l4r5xx_flash.icf
# For flash-jlink target
JLINK_DEVICE = stm32l4r5zi

View File

@ -179,7 +179,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)
@ -214,7 +215,7 @@ uint32_t board_millis(void)
void HardFault_Handler (void)
{
asm("bkpt 0x10");
__asm("BKPT #0\n");
}
// Required by __libc_init_array in startup code if we are compiling using

View File

@ -6,23 +6,36 @@ 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_STM32L4
# GCC Flags
GCC_CFLAGS += \
-flto \
-mthumb \
-mabi=aapcs \
-mcpu=cortex-m4 \
-mfloat-abi=hard \
-mfpu=fpv4-sp-d16 \
-nostdlib -nostartfiles \
-DCFG_TUSB_MCU=OPT_MCU_STM32L4
-nostdlib -nostartfiles
# suppress warning caused by vendor mcu driver
CFLAGS += -Wno-error=maybe-uninitialized -Wno-error=cast-align
GCC_CFLAGS += -Wno-error=maybe-uninitialized -Wno-error=cast-align
# IAR Flags
IAR_CFLAGS += --cpu cortex-m4 --fpu VFPv4
IAR_ASFLAGS += --cpu cortex-m4 --fpu VFPv4
# -----------------
# Sources & Include
# -----------------
#src/portable/st/synopsys/dcd_synopsys.c
SRC_C += \
src/portable/synopsys/dwc2/dcd_dwc2.c \
src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c \
src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c \
$(ST_CMSIS)/Source/Templates/system_stm32$(ST_FAMILY)xx.c \
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal.c \
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_cortex.c \