Skip to content

Commit

Permalink
feat: add mcu hex test
Browse files Browse the repository at this point in the history
  • Loading branch information
hacperme committed May 12, 2024
1 parent 913d000 commit f7fe77d
Show file tree
Hide file tree
Showing 13 changed files with 1,107 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
build_dirs += shell
build_dirs += opus_demo
build_dirs += linksdk_demo
build_dirs += mcu_hex
all: $(build_dirs)

$(build_dirs):
Expand Down
41 changes: 41 additions & 0 deletions examples/mcu_hex/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
cmake_minimum_required(VERSION 3.15)

# file(READ proj.conf PROJ_CONFIG)
message("PROJ_CONFIG:")



set(SRC_CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/proj.conf)
set(TARGET_CONFIG ${CMAKE_CURRENT_BINARY_DIR}/proj.conf)
set(TOP_KCONFIG_CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/kconfig)
execute_process(
COMMAND python $ENV{SDK_BASE}/tools/kconfig/genconfig.py ${TOP_KCONFIG_CONFIG} --config-out=${SRC_CONFIG}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)

file(COPY ${SRC_CONFIG} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})

set(TARGET_CMAKE ${CMAKE_CURRENT_BINARY_DIR}/proj.cmake)
execute_process(
COMMAND python $ENV{SDK_BASE}/tools/kconfig/cmakeconfig.py ${TARGET_CONFIG} ${TARGET_CMAKE}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)

include(${TARGET_CMAKE})


message("mcuhex start")

find_package(qt_idf_sdk REQUIRED HINTS $ENV{SDK_BASE})

# sdk_set_linker_script(template.ld)


sdk_set_main_file(main.c)
sdk_add_include_directories(.)

sdk_add_subdirectory_if_exist(mcu)

project(mcuhex)

message("mcuhex end")
7 changes: 7 additions & 0 deletions examples/mcu_hex/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
mainmenu "SDK Configuration"

config SDK_BASE
string
option env="SDK_BASE"

source "$SDK_BASE/Kconfig"
15 changes: 15 additions & 0 deletions examples/mcu_hex/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
SDK_DEMO_PATH = .

SDK_BASE ?= $(abspath ../../)

KCONFIG_CONFIG ?= ${SDK_DEMO_PATH}/proj.conf

export SDK_BASE
export KCONFIG_CONFIG

CROSS_COMPILE ?=
#cmake definition config
cmake_definition+= -DCROSS_COMPILE=${CROSS_COMPILE}

include $(SDK_BASE)/project.build

20 changes: 20 additions & 0 deletions examples/mcu_hex/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include<stdio.h>
#include<stdlib.h>

#include "wifi.h"


int main(int argc, char *argv[])
{
wifi_protocol_init();

char test_cmd[] = {0x55, 0x0B, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68};
uart_receive_buff_input((unsigned char *)test_cmd, sizeof(test_cmd));

while(1)
{
wifi_uart_service();
}
printf("Hello, World!\n");
return 0;
}
6 changes: 6 additions & 0 deletions examples/mcu_hex/mcu/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
message("mcu")

sdk_generate_library()
file(GLOB_RECURSE SOURCES ./*.c)
sdk_library_add_sources(${SOURCES})
sdk_add_include_directories(.)
Loading

0 comments on commit f7fe77d

Please sign in to comment.