diff --git a/.travis.sh b/.travis.sh index 7e5d78083..08b461726 100755 --- a/.travis.sh +++ b/.travis.sh @@ -69,6 +69,7 @@ elif [ $GOAL ] ; then if [ "test" == "$GOAL" ] ; then $MAKE check-target-independence || exit $? $MAKE check-fastram-usage-correctness || exit $? + $MAKE check-platform-included || exit $? fi $MAKE $GOAL || exit $? diff --git a/Makefile b/Makefile index 41820ad4e..13b359409 100644 --- a/Makefile +++ b/Makefile @@ -572,7 +572,15 @@ check-fastram-usage-correctness: echo "Trivially initialized FAST_RAM variables found, use FAST_RAM_ZERO_INIT instead to save FLASH:"; \ echo "$${TRIVIALLY_INITIALIZED}\n$${EXPLICITLY_TRIVIALLY_INITIALIZED}"; \ exit 1; \ - fi; + fi + +check-platform-included: + $(V1) PLATFORM_NOT_INCLUDED=$$(find src/main -type d -name target -prune -o -type f -name \*.c -exec grep -L "^#include \"platform.h\"" {} \;); \ + if [ "$$(echo $${PLATFORM_NOT_INCLUDED} | grep -v -e '^$$' | wc -l)" -ne 0 ]; then \ + echo "The following compilation units do not include the required target specific configuration provided by 'platform.h':"; \ + echo "$${PLATFORM_NOT_INCLUDED}"; \ + exit 1; \ + fi # rebuild everything when makefile changes $(TARGET_OBJS): Makefile $(TARGET_DIR)/target.mk $(wildcard make/*) diff --git a/src/main/build/atomic.c b/src/main/build/atomic.c index 87ea705df..d69e2fb0f 100644 --- a/src/main/build/atomic.c +++ b/src/main/build/atomic.c @@ -20,6 +20,8 @@ #include +#include "platform.h" + #include "atomic.h" #if defined(UNIT_TEST) diff --git a/src/main/build/debug.c b/src/main/build/debug.c index a3285cf7a..ca953f2e0 100644 --- a/src/main/build/debug.c +++ b/src/main/build/debug.c @@ -18,8 +18,9 @@ * If not, see . */ -#include "stdint.h" +#include +#include "platform.h" #include "debug.h" diff --git a/src/main/build/version.c b/src/main/build/version.c index 4df18b676..be0eb1bbf 100644 --- a/src/main/build/version.c +++ b/src/main/build/version.c @@ -18,6 +18,8 @@ * If not, see . */ +#include "platform.h" + #include "version.h" const char * const targetName = __TARGET__; diff --git a/src/main/common/bitarray.c b/src/main/common/bitarray.c index 1794e60e5..8b77093b7 100644 --- a/src/main/common/bitarray.c +++ b/src/main/common/bitarray.c @@ -22,6 +22,8 @@ #include #include +#include "platform.h" + #include "bitarray.h" #define BITARRAY_BIT_OP(array, bit, op) ((array)[(bit) / (sizeof((array)[0]) * 8)] op (1 << ((bit) % (sizeof((array)[0]) * 8)))) diff --git a/src/main/common/colorconversion.c b/src/main/common/colorconversion.c index d599c7cae..4c5226722 100644 --- a/src/main/common/colorconversion.c +++ b/src/main/common/colorconversion.c @@ -18,7 +18,9 @@ * If not, see . */ -#include "stdint.h" +#include + +#include "platform.h" #include "color.h" #include "colorconversion.h" diff --git a/src/main/common/crc.c b/src/main/common/crc.c index f85caaf98..9910c030e 100644 --- a/src/main/common/crc.c +++ b/src/main/common/crc.c @@ -20,6 +20,8 @@ #include +#include "platform.h" + #include "streambuf.h" diff --git a/src/main/common/encoding.c b/src/main/common/encoding.c index 86d3398d0..3bb2f709a 100644 --- a/src/main/common/encoding.c +++ b/src/main/common/encoding.c @@ -18,6 +18,8 @@ * If not, see . */ +#include "platform.h" + #include "encoding.h" /** diff --git a/src/main/common/explog_approx.c b/src/main/common/explog_approx.c index 6dea0186a..6f961f3c3 100644 --- a/src/main/common/explog_approx.c +++ b/src/main/common/explog_approx.c @@ -30,6 +30,8 @@ Stripped down for BF use #include #include +#include "platform.h" + /* Workaround a lack of optimization in gcc */ float exp_cst1 = 2139095040.f; float exp_cst2 = 0.f; diff --git a/src/main/common/huffman_table.c b/src/main/common/huffman_table.c index 7b999ab42..76376fbf1 100644 --- a/src/main/common/huffman_table.c +++ b/src/main/common/huffman_table.c @@ -20,6 +20,8 @@ #include +#include "platform.h" + #include "huffman.h" /* diff --git a/src/main/common/maths.c b/src/main/common/maths.c index 00a0c51ec..e08051f2f 100644 --- a/src/main/common/maths.c +++ b/src/main/common/maths.c @@ -21,6 +21,8 @@ #include #include +#include "platform.h" + #include "axis.h" #include "maths.h" diff --git a/src/main/common/streambuf.c b/src/main/common/streambuf.c index 8ea86a921..609e3c0f6 100644 --- a/src/main/common/streambuf.c +++ b/src/main/common/streambuf.c @@ -21,6 +21,8 @@ #include #include +#include "platform.h" + #include "streambuf.h" sbuf_t *sbufInit(sbuf_t *sbuf, uint8_t *ptr, uint8_t *end) diff --git a/src/main/common/string_light.c b/src/main/common/string_light.c index 6e28e2f83..b44a99b77 100644 --- a/src/main/common/string_light.c +++ b/src/main/common/string_light.c @@ -22,6 +22,8 @@ #include #include +#include "platform.h" + #include "typeconversion.h" int isalnum(int c) diff --git a/src/main/common/strtol.c b/src/main/common/strtol.c index 18300d562..b14ce8d36 100644 --- a/src/main/common/strtol.c +++ b/src/main/common/strtol.c @@ -23,6 +23,8 @@ #include #include +#include "platform.h" + #include "common/utils.h" #define _STRTO_ENDPTR 1 diff --git a/src/main/common/time.c b/src/main/common/time.c index c6044e178..472eeed82 100644 --- a/src/main/common/time.c +++ b/src/main/common/time.c @@ -26,6 +26,8 @@ #include +#include "platform.h" + #include "common/maths.h" #include "common/printf.h" #include "common/time.h" diff --git a/src/main/common/typeconversion.c b/src/main/common/typeconversion.c index db6621c26..dd49897c8 100644 --- a/src/main/common/typeconversion.c +++ b/src/main/common/typeconversion.c @@ -21,6 +21,9 @@ #include #include #include + +#include "platform.h" + #include "build/build_config.h" #include "maths.h" diff --git a/src/main/drivers/barometer/barometer_qmp6988.c b/src/main/drivers/barometer/barometer_qmp6988.c index 451a0b301..13296d358 100755 --- a/src/main/drivers/barometer/barometer_qmp6988.c +++ b/src/main/drivers/barometer/barometer_qmp6988.c @@ -17,7 +17,9 @@ #include #include -#include + +#include "platform.h" + #include "build/build_config.h" #include "build/debug.h" #include "barometer.h" diff --git a/src/main/drivers/buf_writer.c b/src/main/drivers/buf_writer.c index 4236b955d..a6c89fc7b 100644 --- a/src/main/drivers/buf_writer.c +++ b/src/main/drivers/buf_writer.c @@ -20,6 +20,8 @@ #include +#include "platform.h" + #include "buf_writer.h" bufWriter_t *bufWriterInit(uint8_t *b, int total_size, bufWrite_t writer, void *arg) diff --git a/src/main/drivers/resource.c b/src/main/drivers/resource.c index 46b601a45..30da4136d 100644 --- a/src/main/drivers/resource.c +++ b/src/main/drivers/resource.c @@ -18,6 +18,8 @@ * If not, see . */ +#include "platform.h" + #include "resource.h" const char * const ownerNames[OWNER_TOTAL_COUNT] = { diff --git a/src/main/drivers/sdcard_standard.c b/src/main/drivers/sdcard_standard.c index 8e59b5710..78d482ee1 100644 --- a/src/main/drivers/sdcard_standard.c +++ b/src/main/drivers/sdcard_standard.c @@ -20,6 +20,8 @@ #include +#include "platform.h" + #include "sdcard_standard.h" #include "common/maths.h" diff --git a/src/main/drivers/timer_common.c b/src/main/drivers/timer_common.c index 7bc38e520..c243d31ac 100644 --- a/src/main/drivers/timer_common.c +++ b/src/main/drivers/timer_common.c @@ -18,8 +18,11 @@ * If not, see . */ +#include "platform.h" + #include "drivers/io.h" #include "timer.h" + #ifdef USE_TIMER_MGMT #include "pg/timerio.h" #endif diff --git a/src/main/flight/position.c b/src/main/flight/position.c index afae24f68..9c3bca585 100644 --- a/src/main/flight/position.c +++ b/src/main/flight/position.c @@ -24,6 +24,8 @@ #include #include +#include "platform.h" + #include "build/debug.h" #include "common/maths.h" diff --git a/src/main/io/asyncfatfs/fat_standard.c b/src/main/io/asyncfatfs/fat_standard.c index 01e776772..febca5ef7 100644 --- a/src/main/io/asyncfatfs/fat_standard.c +++ b/src/main/io/asyncfatfs/fat_standard.c @@ -20,6 +20,8 @@ #include +#include "platform.h" + #include "fat_standard.h" bool fat16_isEndOfChainMarker(uint16_t clusterNumber) diff --git a/src/main/io/flashfs.c b/src/main/io/flashfs.c index 18174c57d..dbc2abe6b 100644 --- a/src/main/io/flashfs.c +++ b/src/main/io/flashfs.c @@ -36,6 +36,8 @@ #include #include +#include "platform.h" + #include "drivers/flash.h" #include "io/flashfs.h" diff --git a/src/main/io/rcdevice.c b/src/main/io/rcdevice.c index 84d634edb..70bad974c 100644 --- a/src/main/io/rcdevice.c +++ b/src/main/io/rcdevice.c @@ -22,6 +22,8 @@ #include #include +#include "platform.h" + #include "common/crc.h" #include "common/maths.h" #include "common/streambuf.h" diff --git a/src/main/msc/emfat.c b/src/main/msc/emfat.c index b10df4e67..49d2092d5 100644 --- a/src/main/msc/emfat.c +++ b/src/main/msc/emfat.c @@ -28,6 +28,8 @@ * SOFTWARE. */ +#include "platform.h" + #include "common/utils.h" #include "emfat.h" diff --git a/src/main/pg/rcdevice.c b/src/main/pg/rcdevice.c index 4dd60507e..15610d846 100644 --- a/src/main/pg/rcdevice.c +++ b/src/main/pg/rcdevice.c @@ -18,6 +18,8 @@ * If not, see . */ +#include "platform.h" + #include "pg/pg_ids.h" #include "pg/rcdevice.h" @@ -27,4 +29,4 @@ void pgResetFn_rcdeviceConfig(rcdeviceConfig_t *rcdeviceConfig) { rcdeviceConfig->initDeviceAttempts = 6; rcdeviceConfig->initDeviceAttemptInterval = 1000; -} \ No newline at end of file +} diff --git a/src/main/startup/system_stm32f30x.c b/src/main/startup/system_stm32f30x.c index e948db3ca..950daac7f 100644 --- a/src/main/startup/system_stm32f30x.c +++ b/src/main/startup/system_stm32f30x.c @@ -99,6 +99,8 @@ * @{ */ +#include "platform.h" + #include "stm32f30x.h" uint32_t hse_value = HSE_VALUE; diff --git a/src/main/vcp/stm32_it.c b/src/main/vcp/stm32_it.c index c58cca338..ee783ec7b 100644 --- a/src/main/vcp/stm32_it.c +++ b/src/main/vcp/stm32_it.c @@ -28,6 +28,9 @@ */ /* Includes ------------------------------------------------------------------*/ + +#include "platform.h" + #include "hw_config.h" #include "stm32_it.h" #include "usb_lib.h" diff --git a/src/main/vcp/usb_desc.c b/src/main/vcp/usb_desc.c index 72c24696a..c866eb757 100644 --- a/src/main/vcp/usb_desc.c +++ b/src/main/vcp/usb_desc.c @@ -26,6 +26,9 @@ */ /* Includes ------------------------------------------------------------------*/ + +#include "platform.h" + #include "usb_lib.h" #include "usb_desc.h" diff --git a/src/main/vcp/usb_endp.c b/src/main/vcp/usb_endp.c index fbbb4bc62..b73939286 100644 --- a/src/main/vcp/usb_endp.c +++ b/src/main/vcp/usb_endp.c @@ -26,6 +26,9 @@ */ /* Includes ------------------------------------------------------------------*/ + +#include "platform.h" + #include "usb_lib.h" #include "usb_desc.h" #include "usb_mem.h" diff --git a/src/main/vcp/usb_istr.c b/src/main/vcp/usb_istr.c index 74a1a56c5..a935a585f 100644 --- a/src/main/vcp/usb_istr.c +++ b/src/main/vcp/usb_istr.c @@ -26,6 +26,9 @@ */ /* Includes ------------------------------------------------------------------*/ + +#include "platform.h" + #include "usb_lib.h" #include "usb_prop.h" #include "usb_pwr.h" diff --git a/src/main/vcp/usb_prop.c b/src/main/vcp/usb_prop.c index 83f996357..c8ac671dc 100644 --- a/src/main/vcp/usb_prop.c +++ b/src/main/vcp/usb_prop.c @@ -26,6 +26,9 @@ */ /* Includes ------------------------------------------------------------------*/ + +#include "platform.h" + #include "usb_lib.h" #include "usb_conf.h" #include "usb_prop.h" diff --git a/src/main/vcp/usb_pwr.c b/src/main/vcp/usb_pwr.c index e383ab2c8..5e65bc9c7 100644 --- a/src/main/vcp/usb_pwr.c +++ b/src/main/vcp/usb_pwr.c @@ -26,6 +26,9 @@ */ /* Includes ------------------------------------------------------------------*/ + +#include "platform.h" + #include "usb_lib.h" #include "usb_conf.h" #include "usb_pwr.h" diff --git a/src/main/vcp_hal/usbd_cdc_interface.c b/src/main/vcp_hal/usbd_cdc_interface.c index b11aff580..98e9640da 100644 --- a/src/main/vcp_hal/usbd_cdc_interface.c +++ b/src/main/vcp_hal/usbd_cdc_interface.c @@ -46,6 +46,9 @@ */ /* Includes ------------------------------------------------------------------*/ + +#include "platform.h" + #include "drivers/serial_usb_vcp.h" #include "drivers/time.h" diff --git a/src/main/vcpf4/stm32f4xx_it.c b/src/main/vcpf4/stm32f4xx_it.c index 91d426cb3..148d11576 100644 --- a/src/main/vcpf4/stm32f4xx_it.c +++ b/src/main/vcpf4/stm32f4xx_it.c @@ -18,6 +18,8 @@ * If not, see . */ +#include "platform.h" + #include "stm32f4xx_it.h" #include "stm32f4xx_conf.h" diff --git a/src/main/vcpf4/usb_bsp.c b/src/main/vcpf4/usb_bsp.c index 27aa963b6..640379150 100644 --- a/src/main/vcpf4/usb_bsp.c +++ b/src/main/vcpf4/usb_bsp.c @@ -21,6 +21,9 @@ */ /* Includes ------------------------------------------------------------------*/ + +#include "platform.h" + #include "usb_bsp.h" #include "usbd_conf.h" #include "stm32f4xx_conf.h" diff --git a/src/main/vcpf4/usbd_cdc_vcp.c b/src/main/vcpf4/usbd_cdc_vcp.c index 40605aa61..dccf0eddb 100644 --- a/src/main/vcpf4/usbd_cdc_vcp.c +++ b/src/main/vcpf4/usbd_cdc_vcp.c @@ -19,16 +19,19 @@ ****************************************************************************** */ -#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED -#pragma data_alignment = 4 -#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */ - /* Includes ------------------------------------------------------------------*/ + +#include "platform.h" + #include "usbd_cdc_vcp.h" #include "stm32f4xx_conf.h" #include "stdbool.h" #include "drivers/time.h" +#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED +#pragma data_alignment = 4 +#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */ + __ALIGN_BEGIN USB_OTG_CORE_HANDLE USB_OTG_dev __ALIGN_END; LINE_CODING g_lc; diff --git a/src/main/vcpf4/usbd_usr.c b/src/main/vcpf4/usbd_usr.c index b5da4143d..ce27e0760 100644 --- a/src/main/vcpf4/usbd_usr.c +++ b/src/main/vcpf4/usbd_usr.c @@ -19,6 +19,8 @@ ****************************************************************************** */ +#include "platform.h" + #include "usbd_usr.h" #include "usbd_ioreq.h"