]> Zhao Yanbai Git Server - acecode.git/commitdiff
...
authorAceVest <zhaoyanbai@126.com>
Tue, 31 Jul 2018 08:14:07 +0000 (16:14 +0800)
committerAceVest <zhaoyanbai@126.com>
Tue, 31 Jul 2018 08:14:07 +0000 (16:14 +0800)
rtos/CMakeLists.txt
rtos/entry.S [new file with mode: 0644]
rtos/rtos.c

index 86c4626b756fa39c32f26a30a17390884a2c83ab..985b32c7d1fc70cc2d48f085f7b8c6125b9a4344 100644 (file)
@@ -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 (file)
index 0000000..b6b96e9
--- /dev/null
@@ -0,0 +1,6 @@
+.global _start
+
+.extern main
+
+_start:
+    call0 main
index 7b361f89a0acfbc5ec279fff13619ad8e95c473f..d03f02a13862ba94b06f5c67cdc316db6d31c03b 100644 (file)
@@ -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;
 }