Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. How to compile MySensors on Platformio for Blue Pill

How to compile MySensors on Platformio for Blue Pill

Scheduled Pinned Locked Moved Troubleshooting
24 Posts 5 Posters 284 Views 5 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    CarloMagno
    wrote on last edited by CarloMagno
    #21

    @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... :disappointed:

    1 Reply Last reply
    0
    • N Offline
      N Offline
      novicit
      wrote on last edited by
      #22

      @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 :) ]

      1 Reply Last reply
      0
      • C Offline
        C Offline
        CarloMagno
        wrote on last edited by
        #23

        @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).
        1 Reply Last reply
        0
        • Bogusz JagodaB Offline
          Bogusz JagodaB Offline
          Bogusz Jagoda
          wrote on last edited by
          #24

          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.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          8

          Online

          11.7k

          Users

          11.2k

          Topics

          113.0k

          Posts


          Copyright 2019 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • MySensors
          • OpenHardware.io
          • Categories
          • Recent
          • Tags
          • Popular