diff --git a/.clang-format b/.clang-format index eb964b4..fd84a72 100644 --- a/.clang-format +++ b/.clang-format @@ -2,7 +2,7 @@ BasedOnStyle: Google IndentWidth: 4 AlignConsecutiveMacros: AcrossEmptyLines AlignConsecutiveDeclarations: Consecutive -AlignConsecutiveAssignments: AcrossEmptyLinesAndComments +AlignConsecutiveAssignments: Consecutive AllowShortFunctionsOnASingleLine: None BreakBeforeBraces: Custom BraceWrapping: diff --git a/.gitmodules b/.gitmodules index e0a5390..5256334 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "lib/freertos"] path = lib/freertos url = https://github.com/FreeRTOS/FreeRTOS-Kernel.git +[submodule "lib/esp_nano_hosted"] + path = lib/esp_nano_hosted + url = https://git.minori.work/Embedded_Drivers/esp_nano_hosted.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 216a189..eb0cdfa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,7 +87,7 @@ set(TARGET_C_INCLUDES # Shared libraries linked with application set(TARGET_LIBS "c" - "esp_hosted" + "esp_nano_hosted" "freertos_kernel" "fro_calib_hardabi" "m" @@ -118,8 +118,7 @@ set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS} -x assembler-with-cpp") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections") # Submodules -set(ESP_HOSTED_PORT_INCLUDES "${CMAKE_SOURCE_DIR}/lib/esp_hosted/nxp/include" CACHE STRING "") -add_subdirectory(lib/esp_hosted) +add_subdirectory(lib/esp_nano_hosted) add_library(freertos_config INTERFACE) target_include_directories(freertos_config SYSTEM INTERFACE include) diff --git a/lib/esp_hosted/CMakeLists.txt b/lib/esp_hosted/CMakeLists.txt deleted file mode 100644 index 316c49a..0000000 --- a/lib/esp_hosted/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -cmake_minimum_required(VERSION 3.10) - -project(esp_hosted) - -if(NOT DEFINED ESP_HOSTED_PORT_INCLUDES) - message(FATAL_ERROR "Variable ESP_HOSTED_PORT_INCLUDES is not defined.") -endif() - -set(ESP_HOSTED_SOURCES - "hosted/esp_hosted_fg/common/protobuf-c/protobuf-c/protobuf-c.c" - "hosted/esp_hosted_fg/common/esp_hosted_config.pb-c.c" - "hosted/esp_hosted_fg/host/components/src/esp_queue.c" - "hosted/esp_hosted_fg/host/control_lib/src/ctrl_api.c" - "hosted/esp_hosted_fg/host/control_lib/src/ctrl_core.c" - "hosted/esp_hosted_fg/host/virtual_serial_if/src/serial_if.c" -) - -set(ESP_HOSTED_INCLUDES - "hosted/esp_hosted_fg/common/include" - "hosted/esp_hosted_fg/common/protobuf-c" - "hosted/esp_hosted_fg/host/control_lib/include" - "hosted/esp_hosted_fg/host/components/include" - "hosted/esp_hosted_fg/host/control_lib/src/include" - "hosted/esp_hosted_fg/host/virtual_serial_if/include" - ${ESP_HOSTED_PORT_INCLUDES} -) - -set(ESP_HOSTED_INCLUDES_PRIVATE -) - -add_library(${PROJECT_NAME} ${ESP_HOSTED_SOURCES}) -target_include_directories(${PROJECT_NAME} - PUBLIC ${ESP_HOSTED_INCLUDES} - PRIVATE ${ESP_HOSTED_INCLUDES_PRIVATE} -) \ No newline at end of file diff --git a/lib/esp_hosted/nxp/include/common.h b/lib/esp_hosted/nxp/include/common.h deleted file mode 100644 index 3a1f4fe..0000000 --- a/lib/esp_hosted/nxp/include/common.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef ESP_HOSTED_NXP_COMMON_H -#define ESP_HOSTED_NXP_COMMON_H - -int min(int x, int y); - -#endif /* ESP_HOSTED_NXP_COMMON_H */ diff --git a/lib/esp_hosted/nxp/include/platform_wrapper.h b/lib/esp_hosted/nxp/include/platform_wrapper.h deleted file mode 100644 index 11b7807..0000000 --- a/lib/esp_hosted/nxp/include/platform_wrapper.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef ESP_HOSTED_NXP_PLATFORM_WRAPPER_H -#define ESP_HOSTED_NXP_PLATFORM_WRAPPER_H - -#include - -#define MCU_SYS 1 - -#define CTRL__TIMER_ONESHOT (0) - -#define HOSTED_SEM_BLOCKING (-1) - -#define mem_free free -#define hosted_malloc malloc -#define hosted_calloc calloc -#define hosted_free free - -int control_path_platform_init(void); -int control_path_platform_deinit(void); - -void *hosted_thread_create(void (*start_routine)(void const *), void *arg); -int hosted_thread_cancel(void *thread_handle); - -void *hosted_create_semaphore(int init_value); -int hosted_get_semaphore(void *semaphore_handle, int timeout); -int hosted_post_semaphore(void *semaphore_handle); -int hosted_destroy_semaphore(void *semaphore_handle); - -void *hosted_timer_start(int duration, int type, void (*timeout_handler)(void const *), void *arg); -int hosted_timer_stop(void *timer_handle); - -unsigned int msleep(unsigned int mseconds); -unsigned int sleep(unsigned int seconds); - -void *serial_drv_open(const char *transport); -int serial_drv_write(void *handle, uint8_t *buf, int in_count, int *out_count); -uint8_t *serial_drv_read(void *handle, uint32_t *out_nbyte); -int serial_drv_close(void *handle); - -#endif /* ESP_HOSTED_NXP_PLATFORM_WRAPPER_H */ diff --git a/lib/esp_nano_hosted b/lib/esp_nano_hosted new file mode 160000 index 0000000..53509e3 --- /dev/null +++ b/lib/esp_nano_hosted @@ -0,0 +1 @@ +Subproject commit 53509e30ba91f2befe7fae439f2f830dd2da3aad