diff --git a/examples/zephyr_example/boards/esp32_devkitc_wrover.overlay b/examples/zephyr_example/boards/esp32_devkitc_wrover.overlay deleted file mode 100644 index c028c9d..0000000 --- a/examples/zephyr_example/boards/esp32_devkitc_wrover.overlay +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2022 Espressif Systems (Shanghai) Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include - -/ { - aliases { - en = &en_button; - boot = &boot_button; - uart = &uart1; - }; - - gpio_keys { - compatible = "gpio-keys"; - en_button: en_button { - gpios = <&gpio0 2 (GPIO_PULL_UP | GPIO_ACTIVE_HIGH)>; - }; - boot_button: boot_button { - gpios = <&gpio0 4 (GPIO_PULL_UP | GPIO_ACTIVE_HIGH)>; - }; - }; -}; - -&uart1 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart1_default>; - pinctrl-names = "default"; -}; diff --git a/examples/zephyr_example/boards/esp32_devkitc_wroom.overlay b/examples/zephyr_example/socs/esp32_procpu.overlay similarity index 55% rename from examples/zephyr_example/boards/esp32_devkitc_wroom.overlay rename to examples/zephyr_example/socs/esp32_procpu.overlay index c028c9d..b4e9a7e 100644 --- a/examples/zephyr_example/boards/esp32_devkitc_wroom.overlay +++ b/examples/zephyr_example/socs/esp32_procpu.overlay @@ -1,13 +1,9 @@ /* - * Copyright (c) 2022 Espressif Systems (Shanghai) Co., Ltd. + * Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. * * SPDX-License-Identifier: Apache-2.0 */ -#include -#include -#include - / { aliases { en = &en_button; @@ -28,7 +24,4 @@ &uart1 { status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart1_default>; - pinctrl-names = "default"; }; diff --git a/examples/zephyr_example/src/main.c b/examples/zephyr_example/src/main.c index ad6afad..f515411 100644 --- a/examples/zephyr_example/src/main.c +++ b/examples/zephyr_example/src/main.c @@ -45,17 +45,17 @@ int main(void) if (!device_is_ready(esp_uart_dev)) { printk("ESP UART not ready"); - return; + return -ENODEV; } if (!device_is_ready(esp_boot_spec.port)) { printk("ESP boot GPIO not ready"); - return; + return -ENODEV; } if (!device_is_ready(esp_enable_spec.port)) { - printk("Bluetooth Enable GPIO not ready"); - return; + printk("ESP enable GPIO not ready"); + return -ENODEV; } gpio_pin_configure_dt(&esp_boot_spec, GPIO_OUTPUT_ACTIVE); @@ -63,7 +63,7 @@ int main(void) if (loader_port_zephyr_init(&config) != ESP_LOADER_SUCCESS) { printk("ESP loader init failed"); - return; + return -EIO; } if (connect_to_target(HIGHER_BAUDRATE) == ESP_LOADER_SUCCESS) { diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index 13548ca..031c174 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -1,24 +1,26 @@ cmake_minimum_required(VERSION 3.5) if (CONFIG_ESP_SERIAL_FLASHER) - zephyr_include_directories( - "${ZEPHYR_CURRENT_MODULE_DIR}/include" - "${ZEPHYR_CURRENT_MODULE_DIR}/port" - "${ZEPHYR_CURRENT_MODULE_DIR}/private_include" - ) zephyr_interface_library_named(esp_flasher) zephyr_library() - zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/src/esp_loader.c - ${ZEPHYR_CURRENT_MODULE_DIR}/src/esp_targets.c - ${ZEPHYR_CURRENT_MODULE_DIR}/src/esp_stubs.c - ${ZEPHYR_CURRENT_MODULE_DIR}/src/protocol_common.c - ${ZEPHYR_CURRENT_MODULE_DIR}/src/protocol_uart.c - ${ZEPHYR_CURRENT_MODULE_DIR}/src/slip.c - ${ZEPHYR_CURRENT_MODULE_DIR}/src/md5_hash.c - ${ZEPHYR_CURRENT_MODULE_DIR}/port/zephyr_port.c + zephyr_include_directories( + ${ZEPHYR_CURRENT_MODULE_DIR}/private_include + ${ZEPHYR_CURRENT_MODULE_DIR}/include + ${ZEPHYR_CURRENT_MODULE_DIR}/port + ) + + zephyr_library_sources( + ${ZEPHYR_CURRENT_MODULE_DIR}/src/esp_loader.c + ${ZEPHYR_CURRENT_MODULE_DIR}/port/zephyr_port.c + ${ZEPHYR_CURRENT_MODULE_DIR}/src/esp_targets.c + ${ZEPHYR_CURRENT_MODULE_DIR}/src/esp_stubs.c + ${ZEPHYR_CURRENT_MODULE_DIR}/src/protocol_common.c + ${ZEPHYR_CURRENT_MODULE_DIR}/src/protocol_uart.c + ${ZEPHYR_CURRENT_MODULE_DIR}/src/slip.c + ${ZEPHYR_CURRENT_MODULE_DIR}/src/md5_hash.c ) target_compile_definitions(esp_flasher INTERFACE SERIAL_FLASHER_INTERFACE_UART)