summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2023-03-06 15:10:21 +0700
committerGitHub <[email protected]>2023-03-06 15:10:21 +0700
commit66da95a0eebcfb6e45980bc894d61b6bfd8fc0cc (patch)
treef96e0829e82976d5a3ed6ae743d06268430c8122
parenta83cef5e4c8cb54e89a0d4be30edac3574e3a185 (diff)
parentec8c292bbebdbaebe39abef6e88c6a0fbb1f2be7 (diff)
Merge pull request #1938 from hathach/update-build
Fix build on windows and macos
-rw-r--r--.github/workflows/build_win_mac.yml56
-rw-r--r--examples/device/audio_4_channel_mic/Makefile1
-rw-r--r--examples/device/audio_test/Makefile1
-rw-r--r--examples/device/audio_test_multi_rate/Makefile1
-rw-r--r--examples/device/board_test/Makefile1
-rw-r--r--examples/device/cdc_dual_ports/Makefile1
-rw-r--r--examples/device/cdc_msc/Makefile1
-rw-r--r--examples/device/cdc_msc_freertos/Makefile1
-rw-r--r--examples/device/dfu/Makefile1
-rw-r--r--examples/device/dfu_runtime/Makefile1
-rw-r--r--examples/device/dynamic_configuration/Makefile1
-rw-r--r--examples/device/hid_boot_interface/Makefile1
-rw-r--r--examples/device/hid_composite/Makefile1
-rw-r--r--examples/device/hid_composite_freertos/Makefile1
-rw-r--r--examples/device/hid_generic_inout/Makefile1
-rw-r--r--examples/device/hid_multiple_interface/Makefile1
-rw-r--r--examples/device/midi_test/Makefile1
-rw-r--r--examples/device/msc_dual_lun/Makefile1
-rw-r--r--examples/device/net_lwip_webserver/Makefile1
-rw-r--r--examples/device/uac2_headset/Makefile1
-rw-r--r--examples/device/usbtmc/Makefile1
-rw-r--r--examples/device/video_capture/Makefile1
-rw-r--r--examples/device/webusb_serial/Makefile1
-rw-r--r--examples/dual/host_hid_to_device_cdc/Makefile1
-rw-r--r--examples/host/bare_api/Makefile1
-rw-r--r--examples/host/cdc_msc_hid/Makefile1
-rw-r--r--examples/host/hid_controller/Makefile1
-rw-r--r--examples/host/msc_file_explorer/Makefile1
-rw-r--r--examples/make.mk45
-rw-r--r--examples/rules.mk26
-rw-r--r--hw/bsp/stm32f0/family.c2
-rw-r--r--hw/bsp/stm32f0/family.mk6
-rw-r--r--hw/bsp/stm32f0/stm32f0xx_hal_conf.h4
-rw-r--r--hw/bsp/stm32f1/family.c2
-rw-r--r--hw/bsp/stm32f1/stm32f1xx_hal_conf.h4
-rw-r--r--hw/bsp/stm32f4/family.mk1
-rw-r--r--hw/bsp/stm32f7/family.mk1
-rw-r--r--hw/bsp/stm32g4/family.mk1
-rw-r--r--hw/bsp/stm32h7/family.mk5
-rw-r--r--hw/bsp/stm32l4/family.mk4
-rw-r--r--test/fuzz/device/cdc/Makefile1
-rw-r--r--test/fuzz/device/msc/Makefile1
-rw-r--r--test/fuzz/device/net/Makefile1
-rw-r--r--test/fuzz/make.mk30
-rw-r--r--tools/build_utils.py17
-rw-r--r--tools/top.mk45
46 files changed, 166 insertions, 113 deletions
diff --git a/.github/workflows/build_win_mac.yml b/.github/workflows/build_win_mac.yml
new file mode 100644
index 000000000..bad9f3162
--- /dev/null
+++ b/.github/workflows/build_win_mac.yml
@@ -0,0 +1,56 @@
+name: Build Windows/MacOS
+
+on:
+ push:
+ paths:
+ - 'src/**'
+ - 'examples/**'
+ - 'lib/**'
+ - 'hw/**'
+ - '.github/workflows/build_win_mac.yml'
+ pull_request:
+ branches: [ master ]
+ paths:
+ - 'src/**'
+ - 'examples/**'
+ - 'lib/**'
+ - 'hw/**'
+ - '.github/workflows/build_win_mac.yml'
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
+ cancel-in-progress: true
+
+jobs:
+ # ---------------------------------------
+ # Build ARM family
+ # ---------------------------------------
+ build-arm:
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [windows-latest, macos-latest]
+ runs-on: ${{ matrix.os }}
+
+ steps:
+ - name: Setup Python
+ uses: actions/setup-python@v4
+ with:
+ python-version: '3.x'
+
+ - name: Install ARM GCC
+ uses: carlosperate/arm-none-eabi-gcc-action@v1
+ with:
+ release: '10.3-2021.10'
+
+ - name: Checkout TinyUSB
+ uses: actions/checkout@v3
+
+ - name: Checkout common submodules in lib
+ run: git submodule update --init lib/FreeRTOS-Kernel lib/lwip
+
+ - name: Get Dependencies
+ run: python3 tools/get_dependencies.py stm32f4
+
+ - name: Build
+ run: python3 tools/build_family.py stm32f4 stm32f411disco
diff --git a/examples/device/audio_4_channel_mic/Makefile b/examples/device/audio_4_channel_mic/Makefile
index 5a455078e..2a3d854fb 100644
--- a/examples/device/audio_4_channel_mic/Makefile
+++ b/examples/device/audio_4_channel_mic/Makefile
@@ -1,4 +1,3 @@
-include ../../../tools/top.mk
include ../../make.mk
INC += \
diff --git a/examples/device/audio_test/Makefile b/examples/device/audio_test/Makefile
index 5a455078e..2a3d854fb 100644
--- a/examples/device/audio_test/Makefile
+++ b/examples/device/audio_test/Makefile
@@ -1,4 +1,3 @@
-include ../../../tools/top.mk
include ../../make.mk
INC += \
diff --git a/examples/device/audio_test_multi_rate/Makefile b/examples/device/audio_test_multi_rate/Makefile
index 5a455078e..2a3d854fb 100644
--- a/examples/device/audio_test_multi_rate/Makefile
+++ b/examples/device/audio_test_multi_rate/Makefile
@@ -1,4 +1,3 @@
-include ../../../tools/top.mk
include ../../make.mk
INC += \
diff --git a/examples/device/board_test/Makefile b/examples/device/board_test/Makefile
index 5a455078e..2a3d854fb 100644
--- a/examples/device/board_test/Makefile
+++ b/examples/device/board_test/Makefile
@@ -1,4 +1,3 @@
-include ../../../tools/top.mk
include ../../make.mk
INC += \
diff --git a/examples/device/cdc_dual_ports/Makefile b/examples/device/cdc_dual_ports/Makefile
index 5a455078e..2a3d854fb 100644
--- a/examples/device/cdc_dual_ports/Makefile
+++ b/examples/device/cdc_dual_ports/Makefile
@@ -1,4 +1,3 @@
-include ../../../tools/top.mk
include ../../make.mk
INC += \
diff --git a/examples/device/cdc_msc/Makefile b/examples/device/cdc_msc/Makefile
index 69b633fea..da088ea6b 100644
--- a/examples/device/cdc_msc/Makefile
+++ b/examples/device/cdc_msc/Makefile
@@ -1,4 +1,3 @@
-include ../../../tools/top.mk
include ../../make.mk
INC += \
diff --git a/examples/device/cdc_msc_freertos/Makefile b/examples/device/cdc_msc_freertos/Makefile
index 4ee816880..e2bbc2268 100644
--- a/examples/device/cdc_msc_freertos/Makefile
+++ b/examples/device/cdc_msc_freertos/Makefile
@@ -1,6 +1,5 @@
DEPS_SUBMODULES += lib/FreeRTOS-Kernel
-include ../../../tools/top.mk
include ../../make.mk
FREERTOS_SRC = lib/FreeRTOS-Kernel
diff --git a/examples/device/dfu/Makefile b/examples/device/dfu/Makefile
index 5148ed55a..b3f2cc588 100644
--- a/examples/device/dfu/Makefile
+++ b/examples/device/dfu/Makefile
@@ -1,4 +1,3 @@
-include ../../../tools/top.mk
include ../../make.mk
INC += \
diff --git a/examples/device/dfu_runtime/Makefile b/examples/device/dfu_runtime/Makefile
index 69b633fea..da088ea6b 100644
--- a/examples/device/dfu_runtime/Makefile
+++ b/examples/device/dfu_runtime/Makefile
@@ -1,4 +1,3 @@
-include ../../../tools/top.mk
include ../../make.mk
INC += \
diff --git a/examples/device/dynamic_configuration/Makefile b/examples/device/dynamic_configuration/Makefile
index 69b633fea..da088ea6b 100644
--- a/examples/device/dynamic_configuration/Makefile
+++ b/examples/device/dynamic_configuration/Makefile
@@ -1,4 +1,3 @@
-include ../../../tools/top.mk
include ../../make.mk
INC += \
diff --git a/examples/device/hid_boot_interface/Makefile b/examples/device/hid_boot_interface/Makefile
index c6a9c5b21..d58a539e8 100644
--- a/examples/device/hid_boot_interface/Makefile
+++ b/examples/device/hid_boot_interface/Makefile
@@ -1,4 +1,3 @@
-include ../../../tools/top.mk
include ../../make.mk
INC += \
diff --git a/examples/device/hid_composite/Makefile b/examples/device/hid_composite/Makefile
index 69b633fea..da088ea6b 100644
--- a/examples/device/hid_composite/Makefile
+++ b/examples/device/hid_composite/Makefile
@@ -1,4 +1,3 @@
-include ../../../tools/top.mk
include ../../make.mk
INC += \
diff --git a/examples/device/hid_composite_freertos/Makefile b/examples/device/hid_composite_freertos/Makefile
index a354a90b6..099a43893 100644
--- a/examples/device/hid_composite_freertos/Makefile
+++ b/examples/device/hid_composite_freertos/Makefile
@@ -1,6 +1,5 @@
DEPS_SUBMODULES += lib/FreeRTOS-Kernel
-include ../../../tools/top.mk
include ../../make.mk
FREERTOS_SRC = lib/FreeRTOS-Kernel
diff --git a/examples/device/hid_generic_inout/Makefile b/examples/device/hid_generic_inout/Makefile
index 69b633fea..da088ea6b 100644
--- a/examples/device/hid_generic_inout/Makefile
+++ b/examples/device/hid_generic_inout/Makefile
@@ -1,4 +1,3 @@
-include ../../../tools/top.mk
include ../../make.mk
INC += \
diff --git a/examples/device/hid_multiple_interface/Makefile b/examples/device/hid_multiple_interface/Makefile
index 69b633fea..da088ea6b 100644
--- a/examples/device/hid_multiple_interface/Makefile
+++ b/examples/device/hid_multiple_interface/Makefile
@@ -1,4 +1,3 @@
-include ../../../tools/top.mk
include ../../make.mk
INC += \
diff --git a/examples/device/midi_test/Makefile b/examples/device/midi_test/Makefile
index 5a455078e..2a3d854fb 100644
--- a/examples/device/midi_test/Makefile
+++ b/examples/device/midi_test/Makefile
@@ -1,4 +1,3 @@
-include ../../../tools/top.mk
include ../../make.mk
INC += \
diff --git a/examples/device/msc_dual_lun/Makefile b/examples/device/msc_dual_lun/Makefile
index 5a455078e..2a3d854fb 100644
--- a/examples/device/msc_dual_lun/Makefile
+++ b/examples/device/msc_dual_lun/Makefile
@@ -1,4 +1,3 @@
-include ../../../tools/top.mk
include ../../make.mk
INC += \
diff --git a/examples/device/net_lwip_webserver/Makefile b/examples/device/net_lwip_webserver/Makefile
index 55bd820bd..bc2914b36 100644
--- a/examples/device/net_lwip_webserver/Makefile
+++ b/examples/device/net_lwip_webserver/Makefile
@@ -1,6 +1,5 @@
DEPS_SUBMODULES += lib/lwip
-include ../../../tools/top.mk
include ../../make.mk
# suppress warning caused by lwip
diff --git a/examples/device/uac2_headset/Makefile b/examples/device/uac2_headset/Makefile
index 5a455078e..2a3d854fb 100644
--- a/examples/device/uac2_headset/Makefile
+++ b/examples/device/uac2_headset/Makefile
@@ -1,4 +1,3 @@
-include ../../../tools/top.mk
include ../../make.mk
INC += \
diff --git a/examples/device/usbtmc/Makefile b/examples/device/usbtmc/Makefile
index 69b633fea..da088ea6b 100644
--- a/examples/device/usbtmc/Makefile
+++ b/examples/device/usbtmc/Makefile
@@ -1,4 +1,3 @@
-include ../../../tools/top.mk
include ../../make.mk
INC += \
diff --git a/examples/device/video_capture/Makefile b/examples/device/video_capture/Makefile
index fda66bcc1..90d174c32 100644
--- a/examples/device/video_capture/Makefile
+++ b/examples/device/video_capture/Makefile
@@ -1,4 +1,3 @@
-include ../../../tools/top.mk
include ../../make.mk
ifeq ($(DISABLE_MJPEG),1)
diff --git a/examples/device/webusb_serial/Makefile b/examples/device/webusb_serial/Makefile
index 5a455078e..2a3d854fb 100644
--- a/examples/device/webusb_serial/Makefile
+++ b/examples/device/webusb_serial/Makefile
@@ -1,4 +1,3 @@
-include ../../../tools/top.mk
include ../../make.mk
INC += \
diff --git a/examples/dual/host_hid_to_device_cdc/Makefile b/examples/dual/host_hid_to_device_cdc/Makefile
index 3fe9b0888..95c88e7e8 100644
--- a/examples/dual/host_hid_to_device_cdc/Makefile
+++ b/examples/dual/host_hid_to_device_cdc/Makefile
@@ -1,4 +1,3 @@
-include ../../../tools/top.mk
include ../../make.mk
INC += \
diff --git a/examples/host/bare_api/Makefile b/examples/host/bare_api/Makefile
index 84555a889..058307c40 100644
--- a/examples/host/bare_api/Makefile
+++ b/examples/host/bare_api/Makefile
@@ -1,4 +1,3 @@
-include ../../../tools/top.mk
include ../../make.mk
INC += \
diff --git a/examples/host/cdc_msc_hid/Makefile b/examples/host/cdc_msc_hid/Makefile
index 9adccfa3a..7c16b39d3 100644
--- a/examples/host/cdc_msc_hid/Makefile
+++ b/examples/host/cdc_msc_hid/Makefile
@@ -1,4 +1,3 @@
-include ../../../tools/top.mk
include ../../make.mk
INC += \
diff --git a/examples/host/hid_controller/Makefile b/examples/host/hid_controller/Makefile
index e7fbd741f..cda2977bc 100644
--- a/examples/host/hid_controller/Makefile
+++ b/examples/host/hid_controller/Makefile
@@ -1,4 +1,3 @@
-include ../../../tools/top.mk
include ../../make.mk
INC += \
diff --git a/examples/host/msc_file_explorer/Makefile b/examples/host/msc_file_explorer/Makefile
index de2f9c01c..1fda72b18 100644
--- a/examples/host/msc_file_explorer/Makefile
+++ b/examples/host/msc_file_explorer/Makefile
@@ -1,4 +1,3 @@
-include ../../../tools/top.mk
include ../../make.mk
FATFS_PATH = lib/fatfs/source
diff --git a/examples/make.mk b/examples/make.mk
index dd7a5cf4e..0a07da21c 100644
--- a/examples/make.mk
+++ b/examples/make.mk
@@ -2,6 +2,35 @@
# Common make definition for all examples
# ---------------------------------------
+#-------------- TOP and CURRENT_PATH ------------
+
+# Set TOP to be the path to get from the current directory (where make was
+# invoked) to the top of the tree. $(lastword $(MAKEFILE_LIST)) returns
+# the name of this makefile relative to where make was invoked.
+THIS_MAKEFILE := $(lastword $(MAKEFILE_LIST))
+
+# strip off /tools/top.mk to get for example ../../..
+# and Set TOP to an absolute path
+TOP = $(abspath $(subst make.mk,..,$(THIS_MAKEFILE)))
+
+# Set CURRENT_PATH to the relative path from TOP to the current directory, ie examples/device/cdc_msc_freertos
+CURRENT_PATH = $(subst $(TOP)/,,$(abspath .))
+
+# Detect whether shell style is windows or not
+# https://stackoverflow.com/questions/714100/os-detecting-makefile/52062069#52062069
+ifeq '$(findstring ;,$(PATH))' ';'
+# PATH contains semicolon - so we're definitely on Windows.
+CMDEXE := 1
+
+# makefile shell commands should use syntax for DOS CMD, not unix sh
+# Unfortunately, SHELL may point to sh or bash, which can't accept DOS syntax.
+# We can't just use sh, because while sh and/or bash shell may be available,
+# many Windows environments won't have utilities like realpath used below, so...
+# Force DOS command shell on Windows.
+SHELL := cmd.exe
+endif
+
+
# Build directory
BUILD := _build/$(BOARD)
@@ -45,14 +74,10 @@ else
SRC_C += $(subst $(TOP)/,,$(wildcard $(TOP)/$(FAMILY_PATH)/*.c))
endif
-
#-------------- Cross Compiler ------------
# Can be set by board, default to ARM GCC
CROSS_COMPILE ?= arm-none-eabi-
-# Allow for -Os to be changed by board makefiles in case -Os is not allowed
-CFLAGS_OPTIMIZED ?= -Os
-
ifeq ($(CC),iccarm)
USE_IAR = 1
endif
@@ -61,29 +86,28 @@ ifdef USE_IAR
AS = iasmarm
LD = ilinkarm
OBJCOPY = ielftool
- SIZE = echo "size not available for IAR"
+ SIZE = size
else
CC = $(CROSS_COMPILE)gcc
CXX = $(CROSS_COMPILE)g++
AS = $(CC) -x assembler-with-cpp
LD = $(CC)
-
+
GDB = $(CROSS_COMPILE)gdb
OBJCOPY = $(CROSS_COMPILE)objcopy
SIZE = $(CROSS_COMPILE)size
endif
-MKDIR = mkdir
-
ifeq ($(CMDEXE),1)
CP = copy
RM = del
+ MKDIR = mkdir
PYTHON = python
else
- SED = sed
CP = cp
RM = rm
+ MKDIR = mkdir
PYTHON = python3
endif
@@ -95,6 +119,9 @@ SRC_C += $(subst $(TOP)/,,$(wildcard $(TOP)/$(BOARD_PATH)/*.c))
INC += $(TOP)/$(FAMILY_PATH)
+# Allow for -Os to be changed by board makefiles in case -Os is not allowed
+CFLAGS_OPTIMIZED ?= -Os
+
# GCC Compiler Flags
GCC_CFLAGS += \
-ggdb \
diff --git a/examples/rules.mk b/examples/rules.mk
index dcef934ab..3254112cf 100644
--- a/examples/rules.mk
+++ b/examples/rules.mk
@@ -112,7 +112,7 @@ OBJ_DIRS = $(sort $(dir $(OBJ)))
$(OBJ): | $(OBJ_DIRS)
$(OBJ_DIRS):
ifeq ($(CMDEXE),1)
- @$(MKDIR) $(subst /,\,$@)
+ -@$(MKDIR) $(subst /,\,$@)
else
@$(MKDIR) -p $@
endif
@@ -139,34 +139,34 @@ $(BUILD)/obj/%_asm.o: %.S
@echo AS $(notdir $@)
@$(AS) $(ASFLAGS) -c -o $@ $<
-ifndef USE_IAR
-# GCC based compiler
+ifdef USE_IAR
+# IAR Compiler
$(BUILD)/$(PROJECT).bin: $(BUILD)/$(PROJECT).elf
@echo CREATE $@
- @$(OBJCOPY) -O binary $^ $@
+ @$(OBJCOPY) --silent --bin $^ $@
$(BUILD)/$(PROJECT).hex: $(BUILD)/$(PROJECT).elf
@echo CREATE $@
- @$(OBJCOPY) -O ihex $^ $@
+ @$(OBJCOPY) --silent --ihex $^ $@
$(BUILD)/$(PROJECT).elf: $(OBJ)
@echo LINK $@
- @$(LD) -o $@ $(LDFLAGS) $^ -Wl,--start-group $(LIBS) -Wl,--end-group
+ @$(LD) -o $@ $(IAR_LDFLAGS) $^
else
-
-# IAR Compiler
+# GCC based compiler
$(BUILD)/$(PROJECT).bin: $(BUILD)/$(PROJECT).elf
@echo CREATE $@
- @$(OBJCOPY) --silent --bin $^ $@
+ @$(OBJCOPY) -O binary $^ $@
$(BUILD)/$(PROJECT).hex: $(BUILD)/$(PROJECT).elf
@echo CREATE $@
- @$(OBJCOPY) --silent --ihex $^ $@
+ @$(OBJCOPY) -O ihex $^ $@
$(BUILD)/$(PROJECT).elf: $(OBJ)
@echo LINK $@
- @$(LD) -o $@ $(IAR_LDFLAGS) $^
+ @$(LD) -o $@ $(LDFLAGS) $^ -Wl,--start-group $(LIBS) -Wl,--end-group
+
endif
# UF2 generation, iMXRT need to strip to text only before conversion
@@ -265,7 +265,11 @@ debug-bmp: $(BUILD)/$(PROJECT).elf
# Create binary directory
$(BIN):
+ifeq ($(CMDEXE),1)
+ @$(MKDIR) $(subst /,\,$@)
+else
@$(MKDIR) -p $@
+endif
# Copy binaries .elf, .bin, .hex, .uf2 to BIN for upload
# due to large size of combined artifacts, only uf2 is uploaded for now
diff --git a/hw/bsp/stm32f0/family.c b/hw/bsp/stm32f0/family.c
index a7e914128..0765f361d 100644
--- a/hw/bsp/stm32f0/family.c
+++ b/hw/bsp/stm32f0/family.c
@@ -165,7 +165,7 @@ void HardFault_Handler (void)
* @param line: assert_param error line source number
* @retval None
*/
-void assert_failed(uint8_t* file, uint32_t line)
+void assert_failed(const char* file, uint32_t line)
{
(void) file; (void) line;
/* USER CODE BEGIN 6 */
diff --git a/hw/bsp/stm32f0/family.mk b/hw/bsp/stm32f0/family.mk
index 2983af49e..1ae2aa5fc 100644
--- a/hw/bsp/stm32f0/family.mk
+++ b/hw/bsp/stm32f0/family.mk
@@ -24,7 +24,7 @@ GCC_CFLAGS += \
-nostdlib -nostartfiles \
# 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
# IAR Flags
IAR_CFLAGS += --cpu cortex-m0
@@ -42,7 +42,9 @@ SRC_C += \
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_rcc.c \
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_rcc_ex.c \
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_gpio.c \
- $(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_uart.c
+ $(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_dma.c \
+ $(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_uart.c \
+ $(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_uart_ex.c
INC += \
$(TOP)/$(BOARD_PATH) \
diff --git a/hw/bsp/stm32f0/stm32f0xx_hal_conf.h b/hw/bsp/stm32f0/stm32f0xx_hal_conf.h
index cfa66b366..0bf053e13 100644
--- a/hw/bsp/stm32f0/stm32f0xx_hal_conf.h
+++ b/hw/bsp/stm32f0/stm32f0xx_hal_conf.h
@@ -303,9 +303,9 @@
* If expr is true, it returns no value.
* @retval None
*/
- #define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
+ #define assert_param(expr) ((expr) ? (void)0U : assert_failed(__FILE__, __LINE__))
/* Exported functions ------------------------------------------------------- */
- void assert_failed(uint8_t* file, uint32_t line);
+ void assert_failed(const char* file, uint32_t line);
#else
#define assert_param(expr) ((void)0U)
#endif /* USE_FULL_ASSERT */
diff --git a/hw/bsp/stm32f1/family.c b/hw/bsp/stm32f1/family.c
index 246d496c8..61b40badd 100644
--- a/hw/bsp/stm32f1/family.c
+++ b/hw/bsp/stm32f1/family.c
@@ -151,7 +151,7 @@ void HardFault_Handler (void)
* @param line: assert_param error line source number
* @retval None
*/
-void assert_failed(char *file, uint32_t line)
+void assert_failed(const char *file, uint32_t line)
{
/* USER CODE BEGIN 6 */
/* User can add his own implementation to report the file name and line number,
diff --git a/hw/bsp/stm32f1/stm32f1xx_hal_conf.h b/hw/bsp/stm32f1/stm32f1xx_hal_conf.h
index a4a3f3086..5243e5bca 100644
--- a/hw/bsp/stm32f1/stm32f1xx_hal_conf.h
+++ b/hw/bsp/stm32f1/stm32f1xx_hal_conf.h
@@ -362,9 +362,9 @@
* If expr is true, it returns no value.
* @retval None
*/
- #define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
+ #define assert_param(expr) ((expr) ? (void)0U : assert_failed(__FILE__, __LINE__))
/* Exported functions ------------------------------------------------------- */
- void assert_failed(uint8_t* file, uint32_t line);
+ void assert_failed(const char* file, uint32_t line);
#else
#define assert_param(expr) ((void)0U)
#endif /* USE_FULL_ASSERT */
diff --git a/hw/bsp/stm32f4/family.mk b/hw/bsp/stm32f4/family.mk
index e8352bad7..860955729 100644
--- a/hw/bsp/stm32f4/family.mk
+++ b/hw/bsp/stm32f4/family.mk
@@ -42,6 +42,7 @@ SRC_C += \
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_rcc.c \
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_rcc_ex.c \
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_uart.c \
+ $(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_dma.c \
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_gpio.c
INC += \
diff --git a/hw/bsp/stm32f7/family.mk b/hw/bsp/stm32f7/family.mk
index 781b8bb18..a54e43780 100644
--- a/hw/bsp/stm32f7/family.mk
+++ b/hw/bsp/stm32f7/family.mk
@@ -52,6 +52,7 @@ SRC_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 \
+ $(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_dma.c \
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_rcc.c \
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_rcc_ex.c \
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_gpio.c \
diff --git a/hw/bsp/stm32g4/family.mk b/hw/bsp/stm32g4/family.mk
index 79defac56..ad9babf3f 100644
--- a/hw/bsp/stm32g4/family.mk
+++ b/hw/bsp/stm32g4/family.mk
@@ -43,6 +43,7 @@ SRC_C += \
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_rcc.c \
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_rcc_ex.c \
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_uart.c \
+ $(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_uart_ex.c \
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_gpio.c
INC += \
diff --git a/hw/bsp/stm32h7/family.mk b/hw/bsp/stm32h7/family.mk
index 834347b4b..9989b17a8 100644
--- a/hw/bsp/stm32h7/family.mk
+++ b/hw/bsp/stm32h7/family.mk
@@ -37,7 +37,7 @@ GCC_CFLAGS += \
-nostdlib -nostartfiles
# suppress warning caused by vendor mcu driver
-GCC_CFLAGS += -Wno-error=maybe-uninitialized -Wno-error=cast-align
+GCC_CFLAGS += -Wno-error=maybe-uninitialized -Wno-error=cast-align -Wno-error=unused-parameter
# IAR Flags
IAR_CFLAGS += --cpu cortex-m7 --fpu VFPv5_D16
@@ -52,10 +52,13 @@ SRC_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 \
+ $(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_dma.c \
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_rcc.c \
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_rcc_ex.c \
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_gpio.c \
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_uart.c \
+ $(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_uart_ex.c \
+ $(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_pwr.c \
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_pwr_ex.c
INC += \
diff --git a/hw/bsp/stm32l4/family.mk b/hw/bsp/stm32l4/family.mk
index 4fab7dc0d..84aa357e9 100644
--- a/hw/bsp/stm32l4/family.mk
+++ b/hw/bsp/stm32l4/family.mk
@@ -39,12 +39,14 @@ SRC_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 \
+ $(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_dma.c \
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_rcc.c \
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_rcc_ex.c \
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_pwr.c \
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_pwr_ex.c \
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_gpio.c \
- $(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_uart.c
+ $(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_uart.c \
+ $(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_uart_ex.c
INC += \
$(TOP)/lib/CMSIS_5/CMSIS/Core/Include \
diff --git a/test/fuzz/device/cdc/Makefile b/test/fuzz/device/cdc/Makefile
index ee51936b5..7071df057 100644
--- a/test/fuzz/device/cdc/Makefile
+++ b/test/fuzz/device/cdc/Makefile
@@ -1,4 +1,3 @@
-include ../../../../tools/top.mk
include ../../make.mk
INC += \
diff --git a/test/fuzz/device/msc/Makefile b/test/fuzz/device/msc/Makefile
index ee51936b5..7071df057 100644
--- a/test/fuzz/device/msc/Makefile
+++ b/test/fuzz/device/msc/Makefile
@@ -1,4 +1,3 @@
-include ../../../../tools/top.mk
include ../../make.mk
INC += \
diff --git a/test/fuzz/device/net/Makefile b/test/fuzz/device/net/Makefile
index 22241fcdc..4e99604ad 100644
--- a/test/fuzz/device/net/Makefile
+++ b/test/fuzz/device/net/Makefile
@@ -1,6 +1,5 @@
DEPS_SUBMODULES += lib/lwip
-include ../../../../tools/top.mk
include ../../make.mk
# suppress warning caused by lwip
diff --git a/test/fuzz/make.mk b/test/fuzz/make.mk
index e7c5518e7..934819665 100644
--- a/test/fuzz/make.mk
+++ b/test/fuzz/make.mk
@@ -2,6 +2,34 @@
# Common make definition for all examples
# ---------------------------------------
+#-------------- TOP and CURRENT_PATH ------------
+
+# Set TOP to be the path to get from the current directory (where make was
+# invoked) to the top of the tree. $(lastword $(MAKEFILE_LIST)) returns
+# the name of this makefile relative to where make was invoked.
+THIS_MAKEFILE := $(lastword $(MAKEFILE_LIST))
+
+# strip off /tools/top.mk to get for example ../../..
+# and Set TOP to an absolute path
+TOP = $(abspath $(subst make.mk,../..,$(THIS_MAKEFILE)))
+
+# Set CURRENT_PATH to the relative path from TOP to the current directory, ie examples/device/cdc_msc_freertos
+CURRENT_PATH = $(subst $(TOP)/,,$(abspath .))
+
+# Detect whether shell style is windows or not
+# https://stackoverflow.com/questions/714100/os-detecting-makefile/52062069#52062069
+ifeq '$(findstring ;,$(PATH))' ';'
+# PATH contains semicolon - so we're definitely on Windows.
+CMDEXE := 1
+
+# makefile shell commands should use syntax for DOS CMD, not unix sh
+# Unfortunately, SHELL may point to sh or bash, which can't accept DOS syntax.
+# We can't just use sh, because while sh and/or bash shell may be available,
+# many Windows environments won't have utilities like realpath used below, so...
+# Force DOS command shell on Windows.
+SHELL := cmd.exe
+endif
+
# Build directory
BUILD := _build
PROJECT := $(notdir $(CURDIR))
@@ -42,8 +70,6 @@ SANITIZER_FLAGS ?= -fsanitize=fuzzer \
CFLAGS += $(COVERAGE_FLAGS) $(SANITIZER_FLAGS)
#-------------- Source files and compiler flags --------------
-
-
INC += $(TOP)/test
# Compiler Flags
diff --git a/tools/build_utils.py b/tools/build_utils.py
index ad1daf8c7..a24cea7bb 100644
--- a/tools/build_utils.py
+++ b/tools/build_utils.py
@@ -114,9 +114,14 @@ def build_example(example, board, make_option):
def build_size(example, board):
- elf_file = 'examples/{}/_build/{}/*.elf'.format(example, board)
- size_output = subprocess.run('size {}'.format(elf_file), shell=True, stdout=subprocess.PIPE).stdout.decode("utf-8")
- size_list = size_output.split('\n')[1].split('\t')
- flash_size = int(size_list[0])
- sram_size = int(size_list[1]) + int(size_list[2])
- return (flash_size, sram_size)
+ size_cmd = 'make -j -C examples/{} BOARD={} size'.format(example, board)
+ size_output = subprocess.run(size_cmd, shell=True, stdout=subprocess.PIPE).stdout.decode("utf-8").splitlines()
+ for i, l in enumerate(size_output):
+ text_title = 'text data bss dec'
+ if text_title in l:
+ size_list = size_output[i+1].split('\t')
+ flash_size = int(size_list[0])
+ sram_size = int(size_list[1]) + int(size_list[2])
+ return (flash_size, sram_size)
+
+ return (0, 0) \ No newline at end of file
diff --git a/tools/top.mk b/tools/top.mk
deleted file mode 100644
index af8d698f5..000000000
--- a/tools/top.mk
+++ /dev/null
@@ -1,45 +0,0 @@
-ifneq ($(lastword a b),b)
-$(error This Makefile requires make 3.81 or newer)
-endif
-
-# Detect whether shell style is windows or not
-# https://stackoverflow.com/questions/714100/os-detecting-makefile/52062069#52062069
-ifeq '$(findstring ;,$(PATH))' ';'
-# PATH contains semicolon - so we're definitely on Windows.
-CMDEXE := 1
-
-# makefile shell commands should use syntax for DOS CMD, not unix sh
-# Unfortunately, SHELL may point to sh or bash, which can't accept DOS syntax.
-# We can't just use sh, because while sh and/or bash shell may be available,
-# many Windows environments won't have utilities like realpath used below, so...
-# Force DOS command shell on Windows.
-SHELL := cmd.exe
-endif
-
-#$(info top.mk: SHELL=$(SHELL))
-#$(info top.mk: CMDEXE=$(CMDEXE))
-
-# Set TOP to be the path to get from the current directory (where make was
-# invoked) to the top of the tree. $(lastword $(MAKEFILE_LIST)) returns
-# the name of this makefile relative to where make was invoked.
-THIS_MAKEFILE := $(lastword $(MAKEFILE_LIST))
-
-# strip off /tools/top.mk to get for example ../../..
-TOP := $(patsubst %/tools/top.mk,%,$(THIS_MAKEFILE))
-#$(info top.mk: Initial TOP=$(TOP))
-
-# Set TOP to an absolute path, for example /tinyUSB (from ../../..)
-ifeq ($(CMDEXE),1)
-TOP := $(subst \,/,$(shell for %%i in ( $(TOP) ) do echo %%~fi))
-else
-TOP := $(shell realpath $(TOP))
-endif
-#$(info top.mk: Top directory is $(TOP))
-
-# Set CURRENT_PATH to the relative path from TOP to the current directory, ie examples/device/cdc_msc_freertos
-ifeq ($(CMDEXE),1)
-CURRENT_PATH := $(subst $(TOP)/,,$(subst \,/,$(shell echo %CD%)))
-else
-CURRENT_PATH := $(shell realpath --relative-to=$(TOP) `pwd`)
-endif
-#$(info top.mk: Path from top is $(CURRENT_PATH))