I have a sketch which requires more main task stack, i.e. I want to override CONFIG_ESP_MAIN_TASK_STACK_SIZE to be 8192 rather than 4096.
I want to do that for this specific sketch, I do not want to change the global value in the main sdkconfig file.
Is there a way to either (a) provide a specific sdkconfig file with this sketch or (b) override the value of CONFIG_ESP_MAIN_TASK_STACK_SIZE from the command-line (I am using arduino-cli for my builds)?
Provide sdkconfig with sketch
-
- Posts: 9730
- Joined: Thu Nov 26, 2015 4:08 am
Re: Provide sdkconfig with sketch
I don't think it's overridable in Arduino, but a workaround would be to use the main task to simply start up a new 'main' task that does the actual work, then use vTaskDelete to kill the original main task. As you start the new 'main' task yourself, you can specify the amount of stack it uses.
Re: Provide sdkconfig with sketch
Understood, that's what I was going to do, just seems a bit of a shame to have to do it that way. I was wondering if I could put a copy of sdkconfig.h somewhere inside the application directory which would be picked in preference to the default.
Re: Provide sdkconfig with sketch
I struggled with the same stack size problem posted here: https://community.platformio.org/t/how- ... e/22769/18
But since I am on Platformio (highly recommended over Arduino!) the solution is easy. Simply add:
to pio's config file "platformio.ini".
Since this config is activated first before the sdkconfig is called, you need to add this to the sdkconfig:
With my ESP32 the default size is 8096.
But since I am on Platformio (highly recommended over Arduino!) the solution is easy. Simply add:
Code: Select all
build_flags =
-D CONFIG_ARDUINO_LOOP_STACK_SIZE=33333
Since this config is activated first before the sdkconfig is called, you need to add this to the sdkconfig:
Code: Select all
#ifndef CONFIG_ARDUINO_LOOP_STACK_SIZE
#define CONFIG_ARDUINO_LOOP_STACK_SIZE 8192
#endif
Re: Provide sdkconfig with sketch
Oh no, another wrapper to get us closer to what we had before with Make and CMake !
That's an interesting suggestion but unfortunately the reason we're adding support for Arduino is because we have one or more customers that use the Arduino IDE, and I guess wouldn't want to switch to using PlatformIO on top instead. In other words we're only contributing "driver" code, we aren't able to control what is above us. Since we're actually using arduino-cli for our testing we could pass a build flag in that way, as you have done, but of course we'd need to modify the single global sdkconfig as you have described and, again, that is really our customer's thing, it's not "ours", IYSWIM.
Personally it seems like Arduino makes things easier for anyone who doesn't know much about software but only for about 6 months: after 6 months they will find that they need the things that might have seemed complicated at first, which Arduino doesn't offer, and will end up having to switch to something rather more normal. Much better to bite the bullet and be normal from the outset. Easy for me to say of course...
That's an interesting suggestion but unfortunately the reason we're adding support for Arduino is because we have one or more customers that use the Arduino IDE, and I guess wouldn't want to switch to using PlatformIO on top instead. In other words we're only contributing "driver" code, we aren't able to control what is above us. Since we're actually using arduino-cli for our testing we could pass a build flag in that way, as you have done, but of course we'd need to modify the single global sdkconfig as you have described and, again, that is really our customer's thing, it's not "ours", IYSWIM.
Personally it seems like Arduino makes things easier for anyone who doesn't know much about software but only for about 6 months: after 6 months they will find that they need the things that might have seemed complicated at first, which Arduino doesn't offer, and will end up having to switch to something rather more normal. Much better to bite the bullet and be normal from the outset. Easy for me to say of course...
Re: Provide sdkconfig with sketch
It appears that adopting @ESP_Sprite's solution is the best way forward, this one can be considered resolved.
Who is online
Users browsing this forum: Majestic-12 [Bot] and 86 guests