新增静态库及配置

This commit is contained in:
LokLiang
2025-07-09 15:41:50 +08:00
parent ea4f688ba0
commit 1e82069ac7
14 changed files with 1799 additions and 19 deletions

View File

@@ -6,13 +6,16 @@
#include <string.h>
/* 配置 */
#include "ota.h"
#include "config/board_config.h"
#include "config/app_config.h"
#include "config/app_log.h"
/* SDK */
#include "esp_err.h"
#include "hal/spi_types.h"
#include "spbelib_interface.h"
#include "lib_shell.h"
#include "ota.h"
/* 驱动 */
#include "drivers/ws2812_spi/ws2812_spi.h"
@@ -37,7 +40,6 @@ nvs_handle g_nvs_hdl; // nvs 句柄
os_work_q_t g_work_q_hdl_low; // 低于 default_os_work_q_hdl 优先级的工作队列
static void _init_nvs(void);
static void _init_work_q(void);
static void _init_ws2812(void);
static void _change_mode_event_button(button_hdl_t *handle, press_event_t event);
static void _vset_cb(sh_t *sh_hdl);
@@ -50,20 +52,22 @@ void work_app_main(void *arg)
/* 初始化配置 */
board_cfg_init(); // 板级配置
app_cfg_init(); // 应用配置
app_log_init(); // 应用记录
/* 初始化 OTA 功能*/
ota_partition_check();
/* 初始化其他优先级的工作队列 */
_init_work_q();
/* 初始化按键检测和控制 */
btn_attach(&g_cfg_board->key_reset, _change_mode_event_button, EVENT_PRESS_UP | EVENT_PRESS_DOWN | EVENT_LONG_PRESS_HOLD);
/* 初始化 ws2812 */
_init_ws2812();
ws2812_spi_shell_register(); // 用于测试 ws2812 的 shell 命令
/* 启动静态库功能 */
sblib_init(SBLIB_INIT_ADAPTER);
lib_shell_register(); // 静态库接口命令
/* 初始化按键检测和控制 */
btn_attach(&g_cfg_board->key_reset, _change_mode_event_button, EVENT_PRESS_UP | EVENT_PRESS_DOWN | EVENT_LONG_PRESS_HOLD);
/* 启动 shell */
os_thread_sleep(100);
shell_start(_vset_cb);
@@ -79,15 +83,6 @@ static void _init_nvs(void)
}
}
static void _init_work_q(void)
{
/* 不使用以节省内存 */
// os_work_q_create(&g_work_q_hdl_low,
// "app-work_q-low",
// 0x2000,
// OS_PRIORITY_LOW);
}
static void _init_ws2812(void)
{
#if (CONFIG_LED_STRIP_MAX_LEDS)
@@ -113,3 +108,36 @@ static void _change_mode_event_button(button_hdl_t *handle, press_event_t event)
SYS_LOG_DBG("button stat: %s", stat_tab[event]);
}
}
// 导出符号,供 linker script 使用
#include "utils/sb_aes.h"
#include "drivers/data_port/sb_data_port.h"
#include "drivers/data_port/uart/uart_port.h"
#if defined(CONFIG_BUILD_BLE)
#include "drivers/data_port/ble_spp/ble_spp_server.h"
#endif
#if defined(CONFIG_BUILD_WIFI)
#include "drivers/data_port/socket_inet/socket_inet.h"
#endif
#if defined(CONFIG_IDF_TARGET_ESP32S3)
#include "drivers/data_port/usb-host/usbport.h"
#endif
void _exporter_reference_symbols(void)
{
btn_attach(NULL, NULL, 0);
sb_aes_init();
sb_data_port_start(NULL);
sb_uart_port_init();
sh_init_vt100(NULL, NULL, NULL);
shell_start(NULL);
ws2812_spi_led_strip_init(0, 0);
#if defined(CONFIG_BUILD_BLE)
sb_ble_server_port_init(NULL);
#endif
#if defined(CONFIG_BUILD_WIFI)
socket_inet_init();
#endif
#if defined(CONFIG_IDF_TARGET_ESP32S3)
usbport_init();
#endif
}