How to compile MySensors on Platformio for Blue Pill



  • Hello.
    I am trying to change to PlatformIO, which has many advantages over Arduino IDE. I want to compile for the STM32 Blue Pill module but have not been able to get the right configuration. I have found many suggestions but have not gotten any to work. At one point I got a compile, but it ignored the MySensors code.

    Can some one please post their working platformio.ini, and are there any detailed instructions anywhere for the exact configuration such as which STM32 library to use?

    I have spent days researching and tried things like;
    board_build.core = maple
    Using a Python script to get rid of multiple main/premain error
    Other Platform & Board options. (such as genericSTM, etc)
    But cant seem to get the right mix.

    Thank you for anyone who can help.

    Also, I have been using MySensors for over 5 years: this is a great system, a great website, has great admin, and a fantastic group of contributors. Thank you all very much for MySensors!

    ++++++++++++++++++++++++++++++++
    [ Below is a sample of the various options I have tried in an experimental platformio.ini. None worked.]

    ;[env:bluepill_f103c8]
    ;platform = ststm32
    ;board = bluepill_f103c8
    ;framework = arduino
    ;upload_protocol = stlink

    ; NOTE - Above lines are not acceptable to MySensors on Blue Pill. Must use maple as shown below.

    ; NOTE - In Platfromio docs, Maple is a different processor
    ;[env:maple]
    ;platform = ststm32
    ;board = maple
    ;framework = arduino
    ;upload_protocol = stlink

    ; NOTE - The below was found when searching the net. It appears an alternative set of ENV entries.
    [env:genericSTM32F103C8]
    platform = ststm32
    board = genericSTM32F103C8
    framework = arduino
    board_build.core = maple
    ;lib_extra_dirs = D:\Dropbox\Elektronik\platformio\libraries
    ;lib_deps = https://github.com/mysensors/MySensors.git#development
    upload_protocol = stlink

    ; Serial Monitor options
    monitor_speed = 115200



  • Hi @novicit ,
    I was just trying to test a BluePill adding a LoRa chip (SX1276) as a new type of MySensors node but got blocked in the first step (no compiling when I include MySensors library).
    In PlatoformIO I installed the default platform (STSTM32). Sorry I cannot give you a solution,...
    Did you get MySensors to compile in the Arduino environment with STM32? (planning to give it a try if it works). Which boards definition?.
    If you are interested I could post the compiler output, but I believe is of no use to you since I have not digged much into the issue. I have used ESP32 and ATmega328 variants in the past with MySensors but wanted to give a try to STM32 architecture as it seems quite promissing when dealing with Analog signals (ADC specs), so I am still at the begginin of the journey...



  • @CarloMagno If you are successful to implement MySensors on the Blue Pill, please post your method. Thank you!

    I have spent 2 weeks on this and remain unable to compile MySensors for the Blue Pill. I can compile and download programs to the BP on both PlatformIO and Arduino IDE, but as soon as I put #include <mysensors.h> in the code, errors appear. I have found these errors on some forum entries, but a clear step-by-step solution method which works has not yet been posted (that I have found).

    I am no expert on coding, so I assume I am missing something.



  • Well, I have tried the Arduino IDE both with the current stable version of MySensors and with the Development version. In both cases i get a HAL error:

    In file included from C:\Users\xxxxx\Documents\Arduino\STM32_MySensors_Test1_v0\STM32_MySensors_Test1_v0.ino:56:
    C:\Users\xxxxx\Documents\Arduino\libraries\MySensors-development/MySensors.h:83:2: error: #error Hardware abstraction not defined (unsupported platform)
       83 | #error Hardware abstraction not defined (unsupported platform)
          |  ^~~~~
    exit status 1
    Error compiling for board Generic STM32F1 series.
    

    Line 56 of the sketch is

    #include <MySensors.h>
    

    So it seems it is related to the compatibility of the official STM32 core provided by ST and the MySensors library. I believe I have read somewhere that the successful implementation of MySensors and STM32 was using another core... I have to dig a little bit more about it. Nevertheless. I'd rather use the ST "official" core as it seems it supports a great number of board and is in continuous development, so new boards that appear could be ready to use... (Cube Cell looks really nice but integrates another type of LoRa radio that I believe will require quite more work from MySensors to get it supported).



  • I will answer to myself... forcing the architecture in the sketch including this line before MySensors (it should be picked automatically but it seems it's not):

    #define ARDUINO_ARCH_STM32F1
    #include <MySensors.h>
    

    The error now goes to the hardware definition where indeed it seems it expects to have the maple core:

    In file included from C:\Users\xxxxx\Documents\Arduino\libraries\MySensors-development/hal/architecture/STM32F1/MyHwSTM32F1.cpp:20,
                     from C:\Users\xxxxx\Documents\Arduino\libraries\MySensors-development/MySensors.h:71,
                     from C:\Users\xxxxx\Documents\Arduino\STM32_MySensors_Test1_v0\STM32_MySensors_Test1_v0.ino:56:
    C:\Users\xxxxx\Documents\Arduino\libraries\MySensors-development/hal/architecture/STM32F1/MyHwSTM32F1.h:23:10: fatal error: libmaple/iwdg.h: No such file or directory
       23 | #include <libmaple/iwdg.h>
          |          ^~~~~~~~~~~~~~~~~
    compilation terminated.
    
    exit status 1
    Error compiling for board Generic STM32F1 series.
    

    I quick search pointed to the Roger Clark github repository (it seems it is the origin of STM32 support in Arduino IDE) https://github.com/rogerclarkmelbourne/Arduino_STM32
    I downloaded the zip file with the repository, created a hardware folder in MyDocuments/arduino folder (it did't exist), and decompressed the zip there. The folder structure is as follows:
    C:\Users\xxxxx\Documents\Arduino\hardware\Arduino_STM32-master

    I closed the Arduino IDE and opened it again so the new boards definition would be available, and in the type of board, under the new group "STM32F1 Boards (STM32duino.com)" I selected the board type "Generic STM32F103C series" and everything compiles OK, (with or without the line #define ARDUINO_ARCH_STM32F1

    Now I have to check if following the indication in https://docs.platformio.org/en/latest/platforms/ststm32.html, including the option "board_build.core = maple" in platformio.ini the compilation will force to use the maple core that seems the one working with MySensors.



  • .. still no luck in Platformio.
    platformio.ini:

    [env:genericSTM32F103CB]
    platform = ststm32
    board = genericSTM32F103CB
    framework = arduino
    board_build.core = maple
    monitor_speed = 115200
    monitor_filters = time, default
    
    [env:Sensor-Serial-Windows]
    upload_port = COM7
    monitor_port = COM7
    
    [env:Sensor-Serial-Linux]
    ; any port that starts with /dev/ttyUSB
    upload_port = /dev/ttyUSB*
    monitor_port = /dev/ttyUSB*
    

    After some warnings regarding definition of SPI2 and not been used, we get to the error when MySensors is included:

    Compiling .pio\build\genericSTM32F103CB\lib5ec\MySensors_ID548\MyASM.S.o
    Archiving .pio\build\genericSTM32F103CB\lib473\libEEPROM.a
    Archiving .pio\build\genericSTM32F103CB\libd15\libSPI.a
    Archiving .pio\build\genericSTM32F103CB\lib5ec\libMySensors_ID548.a
    Linking .pio\build\genericSTM32F103CB\firmware.elf
    .pio\build\genericSTM32F103CB\src\main.cpp.o: In function `premain()':
    main.cpp:(.text.startup._Z7premainv+0x0): multiple definition of `premain()'
    .pio\build\genericSTM32F103CB\FrameworkArduino\main.cpp.o:main.cpp:(.text.startup._Z7premainv+0x0): first defined here        
    .pio\build\genericSTM32F103CB\src\main.cpp.o: In function `main':
    main.cpp:(.text.startup.main+0x0): multiple definition of `main'
    .pio\build\genericSTM32F103CB\FrameworkArduino\main.cpp.o:main.cpp:(.text.startup.main+0x0): first defined here
    collect2.exe: error: ld returned 1 exit status
    *** [.pio\build\genericSTM32F103CB\firmware.elf] Error 1
    ================================================ [FAILED] Took 19.66 seconds ================================================
    

    For what I understand of the error... (nothing)... It seems it will take me quite some time to go any further... At least Arduino IDE is working and I can start testing the Radio with that.



  • @CarloMagno Thank you for putting up your experience and success with the Arduino IDE. It appears we did many of the same steps. I also ran into the HAL error, tried the #define ARDUINO_ARCH..., and failed. Also tried the Roger Clark version and id not get that to run. Today I took an older PC and clean installed the IDE and Roger Clark core as you described and SUCCESS, was able to compile MySensors. There must be something wrong with my configuration on my main PC.

    The "official" core is also my preference as it is available on PlatformIO. And there are libraries available for it that may not run on Roger's. For example I have read there is a sleep/low power library for Blue Pill that only runs on the STM32 "official" core (I have not tested that). I might take another try at getting PlatformIO to work with Roger Clarks core but we are getting to the fringes of my technical skills.

    In either case, I am very happy to be able to compile MySensors for the Blue Pill. Essentially same cost and size of the Pro Mini, but so much more capable. I have a number of applications it will fit perfectly for.

    If I make any progress on PlatformIO, will post here.



  • @CarloMagno Forgot to mention, in my clean install I created - the directory you described and did not work for me. Instead I just dropped the RogerClark core folder in the regular Arduino hardware folder and it worked. Program Files(x86)\Arduino\hardware\Arduino_STM32-master. The arduino IDE read it fine along with all its native hardware folders.



  • You need to either use unofficial stm32 core which is what Mysensors port is built upon, or to make a new port which will be compatible with official core. I looked into this and it seems feasible for me to accomplish. I am now working on a node with STM32, so I will try to make it work.


  • Mod

    @monte have you seen https://github.com/mysensors/MySensors/pull/1422 ? Maybe that is a good way forward for stm32 support.



  • @novicit said in How to compile MySensors on Platformio for Blue Pill:

    @CarloMagno Forgot to mention, in my clean install I created - the directory you described and did not work for me. Instead I just dropped the RogerClark core folder in the regular Arduino hardware folder and it worked. Program Files(x86)\Arduino\hardware\Arduino_STM32-master. The arduino IDE read it fine along with all its native hardware folders.

    ...It could be because I used the ZIP file to install the Arduino IDE instead of the windows installer... good to point if someone else faces the same problems.



  • @monte , @mfalkvidd ... Fantastic!!, is good to know that there there is development to support the official ST Core, for sure it will provide much better future stability with the new hardware from ST.



  • @mfalkvidd I guess this will make the code compile, but I was going to implement at least the same functionality that is present with current port. Nice to see that someone else is also working on it 🙂


  • Mod

    @monte I can't judge the quality or completeness of the suggested code contribution unfortunately.



  • @CarloMagno I have now compiled 2 small test programs, using RogerClarks core. I was very surprised as both used most of the Blue Pill Flash and Memory for very small sketchs.

    1. test sketch simple relay off/on used 48k (73%) of flash and 5k (24%) of memory.
    2. Sketch with simple LED off/on with 'receive' from controller and rfm69 use 58k flash (88%) and 5.2k (25%) of memory.

    I used MySensors current release, & latest Arduino IDE. Have you had similar results in the work you are doing? This would take away the Blue Pill advantage of twice the flash of a pro mini, and make it unusable.

    I will dig deeper, and try the @KooLru code above to see if it makes a difference. @monte states that it might not have functionality, but I am not sure what that means as 'core' work is beyond my skill level.

    Again, I will assume I am doing something incorrectly as I know others on MySensors forum have used the blue pill.



  • @novicit I can more or less confirm your results. I have used the PH dummy sketch to simulate a value sent to the gateway and it has worked perfectly. Using MySensors development branch the compilation results are:

    Sketch uses 47216 bytes (72%) of program storage space. Maximum is 65536 bytes.
    Global variables use 5384 bytes (26%) of dynamic memory, leaving 15096 bytes for local variables. Maximum is 20480 bytes.
    
    

    This results are selecting the variant in the "STMF103C8 (20k RAM, 64k Flash)" of the board in the Arduino IDE tools menu.
    However, In the multiple forums I have read about the STM32F103 it seems that regardless of the amount of memory the board you have bought, (64k or 128k) most of them are 128k,... so, you can always try 128k.. or buy 128k variants (STM32F103CB), in which case the compilation results give more headroom for bigger sketches:

    Sketch uses 47216 bytes (36%) of program storage space. Maximum is 131072 bytes.
    Global variables use 5384 bytes (26%) of dynamic memory, leaving 15096 bytes for local variables. Maximum is 20480 bytes.
    
    

    I have tried changing the definition to the 128k variant and can confirm that the upload works and that the node works (message received in the gateway)... I don't know if the 64k of sketch are exceeded the code will upload... I believe the upload would have failed if the board does not have that flash memory space.
    Find attached the sketch I am using that I can confirm that works... in my setup. I am using a SX1276 LoRa radio.
    I used a STLink V2 clone to upload the sketch and a TTL to usb attached to PA9 and PA10 pins to serial print messages. To get Serial.print working (for MySensors connection debug) I had to redirect debug messages to Serial1 port (PA9 and PA10 in STM32 maple core). I believe that Serial corresponds to the on-board usb but mine does't work out of the box and I believe that I would have to upload first a bootloader in order to use it... so I took the short test route and used the TTL to usb instead.

    // Enable debug prints to serial monitor
    #define MY_DEBUG
    
    // Enable and select radio type attached
    //#define MY_RADIO_RF24
    //#define MY_RADIO_NRF5_ESB
    //#define MY_RADIO_RFM69
    #define MY_RADIO_RFM95
    #define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW125CR45SF128     // Default, medium range
    //#define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW500CR45SF128   // Fast, short range
    //#define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW31_25CR48SF512 // Slow, long range
    //#define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW125CR48SF4096  // Slow, long range
    
    // For RFM95 connections. Following: https://www.thethingsnetwork.org/labs/story/a-cheap-stm32-arduino-node 
    #define MY_RFM95_IRQ_PIN      PA11               //  SX1276's IRQ(Interrupt Request)
    #define MY_RFM95_IRQ_NUM      MY_RFM95_IRQ_PIN
    #define MY_RFM95_CS_PIN       PA4                // SX1276's CS (NSS)
    #define MY_RFM95_RST_PIN      PB0                // SX1276's RESET
    //#define MY_SOFTSPI
    #define MY_SOFT_SPI_SCK_PIN   PA5                // SX1276's SCK
    #define MY_SOFT_SPI_MISO_PIN  PA6                // SX1276's MISnO 
    #define MY_SOFT_SPI_MOSI_PIN  PA7                // SX1276's MOSI  
    //#define MY_RFM95_POWER_PIN (3)                // What is this used for?
    
    
    #define MY_SERIALDEVICE Serial1 // Force using Serial 1 (RX ->PA9 and TX -> PA10) for MySensor debug messages
    // Define a static node address, remove if you want auto address assignment 
    #define MY_NODE_ID   70 
    //#define ARDUINO_ARCH_STM32F1
    #include <MySensors.h>
    
    #define COMPARE_PH 1 // Send PH only if changed? 1 = Yes 0 = No
    const int ledPIN = PC13; 
    
    uint32_t SLEEP_TIME = 60000; // Sleep time between reads (in milliseconds)
    float lastPH;
    bool receivedConfig = false;
    bool metric = true;
    // Initialize PH message
    MyMessage msg(0, V_PH);
    
    void setup()
    {
      Serial1.begin(115200); //RX->PA9 / TX->PA10
      // initialize digital pin PC13 as an outp
      pinMode(ledPIN, OUTPUT);
      //Setup your PH sensor here (I2C,Serial,Phidget...)
    }
    
    float getPH()
    {
      //query your PH sensor here (I2C,Serial,Phidget...)
      float dummy = 7;
      return dummy;
    }
    
    void presentation()
    {
      // Send the sketch version information to the gateway and Controller
      //sendSketchInfo("PH Sensor", "1.1");
      present(0, S_WATER_QUALITY);
    
    }
    
    void loop()
    {
    
      float ph = getPH();
      Serial1.println("PH: ");Serial1.println(ph);
    #if COMPARE_PH == 1
      if (lastPH != ph) {
    #endif
    
        // Send in the new PH value
        send(msg.set(ph, 1));
        // Save new PH value for next compare
        lastPH = ph;
    
    #if COMPARE_PH == 1
      }
    #endif
      wait(SLEEP_TIME);
    }
    


  • Just pulled commits proposed by @KooLru and tried compiling relay example for a test.
    STM32F103C8:

    Sketch uses 27700 bytes (42%) of program storage space. Maximum is 65536 bytes.
    Global variables use 2832 bytes (13%) of dynamic memory, leaving 17648 bytes for local variables. Maximum is 20480 bytes.
    

    The same example compiled for ATmega 328p:

    Sketch uses 13712 bytes (44%) of program storage space. Maximum is 30720 bytes.
    Global variables use 449 bytes (21%) of dynamic memory, leaving 1599 bytes for local variables. Maximum is 2048 bytes.
    

    The same, but for NRF52832:

    Sketch uses 29784 bytes (5%) of program storage space. Maximum is 524288 bytes.
    

    I guess overhead is added by ARM specific HAL and other similar stuff.



  • I still have to try the commits by @KooLru .. (first I have to figure out how to use a commit in a library with the Arduino IDE 🙄 ) but in the meantime I have found that the compiling problem with PlatformIO, STM32 and MySensors had been already documented in previous posts:
    https://forum.mysensors.org/topic/10324/platformio-not-longer-working-with-mysensors/6
    That also links to this post:
    https://forum.mysensors.org/topic/10193/stm32f103c8-problem-at-compilation/12
    That points to the ticket open in the PlatformIO and temporary workaroud (I have to learn to test it):
    https://github.com/platformio/platform-ststm32/issues/283#issuecomment-533585597

    I have tested the temporary solution in the github ticket and it has compiled for the mapple core. The Plaformio.ini file is:

    [env:genericSTM32F103CB]
    platform = ststm32
    board = genericSTM32F103CB
    framework = arduino
    board_build.core = maple
    extra_scripts = pre:fix_main.py
    

    Before getting it to compile I had to install Python for the OS (in this case I am using Windows 10) and the Python extension for PlatformIO (I chose Microsoft one).
    And also, it seems something has changed in the last versions of PlatformIO since solution post in the fix and I had to change the variable name in the Python script PROJECTPACKAGES_DIR by PROJECT_PACKAGES_DIR, so the line in the final line in that scrips is as follows:

    STM32_FRAMEWORK_DIR = env['PROJECT_PACKAGES_DIR'] + "/framework-arduinoststm32-maple"
    


  • @CarloMagno I also found the links you refer to. They appear to be "workarounds" rather than truly solving the real problem. I was never able to get the script shown to work. I did get an error free compile with the information in them, but for some reason it appeared to never link the MySensors library. I did not get a splash screen, or any MySensors debug messages.

    The tests @monte did seemed to show a significant decrease in flash usage when using the STM32 core. So I also used the @KooLru proposed commits on the same two sketches as before, with promising results (on arduino IDE):

    Sketch #1
    w/ RogerClarke core Flash used 58k (88%)
    w/ @KooLru STM32 core Flash used 41k (61%)

    Sketch #2
    w/ RogerClarke core Flash used 48k (73%)
    w/ @KooLru STM32 core Flash used 30k (45%)

    This looks good. I have only tested compile, not yet loaded a Blue Pill with the output.

    To use @KooLru proposed commits:

    1. must use development branch.
    2. create folder MySensors\hal\archetecture\STM32
    3. drop @koolru 3 files in above directory. [MyMainSTM32.cpp, MyHwSTM32.h & .cpp]
    4. Replace MySensors.h with his version.

    @CarloMagno I forgot that most Blue Pills are actually 128k - nice suggestion! I found the following website which shows how to check the flash in a blue pill. [https://www.onetransistor.eu/2020/01/stm32-bluepill-arduino-support.html]

    Next Steps:

    1. Try @koolru modified development branch with PlatformIO.
    2. Live test a program compiled with the modifications in a working MySensors network.


  • Re: the site to check if Blue Pill is 128k: I believe the "STM32CubeProgrammer" is loaded as part of the STM32 core and does not need to be loaded separately. Should be able to execute those commands without installing anything else.



  • @novicit Using the link you provided I have confirmed that my board is a 128k flash variant (installing STM32CubeProgrammer" and launching its graphical IDE, not tried the command line option).
    I have sucessfully compiled the koolru branch with PlatformIO and got the node to send messages go the gateway. What I did:

    1. Installed in PlatformIO the stable MySensors library (from PlatformIO library manager)
    2. Downloaded the koolru MySensos full library (Download Zip option from View Code Github) and decompress it into a custom folder
    3. Linked the koolru MySensors library as a project specific library (to be used for that project instead of the global MySensors library). Place the decompressed folder library in a folder, for example: H:\PlatformIO\custom_libraries\ (so the files for the custom MySensors library are in *H:\PlatformIO\custom_libraries\MySensors-development* ).
    4. Created the fix_main.py with the modified line I posted in the previous post (you need to have installed pyton intepreter for OS and Pytnon plugin for PlatformIO to be able to use this precompiling script)

    The platformio.ini file is:

    [env:genericSTM32F103CB]
    platform = ststm32
    board = genericSTM32F103CB
    framework = arduino
    ;board_build.core = maple
    monitor_speed = 115200
    monitor_filters = time, default
    extra_scripts = pre:fix_main.py
    lib_extra_dirs = H:\PlatformIO\custom_libraries\
    
    [env:Sensor-Serial-Windows]
    upload_port = COM7
    monitor_port = COM7
    
    
    [env:Sensor-Serial-Linux]
    ; any port that starts with /dev/ttyUSB
    upload_port = /dev/ttyUSB*
    monitor_port = /dev/ttyUSB*
    

    Start of the compiling process (you can see that the python script is being executed and that the development version of MySensors is selected):

    Processing genericSTM32F103CB (platform: ststm32; board: genericSTM32F103CB; framework: arduino)
    ------------------------------------------------------------------------------------------------------------------------------
    
    Verbose mode can be enabled via `-v, --verbose` option
    
    ================================= STM32 FRAMEWORK PATCHER =================================
    
    [INFO] Patching file: C:\Users\xxxxxx\.platformio\packages/framework-arduinoststm32-maple\STM32F1\cores\maple\main.cpp
    [INFO] Patching file: C:\Users\xxxxxx\.platformio\packages/framework-arduinoststm32-maple\STM32F4\cores\maple\libmaple\main.cpp
    
    ============================================================================================
    
    CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/genericSTM32F103CB.html
    PLATFORM: ST STM32 6.1.0 > STM32F103CB (20k RAM. 128k Flash)
    HARDWARE: STM32F103CBT6 72MHz, 20KB RAM, 128KB Flash
    DEBUG: Current (blackmagic) External (blackmagic, jlink, stlink)
    PACKAGES:
     - framework-arduinoststm32-maple 2.10000.200103 (1.0.0)
     - toolchain-gccarmnoneeabi 1.70201.0 (7.2.1)
    LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
    LDF Modes: Finder ~ chain, Compatibility ~ soft
    Found 48 compatible libraries
    Scanning dependencies...
    Dependency Graph
    |-- <MySensors> 2.4.0-alpha
    |   |-- <Wire> 1.0
    |   |-- <SPI> 1.0
    |   |-- <EEPROM>
    Building in release mode
    

    And the compilation results (I got several warnings regarding SPI but the result is sucessful):

    Building .pio\build\genericSTM32F103CB\firmware.bin
    Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
    RAM:   [===       ]  26.3% (used 5384 bytes from 20480 bytes)
    Flash: [====      ]  38.0% (used 49840 bytes from 131072 bytes)
    ================================================ [SUCCESS] Took 17.96 seconds ================================================
    

    ... @novicit you mention that using the script previously you couldn't get it to work.. check Python install and plugins.. also to debug MySensor messages I used a separate usb to TTL (not STLINK attached to PA9 and PA10 as I explained before).

    ... and now the next problem... the STM32LowPower.h library (to get the STM32 to deep sleep) is compiling properly in Arduino IDE but does not compile in PlatformIO ... again... 😞



  • @CarloMagno You are fortunate to have the 128k Blue Pill. I hope mine are also.

    Funny, in coding there are always different ways to do things. Working with PlatformIO, I linked to the MySensors development branch in the platform.ini as follows:

    [env:bluepill_f103c8]
    platform = ststm32
    board = bluepill_f103c8
    framework = arduino
    
    lib_deps =
      https://github.com/mysensors/MySensors.git#development
    
    lib_ignore =
      ;MySensors standard library
      548
    

    It seemed to work. But I have not yet finished testing.

    In your compile on PlatformIO, it makes me wonder if perhaps it used the maple (RogerClark) core instead of STM32. I observe:

    1. The STM core also includes the maple core. (https://docs.platformio.org/en/latest/platforms/ststm32.html)
    2. Though the .ini file does not have "board_build.core = maple" in it, the compile output has "framework-arduinoststm32-maple 2.10000.200103 (1.0.0)" in the output.
    3. The output file size of 50k flash seems large and is comparable to the output I got from my Maple/RogerClark testing. Is it the same size as you got when compiling in the Arduino IDE with STM32 core?
    4. The low power library has been written up as not compiling with maple/RogerClark core, but does with STM32 core.
      ==> Just some observations to be confirmed?

    In my initial attempts to compile with STM32 core on PlatformIO, it uses the development branch, but I get an error message:
    ".pio/build/bluepill_f103c8/FrameworkArduinoVariant/PeripheralPins.c' not found, needed by target..."
    => I have not had the time to solve this yet. But, compiler is looking for a file which describe pin map - PeripheralPins.c I am guessing this is similar to MySensors instructions for Nrf5 where two files are in the sketch directory to specify pin assignments. (MyBoardNRF5.cpp and .h)

    [Sorry I am not able to make faster progress contributing to this thread. I am a couple weeks out of the hospital and can only sit at my computer for short periods so far. But happy, repairs were successful 🙂 ]



  • @novicit, nice to hear hospital "repairs" doing well!
    I don't have much time either, so, when I find some time in the weekends I try the following step...
    A couple of things regarding your comments:

    1. The way you included the development branch of MySensors in Platformio I believe it takes the "official" MySensors development branch, and I don't konw if the commit by koolru has been merged into that branch.. i believe not.. so it is not using the right code for the STM official core, and could be the origin of your error message. That is the reason I downloaded the library and used a local stored copy from koolru repository. I had also to have installed the official MySensors library (otherwise it gave me compiling errors), as if some library dependencies were missing from koolru branch ¿?.
    2. It is true that STM32 core in platformio has both the Roger Clark and Official ststm core. By default it uses the official core. If you want to compile for the Rogre Clark you include the option board_build.core = maple in Platformio.ini.
    3. The LowPower library is compiling in the Arduino IDE but gives errors in Platformio with ststm32 core (official).


  • Maybe diggin a topic a bit, but as for June 2021 :

    In library file MyHwSTM32.h one line seems to be lost :

    
    #ifndef MyHwSTM32_h
    #define MyHwSTM32_h
    
    #include <IWatchdog.h>
    #include <itoa.h>
    #include <SPI.h>
    #include <EEPROM.h>   <<--- this is necessary to compile agains BluePill
    
    

    and something like this in platformio.ini

    [env:bluepill_f103c8]
    platform = ststm32
    board = bluepill_f103c8
    framework = arduino
    
    upload_protocol = stlink
    debug_port = stlink
    debug_tool = stlink
    monitor_speed = 115200
    monitor_filters = time, default
    
    

    Just to keep you entertained.
    Cheerz.


Log in to reply
 

Suggested Topics

14
Online

11.4k
Users

11.1k
Topics

112.7k
Posts