diff --git a/.travis.sh b/.travis.sh index 7e5d780831..08b4617268 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 41820ad4ef..13b3594093 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 87ea705dfb..d69e2fb0fa 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 a3285cf7ac..ca953f2e06 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 4df18b6768..be0eb1bbf3 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 1794e60e51..8b77093b7a 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 d599c7cae8..4c5226722c 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 f85caaf98c..9910c030eb 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 86d3398d0b..3bb2f709ae 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 6dea0186ae..6f961f3c30 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 7b999ab426..76376fbf14 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 00a0c51ecd..e08051f2f2 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 8ea86a921e..609e3c0f6a 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 6e28e2f83e..b44a99b774 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 18300d5623..b14ce8d369 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 c6044e178d..472eeed821 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 db6621c26f..dd49897c8f 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 451a0b3013..13296d358b 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 4236b955d8..a6c89fc7bc 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 46b601a45f..30da4136da 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 8e59b57105..78d482ee12 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 7bc38e5207..c243d31ac2 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 afae24f68c..9c3bca5851 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 01e776772d..febca5ef7e 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 18174c57d1..dbc2abe6bf 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 84d634edb3..70bad974c5 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 b10df4e672..49d2092d53 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 4dd60507e7..15610d8467 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 e948db3caa..950daac7f2 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 c58cca3385..ee783ec7b0 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 72c24696ac..c866eb757e 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 fbbb4bc62b..b739392868 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 74a1a56c57..a935a585fc 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 83f996357e..c8ac671dcd 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 e383ab2c81..5e65bc9c76 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 b11aff5807..98e9640dad 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 91d426cb30..148d115766 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 27aa963b62..640379150b 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 40605aa614..dccf0eddbf 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 b5da4143d4..ce27e0760b 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"