lincomatic / open_evse

Firmware for Open EVSE
GNU General Public License v3.0
114 stars 163 forks source link

Changes to bring Platform IO build in line with Arduino build #108

Closed jeremypoulter closed 4 years ago

jeremypoulter commented 4 years ago

These changes fix the 'Arduino' version when building with Platform IO to make sure both Platform IO and Arduino can be used to generate certified builds.

As part of this I have added Travis CI config that builds with various AVR cors both with Platform IO and Arduino.

I did try to find a Platform IO version that matches 1.6.15 but the there is a jump from 1.6.14 to 1.6.17. Note the compiler version between those is the same and also the only real change between those packages is the boards.txt so should be equivalent to 1.6.15.

See https://travis-ci.org/jeremypoulter/open_evse/builds/582162466 for some example builds with Travis CI. I added a little script that outputs a few key details:

Arduino CLI, AVR core 1.6.15:

Arduino AVR Version: 1.6.15
GCC Version: avr-gcc (GCC) 4.9.2
Binary Size: 91261
   text    data     bss     dec     hex filename
  31710     732     840   33282    8202 firmware/open_evse/open_evse.arduino.avr.openevse.elf

Platform IO, AVR core 1.6.14

Arduino AVR Version: 1.6.14
GCC Version: avr-gcc (GCC) 4.9.2
Binary Size: 91261
   text    data     bss     dec     hex filename
  31710     732     840   33282    8202 .pio/build/openevse_1-6-14/firmware.elf

Arduino CLI, AVR core 1.6.23

Arduino AVR Version: 1.6.23
GCC Version: avr-gcc (GCC) 5.4.0
Binary Size: 90423
   text    data     bss     dec     hex filename
  31398     742     828   32968    80c8 firmware/open_evse/open_evse.arduino.avr.openevse.elf

Platform IO, AVR core 1.6.23

Arduino AVR Version: 1.6.23
GCC Version: avr-gcc (AVR_8_bit_GNU_Toolchain_3.6.2_1759) 5.4.0
Binary Size: 90423
   text    data     bss     dec     hex filename
  31398     742     828   32968    80c8 .pio/build/openevse_1-6-23/firmware.elf

I think with the platform version fixed in Platform IO, at least on the surface the binaries look identical to the ones produced by equivalent AVR core versions with Arduino IDE/CLI.

jeremypoulter commented 4 years ago

FYI I think this is the diff between Arduino AVR Core 1.6.14 and 1.6.17 https://github.com/arduino/ArduinoCore-avr/compare/9ef763b137012ad333eced410f34acd4df732d9c...5a05bf01f4ffbe16670eb8d713688d059c3bd084#diff-293796aa8902943c0f1a5ff91a5ea0aa

Unfortunately Arduino have not tagged the repo but I think these are the commit hashes of the different releases based on the version number in platform.txt changing:

There are a few compile options that change but Platform IO will not use those anyway so I need to see what the compile options are when building on 1.6.15.

lincomatic commented 4 years ago

Hi, sorry, I've been traveling a lot, so super busy w/ other work. If you want me to merge this, do you mind squashing it first?

jeremypoulter commented 4 years ago

Easiest way is to do that on merge, https://help.github.com/en/articles/about-pull-request-merges#squash-and-merge-your-pull-request-commits, but if you need this done before hand A will create a new PR with a squashed commit.

lincomatic commented 4 years ago

Hi, sorry for the huge delay on this. How do I see how the merge changes the files w/o actually merging the pull request? is there a way to merge this pull request into a new branch cloned from development? or could you just tell me which files it adds? I don't want to include the empty lib/ subdir you have in your branch, for instance.. it's superfluous and confusing to me

jeremypoulter commented 4 years ago

If you use VS Code there is a nice extension for this. To do it with normal Git I think you can do:

git fetch origin pull/108/head:pr_108
git checkout pr_108

See: https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/checking-out-pull-requests-locally

Re the lib directory, that is already on the development branch already. Is something that Platform UI creates automatically, but can be removed and added to the .gitignore file

lincomatic commented 4 years ago

Looks different to me, but I pushed your changes anyway

Your platformio.ini: DATA: [======== ] 76.7% (used 1570 bytes from 2048 bytes) PROGRAM: [==========] 98.5% (used 32282 bytes from 32768 bytes)

Arduino AVR 1.6.15 Sketch uses 32596 bytes (106%) of program storage space. Maximum is 30720 bytes. Global variables use 1572 bytes (76%) of dynamic memory, leaving 476 bytes for local variables. Maximum is 2048 bytes.