Comments (12)
Configuration of sdkconfig is much different for native, is this OK?
IMO, we should try to unify these.
By the way, I think there is a small issue here and the user-defined sdkconfig / sdkconfig.defaults is not really picked up. I'll contribute a small fix in the next days (working on making the native build working with ESP-IDF master
ATM)
Currently no tools like cargo pio espidf exist for the native, should we add an equivalent tool before we set it as default?
IMO we do need at least the menuconfig
tool, so that the user can visually configure the sdkconfig
file (separately for debug vs release).
Second priority (but still very useful) would be support for the ESP-IDF monitor, as it is capable of properly decrypting panic backtraces even for RiscV chips.
from esp-idf-sys.
Small status update for this issue
- I tried writing my own
crate
for downloading and unpacking tools here but I wasn't really satisfied with what I came up with and it also seems overkill right now. - I've also looked a little bit into
idf-env
, but it seems difficult to use this instead of directly usingidf_tools.py
. As it's a binary crate (depending on binary crates is currently unstable) we would need to publishidf-env
as a library tocrates.io
. Additionally, it would mean more research into the code-base and many more dependencies for the end-user. - In the meantime (until I find a better solution), I will just move my install logic from the
esp-idf-sys
' native build script to a newespidf
module inembuild
and abuseidf-tools.py
to install custom tools that we need (with a customtools.json
). I'm moving this logic to embuild, so that we have a more or less general solution to detecting installedesp-idf
tools and theesp-idf
itself. This allows us then create a tool similar tocargo-pio
.
from esp-idf-sys.
- In the meantime (until I find a better solution), I will just move my install logic from the
esp-idf-sys
' native build script to a newespidf
module inembuild
and abuseidf-tools.py
to install custom tools that we need (with a customtools.json
). I'm moving this logic to embuild, so that we have a more or less general solution to detecting installedesp-idf
tools and theesp-idf
itself. This allows us then create a tool similar tocargo-pio
.
I agree with that plan.
Note that in the long term we still might have to reconsider depending on a library incarnation of idf-env
, because - if I understood correctly - the plan of Espressif is to gradually retire idf-tools.py
& other installer logic which is currently in Python/scripts in favor of a Rust-based solution.
from esp-idf-sys.
Configuration of sdkconfig
and sdkconfig.defaults
We have to find a consensus as to what the way to configure these is. I believe my way (setting ESP_IDF_SDKCONFIG
and ESP_IDF_SDKCONFIG_DEFAULTS
) makes the most sense and follows the way they are configured for the esp-idf itself (minus the ESP_IDF_
prefix). I'm not sure though how applicable this approach is to the pio
build.
Please tell me what you think?
from esp-idf-sys.
Configuration of
sdkconfig
andsdkconfig.defaults
We have to find a consensus as to what the way to configure these is. I believe my way (setting
ESP_IDF_SDKCONFIG
andESP_IDF_SDKCONFIG_DEFAULTS
) makes the most sense and follows the way they are configured for the esp-idf itself (minus theESP_IDF_
prefix). I'm not sure though how applicable this approach is to thepio
build.Please tell me what you think?
How would you copy and track the custom partition table when there is one? The PlatformIO mechanism is generic for these reasons precisely - as there might be multiple things you might want to shuffle into the native PlatformIO project prior to building.
from esp-idf-sys.
How would you copy and track the custom partition table when there is one? The PlatformIO mechanism is generic for these reasons precisely - as there might be multiple things you might want to shuffle into the native PlatformIO project prior to building.
That is indeed a good question.
If it's just the partition table, which as far as I know, is only used at the end of the build for size checking and then to flash its binary version. And since we have a dummy project which doesn't actually use anything from the esp-idf, the compiled size is almost zero, so the size check should really always pass.
So if what is said is the case, a custom partition table should be irrelevant for esp-idf-sys (and the compilation of the esp-idf).
But besides that, are there other things other than the sdkconfig and partition table that the esp-idf needs and that are critical for the compilation of the esp-idf?
from esp-idf-sys.
Well, if the partition table CSV file is really only used (in our case) for size check comparisons, then the partition table problem is solved.
The PIO builder does use the generic glob
-based copying mechanism internally to patch the ESP-IDF itself (the story is a bit complicated), and I would actually like to preserve the glob functionality, because the PIO builder can also be used to drive a cargo-first build for non-esp-idf-sys
and non-ESP-IDF projects too, where generic glob-based copying might be useful.
But we can always layer your set of variables on top of my PIO glob patterns and this way achieve parity between the two builders. One annoying complication is that regarding sdkconfig
, PIO actually uses two separate files:
sdkconfig.release
and sdkconfig.debug
- depending on what type of build you are performing. But I think I can hide this somehow behind the scenes.
As for other files that we might have to contribute to the ESP-IDF build... not sure. I couldn't find others, but I could've missed something.
from esp-idf-sys.
The PIO builder does use the generic glob-based copying mechanism internally to patch the ESP-IDF itself (the story is a bit complicated), and I would actually like to preserve the glob functionality, because the PIO builder can also be used to drive a cargo-first build for non-esp-idf-sys and non-ESP-IDF projects too, where generic glob-based copying might be useful.
I agree we shouldn't remove the glob functionality. Maybe in the future, the esp-idf needs some other custom files why by that mechanism can easily be added to its build. (So lets add this mechanism to the native build too)
But we can always layer your set of variables on top of my PIO glob patterns and this way achieve parity between the two builders.
Does the esp-idf pio platform not support giving the sdkconfig
and sdkconfig.defaults
as paths? Because if it does we could do this instead of copying like I'm doing with the native build.
If it doesn't support this:
Because the sdkconfig
is such a common file that really everyone that does something non-trivial needs to change, my proposal would be to special-case these files. Meaning, instead of using the glob mechanism for copying these, we can instead add some logic that just looks at the ESP_IDF_SDKCONFIG
and ESP_IDF_SDKCONFIG_DEFAULTS
variables and specially copies these files into the pio project.
I think for the sdkconfig
having a special way to set it makes more sense than using glob to copy it. This way we can also just set the paths to these files if the build system supports it.
One annoying complication is that regarding
sdkconfig
, PIO actually uses two separate files:sdkconfig.release
andsdkconfig.debug
- depending on what type of build you are performing. But I think I can hide this somehow behind the scenes.
Wouldn't this feature also be nice to have in the native
build?
But also the whole build type opens another can of worms that we should really address before setting the native
build as default. Currently, we have two independent settings that determine the optimization level:
-
The cargo profile
It is used by the
cmake
crate to determine whichCMAKE_BUILD_TYPE
it should set. CMake then uses this to add the appropriate compiler flags. (Note: That this also affects the bootloader build, which isn't ideal) -
CONFIG_COMPILER_OPTIMIZATION
configured in thesdkconfig
This is separate from CMake's mechanism and depending and this optimization flags will also be added in addition to the above.
So, my idea would be to use the cargo profile settings to determine the CONFIG_COMPILER_OPTIMIZATION
or use any configured in the user-supplied sdkconfig
. And use the cargo profile name to determine which sdkconfig.<profile>
to use, like pio. Finally, we should prevent the cmake
crate from setting a CMAKE_BUILD_TYPE
to stop interfering with the bootloader optimization configuration in the sdkconfig
and as it is already configured in the sdkconfig
.
from esp-idf-sys.
@ivmarkov Any comments on this?
If not, I'll whip up an implementation of this.
from esp-idf-sys.
The PIO builder does use the generic glob-based copying mechanism internally to patch the ESP-IDF itself (the story is a bit complicated), and I would actually like to preserve the glob functionality, because the PIO builder can also be used to drive a cargo-first build for non-esp-idf-sys and non-ESP-IDF projects too, where generic glob-based copying might be useful.
I agree we shouldn't remove the glob functionality. Maybe in the future, the esp-idf needs some other custom files why by that mechanism can easily be added to its build. (So lets add this mechanism to the native build too)
+1
But we can always layer your set of variables on top of my PIO glob patterns and this way achieve parity between the two builders.
Does the esp-idf pio platform not support giving the
sdkconfig
andsdkconfig.defaults
as paths? Because if it does we could do this instead of copying like I'm doing with the native build.
Not that I'm aware of. Maybe I'm missing something, but unlikely. FYI, the black magic PlatformIO does on top of ESP-IDF is here, in their "espressif32" "platform".
If it doesn't support this:
Because the
sdkconfig
is such a common file that really everyone that does something non-trivial needs to change, my proposal would be to special-case these files. Meaning, instead of using the glob mechanism for copying these, we can instead add some logic that just looks at theESP_IDF_SDKCONFIG
andESP_IDF_SDKCONFIG_DEFAULTS
variables and specially copies these files into the pio project.
I'm fine with that. In fact, you might re-use the glob mechanism to copy the files as well, but actually up to you.
I think for the
sdkconfig
having a special way to set it makes more sense than using glob to copy it. This way we can also just set the paths to these files if the build system supports it.One annoying complication is that regarding
sdkconfig
, PIO actually uses two separate files:sdkconfig.release
andsdkconfig.debug
- depending on what type of build you are performing. But I think I can hide this somehow behind the scenes.Wouldn't this feature also be nice to have in the
native
build?
My only concern is that it is not very "ESP-IDFy". And, I don't see a similar mechanism in PIO for sdkconfig.defaults
.
I'm actually OK to stick with plain sdkconfig
as well, but then we have to touch cargo pio espidf menuconfig
as well - and - if you feel sdkconfig.debug|release
has benefits in the native world as well, I'm fine with that.
But also the whole build type opens another can of worms that we should really address before setting the
native
build as default. Currently, we have two independent settings that determine the optimization level:
- The cargo profile
It is used by thecmake
crate to determine whichCMAKE_BUILD_TYPE
it should set. CMake then uses this to add the appropriate compiler flags. (Note: That this also affects the bootloader build, which isn't ideal)CONFIG_COMPILER_OPTIMIZATION
configured in thesdkconfig
This is separate from CMake's mechanism and depending and this optimization flags will also be added in addition to the above.So, my idea would be to use the cargo profile settings to determine the
CONFIG_COMPILER_OPTIMIZATION
or use any configured in the user-suppliedsdkconfig
. And use the cargo profile name to determine whichsdkconfig.<profile>
to use, like pio. Finally, we should prevent thecmake
crate from setting aCMAKE_BUILD_TYPE
to stop interfering with the bootloader optimization configuration in thesdkconfig
and as it is already configured in thesdkconfig
.
I'm OK with that too.
from esp-idf-sys.
@ivmarkov Any comments on this?
If not, I'll whip up an implementation of this.
I don't have strong feelings/disagreements with any of your statements from above, so by all means - go ahead.
from esp-idf-sys.
573bcc6 made native
the default.
from esp-idf-sys.
Related Issues (20)
- Failing to add mdns remote component HOT 4
- How to allocate a vector or array in PSRAM HOT 4
- backtrace (of rust code) is incomplete on esp32c6 HOT 17
- Integration with `bevy_ecs` - linker failure `pthread_setcancelstate is not implemented` HOT 5
- Do Rust Native Queues and Mutexes Properly Suspend Tasks HOT 3
- Misaligned struct pointer from esp camera HOT 22
- could not identify the root crate and `ESP_IDF_SYS_ROOT_CRATE` not specified HOT 2
- Time for `espidf_time32`? HOT 4
- Trying to set CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=1 not working HOT 2
- esp-idf-sys HOT 1
- esp-idf-sys build started fail on arm mac os HOT 20
- Unable to build on Mac M1 HOT 1
- ...no 'IDF_PYTHON_ENV_PATH' item,Debian 12, std mode, esp-idf-template, idf master HOT 4
- Windows path length message is wrong. HOT 1
- tskNO_AFFINITY missing with esp-idf v5.2.1 HOT 1
- Using custom components introduces a requirement of specifying all components HOT 7
- failed to run custom build command for `esp-idf-sys v0.34.1` HOT 1
- Wrapper for RTC Slow memory HOT 2
- Implementing tinyusb callbacks in rust HOT 1
- Use of mixed i2c legacy and new apis HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from esp-idf-sys.