mirror of
https://github.com/hathach/tinyusb.git
synced 2025-04-16 05:42:56 +00:00
update stm32f1 to support iar build
This commit is contained in:
parent
cb34cb2a93
commit
1bbeb6ad79
1
.github/workflows/build_iar.yml
vendored
1
.github/workflows/build_iar.yml
vendored
@ -28,6 +28,7 @@ jobs:
|
|||||||
family:
|
family:
|
||||||
# Alphabetical order
|
# Alphabetical order
|
||||||
- 'stm32f0'
|
- 'stm32f0'
|
||||||
|
- 'stm32f1'
|
||||||
steps:
|
steps:
|
||||||
- name: Clean workspace
|
- name: Clean workspace
|
||||||
run: |
|
run: |
|
||||||
|
@ -72,6 +72,10 @@ ifdef LD_FILE
|
|||||||
LDFLAGS += -Wl,-T,$(TOP)/$(LD_FILE)
|
LDFLAGS += -Wl,-T,$(TOP)/$(LD_FILE)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifdef GCC_LD_FILE
|
||||||
|
LDFLAGS += -Wl,-T,$(TOP)/$(GCC_LD_FILE)
|
||||||
|
endif
|
||||||
|
|
||||||
ifneq ($(SKIP_NANOLIB), 1)
|
ifneq ($(SKIP_NANOLIB), 1)
|
||||||
LDFLAGS += -specs=nosys.specs -specs=nano.specs
|
LDFLAGS += -specs=nosys.specs -specs=nano.specs
|
||||||
endif
|
endif
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
CFLAGS += -DSTM32F070xB -DCFG_EXAMPLE_VIDEO_READONLY
|
CFLAGS += -DSTM32F070xB -DCFG_EXAMPLE_VIDEO_READONLY
|
||||||
|
|
||||||
|
# GCC
|
||||||
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f070xb.s
|
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f070xb.s
|
||||||
LD_FILE = $(BOARD_PATH)/stm32F070rbtx_flash.ld
|
GCC_LD_FILE = $(BOARD_PATH)/stm32F070rbtx_flash.ld
|
||||||
|
|
||||||
|
# IAR
|
||||||
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32f070xb.s
|
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32f070xb.s
|
||||||
IAR_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32f070xb_flash.icf
|
IAR_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32f070xb_flash.icf
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
CFLAGS += -DSTM32F072xB -DCFG_EXAMPLE_VIDEO_READONLY
|
CFLAGS += -DSTM32F072xB -DCFG_EXAMPLE_VIDEO_READONLY
|
||||||
|
|
||||||
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f072xb.s
|
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f072xb.s
|
||||||
LD_FILE = $(BOARD_PATH)/STM32F072RBTx_FLASH.ld
|
GCC_LD_FILE = $(BOARD_PATH)/STM32F072RBTx_FLASH.ld
|
||||||
|
|
||||||
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32f072xb.s
|
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32f072xb.s
|
||||||
IAR_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32f072xb_flash.icf
|
IAR_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32f072xb_flash.icf
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
CFLAGS += -DSTM32F072xB -DLSI_VALUE=40000 -DCFG_EXAMPLE_VIDEO_READONLY
|
CFLAGS += -DSTM32F072xB -DLSI_VALUE=40000 -DCFG_EXAMPLE_VIDEO_READONLY
|
||||||
|
|
||||||
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f072xb.s
|
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f072xb.s
|
||||||
LD_FILE = $(BOARD_PATH)/STM32F072VBTx_FLASH.ld
|
GCC_LD_FILE = $(BOARD_PATH)/STM32F072VBTx_FLASH.ld
|
||||||
|
|
||||||
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32f072xb.s
|
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32f072xb.s
|
||||||
IAR_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32f072xb_flash.icf
|
IAR_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32f072xb_flash.icf
|
||||||
|
@ -7,13 +7,14 @@ ST_HAL_DRIVER = hw/mcu/st/stm32$(ST_FAMILY)xx_hal_driver
|
|||||||
|
|
||||||
include $(TOP)/$(BOARD_PATH)/board.mk
|
include $(TOP)/$(BOARD_PATH)/board.mk
|
||||||
|
|
||||||
|
# --------------
|
||||||
|
# Compiler Flags
|
||||||
|
# --------------
|
||||||
CFLAGS += \
|
CFLAGS += \
|
||||||
-DCFG_EXAMPLE_MSC_READONLY \
|
-DCFG_EXAMPLE_MSC_READONLY \
|
||||||
-DCFG_TUSB_MCU=OPT_MCU_STM32F0
|
-DCFG_TUSB_MCU=OPT_MCU_STM32F0
|
||||||
|
|
||||||
# --------------
|
|
||||||
# GCC Flags
|
# GCC Flags
|
||||||
# --------------
|
|
||||||
GCC_CFLAGS += \
|
GCC_CFLAGS += \
|
||||||
-flto \
|
-flto \
|
||||||
-mthumb \
|
-mthumb \
|
||||||
@ -25,12 +26,14 @@ GCC_CFLAGS += \
|
|||||||
# suppress warning caused by vendor mcu driver
|
# suppress warning caused by vendor mcu driver
|
||||||
GCC_CFLAGS += -Wno-error=unused-parameter -Wno-error=cast-align -Wno-error=cast-qual
|
GCC_CFLAGS += -Wno-error=unused-parameter -Wno-error=cast-align -Wno-error=cast-qual
|
||||||
|
|
||||||
# --------------
|
|
||||||
# IAR Flags
|
# IAR Flags
|
||||||
# --------------
|
|
||||||
IAR_CFLAGS += --cpu cortex-m0
|
IAR_CFLAGS += --cpu cortex-m0
|
||||||
IAR_ASFLAGS += --cpu cortex-m0
|
IAR_ASFLAGS += --cpu cortex-m0
|
||||||
|
|
||||||
|
# ------------------------
|
||||||
|
# All source paths should be relative to the top level.
|
||||||
|
# ------------------------
|
||||||
|
|
||||||
SRC_C += \
|
SRC_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_CMSIS)/Source/Templates/system_stm32$(ST_FAMILY)xx.c \
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
CFLAGS += -DSTM32F103xB -DHSE_VALUE=8000000U -DCFG_EXAMPLE_VIDEO_READONLY
|
CFLAGS += -DSTM32F103xB -DHSE_VALUE=8000000U -DCFG_EXAMPLE_VIDEO_READONLY
|
||||||
|
|
||||||
# All source paths should be relative to the top level.
|
# GCC
|
||||||
LD_FILE = $(BOARD_PATH)/STM32F103X8_FLASH.ld
|
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f103xb.s
|
||||||
SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f103xb.s
|
GCC_LD_FILE = $(BOARD_PATH)/STM32F103X8_FLASH.ld
|
||||||
|
|
||||||
|
# IAR
|
||||||
|
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32f103xb.s
|
||||||
|
IAR_LD_FILE = $(BOARD_PATH)/stm32f103x8_flash.icf
|
||||||
|
|
||||||
# For flash-jlink target
|
# For flash-jlink target
|
||||||
JLINK_DEVICE = stm32f103c8
|
JLINK_DEVICE = stm32f103c8
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
/*###ICF### Section handled by ICF editor, don't touch! ****/
|
||||||
|
/*-Editor annotation file-*/
|
||||||
|
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
|
||||||
|
/*-Specials-*/
|
||||||
|
define symbol __ICFEDIT_intvec_start__ = 0x08000000;
|
||||||
|
/*-Memory Regions-*/
|
||||||
|
define symbol __ICFEDIT_region_ROM_start__ = 0x08000000 ;
|
||||||
|
define symbol __ICFEDIT_region_ROM_end__ = 0x0800FFFF;
|
||||||
|
define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
|
||||||
|
define symbol __ICFEDIT_region_RAM_end__ = 0x20004FFF;
|
||||||
|
/*-Sizes-*/
|
||||||
|
define symbol __ICFEDIT_size_cstack__ = 0x400;
|
||||||
|
define symbol __ICFEDIT_size_heap__ = 0x200;
|
||||||
|
/**** End of ICF editor section. ###ICF###*/
|
||||||
|
|
||||||
|
|
||||||
|
define memory mem with size = 4G;
|
||||||
|
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
|
||||||
|
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
|
||||||
|
|
||||||
|
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
|
||||||
|
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
|
||||||
|
|
||||||
|
initialize by copy { readwrite };
|
||||||
|
do not initialize { section .noinit };
|
||||||
|
|
||||||
|
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
|
||||||
|
|
||||||
|
place in ROM_region { readonly };
|
||||||
|
place in RAM_region { readwrite,
|
||||||
|
block CSTACK, block HEAP };
|
@ -1,8 +1,12 @@
|
|||||||
CFLAGS += -DSTM32F103xB -DHSE_VALUE=8000000U
|
CFLAGS += -DSTM32F103xB -DHSE_VALUE=8000000U
|
||||||
|
|
||||||
# All source paths should be relative to the top level.
|
# GCC
|
||||||
LD_FILE = $(BOARD_PATH)/STM32F103XC_FLASH.ld
|
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f103xb.s
|
||||||
SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f103xb.s
|
GCC_LD_FILE = $(BOARD_PATH)/STM32F103XC_FLASH.ld
|
||||||
|
|
||||||
|
# IAR
|
||||||
|
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32f103xb.s
|
||||||
|
IAR_LD_FILE = $(BOARD_PATH)/stm32f103xc_flash.icf
|
||||||
|
|
||||||
# For flash-jlink target
|
# For flash-jlink target
|
||||||
JLINK_DEVICE = stm32f103rc
|
JLINK_DEVICE = stm32f103rc
|
||||||
|
@ -104,7 +104,8 @@ void board_init(void)
|
|||||||
|
|
||||||
void board_led_write(bool state)
|
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)
|
uint32_t board_button_read(void)
|
||||||
@ -139,7 +140,7 @@ uint32_t board_millis(void)
|
|||||||
|
|
||||||
void HardFault_Handler (void)
|
void HardFault_Handler (void)
|
||||||
{
|
{
|
||||||
asm("bkpt");
|
__asm("BKPT #0\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_FULL_ASSERT
|
#ifdef USE_FULL_ASSERT
|
||||||
|
@ -6,19 +6,28 @@ ST_HAL_DRIVER = hw/mcu/st/stm32$(ST_FAMILY)xx_hal_driver
|
|||||||
|
|
||||||
include $(TOP)/$(BOARD_PATH)/board.mk
|
include $(TOP)/$(BOARD_PATH)/board.mk
|
||||||
|
|
||||||
|
# --------------
|
||||||
|
# Compiler Flags
|
||||||
|
# --------------
|
||||||
CFLAGS += \
|
CFLAGS += \
|
||||||
|
-DCFG_TUSB_MCU=OPT_MCU_STM32F1
|
||||||
|
|
||||||
|
# GCC Flags
|
||||||
|
GCC_CFLAGS += \
|
||||||
-flto \
|
-flto \
|
||||||
-mthumb \
|
-mthumb \
|
||||||
-mabi=aapcs \
|
-mabi=aapcs \
|
||||||
-mcpu=cortex-m3 \
|
-mcpu=cortex-m3 \
|
||||||
-mfloat-abi=soft \
|
-mfloat-abi=soft \
|
||||||
-nostdlib -nostartfiles \
|
-nostdlib -nostartfiles \
|
||||||
-DCFG_TUSB_MCU=OPT_MCU_STM32F1
|
|
||||||
|
|
||||||
# mcu driver cause following warnings
|
# IAR Flags
|
||||||
#CFLAGS += -Wno-error=unused-parameter
|
IAR_CFLAGS += --cpu cortex-m3
|
||||||
|
IAR_ASFLAGS += --cpu cortex-m3
|
||||||
|
|
||||||
|
# ------------------------
|
||||||
# All source paths should be relative to the top level.
|
# All source paths should be relative to the top level.
|
||||||
|
# ------------------------
|
||||||
SRC_C += \
|
SRC_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_CMSIS)/Source/Templates/system_stm32$(ST_FAMILY)xx.c \
|
||||||
|
@ -76,9 +76,9 @@
|
|||||||
* - ##__VA_ARGS__ is used to deal with 0 paramerter (swallows comma)
|
* - ##__VA_ARGS__ is used to deal with 0 paramerter (swallows comma)
|
||||||
*------------------------------------------------------------------*/
|
*------------------------------------------------------------------*/
|
||||||
#if !defined(__CCRX__)
|
#if !defined(__CCRX__)
|
||||||
#define TU_ARGS_NUM(...) _TU_NARG(_0, ##__VA_ARGS__,_RSEQ_N())
|
#define TU_ARGS_NUM(...) _TU_NARG(_0, ##__VA_ARGS__, _RSEQ_N())
|
||||||
#else
|
#else
|
||||||
#define TU_ARGS_NUM(...) _TU_NARG(_0, __VA_ARGS__,_RSEQ_N())
|
#define TU_ARGS_NUM(...) _TU_NARG(_0, __VA_ARGS__, _RSEQ_N())
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define _TU_NARG(...) _GET_NTH_ARG(__VA_ARGS__)
|
#define _TU_NARG(...) _GET_NTH_ARG(__VA_ARGS__)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user