Arduino as component PlatformIO, Arduino.h not found

Clickau
Posts: 4
Joined: Thu Jan 02, 2020 9:55 pm

Arduino as component PlatformIO, Arduino.h not found

Postby Clickau » Tue Aug 18, 2020 9:32 pm

I have a project built using the Arduino framework and PlatformIO. I want to get rid of setup and loop, so I'm trying to make the project use the esp-idf and Arduino as a component. After adding "framework = espidf, arduino" to platformio.ini, the compiler can't find Arduino.h. I tried adding defines to sdkconfig.h but it doesn't help.
#define CONFIG_ENABLE_ARDUINO_DEPENDS 1
#define CONFIG_AUTOSTART_ARDUINO 0
#define CONFIG_ARDUINO_RUN_NO_AFFINITY 1
#define CONFIG_ARDUINO_RUNNING_CORE -1
#define CONFIG_ARDUINO_EVENT_RUN_NO_AFFINITY 1
#define CONFIG_ARDUINO_EVENT_RUNNING_CORE -1
#define CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL 1
Help would be appreciated.

Clickau
Posts: 4
Joined: Thu Jan 02, 2020 9:55 pm

Re: Arduino as component PlatformIO, Arduino.h not found

Postby Clickau » Sun Aug 23, 2020 6:05 pm

Ok, I solved it by adding

Code: Select all

platform_packages =
  ; use a special branch
  framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#idf-release/v4.0
to platformio.ini along with 'framework = espidf, arduino' and creating a sdkconfig.defaults file in the root of the project containing arduino config

Code: Select all

# Override some defaults to enable Arduino framework
CONFIG_ENABLE_ARDUINO_DEPENDS=y
CONFIG_AUTOSTART_ARDUINO=n
CONFIG_ARDUINO_RUN_CORE1=y
CONFIG_ARDUINO_RUNNING_CORE=1
CONFIG_ARDUINO_EVENT_RUN_CORE1=y
CONFIG_ARDUINO_EVENT_RUNNING_CORE=1
CONFIG_ARDUINO_UDP_RUN_CORE1=y
CONFIG_ARDUINO_UDP_RUNNING_CORE=1
CONFIG_DISABLE_HAL_LOCKS=n
CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_ERROR=y
CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL=1
CONFIG_ARDUHAL_PARTITION_SCHEME_DEFAULT=y
CONFIG_ARDUHAL_PARTITION_SCHEME="default"
CONFIG_MBEDTLS_PSK_MODES=y
CONFIG_MBEDTLS_KEY_EXCHANGE_PSK=y

Who is online

Users browsing this forum: No registered users and 63 guests