Add test modules and update main entry

This commit is contained in:
wang committed 2026-05-07 18:34:31 +08:00
1 parent 60914b6daa
commit a35a6e8f37
7 files changed
+76 -2

No files matched your search

+5 -2
View File
@@ -1,5 +1,8 @@
#include "add.h"
#include "load.h"
#include <cstdio>
extern "C" void app_main() {
load();
printf("%d\n",add(5, 4));
}
+5
View File
@@ -0,0 +1,5 @@
#include "add.h"
int add(int a, int b) {
return a + b;
}
+2
View File
@@ -0,0 +1,2 @@
int add(int a, int b);
+27
View File
@@ -0,0 +1,27 @@
# main/tests/add/module.cmake
# 自动生成的模块脚手架,可直接手工修改。
# 如果后续添加了新文件,可以手工在此处添加,或者删除本文件让脚本重新生成。
if(NOT CONFIG_ENABLE_TEST_ADD AND NOT EARLY_EXPANSION)
message(STATUS " [Skip] add module disabled by menuconfig.")
return()
endif()
list(APPEND MODULE_SRCS
"tests/add/add.cc"
)
list(APPEND MODULE_INCLUDE_DIRS
"tests/add"
)
# 需要公开依赖时,在这里手工补充。例如:
# list(APPEND MODULE_REQUIRES
# esp_timer
# driver
# )
# 需要私有依赖时,在这里手工补充。例如:
# list(APPEND MODULE_PRIV_REQUIRES
# nvs_flash
# )
+8
View File
@@ -0,0 +1,8 @@
#include "load.h"
#include <cstdio>
#include <gyroscope.h>
void load() {
Gyroscope g;
printf("load OK \n");
}
+2
View File
@@ -0,0 +1,2 @@
void load();
+27
View File
@@ -0,0 +1,27 @@
# main/tests/load_gyroscope/module.cmake
# 自动生成的模块脚手架,可直接手工修改。
# 如果后续添加了新文件,可以手工在此处添加,或者删除本文件让脚本重新生成。
if(NOT CONFIG_ENABLE_TEST_LOAD_GYROSCOPE AND NOT EARLY_EXPANSION)
message(STATUS " [Skip] load_gyroscope module disabled by menuconfig.")
return()
endif()
list(APPEND MODULE_SRCS
"tests/load_gyroscope/load.cc"
)
list(APPEND MODULE_INCLUDE_DIRS
"tests/load_gyroscope"
)
# 需要公开依赖时,在这里手工补充。例如:
# list(APPEND MODULE_REQUIRES
# esp_timer
# driver
# )
# 需要私有依赖时,在这里手工补充。例如:
# list(APPEND MODULE_PRIV_REQUIRES
# nvs_flash
# )