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. Development
  3. Platformio and MySensors development branch

Platformio and MySensors development branch

Scheduled Pinned Locked Moved Development
6 Posts 2 Posters 3.1k Views 4 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.
  • gerritvG Offline
    gerritvG Offline
    gerritv
    wrote on last edited by gerritv
    #1

    Is anyone successfully using Platformio with development branch?

    I am using platformio to do my Arduino development. Works fine if I stick to the Master branch of MySensors (library #548). But if I try to use the Development branch (manually installing it as a library for Platformio) then I get a lot of compile problems that frankly make no sense. E.g. compiling the MQTT demo (GatewayW5100MQTTClient) I get errors in MyGatewayTransportEthernet that EthernetServer and EthernetClient are not a type, aka they were not found in an include somewhere.
    http://platformio.org for those wondering.

    gerritvG 1 Reply Last reply
    0
    • gerritvG gerritv

      Is anyone successfully using Platformio with development branch?

      I am using platformio to do my Arduino development. Works fine if I stick to the Master branch of MySensors (library #548). But if I try to use the Development branch (manually installing it as a library for Platformio) then I get a lot of compile problems that frankly make no sense. E.g. compiling the MQTT demo (GatewayW5100MQTTClient) I get errors in MyGatewayTransportEthernet that EthernetServer and EthernetClient are not a type, aka they were not found in an include somewhere.
      http://platformio.org for those wondering.

      gerritvG Offline
      gerritvG Offline
      gerritv
      wrote on last edited by gerritv
      #2

      @gerritv I will answer the question myself.

      The directory layout of MySensors is a bit unusual, requires the following layout in platformio.ini

      [platformio]
      lib_dir = ../lib
      
      [env:nanoatmega328]
      platform = atmelavr
      framework = arduino
      board = nanoatmega328
      build_flags = -I../lib/MySensors
      lib_ignore = MySensors
      

      The directory layout I use is:
      Top level, a directory called lib with the contents of MySensors development branch. Inside this top level directory you have your various projects relating to this Solution:
      A directory for your sensor node sketch, e.g, LivingRoomNode which contains the Platformio directory and the above info in its ini file
      A directory for your gateway, with the same library parameters

      The result is a solution with multiple source projects pointing at the same MySensors library.

      Platformio is a great way to develop ESP8266/Arduino etc code. Also Platformio works very well with Visual Studio 2015 CE (this is what I build my MySensors nodes and gateways with).

      1 Reply Last reply
      1
      • Iyad NahasI Offline
        Iyad NahasI Offline
        Iyad Nahas
        wrote on last edited by
        #3

        I am trying to do the same but can't get a compile to work. I created a directory structure similar to the one you describe. In my gateway /src directory I copied the GatewayESP8266MQTTClient.ino file and used the same parameters for platformio.ini as in your example:

        [platformio]
        lib_dir = ../lib
        
        [env:nodemcu]
        platform = espressif
        framework = arduino
        board = nodemcu
        build_flags = -I../lib/MySensors
        lib_ignore = MySensors
        

        However, when I compile I get this error:

        src/tmp_ino_to.cpp:129:22: fatal error: MySensor.h: No such file or directory
        #include <MySensor.h>
        ^
        compilation terminated.
        

        The sketch otherwise compiles perfectly fine under the Arduino IDE.

        I'm sure it's a configuration issue somewhere. Can you expand a bit more on your file structure. Did you need to do any customization of PlatformIO to make it see the MySensors library?

        gerritvG 1 Reply Last reply
        0
        • Iyad NahasI Iyad Nahas

          I am trying to do the same but can't get a compile to work. I created a directory structure similar to the one you describe. In my gateway /src directory I copied the GatewayESP8266MQTTClient.ino file and used the same parameters for platformio.ini as in your example:

          [platformio]
          lib_dir = ../lib
          
          [env:nodemcu]
          platform = espressif
          framework = arduino
          board = nodemcu
          build_flags = -I../lib/MySensors
          lib_ignore = MySensors
          

          However, when I compile I get this error:

          src/tmp_ino_to.cpp:129:22: fatal error: MySensor.h: No such file or directory
          #include <MySensor.h>
          ^
          compilation terminated.
          

          The sketch otherwise compiles perfectly fine under the Arduino IDE.

          I'm sure it's a configuration issue somewhere. Can you expand a bit more on your file structure. Did you need to do any customization of PlatformIO to make it see the MySensors library?

          gerritvG Offline
          gerritvG Offline
          gerritv
          wrote on last edited by
          #4

          @Iyad-Nahas your .ino file must be in the src directory. I was compiling my ESP8266 gw yesterday with no issues.
          I didn't need any customization of platformio. I am using 2.8.5

          gerritvG 1 Reply Last reply
          0
          • gerritvG gerritv

            @Iyad-Nahas your .ino file must be in the src directory. I was compiling my ESP8266 gw yesterday with no issues.
            I didn't need any customization of platformio. I am using 2.8.5

            gerritvG Offline
            gerritvG Offline
            gerritv
            wrote on last edited by gerritv
            #5

            @gerritv Sorry, just re-read your msg and you already have the .ino in correct place.
            Are you certain there is no .ino outside the src directory? Are you using the development version of the libraries as well as the example from it?
            I recently changed my MySensors lib directory to be direct from Git development branch so the platformio lines are a bit different now (but same idea)

            [platformio]
            lib_dir = ../MySensorsLib/libraries
            
            [env:nodemcuv2]
            platform = espressif
            framework = arduino
            board = nodemcuv2
            build_flags = -I../MySensorsLib/libraries/MySensors
            lib_ignore = MySensors
            targets = upload
            

            Example output from my recent build:

            1>------ Build started: Project: GW-ESP8266, Configuration: Debug Win32 ------
            1>  [04/07/16 11:47:31] Processing nodemcuv2 (framework: arduino, build_flags: -I../MySensorsLib/libraries/MySensors, lib_ignore: MySensors, platform: espressif, board: nodemcuv2, targets: upload)
            1>
            1>  xtensa-lx106-elf-g++ -o .pioenvs\nodemcuv2\src\tmp_ino_to.o -c -fno-rtti -fno-exceptions -std=c++11 -Os -mlongcalls -mtext-section-literals -falign-functions=4 -ffunction-sections -fdata-sections -MMD -DF_CPU=80000000L -D__ets__ -DICACHE_FLASH -DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP12 -DARDUINO=20100 -DPLATFORMIO=020805 -U__STRICT_ANSI__ -IC:\Users\gerrit\.platformio\packages\framework-arduinoespressif\tools\sdk\include "-IC:\Users\gerrit\Documents\My Projects\SensorNet\MySensorsLib\libraries\MySensors" -I.pioenvs\nodemcuv2\FrameworkArduino -I.pioenvs\nodemcuv2\FrameworkArduinoVariant -I.pioenvs\nodemcuv2\EEPROM -I.pioenvs\nodemcuv2\SPI -I.pioenvs\nodemcuv2\ESP8266WiFi src\tmp_ino_to.cpp
            1>  xtensa-lx106-elf-g++ -o .pioenvs\nodemcuv2\firmware.elf -Os -nostdlib -Wl,--no-check-sections -u call_user_start -Wl,-static -Wl,--gc-sections -Wl,-wrap,system_restart_local -Wl,-wrap,register_chipv6_phy -Wl,-T"esp8266.flash.4m1m.ld" .pioenvs\nodemcuv2\src\tmp_ino_to.o -LC:\Users\gerrit\.platformio\packages\framework-arduinoespressif\tools\sdk\lib -LC:\Users\gerrit\.platformio\packages\ldscripts -L.pioenvs\nodemcuv2 -Wl,--start-group .pioenvs\nodemcuv2\libFrameworkArduinoVariant.a .pioenvs\nodemcuv2\libFrameworkArduino.a -lmesh -lwpa2 -lsmartconfig -lpp -lmain -lwpa -llwip -lnet80211 -lwps -lcrypto -lphy -lhal -laxtls -lgcc -lm .pioenvs\nodemcuv2\libEEPROM.a .pioenvs\nodemcuv2\libSPI.a .pioenvs\nodemcuv2\libESP8266WiFi.a -Wl,--end-group
            1>  "C:\Users\gerrit\.platformio\packages\tool-esptool\esptool" -eo "C:\Users\gerrit\.platformio\packages\framework-arduinoespressif\bootloaders\eboot\eboot.elf" -bo .pioenvs\nodemcuv2\firmware.bin -bm dio -bf 40 -bz 4M -bs .text -bp 4096 -ec -eo .pioenvs\nodemcuv2\firmware.elf -bs .irom0.text -bs .text -bs .data -bs .rodata -bc -ec
            1>  <lambda>(["upload"], [".pioenvs\nodemcuv2\firmware.bin"])
            1>  Auto-detected UPLOAD_PORT/DISK: COM6
            1>  "C:\Users\gerrit\.platformio\packages\tool-esptool\esptool" -vv -cd nodemcu -cb 115200 -cp COM6 -cf .pioenvs\nodemcuv2\firmware.bin
            1>  esptool v0.4.8 - (c) 2014 Ch. Klippel <ck@atelier-klippel.de>
            1>  setting board to nodemcu
            1>  setting baudrate from 115200 to 115200
            1>  setting port from COM1 to COM6```
            1 Reply Last reply
            0
            • Iyad NahasI Offline
              Iyad NahasI Offline
              Iyad Nahas
              wrote on last edited by
              #6

              Well, after some trial and error I ended up with just adding the build_flags option with the path to the MySensors library and now building works fine.

              Here's my final platform.ini:

              [env:nodemcu]
              platform = espressif
              framework = arduino
              board = nodemcu
              build_flags = -I../lib/libraries/MySensors
              

              Now to figure out why the auto upload doesn't work. If I upload manually it works fine, but when I add "targets = upload" it keeps trying to connect then times out with an error. No big deal though. I don't mind uploading manually.

              Thank you for your help.

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


              17

              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