-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Unable to compile arduino as idf component #5319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
How |
|
issue happens with arduino loop() or app_main with clinkage Arduino Revision: 21947eb edit: arduino revision |
can you please create a minimal example project (exclude the arduino component) zip and upload it here? |
hi @me-no-dev thank you for your reply. esptool.py v3.1-dev
|
I can confirm that using |
this is really confusing... why there is no issue calling |
@tsctrl you've gone all wild with the extern "C" into the files :D You can call WiFi.begin inside the component, as long as you call any WiFi function in the main component. Sounds strange but it works :) |
That make sense sort of. |
@tsctrl here is your sample project cleaned and working |
Alright :) here is the fix: set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY LINK_INTERFACE_MULTIPLICITY 3) End result should look something like: idf_component_register(
SRCS "component2.cpp"
INCLUDE_DIRS "include"
REQUIRES arduino-esp32
)
set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY LINK_INTERFACE_MULTIPLICITY 3) There is some effort to make this line not required, but for right now, this is a solution :) |
thanks @me-no-dev |
hi, few more wish to have to this: i hope that arduino as component can be initialize as previous setup, without depending on setup and loop function. the loop and setup should be optional. i am not using setup and loop as it require additional larga stack. its looks redundant on top of the main task with existing stack as we could run while(;;) loop in it. should have the ability to disable the stack on top of the auto start loop in config. i never got issue running while loop in the main function so not sure adding setup and loop add benefits per ram usage that required. the new changes where loop is extern c also not favorable to me. its add limits then the user add the extern them self. cc, @me-no-dev thanks. |
@tsctrl do you have |
Until this commit, Kconfig options (e.g. CONFIG_TINYUSB_ENABLED) were used in conditions preceding idf_component_register to determine which components need to be added to `arduino` component requirements. However the Kconfig options aren't known at the early expansion stage, when the component CMakeLists.txt files are expanded the first time and requirements are evaluated. So all the conditions evaluated as if the options were not set. This commit changes the logic to only add these components as dependencies when the Kconfig options are known. Dependencies become "weak", which means that if one of the components isn't included into the build for some reason, it is not added as a dependency. This may happen, for example, if the component is not present in the `components` directory or is excluded by setting `COMPONENTS` variable in the project CMakeLists.txt file. This also ensures that if the component is not present, it will not be added as a dependency, and this will allow the build to proceed. Follow-up to #5391. Closes #5319.
Until this commit, Kconfig options (e.g. CONFIG_TINYUSB_ENABLED) were used in conditions preceding idf_component_register to determine which components need to be added to `arduino` component requirements. However the Kconfig options aren't known at the early expansion stage, when the component CMakeLists.txt files are expanded the first time and requirements are evaluated. So all the conditions evaluated as if the options were not set. This commit changes the logic to only add these components as dependencies when the Kconfig options are known. Dependencies become "weak", which means that if one of the components isn't included into the build for some reason, it is not added as a dependency. This may happen, for example, if the component is not present in the `components` directory or is excluded by setting `COMPONENTS` variable in the project CMakeLists.txt file. This also ensures that if the component is not present, it will not be added as a dependency, and this will allow the build to proceed. Follow-up to #5391. Closes #5319.
…5404) Until this commit, Kconfig options (e.g. CONFIG_TINYUSB_ENABLED) were used in conditions preceding idf_component_register to determine which components need to be added to `arduino` component requirements. However the Kconfig options aren't known at the early expansion stage, when the component CMakeLists.txt files are expanded the first time and requirements are evaluated. So all the conditions evaluated as if the options were not set. This commit changes the logic to only add these components as dependencies when the Kconfig options are known. Dependencies become "weak", which means that if one of the components isn't included into the build for some reason, it is not added as a dependency. This may happen, for example, if the component is not present in the `components` directory or is excluded by setting `COMPONENTS` variable in the project CMakeLists.txt file. This also ensures that if the component is not present, it will not be added as a dependency, and this will allow the build to proceed. Follow-up to #5391. Closes #5319.
hi @igrr yup, i disable the auto start and i guess it does not register the task and did not run any initialization. but still, there is arduino stack size option in the config. i an able to reduce the size but just hope it does not impacting any functionality. |
If autostart option is disabled then no stack is created by Arduino core. We can make this Kconfig option hidden when autostart is disabled, so it doesn't confuse anybody. |
Hardware:
Board: ESP32 Dev Module
Core Installation version: ESP-IDF v4.4-dev-1594-g1d7068e4b-dirty
IDE name: IDF component
Flash Frequency: 40Mhz
PSRAM enabled: no
Upload Speed: 115200
Computer OS: Windows 10
Description:
Unable to compile arduino as idf component.
I am doing library update from 4.2 to the current master 4.4 for idf and arduino but having issue with the arduino esp32 lib to compile with error:
I am able to replicate this issue using simple blink project with one additional idf components.
Arduino WiFi / Server need to be call from idf component cpp file.
Step to reproduce:
Observation:
can compile and Serial.println works in main files, also work if added from component.
compile failed if i add WiFi.begin() in the component files.
This issue not happening on the 4.2 release
build the project with error as below:
edit: some correction and formatting.
thanks!
The text was updated successfully, but these errors were encountered: