PlatformIO Community

STM32 for Arduino framework no longer compiles, Serial2, INPUT_ANALOG and PWM build errors

Operating system: LinuxMint 18.3

PlatformIO version ( platformio --version): version 4.0.0a1, using Atom 1.33.1

Problem description
I have some code for Maple Mini (2.0 bootloader) that compiled fine a few weeks ago. After the latest complete update (my libraries, platform, piocore, etc.) nothing compiles that is unique to the Leaflabs/stm32duino core library. Setting something like pinMode(1, PWM); raises an error like “PWM not declared in this range”. serial2 and serial3 also no longer work and generate the error: .pioenvs/maple_mini_b20/src/ main.cpp.o: In function ‘setup’: main.cpp:(.text.setup+0x1c): undefined reference toSerial2’ collect2: error: ld returned 1 exit status *** [.pioenvs/maple_mini_b20/firmware.elf] Error 1`

I wrote a small test to make sure it wasn’t something I was breaking in my own code. The problem still exists in the new project, but it compiles well using ArduinoIDE v.1.8.5

Reproduction steps

  1. Initialize the new Maple Mini b2 project using the arduino framework.
  2. Code with analog input or PWM output and pinMode setting for Serial2 or Serial3
    3、Build
    4, pinMode errors will be shown in the following sample code, comment them out and use just to compile Serial2.begin(9600) will result in a different error.

Contents platformio.ini.

[env:maple_mini_b20]
platform = ststm32
board = maple_mini_b20
framework = arduino

#include <arduino.h>

void setup() {
pinMode(5, INPUT);
pinMode(1, PWM);
pinMode(10, INPUT_ANALOG);
Serial2.begin(9600);

}

void loop() {
}
</arduino.h>

platformio run results.
Processing maple_mini_b20 (platform: sstm32; board: maple_mini_b20; frame: arduino)
Detailed mode can be enabled with the “-v, --verbose” option Configuration: Redirecting... Platform: ST STM32 > Maple Mini Bootloader 2.0 Hardware: STM32F103CBT20KBMHz RAM (120KB Flash) DEBUG: CURRENT(blackmagic) EXTERNAL(blackmagic, jlink, stlink)  Library Dependency Finder → http://bit.ly/configure-pio-ldf LDF MODES: FINDER(chain) COMPATIBILITY(soft) Collected 27 compatible libraries to scan for dependencies… Compile without dependencies .pioenvs/maple_mini_b20/src/main.cpp.o src/main.cpp: in function ‘void setup()’: src/main.cpp:5:14: error: ‘PWM’ is not declared in this scope pinMode(1, PWM); ^~~ src/main.cpp:5:14: Note: Suggested substitution: ‘PWR’ pinMode(1, PWM); ^~~ PWR src/main.cpp:6:15: Error: ‘INPUT_ANALOG’ not declared in this scope pinMode(10.); ^~~ PWR src/main.cpp:6:15: Error: ‘INPUT_ANALOG’ not declared in this scope pinMode(10, INPUT_ANALOG); ^~~~~~~~~~~~ src/main.cpp:6:15: Note: Suggested substitution: ‘INPUT_PULLUP’ pinMode(10, INPUT_ANALOG); ^~~~~~~~~~~~ INPUT_PULLUP *** [. pioenvs/maple_mini_b20/src/main.cpp.o] Error 1`

Want to use the Maple core (https://github.com/rogerclarkmelbourne/Arduino_STM32/) instead of STM32Duino (https://github.com/stm32duino/Arduino_Core_STM32/)? See docs.

Thank you for your reply, I will check this document.