From 1a5663fbf4fc54efd8a9ca9ecad888fbae2cc76f Mon Sep 17 00:00:00 2001 From: Jason Smith Date: Sun, 7 Jun 2020 18:29:10 -0700 Subject: [PATCH] PIO base STM32 environment (#18116) --- platformio.ini | 166 +++++++++++++++++++------------------------------ 1 file changed, 65 insertions(+), 101 deletions(-) diff --git a/platformio.ini b/platformio.ini index eec9710c64..18390e1d21 100644 --- a/platformio.ini +++ b/platformio.ini @@ -21,7 +21,6 @@ boards_dir = buildroot/share/PlatformIO/boards default_envs = mega2560 [common] -arduinoststm32_ver = >=4.10700,<4.10800 default_src_filter = + - - + extra_scripts = pre:buildroot/share/PlatformIO/scripts/common-cxxflags.py build_flags = -fmax-errors=5 -g -D__MARLIN_FIRMWARE__ -fmerge-all-constants @@ -36,8 +35,21 @@ lib_deps = SailfishLCD=https://github.com/mikeshub/SailfishLCD/archive/master.zip SlowSoftI2CMaster=https://github.com/mikeshub/SlowSoftI2CMaster/archive/master.zip -[common_stm32f1] +# Common traits for environments using HAL/STM32 +[common_stm32] platform = ststm32@<6.2.0 +platform_packages = framework-arduinoststm32@>=4.10700,<4.10800 +lib_deps = ${common.lib_deps} +lib_ignore = SoftwareSerial +build_flags = ${common.build_flags} + -IMarlin/src/HAL/STM32 -std=gnu++14 + -DUSBCON -DUSBD_USE_CDC -DUSBD_VID=0x0483 +build_unflags = -std=gnu++11 +src_filter = ${common.default_src_filter} + + +# Common traits for environments using HAL/STM32F1 +[common_stm32f1] +platform = ${common_stm32.platform} build_flags = !python Marlin/src/HAL/STM32F1/build_flags.py ${common.build_flags} -std=gnu++14 -DHAVE_SW_SERIAL build_unflags = -std=gnu++11 @@ -386,7 +398,7 @@ lib_deps = ${common_stm32f1.lib_deps} # STM32F4 with STM32GENERIC # [env:STM32F4] -platform = ststm32@<6.2.0 +platform = ${common_stm32.platform} board = disco_f407vg build_flags = ${common.build_flags} -DUSE_STM32GENERIC -DSTM32GENERIC -DSTM32F4 -DMENU_USB_SERIAL -DMENU_SERIAL=SerialUSB -DHAL_IWDG_MODULE_ENABLED lib_ignore = Adafruit NeoPixel, TMCStepper @@ -396,7 +408,7 @@ src_filter = ${common.default_src_filter} + - - +build_flags = ${common_stm32.build_flags} + '-DUSB_PRODUCT="ARMED_V1"' + -O2 -ffreestanding -fsigned-char -fno-move-loop-invariants -fno-strict-aliasing # # Geeetech GTM32 (STM32F103VET6) @@ -548,14 +557,12 @@ lib_ignore = ${common_stm32f1.lib_ignore} # Malyan M200 v2 (STM32F070RB) # [env:STM32F070RB_malyan] -platform = ststm32@<6.2.0 -platform_packages = framework-arduinoststm32@${common.arduinoststm32_ver} +platform = ${common_stm32.platform} +extends = common_stm32 board = malyanM200v2 -build_flags = -DSTM32F0xx -DUSBCON -DUSBD_VID=0x0483 '-DUSB_MANUFACTURER="Unknown"' '-DUSB_PRODUCT="ARMED_V1"' -DUSBD_USE_CDC -DHAL_PCD_MODULE_ENABLED +build_flags = ${common_stm32.build_flags} -DSTM32F0xx -DUSB_PRODUCT=\"STM32F070RB\" -DHAL_PCD_MODULE_ENABLED -O2 -ffreestanding -fsigned-char -fno-move-loop-invariants -fno-strict-aliasing -std=gnu11 -std=gnu++11 -DCUSTOM_STARTUP_FILE - -IMarlin/src/HAL/STM32 -src_filter = ${common.default_src_filter} + lib_ignore = LiquidCrystal, LiquidTWI2, Adafruit NeoPixel, TMCStepper, U8glib-HAL, SoftwareSerial # @@ -588,56 +595,42 @@ build_unflags = ${common_stm32f1.build_unflags} # 'STEVAL-3DP001V1' STM32F401VE board - https://www.st.com/en/evaluation-tools/steval-3dp001v1.html # [env:STM32F401VE_STEVAL] -platform = ststm32@<6.2.0 -platform_packages = framework-arduinoststm32@${common.arduinoststm32_ver} +platform = ${common_stm32.platform} +extends = common_stm32 board = STEVAL_STM32F401VE -build_flags = ${common.build_flags} - -DTARGET_STM32F4 -DSTM32F401xE -DUSBCON - -DUSBD_USE_CDC -DUSBD_VID=0x0483 -DUSB_PRODUCT=\"STEVAL_F401VE\" - -DARDUINO_STEVAL -DDISABLE_GENERIC_SERIALUSB - -DUSBD_USE_CDC_COMPOSITE -DUSE_USB_FS - -IMarlin/src/HAL/STM32 -build_unflags = -std=gnu++11 +build_flags = ${common_stm32.build_flags} + -DTARGET_STM32F4 -DARDUINO_STEVAL -DSTM32F401xE + -DUSB_PRODUCT=\"STEVAL_F401VE\" + -DDISABLE_GENERIC_SERIALUSB -DUSBD_USE_CDC_COMPOSITE -DUSE_USB_FS extra_scripts = pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py buildroot/share/PlatformIO/scripts/STEVAL__F401XX.py lib_ignore = Adafruit NeoPixel, TMCStepper, SailfishLCD, SlowSoftI2CMaster, SoftwareSerial -src_filter = ${common.default_src_filter} + # # FLYF407ZG # [env:FLYF407ZG] -platform = ststm32@<6.2.0 -platform_packages = framework-arduinoststm32@${common.arduinoststm32_ver} +platform = ${common_stm32.platform} +extends = common_stm32 board = FLYF407ZG -build_flags = ${common.build_flags} - -DTARGET_STM32F4 -DSTM32F4 -DUSBCON - -DUSBD_USE_CDC -DUSBD_VID=0x0483 -DUSB_PRODUCT=\"STM32F407ZG\" - -DVECT_TAB_OFFSET=0x8000 -IMarlin/src/HAL/STM32 -build_unflags = -std=gnu++11 +build_flags = ${common_stm32.build_flags} + -DSTM32F4 -DUSB_PRODUCT=\"STM32F407ZG\" + -DTARGET_STM32F4 -DVECT_TAB_OFFSET=0x8000 extra_scripts = pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py -lib_ignore = Adafruit NeoPixel, SailfishLCD, SlowSoftI2CMaster, SoftwareSerial -src_filter = ${common.default_src_filter} + - # # FYSETC S6 (STM32F446VET6 ARM Cortex-M4) # [env:FYSETC_S6] -platform = ststm32@<6.2.0 -platform_packages = +platform = ${common_stm32.platform} +extends = common_stm32 +platform_packages = ${common_stm32.platform_packages} tool-stm32duino - framework-arduinoststm32@${common.arduinoststm32_ver} board = fysetc_s6 -build_flags = ${common.build_flags} - -DTARGET_STM32F4 -std=gnu++14 - -DVECT_TAB_OFFSET=0x10000 - -DUSBCON -DUSBD_USE_CDC -DHAL_PCD_MODULE_ENABLED -DUSBD_VID=0x0483 '-DUSB_PRODUCT="FYSETC_S6"' - -IMarlin/src/HAL/STM32 -build_unflags = -std=gnu++11 +build_flags = ${common_stm32.build_flags} + -DTARGET_STM32F4 -DVECT_TAB_OFFSET=0x10000 + -DHAL_PCD_MODULE_ENABLED '-DUSB_PRODUCT="FYSETC_S6"' extra_scripts = pre:buildroot/share/PlatformIO/scripts/fysetc_STM32S6.py -src_filter = ${common.default_src_filter} + -lib_ignore = Arduino-L6470, SoftwareSerial debug_tool = stlink upload_protocol = dfu upload_command = dfu-util -a 0 -s 0x08010000:leave -D "$SOURCE" @@ -648,34 +641,27 @@ upload_command = dfu-util -a 0 -s 0x08010000:leave -D "$SOURCE" # Shield - https://github.com/jmz52/Hardware # [env:STM32F407VE_black] -platform = ststm32@<6.2.0 -platform_packages = framework-arduinoststm32@${common.arduinoststm32_ver} +platform = ${common_stm32.platform} +extends = common_stm32 board = blackSTM32F407VET6 -build_flags = ${common.build_flags} +build_flags = ${common_stm32.build_flags} -DTARGET_STM32F4 -DARDUINO_BLACK_F407VE - -DUSBCON -DUSBD_USE_CDC -DUSBD_VID=0x0483 -DUSB_PRODUCT=\"BLACK_F407VE\" + -DUSB_PRODUCT=\"BLACK_F407VE\" -DUSBD_USE_CDC_COMPOSITE -DUSE_USB_FS - -IMarlin/src/HAL/STM32 -build_unflags = -std=gnu++11 extra_scripts = pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py lib_ignore = Adafruit NeoPixel, TMCStepper, SailfishLCD, SlowSoftI2CMaster, SoftwareSerial -src_filter = ${common.default_src_filter} + # # BigTreeTech SKR Pro (STM32F407ZGT6 ARM Cortex-M4) # [env:BIGTREE_SKR_PRO] -platform = ststm32@<6.2.0 -platform_packages = framework-arduinoststm32@${common.arduinoststm32_ver} +platform = ${common_stm32.platform} +extends = common_stm32 board = BigTree_SKR_Pro -build_flags = ${common.build_flags} - -DUSBCON -DUSBD_USE_CDC -DUSBD_VID=0x0483 -DUSB_PRODUCT=\"STM32F407ZG\" +build_flags = ${common_stm32.build_flags} + -DUSB_PRODUCT=\"STM32F407ZG\" -DTARGET_STM32F4 -DSTM32F407_5ZX -DVECT_TAB_OFFSET=0x8000 - -IMarlin/src/HAL/STM32 -build_unflags = -std=gnu++11 extra_scripts = pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py -lib_ignore = SoftwareSerial, SoftwareSerialM -src_filter = ${common.default_src_filter} + #upload_protocol = stlink #upload_command = "$PROJECT_PACKAGES_DIR/tool-stm32duino/stlink/ST-LINK_CLI.exe" -c SWD -P "$BUILD_DIR/firmware.bin" 0x8008000 -Rst -Run debug_tool = stlink @@ -686,42 +672,29 @@ debug_init_break = # [env:BIGTREE_GTR_V1_0] platform = ststm32@>=5.7.0,<6.2.0 -platform_packages = framework-arduinoststm32@${common.arduinoststm32_ver} +extends = common_stm32 board = BigTree_GTR_v1 extra_scripts = pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py -build_flags = ${common.build_flags} - -DUSBCON -DUSBD_USE_CDC -DUSBD_VID=0x0483 -DUSB_PRODUCT=\"STM32F407IG\" +build_flags = ${common_stm32.build_flags} + -DUSB_PRODUCT=\"STM32F407IG\" -DTARGET_STM32F4 -DSTM32F407IX -DVECT_TAB_OFFSET=0x8000 - -IMarlin/src/HAL/STM32 -lib_deps = - U8glib-HAL=https://github.com/MarlinFirmware/U8glib-HAL/archive/bugfix.zip - LiquidCrystal - TMCStepper@>=0.5.2,<1.0.0 - Adafruit NeoPixel - LiquidTWI2=https://github.com/lincomatic/LiquidTWI2/archive/master.zip - Arduino-L6470=https://github.com/ameyer/Arduino-L6470/archive/dev.zip -lib_ignore = SoftwareSerial, SoftwareSerialM -src_filter = ${common.default_src_filter} + # # BigTreeTech BTT002 V1.0 (STM32F407VGT6 ARM Cortex-M4) # [env:BIGTREE_BTT002] -platform = ststm32@5.6.0 -platform_packages = framework-arduinoststm32@${common.arduinoststm32_ver} +platform = ${common_stm32.platform} +extends = common_stm32 board = BigTree_Btt002 -build_flags = ${common.build_flags} - -DUSBCON -DUSBD_USE_CDC -DUSBD_VID=0x0483 -DUSB_PRODUCT=\"STM32F407VG\" +build_flags = ${common_stm32.build_flags} + -DUSB_PRODUCT=\"STM32F407VG\" -DTARGET_STM32F4 -DSTM32F407_5VX -DVECT_TAB_OFFSET=0x8000 -DHAVE_HWSERIAL2 -DHAVE_HWSERIAL3 -DPIN_SERIAL2_RX=PD_6 -DPIN_SERIAL2_TX=PD_5 - -IMarlin/src/HAL/STM32 -build_unflags = -std=gnu++11 extra_scripts = pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py lib_ignore = Adafruit NeoPixel, SailfishLCD, SlowSoftI2CMaster, SoftwareSerial -src_filter = ${common.default_src_filter} + # # Teensy 3.1 / 3.2 (ARM Cortex-M4) @@ -795,35 +768,26 @@ debug_tool = jlink # # RUMBA32 # - -[common_rumba32] -platform = ststm32@<6.2.0 -platform_packages = framework-arduinoststm32@${common.arduinoststm32_ver} +[env:rumba32_f446ve] +platform = ${common_stm32.platform} +extends = common_stm32 board = rumba32_f446ve -build_flags = ${common.build_flags} -Os -IMarlin/src/HAL/STM32 +build_flags = ${common_stm32.build_flags} -Os -DSTM32F4xx -DARDUINO_RUMBA32_F446VE -DARDUINO_ARCH_STM32 "-DBOARD_NAME=\"RUMBA32_F446VE\"" - -DSTM32F446xx -DUSBCON "-DUSB_MANUFACTURER=\"Unknown\"" "-DUSB_PRODUCT=\"RUMBA32_F446VE\"" + -DSTM32F446xx "-DUSB_PRODUCT=\"RUMBA32_F446VE\"" -DHAL_PCD_MODULE_ENABLED - -DUSBD_USE_CDC -DDISABLE_GENERIC_SERIALUSB -DHAL_UART_MODULE_ENABLED -lib_ignore = Adafruit NeoPixel, SoftwareSerial -src_filter = ${common.default_src_filter} + -upload_protocol = dfu - -[env:rumba32_f446ve] -platform = ${common_rumba32.platform} -extends = common_rumba32 -build_flags = ${common_rumba32.build_flags} -DUSBD_VID=0x0483 monitor_speed = 500000 +upload_protocol = dfu # # MKS RUMBA32 (adds TMC2208/2209 UART interface and AUX-1) # [env:rumba32_mks] -platform = ${common_rumba32.platform} -extends = common_rumba32 -build_flags = ${common_rumba32.build_flags} -DUSBD_VID=0x8000 +platform = ${common_stm32.platform} +extends = env:rumba32_f446ve +build_flags = ${rumba32_f446ve.build_flags} -UUSBD_VID -DUSBD_VID=0x8000 # # Just print the dependency tree