WelterRocks / WESPOTA

WESPOTA is a Sonoff-Tasmota fork, designed to support as many devices as possible, not only Sonoff and equivalent.
GNU General Public License v3.0
15 stars 0 forks source link

revision of building automation #22

Open wolfgangr opened 5 years ago

wolfgangr commented 5 years ago

Current build management with platformIO is quite opaque. PlatformIO seems to be a moving target and not yet matured. A closer-to-metal approach might be preferrable.

While the editing features of PIO are great, it is hard to achieve a fine control of the build process for non standard arduino constructions. Git control of the build process is limited.

There is a makefile available for the EspArduino framework https://github.com/plerup/makeEspArduino It still can manage builds automagically and use the same directory structure than ArduinoIDE or PlatformIO. However, special needs can be control by overriding variables and/or including own makefiles. It has to be tested whether platformIO is able to cope with elaborated build controls based on the arduino makefile. This would allow the goodies of both words.

As an alternative, we might consider writing an own makefile from bottom up., to gain full control. This will require considerable work and test, however.

wolfgangr commented 5 years ago

The topic has been adressed in other issues alredy: https://github.com/VerboteneZone/WESPOTA/issues/14#issuecomment-455869951 https://github.com/VerboteneZone/WESPOTA/issues/11#issuecomment-455870887

wolfgangr commented 5 years ago

@VerboteneZone Hello, Oliver, I hope you are quite well. Have you settled on the question of build management? I'd try to start merging forth into our codebase, as far as my time the next days will allow.

wolfgangr commented 5 years ago

just issued a make flash and got a LED blinking on a nodemcu 1.0. no Arduino IDE, no platformIO :-)

Prerequesites:

this is my experimental Makefile

# Wolfgang Rosner
# 2019-01-25
# try to get a make based arduino build

# CHIP = esp8266
# nodemcuv2.name=NodeMCU 1.0 (ESP-12E Module)
BOARD = nodemcuv2
# UPLOAD_PORT=/dev/tty/USB0
SKETCH=main.cpp

BUILD_ROOT = ./build
BUILD_DIR  = $(BUILD_ROOT)/bin

# ESPTOOL = /usr/local/bin/esptool.py
# ESPTOOL = $(HOME)/.local/bin/esptool.py 
ESPTOOL = /usr/bin/esptool

include ~/makeEspArduino/makeEspArduino.mk

So instead of calling a bunch of cmdline parameters as the instruction says, I put these in my local makefile and call the arduino automagics at the end. So I might put anything before, I think, which requires special attention and does not fit into the arduino scheme.

wolfgangr commented 5 years ago

Next step was to try to include cfort into the arduino framework.

 tree -L 2
.
├── build
│   ├── bin
│   └── main.elf -> bin/main.elf
├── cforth
│   ├── build
│   ├── LICENSE
│   ├── README
│   ├── README.md
│   └── src
├── ESP8266_NONOS_SDK
│   ├── bin
│   ├── documents
│   ├── driver_lib
│   ├── examples
│   ├── include
│   ├── ld
│   ├── lib
│   ├── License
│   ├── Makefile
│   ├── README.md
│   ├── third_party
│   ├── tools
│   └── VERSION
├── include
│   └── ESPextra
├── main.cpp
└── Makefile

I get weir'd build errors from the included projects. Tried to fix them by adding missing includes, but then I get errors from the arduino tree. The errors continue, even if I do not call the makefile of the included subprojects (ESP and cforth in this case). So it looks like the arduino makefile greedily tries to build anything it can find in its subdirectorires, whitout beeing properly configured to do so. Can I configure that away? Or do I have to move the subprojects out of the arduino tree?