diff --git a/stmhal/Makefile b/stmhal/Makefile index 4931ebf80c..b1424a61ef 100644 --- a/stmhal/Makefile +++ b/stmhal/Makefile @@ -47,6 +47,7 @@ INC += -I../lib/timeutils CFLAGS_CORTEX_M4 = -mthumb -mtune=cortex-m4 -mabi=aapcs-linux -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fsingle-precision-constant -Wdouble-promotion CFLAGS = $(INC) -Wall -Wpointer-arith -Werror -ansi -std=gnu99 -nostdlib $(CFLAGS_MOD) $(CFLAGS_CORTEX_M4) $(COPT) CFLAGS += -Iboards/$(BOARD) +CFLAGS += -DSTM32_HAL_H='' LDFLAGS = -nostdlib -T $(LD_FILE) -Map=$(@:.elf=.map) --cref LIBS = diff --git a/stmhal/accel.c b/stmhal/accel.c index a61e8ef3ee..64ac852664 100644 --- a/stmhal/accel.c +++ b/stmhal/accel.c @@ -27,7 +27,7 @@ #include #include -#include "stm32f4xx_hal.h" +#include STM32_HAL_H #include "py/nlr.h" #include "py/runtime.h" diff --git a/stmhal/adc.c b/stmhal/adc.c index 9ec8eac725..7431a356d5 100644 --- a/stmhal/adc.c +++ b/stmhal/adc.c @@ -25,7 +25,7 @@ */ #include -#include +#include STM32_HAL_H #include #include "py/nlr.h" diff --git a/stmhal/dac.c b/stmhal/dac.c index b1e688442a..178017e222 100644 --- a/stmhal/dac.c +++ b/stmhal/dac.c @@ -28,7 +28,7 @@ #include #include -#include "stm32f4xx_hal.h" +#include STM32_HAL_H #include "py/nlr.h" #include "py/runtime.h" diff --git a/stmhal/diskio.c b/stmhal/diskio.c index abad2f41ab..3fd83ec90d 100644 --- a/stmhal/diskio.c +++ b/stmhal/diskio.c @@ -30,7 +30,7 @@ #include #include -#include "stm32f4xx_hal.h" +#include STM32_HAL_H #include "py/runtime.h" #include "lib/fatfs/ff.h" /* FatFs lower layer API */ diff --git a/stmhal/dma.c b/stmhal/dma.c index 77474b7676..674e4a9372 100644 --- a/stmhal/dma.c +++ b/stmhal/dma.c @@ -27,7 +27,7 @@ #include #include #include -#include +#include STM32_HAL_H #include "dma.h" diff --git a/stmhal/flash.c b/stmhal/flash.c index f576f927a2..7eef9b9796 100644 --- a/stmhal/flash.c +++ b/stmhal/flash.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include +#include STM32_HAL_H #include "flash.h" diff --git a/stmhal/lcd.c b/stmhal/lcd.c index f0f7ae90f2..12d96e6996 100644 --- a/stmhal/lcd.c +++ b/stmhal/lcd.c @@ -26,7 +26,7 @@ #include #include -#include +#include STM32_HAL_H #include "py/nlr.h" #include "py/runtime.h" diff --git a/stmhal/led.c b/stmhal/led.c index 5c538eee18..11a2ec4317 100644 --- a/stmhal/led.c +++ b/stmhal/led.c @@ -25,7 +25,7 @@ */ #include -#include +#include STM32_HAL_H #include "py/nlr.h" #include "py/runtime.h" diff --git a/stmhal/modpyb.c b/stmhal/modpyb.c index 2c5c19903e..2f2e039964 100644 --- a/stmhal/modpyb.c +++ b/stmhal/modpyb.c @@ -27,7 +27,7 @@ #include #include -#include "stm32f4xx_hal.h" +#include STM32_HAL_H #include "py/mpstate.h" #include "py/nlr.h" diff --git a/stmhal/modstm.c b/stmhal/modstm.c index b795d296b4..cedc894812 100644 --- a/stmhal/modstm.c +++ b/stmhal/modstm.c @@ -27,7 +27,7 @@ #include #include -#include "stm32f4xx_hal.h" +#include STM32_HAL_H #include "py/nlr.h" #include "py/obj.h" diff --git a/stmhal/modutime.c b/stmhal/modutime.c index 75605a37c3..72ed4d2518 100644 --- a/stmhal/modutime.c +++ b/stmhal/modutime.c @@ -26,7 +26,7 @@ #include #include -#include "stm32f4xx_hal.h" +#include STM32_HAL_H #include "py/nlr.h" #include "py/obj.h" diff --git a/stmhal/mpconfigport.h b/stmhal/mpconfigport.h index 67efd091bf..0ed8c21893 100644 --- a/stmhal/mpconfigport.h +++ b/stmhal/mpconfigport.h @@ -200,7 +200,7 @@ void mp_hal_stdout_tx_strn_cooked(const char *str, mp_uint_t len); // value from disable_irq back to enable_irq. If you really need // to know the machine-specific values, see irq.h. -#include +#include STM32_HAL_H static inline void enable_irq(mp_uint_t state) { __set_PRIMASK(state); diff --git a/stmhal/mphal.h b/stmhal/mphal.h index b705facc43..e211cc02f3 100644 --- a/stmhal/mphal.h +++ b/stmhal/mphal.h @@ -1,5 +1,5 @@ // We use the ST Cube HAL library for most hardware peripherals -#include +#include STM32_HAL_H // Basic GPIO functions #define GPIO_read_pin(gpio, pin) (((gpio)->IDR >> (pin)) & 1) diff --git a/stmhal/pendsv.c b/stmhal/pendsv.c index 5f5603f35b..f374e06fdf 100644 --- a/stmhal/pendsv.c +++ b/stmhal/pendsv.c @@ -25,7 +25,7 @@ */ #include -#include +#include STM32_HAL_H #include "py/mpstate.h" #include "py/runtime.h" diff --git a/stmhal/rng.c b/stmhal/rng.c index c2685ce2be..2571bc3a01 100644 --- a/stmhal/rng.c +++ b/stmhal/rng.c @@ -26,7 +26,7 @@ #include -#include "stm32f4xx_hal.h" +#include STM32_HAL_H #include "py/obj.h" #include "rng.h" diff --git a/stmhal/rtc.c b/stmhal/rtc.c index 8b21c6ee50..00821cabb3 100644 --- a/stmhal/rtc.c +++ b/stmhal/rtc.c @@ -26,7 +26,7 @@ #include -#include "stm32f4xx_hal.h" +#include STM32_HAL_H #include "py/runtime.h" #include "rtc.h" diff --git a/stmhal/sdcard.c b/stmhal/sdcard.c index 0eac1615c8..2e98f73c15 100644 --- a/stmhal/sdcard.c +++ b/stmhal/sdcard.c @@ -26,7 +26,7 @@ // TODO make it work with DMA -#include +#include STM32_HAL_H #include "py/nlr.h" #include "py/runtime.h" diff --git a/stmhal/servo.c b/stmhal/servo.c index 4c4f95da4f..7f5a09f777 100644 --- a/stmhal/servo.c +++ b/stmhal/servo.c @@ -26,7 +26,7 @@ #include -#include "stm32f4xx_hal.h" +#include STM32_HAL_H #include "py/nlr.h" #include "py/runtime.h" diff --git a/stmhal/stm32f4xx_it.c b/stmhal/stm32f4xx_it.c index 26c914da62..7be5af30f6 100644 --- a/stmhal/stm32f4xx_it.c +++ b/stmhal/stm32f4xx_it.c @@ -68,7 +68,7 @@ #include #include "stm32f4xx_it.h" -#include "stm32f4xx_hal.h" +#include STM32_HAL_H #include "py/obj.h" #include "pendsv.h" diff --git a/stmhal/storage.c b/stmhal/storage.c index da3541c587..97dfc74b2b 100644 --- a/stmhal/storage.c +++ b/stmhal/storage.c @@ -26,7 +26,7 @@ #include #include -#include +#include STM32_HAL_H #include "py/obj.h" #include "systick.h" diff --git a/stmhal/system_stm32f4xx.c b/stmhal/system_stm32f4xx.c index 207fb528b6..f6dbf70db1 100644 --- a/stmhal/system_stm32f4xx.c +++ b/stmhal/system_stm32f4xx.c @@ -92,7 +92,7 @@ */ #include "mpconfigboard.h" -#include "stm32f4xx_hal.h" +#include STM32_HAL_H void __fatal_error(const char *msg); diff --git a/stmhal/systick.c b/stmhal/systick.c index 027e72a414..aed5b96901 100644 --- a/stmhal/systick.c +++ b/stmhal/systick.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include +#include STM32_HAL_H #include "py/obj.h" #include "irq.h" diff --git a/stmhal/timer.c b/stmhal/timer.c index 002e6b4296..f88229b8ac 100644 --- a/stmhal/timer.c +++ b/stmhal/timer.c @@ -28,7 +28,7 @@ #include #include -#include +#include STM32_HAL_H #include "usbd_cdc_msc_hid.h" #include "usbd_cdc_interface.h" diff --git a/stmhal/usbd_conf.c b/stmhal/usbd_conf.c index c55db33c96..600c17a41d 100644 --- a/stmhal/usbd_conf.c +++ b/stmhal/usbd_conf.c @@ -30,7 +30,7 @@ */ /* Includes ------------------------------------------------------------------*/ -#include "stm32f4xx_hal.h" +#include STM32_HAL_H #include "usbd_core.h" /* Private typedef -----------------------------------------------------------*/ diff --git a/stmhal/usbd_conf.h b/stmhal/usbd_conf.h index fc8015f318..5415eb10b4 100644 --- a/stmhal/usbd_conf.h +++ b/stmhal/usbd_conf.h @@ -34,7 +34,7 @@ #define __USBD_CONF_H /* Includes ------------------------------------------------------------------*/ -#include "stm32f4xx_hal.h" +#include STM32_HAL_H #include #include #include