From 2c5967925f5a09db2522d1611efd225dbd3990dd Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Sat, 6 Mar 2021 01:50:26 -0800 Subject: [PATCH] Pins/tests followup (#21268) Missing commit from #21254 Co-authored-by: Scott Lahteine --- Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h | 4 ++++ Marlin/src/pins/ramps/pins_LONGER3D_LKx_PRO.h | 3 +++ Marlin/src/pins/ramps/pins_RAMPS.h | 3 +++ Marlin/src/pins/ramps/pins_RAMPS_S_12.h | 3 +++ .../scripts/common-dependencies-post.py | 16 ++++++++++++++++ platformio.ini | 7 +------ 6 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 buildroot/share/PlatformIO/scripts/common-dependencies-post.py diff --git a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h index c555ef786..94165d394 100644 --- a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h +++ b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h @@ -27,6 +27,10 @@ #define BOARD_INFO_NAME "BTT SKR V1.4" #endif +#ifndef BOARD_CUSTOM_BUILD_FLAGS + #define BOARD_CUSTOM_BUILD_FLAGS -DLPC_PINCFG_UART3_P4_28 +#endif + // // SD Connection // diff --git a/Marlin/src/pins/ramps/pins_LONGER3D_LKx_PRO.h b/Marlin/src/pins/ramps/pins_LONGER3D_LKx_PRO.h index 2fd599e61..5ff3b366b 100644 --- a/Marlin/src/pins/ramps/pins_LONGER3D_LKx_PRO.h +++ b/Marlin/src/pins/ramps/pins_LONGER3D_LKx_PRO.h @@ -43,6 +43,9 @@ #warning "Serial 3 is originally reserved to Y limit switches. Hardware changes are required to use it." #endif +// Custom flags and defines for the build +//#define BOARD_CUSTOM_BUILD_FLAGS -D__FOO__ + #define BOARD_INFO_NAME "LGT KIT V1.0" // diff --git a/Marlin/src/pins/ramps/pins_RAMPS.h b/Marlin/src/pins/ramps/pins_RAMPS.h index f56a9ec38..805c92d71 100644 --- a/Marlin/src/pins/ramps/pins_RAMPS.h +++ b/Marlin/src/pins/ramps/pins_RAMPS.h @@ -47,6 +47,9 @@ #include "env_validate.h" +// Custom flags and defines for the build +//#define BOARD_CUSTOM_BUILD_FLAGS -D__FOO__ + #ifndef BOARD_INFO_NAME #define BOARD_INFO_NAME "RAMPS 1.4" #endif diff --git a/Marlin/src/pins/ramps/pins_RAMPS_S_12.h b/Marlin/src/pins/ramps/pins_RAMPS_S_12.h index 62b6e3ff9..e1ba91cde 100644 --- a/Marlin/src/pins/ramps/pins_RAMPS_S_12.h +++ b/Marlin/src/pins/ramps/pins_RAMPS_S_12.h @@ -36,6 +36,9 @@ #include "env_validate.h" +// Custom flags and defines for the build +//#define BOARD_CUSTOM_BUILD_FLAGS -D__FOO__ + #ifndef BOARD_INFO_NAME #define BOARD_INFO_NAME "RAMPS S 1.2" #endif diff --git a/buildroot/share/PlatformIO/scripts/common-dependencies-post.py b/buildroot/share/PlatformIO/scripts/common-dependencies-post.py new file mode 100644 index 000000000..2b1b94811 --- /dev/null +++ b/buildroot/share/PlatformIO/scripts/common-dependencies-post.py @@ -0,0 +1,16 @@ +# +# common-dependencies-post.py +# Convenience script to add build flags for Marlin Enabled Features +# + +Import("env") +Import("projenv") + +def apply_board_build_flags(): + if not 'BOARD_CUSTOM_BUILD_FLAGS' in env['MARLIN_FEATURES']: + return + projenv.Append(CCFLAGS=env['MARLIN_FEATURES']['BOARD_CUSTOM_BUILD_FLAGS'].split()) + +# We need to add the board build flags in a post script +# so the platform build script doesn't overwrite the custom CCFLAGS +apply_board_build_flags() diff --git a/platformio.ini b/platformio.ini index 0ed883ba0..aad59362c 100644 --- a/platformio.ini +++ b/platformio.ini @@ -215,6 +215,7 @@ extra_scripts = pre:buildroot/share/PlatformIO/scripts/common-dependencies.py pre:buildroot/share/PlatformIO/scripts/common-cxxflags.py pre:buildroot/share/PlatformIO/scripts/preflight-checks.py + post:buildroot/share/PlatformIO/scripts/common-dependencies-post.py build_flags = -fmax-errors=5 -g3 -D__MARLIN_FIRMWARE__ -fmerge-constants lib_deps = @@ -727,12 +728,6 @@ platform = ${common_LPC.platform} extends = common_LPC board = nxp_lpc1769 -# BTT SKR 1.4 needs a UART3 tweak -[env:LPC1768_btt_skr_v1_4] -platform = ${env:LPC1768.platform} -extends = env:LPC1768 -build_flags = ${env:LPC1768.build_flags} -DLPC_PINCFG_UART3_P4_28 - ################################# # # # STM32 Architecture #