Go Down

Topic: Add "variant" to the g++ recipe  (Read 8353 times) previous topic - next topic


The boards.txt variant is used to name the binary when using sketch/Export compiled binary.

When using the ESP8266 core, and ESP8266httpUpdate the sketch can request an OTA update from a remote server, but it needs to know the name of the binary to ask for...

At the moment I have to rename all my binaries after exporting them to my update server, which is tedious and error prone. When asking for the remote file, the best I can do automatically is use the ARDUINO_BOARD define. Sometimes this is not "granular" enough and I would like the sketch to know its own variant at compile time, to avoid all the renaming and allow automatic unattended updates by just dragging the latest exported binary to my update server.

I have tested adding it to the platforms.txt file with no apparent side-effects and it works fine!
Code: [Select]

## Compile c++ files
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpreprocessor.flags} {compiler.cpp.flags} -D{build.sdk}=1 -DF_CPU={build.f_cpu} {build.lwip_flags} {build.debug_port} {build.debug_level} -DVARIANT={build.variant} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BOARD="{build.board}" {build.led} {build.flash_flags} {compiler.cpp.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"

As this is such a tiny change, could we add it to the next release please?

Phil Bowles

Go Up