Closed jeremypoulter closed 5 years ago
Wow, this is a lot of stuff. Sorry, I'm not familiar with Travis CI, except that I know it's some sort of autobuild setup... can you elaborate on what you've added for that, and how to use it?
Also, I noticed that you your build instructions, you say to copy the libraries to your Arduino libraries directory. Actually, the reason that I've included them directly with the source code is to allow tighter control over them (bug fixes and eliminating clashes caused by wrong versions)
can you elaborate on what you've added for that, and how to use it?
Travis CI is a continuations integration system that will attempt to build the source code on every commit/pull request. It is really handy for making sure all the different build options (although I didn't go this far). I mainly added it as Platform IO auto creates this file (some what annoyingly) but it is generally a good thing to use.
The .travis.yml
file is the main config file ad defines the commands to build the code, using Platform IO (you can set up to build with Arduino IDE but it is a bit more work). To use you have to create an account on https://travis-ci.org/ and link with you GitHub account. You can then select which repositories to build. FYI my fork is here https://travis-ci.org/jeremypoulter/open_evse.
Platform IO is an alternative to using Arduino IDE to build. It integrates in to lots of IDEs (rather than reinventing the wheel ;-) and has much better library and configuration management. The platformio.ini
file contains the definitions of the different 'environments', basically combinations of framework (Arduino), platform, board, build options, programmer, etc.
arduino/boards.txt
and arduino/openevse.json
are the board definition files for Arduino IDE and Platform IO respectively. arduino/boards.txt
is a standalone version without any other board (as with the other examples). This can just be copied to ~\Arduino\hardware\openevse\avr
and you don't have to overwrite anything in the Arduino IDE install.
Also, I noticed that you your build instructions, you say to copy the libraries to your Arduino libraries directory.
These where mostly copied from http://code.google.com/p/open-evse/wiki/LoadingFirmware (as pointed to by [README](https://github.com/lincomatic/open_evse/tree/development)
, which I should really update to point at the new build instructions). I can remove that section as I agree does not look to be relevant anymore.
Actually, the reason that I've included them directly with the source code is to allow tighter control over them (bug fixes and eliminating clashes caused by wrong versions)
This is one of the things PlatformIO can help with, you can set explicit versions of the libraries to use.
Thanks for the contribution. It's going to take me a while to digest all this before I can merge it.
BTW, regarding library management. Since we're tight on resources, I don't like to use any standard versions of the libraries, because they often contain extraneous code that we don't need, or I've made local edits, so it's best to just compile the ones that are included with the source.
I tried your pio installation script,
sudo python -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)"
on Debian 8.2.0, and it fails:
==> Installing PlatformIO and dependencies ...
/usr/bin/python: can't open file 'pip': [Errno 2] No such file or directory
Any idea what could be going wrong? I already had pip installed before running it, and I can still invoke pip from a terminal, despite the error.
I also use PlatformIO, it's got significant advantages over Arduino IDE for build replicabiliyt. It would fantastic if the PR was merged.
I will try and help with installing PlatformIO. What OS are you using?
Can you check if python pip is working? What happens when you run $ pip freeze
? This should show all the python packages currently installed.
However, I would have expected that the PlatformIO installer would have installed pip if it was not already installed, I've asked the questions on the PlatformIO forums: https://community.platformio.org/t/linux-install-script-fails-on-debian-8-2-0/2717
@lincomatic please use fixed script
python -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/develop/scripts/get-platformio.py)"
Hi @lincomatic,
Would it be possible to merge this? I've been using platformio to compile open_evse firmware with this PR applied for a while now. It works very well. Non of these changes actually modify any open_evse code, this PR just adds the config files required to enable compiling using PlatformIO.
sorry, I can't merge this one. I explored platformio, and it really isn't add much value as an alternate IDE. Besides that fact that it doesn't simplify matching code to compile errors, it also doesn't properly manage the arduino AVR library in a controllable fashion, since it uses its own version. I am using visual micro, which provides not only better IDE integration, but uses standard AVR libraries, and even has a rudimentary debugging function. Its config is different from what you use for platformio.
I really don't want to pollute the source tree with extra files for alternate IDE's as it can get confusing and unwieldy to maintain. Sorry.
Thank you @jeremypoulter for the work to support building OpenEVSE with PIO. I started down this path myself, then was glad when I stumbled across your PR.
I've been using the slightly better optimization results of the default pio core to squeak the latest Marlin 2.0.x onto my old 128k Printboard and it seems it's helping out OpenEVSE as well. Rebasing your branch against Sam's latest and compiling, PIO comes out with the most breathing room by a fair margin:
AIDE 1.9.x beta (FAIL):
Sketch uses 32072 bytes (104%) of program storage space. Maximum is 30720 bytes. Global variables use 1554 bytes (75%) of dynamic memory, leaving 494 bytes for local variables. Maximum is 2048 bytes. Sketch too big; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing it.
AIDE 1.8.5 (PASS):
Sketch uses 32072 bytes (99%) of program storage space. Maximum is 32256 bytes. Global variables use 1554 bytes (75%) of dynamic memory, leaving 494 bytes for local variables. Maximum is 2048 bytes.
AIDE 1.6.13 (FAIL):
Sketch uses 32,026 bytes (104%) of program storage space. Maximum is 30,720 bytes. Global variables use 1,546 bytes (75%) of dynamic memory, leaving 502 bytes for local variables. Maximum is 2,048 bytes. processing.app.debug.RunnerException: Sketch too big; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing it.
Latest PIO 3.6.2 (PASS):
DATA: [======== ] 75.4% (used 1544 bytes from 2048 bytes) PROGRAM: [==========] 96.9% (used 31758 bytes from 32768 bytes)
This mirrors my experience with Marlin on AT90USB.
Thanks again,
-=dave
Thanks for the feedback, but you aren't really testing correctly. 1) the FAILs you listed above are all due to not correctly configuring the proper board type. Since we don't use a bootloader, the full 32768 bytes of program space are available. AIDE is complaining due to leaving space for the bootloader.
2) the IDE is really irrelevant to the compilation. The way to change the compiler is to go into the Boards Manager, and select a version of the "Arduino AVR Boards by Arduino." Selecting the same version in different versions of IDE yield identical outputs.
Which leads me to why I'm currently not willing to merge the PIO support into the development branch.. PIO seems to have its own version of the AVR tools, which can't be controlled. We can't allow the compiler to randomly change, because compiler bugs to change the behavior of the code. For the same reason, I include all of the required libraries with the source.. different versions of libraries may behave differently, and worse yet, may cause the compiled output to change size.
Control of which version of toolchain and core library is extremely important, because the EVSE is a safety device. UL required me to specify the exact compiler version used, and requires me to update them and retest whenever I want to change it. The version I used for UL certification was 1.6.15. I strongly recommend that you use PIO only for debugging, and that you create production firmwares using 1.6.15.
Personally, I'm using VisualMicro with Microsoft Visual Studio Community Edition instead of PIO, because it allows me to select the toolchain version (and, I just happen to find it more user friendly than PIO). But even so, I always generate my production firmwares using the Arduino IDE with AVR 1.6.15, just in case VisualMicro does something differently in the background.
For reference, here is the output using 1.6.15 using today's (2018-12-04) code:
Sketch uses 32026 bytes (97%) of program storage space. Maximum is 32768 bytes. Global variables use 1546 bytes (75%) of dynamic memory, leaving 502 bytes for local variables. Maximum is 2048 bytes.
I always generate my production firmwares using the Arduino IDE with AVR 1.6.15
@lincomatic - 1.6.13 appears to be the latest 1.6.x branch available for download: https://www.arduino.cc/en/Main/OldSoftwareReleases https://github.com/arduino/Arduino/releases https://www.google.com/search?q=arduino+ide+1.6.15&oq=arduino+ide
I strongly recommend that you use PIO only for debugging, and that you create production firmwares using 1.6.15.
Where on Earth should people find this mythical unicorn ? :grin:
Thanks,
-=dave
I maintain version of open_evse with a few EU specific setting on OpenEnergyMonitor github which is PlatformIO compatible:
@fiveangle
Changes to support building via Platform IO and Travis CI
Also include build instructions.