From 658fca260195abbd881094598b12c502ad720cb3 Mon Sep 17 00:00:00 2001 From: pmantoine Date: Mon, 9 Jan 2023 16:24:29 +0800 Subject: [PATCH] Nucleo-F446RE Build target support --- DCCTimerSTM32.cpp | 9 ++++----- platformio.ini | 33 +++++++++++++-------------------- 2 files changed, 17 insertions(+), 25 deletions(-) diff --git a/DCCTimerSTM32.cpp b/DCCTimerSTM32.cpp index b26aa4d..1b96f70 100644 --- a/DCCTimerSTM32.cpp +++ b/DCCTimerSTM32.cpp @@ -30,13 +30,12 @@ #include "DCCTimer.h" -#if defined(ARDUINO_NUCLEO_F411RE) -// STM32F411RE doesn't have Serial1 defined by default +#if defined(ARDUINO_NUCLEO_F411RE) || defined(ARDUINO_NUCLEO_F446RE) +// Nucleo-64 boards don't have Serial1 defined by default HardwareSerial Serial1(PB7, PA15); // Rx=PB7, Tx=PA15 -- CN7 pins 17 and 21 - F411RE // Serial2 is defined to use USART2 by default, but is in fact used as the diag console -// via the debugger on the Nucleo-64 STM32F411RE. It is therefore unavailable -// for other DCC-EX uses like WiFi, DFPlayer, etc. -// Let's define Serial6 as an additional serial port (the only other option for the F411RE) +// via the debugger on the Nucleo-64. It is therefore unavailable for other DCC-EX uses like WiFi, DFPlayer, etc. +// Let's define Serial6 as an additional serial port (the only other option for the Nucleo-64s) HardwareSerial Serial6(PA12, PA11); // Rx=PA12, Tx=PA11 -- CN10 pins 12 and 14 - F411RE #elif defined(ARDUINO_BLAH_F412ZG) || defined(ARDUINO_NUCLEO_F412ZG) || defined(ARDUINO_NUCLEO_F429ZI) || defined(ARDUINO_NUCLEO_F446ZE) // Nucleo-144 boards don't have Serial1 defined by default diff --git a/platformio.ini b/platformio.ini index 5fcda00..46606b1 100644 --- a/platformio.ini +++ b/platformio.ini @@ -24,8 +24,8 @@ default_envs = Teensy3.6 Teensy4.0 Teensy4.1 -src_dir = . -include_dir = . +src_dir = /Users/paul/Projects/CommandStation-EX-devel +include_dir = /Users/paul/Projects/CommandStation-EX-devel [env] build_flags = -Wall -Wextra @@ -50,19 +50,6 @@ monitor_speed = 115200 monitor_echo = yes build_flags = -std=c++17 -; Firebox disabled for now -; [env:samc21-firebox] -; platform = atmelsam -; board = firebox -; framework = arduino -; upload_protocol = atmel-ice -; lib_deps = -; ${env.lib_deps} -; SparkFun External EEPROM Arduino Library -;monitor_speed = 115200 -;monitor_echo = yes -;build_flags = -std=c++17 - [env:mega2560-debug] platform = atmelavr board = megaatmega2560 @@ -109,9 +96,6 @@ lib_deps = SPI monitor_speed = 115200 monitor_echo = yes -; Example, but v12 does generate bigger binaries -; platform_packages = toolchain-atmelavr@symlink:///opt/avr-gcc-12.1.0-x64-linux -; Should make binaries smaller build_flags = -mcall-prologues [env:mega328] @@ -160,7 +144,6 @@ lib_deps = SPI monitor_speed = 115200 monitor_echo = yes -; Should make binaries smaller build_flags = -mcall-prologues [env:nano] @@ -188,6 +171,15 @@ build_flags = -std=c++17 -Os -g2 monitor_speed = 115200 monitor_echo = yes +[env:Nucleo-F446RE] +platform = ststm32 +board = nucleo_f446re +framework = arduino +lib_deps = ${env.lib_deps} +build_flags = -std=c++17 -Os -g2 +monitor_speed = 115200 +monitor_echo = yes + [env:Teensy3.2] platform = teensy board = teensy31 @@ -226,4 +218,5 @@ board = teensy41 framework = arduino build_flags = -std=c++17 -Os -g2 lib_deps = ${env.lib_deps} -lib_ignore = \ No newline at end of file +lib_ignore = +