Good morning,
I am using ESP-IDF in order to program an Esp32S3 chip.
I would like to place environment variables in my project so that I can use them in my firmware.
For example, I would like to define a "PROJECT_VERSION = 10" environment variable
and use it in the program.
Could you please help me to do it ?
Best regards,
Thomas TRUILHE
Esp32S3 : How to place environment variables in a ESP-IDF project ?
-
- Posts: 229
- Joined: Thu Jul 14, 2022 5:15 am
Re: Esp32S3 : How to place environment variables in a ESP-IDF project ?
You can add custom 'menuconfig' pages containing options/macro definitions you can access from code. Is that what you are looking for?
https://docs.espressif.com/projects/esp ... figuration
Or are you looking to include Unix shell environment variables a'la `-D$(ENV_VAR)` ? I assume you'd just need to pass those in as compiler flags:
https://docs.espressif.com/projects/esp ... ompilation
https://docs.espressif.com/projects/esp ... figuration
Or are you looking to include Unix shell environment variables a'la `-D$(ENV_VAR)` ? I assume you'd just need to pass those in as compiler flags:
https://docs.espressif.com/projects/esp ... ompilation
-
- Posts: 229
- Joined: Thu Jul 14, 2022 5:15 am
Re: Esp32S3 : How to place environment variables in a ESP-IDF project ?
No sorry this is not what I want.
I can see that in Eclipse, in the Run, Run Configuration Menu, and in Environment tab,
I can device some environment variables with their values.
Here is can define for example : SOFTWARE_VERSION = 1.0.0.0.1
However, I do not know, how to access to them into my firmware.
Do you have any idea ?
I can see that in Eclipse, in the Run, Run Configuration Menu, and in Environment tab,
I can device some environment variables with their values.
Here is can define for example : SOFTWARE_VERSION = 1.0.0.0.1
However, I do not know, how to access to them into my firmware.
Do you have any idea ?
Re: Esp32S3 : How to place environment variables in a ESP-IDF project ?
There's likely a better solution than environment variables for storing the software version (for example: IDF can automatically determine project version from Git tags). However if you have decided to use environment variables, you can pass their values to the compiler as described in this thread: viewtopic.php?f=13&t=30196
Who is online
Users browsing this forum: nopnop2002 and 63 guests