From 1823ac47c676d995f20bd45baadb66c4a82bb8ca Mon Sep 17 00:00:00 2001 From: Ayush Singh Date: Sat, 25 May 2024 19:04:51 +0530 Subject: [PATCH] Add ARDUINO_ENTRY config variable - Controls if arduino entry functions (setup and loop) wrapper is provided - Useful for porting programs since while it might need Arduino APIs, but don't really need setup and loop structure. - Also useful for slowly migrating to Zephyr APIs Signed-off-by: Ayush Singh --- Kconfig | 4 ++++ cores/arduino/CMakeLists.txt | 3 +++ 2 files changed, 7 insertions(+) diff --git a/Kconfig b/Kconfig index 64ccf3a8..27f9fb3c 100644 --- a/Kconfig +++ b/Kconfig @@ -26,4 +26,8 @@ config ARDUINO_API_SERIAL_BUFFER_SIZE int "Buffer size for Arduino Serial API" default 64 +config ARDUINO_ENTRY + bool "Provide arduino setup and loop entry points" + default y + endif diff --git a/cores/arduino/CMakeLists.txt b/cores/arduino/CMakeLists.txt index b3b1af15..193fd3c1 100644 --- a/cores/arduino/CMakeLists.txt +++ b/cores/arduino/CMakeLists.txt @@ -7,7 +7,10 @@ if(NOT DEFINED ARDUINO_BUILD_PATH) zephyr_sources(zephyrPrint.cpp) zephyr_sources(zephyrSerial.cpp) zephyr_sources(zephyrCommon.cpp) + +if(DEFINED CONFIG_ARDUINO_ENTRY) zephyr_sources(main.cpp) +endif() endif()