Hi!
Below is a screenshot of my 2 files, I have a working project but want to define the flag “HARDWARE_VERSION” from the outside.
On the right i got the ini file setting the flags as per the docs, but every time i build the project the error is thrown.
The left file is under include\CONFIGURATION.hpp (i set a lot of pin flags here)
the src/include folders are all default.
I googled for like 3 hours but all i can find is people asking “how to do this?” and the answer is always use “build_flags” but i haven’t found anyone where this just doesn’t produce the desired result…
The build_flags
of selectionDev
overwrite the definition of build_flags
in env
.
You have to do the interpolation correctly so that you have the sum of both flags.
https://docs.platformio.org/en/latest/projectconf/interpolation.html
1 Like
Ok, i thougtht they’d do that automatically ?
Edit: They don’t i just misread
Documentation here Section [env] — PlatformIO latest documentation
Adding this definition would result in:
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env]
platform = espressif32
board = esp-wrover-kit
framework = espidf
monitor_speed = 115200
monitor_filters = esp32_exception_decoder
board_build.partitions = partition_table.csv
build_flags =
-D CONFIG_SPIRAM_CACHE_WORKAROUND
-D SOFTWARE_VERSION=10
-D HARDWARE_VERSION=3
upload_port = /dev/ttyUSB*
monitor_port = /dev/ttyUSB*
[env:selectionDev]
build_type = debug
build_flags =
${env.build_flags}
'-D BACKEND_SERVER=\\"http:192.168.0.173:8081\\"'
-D DEV_MODE
-E
[env:selectionProd]
build_type = release
build_flags =
${env.build_flags}
'-D BACKEND_SERVER=\\"https://\\"'
but the end result when building is the same, still undefined
Well the screenshot is also complaining about "missing terminating "
so let’s rewrite the string constant to how the docs says it
replace that with
'-D BACKEND_SERVER="http:192.168.0.173:8081"'
Yeah but that section of the docs deals with strings in particular, which isn’t what I need here anyways… I am not even using that variable.
I removed it now but the end result is the same either way.
Okay but… you only define HARDWARE_VERSION
, not CONFIG_HARDWARE_VERSION
, so that that isn’t found is understandable.
Usually CONFIG_
macros are generated from settings in the menuconfig.
1 Like
Oh good god i am stupid, ok thanks!
So my error was just the incorrect merging of the environments.
I first thought that maybe the macros got the CONFIG_ automatically, but this makes a lot more sense.
Thanks a lot for your help !