summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
Diffstat (limited to 'hw')
-rw-r--r--hw/bsp/stm32f0/boards/stm32f070rbnucleo/board.mk4
-rw-r--r--hw/bsp/stm32f0/boards/stm32f072disco/board.mk2
-rw-r--r--hw/bsp/stm32f0/boards/stm32f072eval/board.mk2
-rw-r--r--hw/bsp/stm32f0/family.mk11
-rw-r--r--hw/bsp/stm32f1/boards/stm32f103_bluepill/board.mk10
-rw-r--r--hw/bsp/stm32f1/boards/stm32f103_bluepill/stm32f103x8_flash.icf31
-rw-r--r--hw/bsp/stm32f1/boards/stm32f103_mini_2/board.mk10
-rw-r--r--hw/bsp/stm32f1/family.c5
-rw-r--r--hw/bsp/stm32f1/family.mk15
9 files changed, 72 insertions, 18 deletions
diff --git a/hw/bsp/stm32f0/boards/stm32f070rbnucleo/board.mk b/hw/bsp/stm32f0/boards/stm32f070rbnucleo/board.mk
index f470b80f0..cf787a103 100644
--- a/hw/bsp/stm32f0/boards/stm32f070rbnucleo/board.mk
+++ b/hw/bsp/stm32f0/boards/stm32f070rbnucleo/board.mk
@@ -1,8 +1,10 @@
CFLAGS += -DSTM32F070xB -DCFG_EXAMPLE_VIDEO_READONLY
+# GCC
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_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32f070xb_flash.icf
diff --git a/hw/bsp/stm32f0/boards/stm32f072disco/board.mk b/hw/bsp/stm32f0/boards/stm32f072disco/board.mk
index edee9b0e8..4216ba186 100644
--- a/hw/bsp/stm32f0/boards/stm32f072disco/board.mk
+++ b/hw/bsp/stm32f0/boards/stm32f072disco/board.mk
@@ -1,7 +1,7 @@
CFLAGS += -DSTM32F072xB -DCFG_EXAMPLE_VIDEO_READONLY
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_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32f072xb_flash.icf
diff --git a/hw/bsp/stm32f0/boards/stm32f072eval/board.mk b/hw/bsp/stm32f0/boards/stm32f072eval/board.mk
index 6503d3273..bb9cba22a 100644
--- a/hw/bsp/stm32f0/boards/stm32f072eval/board.mk
+++ b/hw/bsp/stm32f0/boards/stm32f072eval/board.mk
@@ -1,7 +1,7 @@
CFLAGS += -DSTM32F072xB -DLSI_VALUE=40000 -DCFG_EXAMPLE_VIDEO_READONLY
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_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32f072xb_flash.icf
diff --git a/hw/bsp/stm32f0/family.mk b/hw/bsp/stm32f0/family.mk
index a81ab426f..2983af49e 100644
--- a/hw/bsp/stm32f0/family.mk
+++ b/hw/bsp/stm32f0/family.mk
@@ -7,13 +7,14 @@ ST_HAL_DRIVER = hw/mcu/st/stm32$(ST_FAMILY)xx_hal_driver
include $(TOP)/$(BOARD_PATH)/board.mk
+# --------------
+# Compiler Flags
+# --------------
CFLAGS += \
-DCFG_EXAMPLE_MSC_READONLY \
-DCFG_TUSB_MCU=OPT_MCU_STM32F0
-# --------------
# GCC Flags
-# --------------
GCC_CFLAGS += \
-flto \
-mthumb \
@@ -25,12 +26,14 @@ GCC_CFLAGS += \
# suppress warning caused by vendor mcu driver
GCC_CFLAGS += -Wno-error=unused-parameter -Wno-error=cast-align -Wno-error=cast-qual
-# --------------
# IAR Flags
-# --------------
IAR_CFLAGS += --cpu cortex-m0
IAR_ASFLAGS += --cpu cortex-m0
+# ------------------------
+# All source paths should be relative to the top level.
+# ------------------------
+
SRC_C += \
src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c \
$(ST_CMSIS)/Source/Templates/system_stm32$(ST_FAMILY)xx.c \
diff --git a/hw/bsp/stm32f1/boards/stm32f103_bluepill/board.mk b/hw/bsp/stm32f1/boards/stm32f103_bluepill/board.mk
index db64b3a3f..159b3ecb6 100644
--- a/hw/bsp/stm32f1/boards/stm32f103_bluepill/board.mk
+++ b/hw/bsp/stm32f1/boards/stm32f103_bluepill/board.mk
@@ -1,8 +1,12 @@
CFLAGS += -DSTM32F103xB -DHSE_VALUE=8000000U -DCFG_EXAMPLE_VIDEO_READONLY
-# All source paths should be relative to the top level.
-LD_FILE = $(BOARD_PATH)/STM32F103X8_FLASH.ld
-SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f103xb.s
+# GCC
+GCC_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
JLINK_DEVICE = stm32f103c8
diff --git a/hw/bsp/stm32f1/boards/stm32f103_bluepill/stm32f103x8_flash.icf b/hw/bsp/stm32f1/boards/stm32f103_bluepill/stm32f103x8_flash.icf
new file mode 100644
index 000000000..07601c2e8
--- /dev/null
+++ b/hw/bsp/stm32f1/boards/stm32f103_bluepill/stm32f103x8_flash.icf
@@ -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 };
diff --git a/hw/bsp/stm32f1/boards/stm32f103_mini_2/board.mk b/hw/bsp/stm32f1/boards/stm32f103_mini_2/board.mk
index eeda87080..efea75be7 100644
--- a/hw/bsp/stm32f1/boards/stm32f103_mini_2/board.mk
+++ b/hw/bsp/stm32f1/boards/stm32f103_mini_2/board.mk
@@ -1,8 +1,12 @@
CFLAGS += -DSTM32F103xB -DHSE_VALUE=8000000U
-# All source paths should be relative to the top level.
-LD_FILE = $(BOARD_PATH)/STM32F103XC_FLASH.ld
-SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f103xb.s
+# GCC
+GCC_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
JLINK_DEVICE = stm32f103rc
diff --git a/hw/bsp/stm32f1/family.c b/hw/bsp/stm32f1/family.c
index 8fcf9ebd6..246d496c8 100644
--- a/hw/bsp/stm32f1/family.c
+++ b/hw/bsp/stm32f1/family.c
@@ -104,7 +104,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)
@@ -139,7 +140,7 @@ uint32_t board_millis(void)
void HardFault_Handler (void)
{
- asm("bkpt");
+ __asm("BKPT #0\n");
}
#ifdef USE_FULL_ASSERT
diff --git a/hw/bsp/stm32f1/family.mk b/hw/bsp/stm32f1/family.mk
index 3fb2e6e70..4327f1cf8 100644
--- a/hw/bsp/stm32f1/family.mk
+++ b/hw/bsp/stm32f1/family.mk
@@ -6,19 +6,28 @@ 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_STM32F1
+
+# GCC Flags
+GCC_CFLAGS += \
-flto \
-mthumb \
-mabi=aapcs \
-mcpu=cortex-m3 \
-mfloat-abi=soft \
-nostdlib -nostartfiles \
- -DCFG_TUSB_MCU=OPT_MCU_STM32F1
-# mcu driver cause following warnings
-#CFLAGS += -Wno-error=unused-parameter
+# IAR Flags
+IAR_CFLAGS += --cpu cortex-m3
+IAR_ASFLAGS += --cpu cortex-m3
+# ------------------------
# All source paths should be relative to the top level.
+# ------------------------
SRC_C += \
src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c \
$(ST_CMSIS)/Source/Templates/system_stm32$(ST_FAMILY)xx.c \