OpenSprinkler Forums OpenSprinkler Unified Firmware Error building firmware from source

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #69352

    raaahbin
    Participant

    Hi folks,

    I hope this is something others will recognise. I’ve tried following the instructions here about how to compile the OpenSprinkler firmware from source. I’d really like to have a try at custom coding a workaround to the rare-but-persistent tendency to drop off a wifi network and never rejoin it.

    Beyond those instructions, I did the following:
    – substituted esp8266_2.7.4 for 2.5.2 throughout, since 2.7.4 is what is referenced in make.lin32
    – changed the “SSD1306” path in make.lin32 to “esp8266-oled-ssd1306” (since that’s what actually gets cloned from the links provided

    At that point, it seems to start building very nicely, listing dozens of .cpp files, right up to the point where it throws the following errors:

    
    In file included from OpenSprinkler.h:38:0,
                     from OpenSprinkler.cpp:24:
    /Volumes/Cloudjumper/Users/robin/Arduino/libraries/UIPEthernet/UIPEthernet.h: In static member function 'static void OpenSprinkler::yield_nicely()':
    /Volumes/Cloudjumper/Users/robin/Arduino/libraries/UIPEthernet/UIPEthernet.h:124:15: error: 'static void UIPEthernetClass::tick()' is private
       static void tick();
                   ^
    OpenSprinkler.cpp:2354:24: error: within this context
      if(m_server) Ethernet.tick();
                            ^
    In file included from OpenSprinkler.h:38:0,
                     from OpenSprinkler.cpp:24:
    /Volumes/Cloudjumper/Users/robin/Arduino/libraries/UIPEthernet/UIPEthernet.h:124:15: error: 'static void UIPEthernetClass::tick()' is private
       static void tick();
                   ^
    OpenSprinkler.cpp:2354:29: error: within this context
      if(m_server) Ethernet.tick();
                                 ^
    make: *** [/tmp/mainArduino/mainArduino_generic/OpenSprinkler.cpp.o] Error 1
    

    Any ideas how I can get past that error? Google isn’t terribly helpful so far.

    #69353

    raaahbin
    Participant

    Further to the above, I’ve found that commenting out the one line in OpenSprinkler.cpp where Ethernet.tick() is called, seems to allow it all to build without errors… but I feel like that’s not a good way to do things, if tick() is supposed to do something important in the yield_nicely function.

    #69354

    Ray
    Keymaster

    The build instructions were outdated and I just updated them. Two things:
    1. using esp8266 core 2.7.4 is fine as the firmware has been verified to compile with 2.7.4 (though 2.5.2 should also work fine)
    2. for the UIPEthernet library, use the one that we’ve modified (it contains some dhcp fixes and customization). This is available in the OpenSprinkler github repository, and here is the direct download link:
    https://github.com/OpenSprinkler/UIPEthernet/archive/fixes/dhcp.zip

    #69355

    raaahbin
    Participant

    Thanks for that. On going through the code, I’ve discovered that (I think) the function in which the Ethernet.tick() function is attempted to be called is not, itself, ever called… so I’m pretty sure it can be safely either commented out (which would break things if I’m wrong), or replaced with Ethernet.maintain() (which should be safer if I’m wrong).

    #69360

    Ray
    Keymaster

    Please note that tick() is called inside the maintain() function:
    https://github.com/OpenSprinkler/UIPEthernet/blob/master/UIPEthernet.cpp#L139
    you can certainly change the call to tick() to maintain() but maintain() is heavier weight than tick().

    #69363

    raaahbin
    Participant

    Yes – I noticed that tick() was called inside maintain()… but the difference is that maintain() is a public function (as opposed to tick() which is private in the stock version of UIPEthernet), so I figured I can put it in that place in OpenSprinkler.cpp without causing a fatal error during build. Of course, if the customised version of the library makes tick() public, that would fix the error too.

    And it still doesn’t appear to matter, since I’m pretty sure delay_nicely is not called at all in the current version of OpenSprinkler.cpp

    #69362

    Water_my_lawn
    Participant

    I wrote a script that does the download and necessary fixups.
    Make a build directory and run this script from there.
    Here it is:

    —————————————————–

    #!/bin/bash

    # This script downloads all of the source code necessary to build
    # the OpenSprinkler binary for the 3.0 hardware.
    # The script fixes a few places in the source downloads that are
    # needed before it will compile cleanly.
    # Finally it runs the make command.
    # This can be run in any directory and will set a local $HOME
    # This runs in Linux.

    # Remove any previous installation. You may or may not want to do this!
    rm -rf Arduino esp8266_2.5.2 OpenSprinkler-Firmware

    # Create a local $HOME foe installation and build.
    export HOME=pwd

    # Get the OpenSprinkler code.
    # Puts it in ~/OpenSprinkler-Firmware
    git clone https://github.com/OpenSprinkler/OpenSprinkler-Firmware.git

    # Get the Arduino code.
    # Puts it in ~/esp8266_2.5.2
    git clone https://github.com/esp8266/Arduino.git esp8266_2.5.2

    # Go into esp8266_2.5.2 and checkout the correct version.
    cd ~/esp8266_2.5.2
    git checkout tags/2.5.2

    # If necessary, install Python.
    # sudo apt install python

    # This Perl script installs the xtensa compiler and tools.
    cd ~/esp8266_2.5.2/tools
    python get.py

    # Go back up the base level.
    #cd

    # Install necessary libraries, including SSD1306, RCSwitch, and UIPEthernet.
    # Download and unzip or git clone these into Arduino/libraries folder.
    mkdir -p ~/Arduino/libraries
    cd ~/Arduino/libraries

    # Get the library for the OLED display.
    git clone https://github.com/ThingPulse/esp8266-oled-ssd1306.git

    # The latest version of the OLED code is not compatable, backup to 4.1.0
    cd ~/Arduino/libraries/esp8266-oled-ssd1306
    git checkout tags/4.1.0

    cd ~/Arduino/libraries

    # Get some of the necessary pieces.
    git clone https://github.com/sui77/rc-switch.git
    git clone https://github.com/UIPEthernet/UIPEthernet.git
    git clone https://github.com/knolleary/pubsubclient.git

    # Remove tests directory as it will not compile but is unnecessary.
    rm -rf ~/Arduino/libraries/pubsubclient/tests

    # Go into the actual build location
    cd ~/OpenSprinkler-Firmware

    # There is an fixup needed in make.lin32:
    # This changes the OLED library to the correct one.
    sed -i s+Arduino/libraries/SSD1306+Arduino/libraries/esp8266-oled-ssd1306+ make.lin32

    # And finally build the final OpenSprinkler binary.
    make -f make.lin32

    echo “**********************************************************”
    echo ‘To build in a directory other than your normal $HOME directory’
    echo ‘run this command to set a local $HOME directory to your current directory:’
    echo ‘ export HOME=pwd
    echo “Next go into the build directory.”
    echo ” cd ~/OpenSprinkler-Firmware”
    echo “Then run this command to build the binary:”
    echo ” make -f make.lin32″
    echo “**********************************************************”

    #69365

    Water_my_lawn
    Participant

    I see that my script is out of date!
    The lines with esp8266_2.5.2 need to be edited to pick up the 2.7.4 version.
    The issue with tick() must also be dealt with.

    #70191

    franzstein
    Participant

    I’ve compiled the OpenSprinkler firmware 2.1.9(7) using the build instructions given in https://openthings.freshdesk.com/support/solutions/articles/5000165132-how-to-compile-opensprinkler-firmware.

    Besides using the modified UIPEthernet library, available in the OpenSprinkler github repository: https://github.com/OpenSprinkler/UIPEthernet/archive/fixes/dhcp.zip, some changes described by the script given above need to be made:

    – Rename the library “UIPEthernet-fixes-dhcp” to “UIPEthernet”
    – Get the library for the OLED display from https://github.com/ThingPulse/esp8266-oled-ssd1306.git, but backup to 4.1.0 as the latest version of the OLED code isn’t compatible:
    cd ~/Arduino/libraries/esp8266-oled-ssd1306, git checkout tags/4.1.0
    – Rename the library “esp8266-oled-ssd1306” to “SSD1306”.
    – Get the library for the MQTT Arduino Client for MQTT from: https://github.com/knolleary/pubsubclient.git and remove the tests directory as it will not compile but is unnecessary: rm -rf ~/Arduino/libraries/pubsubclient/tests

    With these changes the compilation was successful. The Ubuntu based Linux-Distribution Linux Mint 20.1 (Codename Ulyssa) with its Cinnamon Edition was used to perform the compilation. VirtualBox 6.1.22 was installed to run Linux.

    #70261

    Water_my_lawn
    Participant

    I have taken your fixes and updated my script.
    This script downloads all of the source and applies the necessary
    fixed to build the latest binary. This is currently: Firmware 2.1.9 (7)
    If this script is run in a new subdirectory it creates it’s own environment
    to build the binary. This allows you to have multiple build trees with
    their own build root.

    I have attached my script. I use Ubuntu 20.04 for development.

    #71024

    franzstein
    Participant

    I’ve modified the script given above in order to compile the OpenSprinkler firmware 2.1.9(9). Unfortunately the compilation fails with the following error message:

    Can’t open perl script “/home/bluetang/OpenSprinkler-Firmware/tools/board_op.pl”: No such file or directory
    makeEspArduino.mk:124: *** Invalid board: generic. Stop.

    The modifications made to the script are very simple substituting the old Ethernet library:

    wget https://github.com/OpenSprinkler/UIPEthernet/archive/fixes/dhcp.zip
    unzip dhcp.zip
    mv ~/Arduino/libraries/UIPEthernet-fixes-dhcp ~/Arduino/libraries/UIPEthernet

    by the new one:

    git clone https://github.com/jandrassy/EthernetENC

    Following the instructions given in How to compile OS firmware results in the same error.

    Any help will be appreciated.

    #71033

    Ray
    Keymaster

    The missing tools folder is an oversight on my part — I’ve now committed it to the respository.

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.

OpenSprinkler Forums OpenSprinkler Unified Firmware Error building firmware from source