From: AceVest Date: Tue, 31 Jul 2018 08:14:07 +0000 (+0800) Subject: ... X-Git-Url: http://zhaoyanbai.com/repos/named.html?a=commitdiff_plain;h=add1a865397796580f61a6c6bccc0fbcceb350c6;p=acecode.git ... --- diff --git a/rtos/CMakeLists.txt b/rtos/CMakeLists.txt index 86c4626..985b32c 100644 --- a/rtos/CMakeLists.txt +++ b/rtos/CMakeLists.txt @@ -6,26 +6,17 @@ SET(RTOS_VERSION_MINOR 1) SET(CMAKE_SYSTEM_NAME Generic) SET(CMAKE_SYSTEM_PROCESSOR xtensa) -#SET(CMAKE_FIND_ROOT_PATH /Users/ace/workspace/esp/xtensa-esp32-elf/) -#SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) -#SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) -#SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) -#SET(CMAKE_C_COMPILER xtensa-esp32-elf-gcc) -#SET(CMAKE_ASM_COMPILER xtensa-esp32-elf-gcc) -#SET(CMAKE_LINKER xtensa-esp32-elf-ld) -#SET(CMAKE_CROSSCOMPILING "TRUE") - -SET(CMAKE_C_FLAGS "-nostdlib -nodefaultlibs") -link_directories(/Users/ace/workspace/esp/xtensa-esp32-elf/lib/) -SET(CMAKE_C_COMPILER /Users/ace/workspace/esp/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc) -SET(CMAKE_C_COMPILER_ID xtensa-esp32-elf-gcc) -SET(CMAKE_LINKER /Users/ace/workspace/esp/xtensa-esp32-elf/bin/xtensa-esp32-elf-ld) -SET(CMAKE_LINKER_ID xtensa-esp32-elf-ld) - -#INCLUDE(CheckCSourceCompiles) -#INCLUDE(CheckCCompilerFlag) -#CHECK_C_COMPILER_FLAG("" toolchain_is_ok) - +SET(xtensa_esp32_elf_path ${IDF_PATH}/../xtensa-esp32-elf/) +LINK_DIRECTORIES(${xtensa_esp32_elf_path}/lib/) +SET(CMAKE_FIND_ROOT_PATH ${xtensa_esp32_elf_path}) +SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +SET(CMAKE_C_COMPILER xtensa-esp32-elf-gcc) +SET(CMAKE_C_FLAGS "-nostdlib") +SET(CMAKE_ASM_COMPILER xtensa-esp32-elf-gcc) +SET(CMAKE_LINKER xtensa-esp32-elf-ld) +SET(CMAKE_CROSSCOMPILING "TRUE") PROJECT(rtos NONE) ENABLE_LANGUAGE(C) @@ -42,14 +33,12 @@ INCLUDE_DIRECTORIES("${PROJECT_BINARY_DIR}" "kernel/include") ADD_SUBDIRECTORY(components) -#ADD_SUBDIRECTORY(kernel) +ADD_SUBDIRECTORY(kernel) LINK_DIRECTORIES(${LIBRARY_OUTPUT_PATH}) -ADD_EXECUTABLE(rtos rtos.c) -SET_TARGET_PROPERTIES(rtos PROPERTIES LINKER_LANGUAGE C) +ADD_EXECUTABLE(rtos entry.S rtos.c) # TARGET_LINK_LIBRARIES 参数里 debug optimized general 是关键词,不能用 -# TARGET_LINK_LIBRARIES(rtos components kernel) -TARGET_LINK_LIBRARIES(rtos components) +TARGET_LINK_LIBRARIES(rtos components kernel) diff --git a/rtos/entry.S b/rtos/entry.S new file mode 100644 index 0000000..b6b96e9 --- /dev/null +++ b/rtos/entry.S @@ -0,0 +1,6 @@ +.global _start + +.extern main + +_start: + call0 main diff --git a/rtos/rtos.c b/rtos/rtos.c index 7b361f8..d03f02a 100644 --- a/rtos/rtos.c +++ b/rtos/rtos.c @@ -11,8 +11,8 @@ #include "utils.h" int main(int argc, char *argv[]){ - printf("rtos: version %u.%u\n", RTOS_VERSION_MAJOR, RTOS_VERSION_MINOR); +// printf("rtos: version %u.%u\n", RTOS_VERSION_MAJOR, RTOS_VERSION_MINOR); debug(); - asm_debug(); +// asm_debug(); return 0; }