From e7b859851b4ea05d746c4d92f881c1c1eb47016f Mon Sep 17 00:00:00 2001 From: wmano Date: Mon, 27 Oct 2025 20:50:06 +0800 Subject: [PATCH] stop run cmd --- apps/chrg/.config | 29 +- apps/chrg/applications/bsp/chrg_gpio.c | 4 +- apps/chrg/applications/bsp/chrg_led.c | 8 +- apps/chrg/applications/bsp/chrg_led.h | 4 +- apps/chrg/applications/thread/chrg_lcd.c | 47 +-- apps/chrg/applications/thread/chrg_lcd.h | 5 - apps/chrg/applications/thread/chrg_north.c | 5 +- apps/chrg/applications/thread/chrg_roll_nor.c | 33 +- apps/chrg/applications/thread/chrg_roll_sou.c | 33 +- apps/chrg/applications/thread/chrg_south.c | 5 +- apps/chrg/applications/utils/chrg_eload.c | 4 +- apps/chrg/applications/utils/chrg_sink.c | 18 +- apps/chrg/applications/utils/chrg_utils.c | 15 + apps/chrg/applications/utils/chrg_utils.h | 4 + apps/chrg/chrg.uvprojx | 382 +++++++++--------- apps/chrg/rtconfig.h | 13 + 16 files changed, 368 insertions(+), 241 deletions(-) diff --git a/apps/chrg/.config b/apps/chrg/.config index 55e1c83..fec995b 100644 --- a/apps/chrg/.config +++ b/apps/chrg/.config @@ -345,7 +345,34 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0 # Utilities # # CONFIG_RT_USING_RYM is not set -# CONFIG_RT_USING_ULOG is not set +CONFIG_RT_USING_ULOG=y +# CONFIG_ULOG_OUTPUT_LVL_A is not set +# CONFIG_ULOG_OUTPUT_LVL_E is not set +# CONFIG_ULOG_OUTPUT_LVL_W is not set +# CONFIG_ULOG_OUTPUT_LVL_I is not set +CONFIG_ULOG_OUTPUT_LVL_D=y +CONFIG_ULOG_OUTPUT_LVL=7 +# CONFIG_ULOG_USING_ISR_LOG is not set +CONFIG_ULOG_ASSERT_ENABLE=y +CONFIG_ULOG_LINE_BUF_SIZE=128 +# CONFIG_ULOG_USING_ASYNC_OUTPUT is not set + +# +# log format +# +# CONFIG_ULOG_OUTPUT_FLOAT is not set +# CONFIG_ULOG_USING_COLOR is not set +CONFIG_ULOG_OUTPUT_TIME=y +# CONFIG_ULOG_TIME_USING_TIMESTAMP is not set +CONFIG_ULOG_OUTPUT_LEVEL=y +CONFIG_ULOG_OUTPUT_TAG=y +# CONFIG_ULOG_OUTPUT_THREAD_NAME is not set +# end of log format + +CONFIG_ULOG_BACKEND_USING_CONSOLE=y +# CONFIG_ULOG_BACKEND_USING_FILE is not set +# CONFIG_ULOG_USING_FILTER is not set +# CONFIG_ULOG_USING_SYSLOG is not set # CONFIG_RT_USING_UTEST is not set # CONFIG_RT_USING_VAR_EXPORT is not set # CONFIG_RT_USING_RESOURCE_ID is not set diff --git a/apps/chrg/applications/bsp/chrg_gpio.c b/apps/chrg/applications/bsp/chrg_gpio.c index 281bb56..e2a938f 100644 --- a/apps/chrg/applications/bsp/chrg_gpio.c +++ b/apps/chrg/applications/bsp/chrg_gpio.c @@ -6,8 +6,8 @@ struct chrg_io_t chrgios[TOTAL_IOS] = { [IDX_GPO_LED1] = {GPO_PIN_LED1, PIN_MODE_OUTPUT, PIN_HIGH}, - [IDX_GPO_LED2] = {GPO_PIN_LED2, PIN_MODE_OUTPUT, PIN_HIGH}, - [IDX_GPO_LED3] = {GPO_PIN_LED3, PIN_MODE_OUTPUT, PIN_HIGH}, + [IDX_GPO_LED2] = {GPO_PIN_LED2, PIN_MODE_OUTPUT, PIN_LOW}, + [IDX_GPO_LED3] = {GPO_PIN_LED3, PIN_MODE_OUTPUT, PIN_LOW}, [IDX_GPO_UART_SW1] = {GPO_PIN_UART_SW1, PIN_MODE_OUTPUT, PIN_LOW}, [IDX_GPO_UART_SW2] = {GPO_PIN_UART_SW2, PIN_MODE_OUTPUT, PIN_LOW}, [IDX_GPO_UART_SW3] = {GPO_PIN_UART_SW3, PIN_MODE_OUTPUT, PIN_LOW}, diff --git a/apps/chrg/applications/bsp/chrg_led.c b/apps/chrg/applications/bsp/chrg_led.c index 90a3cfd..987cba9 100644 --- a/apps/chrg/applications/bsp/chrg_led.c +++ b/apps/chrg/applications/bsp/chrg_led.c @@ -20,13 +20,13 @@ struct chrg_led_t chrgleds[TOTAL_LEDS] = { .tmr_millis_off = PULSE_TIME*8, .tmr_times = 1, .tmr_cnt = 0, - } /*, + }, [IDX_LED2] = { .index = IDX_LED2, .pin_name = PIN_NAME_LED2, .pin_base = PIN_LED2, .pin_mode = PIN_MODE_OUTPUT, - .pin_value = PIN_HIGH, + .pin_value = PIN_LOW, .tmr_name = TMR_NAME_LED2, .tmr_fd = RT_NULL, .tmr_stage = PIN_STAGE_IDLE, @@ -40,7 +40,7 @@ struct chrg_led_t chrgleds[TOTAL_LEDS] = { .pin_name = PIN_NAME_LED3, .pin_base = PIN_LED3, .pin_mode = PIN_MODE_OUTPUT, - .pin_value = PIN_HIGH, + .pin_value = PIN_LOW, .tmr_name = TMR_NAME_LED3, .tmr_fd = RT_NULL, .tmr_stage = PIN_STAGE_IDLE, @@ -48,7 +48,7 @@ struct chrg_led_t chrgleds[TOTAL_LEDS] = { .tmr_millis_off = PULSE_TIME*8, .tmr_times = 1, .tmr_cnt = 0, - }*/ + } }; rt_int32_t chrg_led_get (eIDX_LED index) diff --git a/apps/chrg/applications/bsp/chrg_led.h b/apps/chrg/applications/bsp/chrg_led.h index 9594671..ce04bd2 100644 --- a/apps/chrg/applications/bsp/chrg_led.h +++ b/apps/chrg/applications/bsp/chrg_led.h @@ -32,8 +32,8 @@ typedef enum { IDX_LED1 = 0, // LED1 -// IDX_LED2, // LED2 -// IDX_LED3, // LED3 + IDX_LED2, // LED2 + IDX_LED3, // LED3 TOTAL_LEDS } eIDX_LED; diff --git a/apps/chrg/applications/thread/chrg_lcd.c b/apps/chrg/applications/thread/chrg_lcd.c index 4048b0f..b9f669e 100644 --- a/apps/chrg/applications/thread/chrg_lcd.c +++ b/apps/chrg/applications/thread/chrg_lcd.c @@ -12,9 +12,7 @@ #include struct chrg_lcd_t chrglcd = { - .name = THR_NAME_LCD, .devname = DEV_NAME_LCD, - .tid = RT_NULL, .tty = RT_NULL, }; @@ -70,14 +68,20 @@ int chrg_lcd_send (char *cmd) void chrg_lcd_thread_entry (void *data) { - struct chrg_lcd_t *pLCD = (struct chrg_lcd_t *)data; + struct chrg_thread_t *pTHR = (struct chrg_thread_t *)data; - if ((RT_NULL == pLCD)||(RT_NULL == pLCD->tty)) { + if (RT_NULL == pTHR) { return ; } int len = 0; - struct chrg_tty_t *pTTY = pLCD->tty; + struct chrg_tty_t *pTTY = RT_NULL; + struct chrg_lcd_t *pLCD = &chrglcd; + pTTY = chrg_tty_create(pLCD->devname, 115200, 0, -1, 1); + if (RT_NULL == pTTY) { + LOG_E("tty can't create."); + return ; + } chrg_tty_set_recv_tmo(pTTY, 100); if (chrg_tty_connect(pTTY) != RT_EOK) { @@ -85,7 +89,10 @@ void chrg_lcd_thread_entry (void *data) return; } + pLCD->tty = pTTY; + while (1) { + rt_memset(pLCD->rx_buf, 0, SIZE_BUF_TTY); len = chrg_tty_recv(pTTY, pLCD->rx_buf, sizeof(pLCD->rx_buf)); if (len <= 0) { rt_thread_mdelay(1); @@ -99,36 +106,6 @@ void chrg_lcd_thread_entry (void *data) } -int chrg_lcd_init (void) -{ - rt_err_t ret; - struct chrg_lcd_t *pLCD = &chrglcd; - - pLCD->tty = chrg_tty_create(pLCD->devname, 115200, 0, -1, 1); - if (RT_NULL == pLCD->tty) { - LOG_E("tty can't create."); - return -1; - } - - rt_memset(pLCD->rx_buf, 0, SIZE_BUF_TTY); - - ret = rt_mutex_init(&pLCD->lock, pLCD->name, RT_IPC_FLAG_FIFO); - if (ret != RT_EOK) { - LOG_E("init mutex '%s' failed.", pLCD->name); - return ret; - } - - pLCD->tid = rt_thread_create(pLCD->name, chrg_lcd_thread_entry, pLCD, 4096, - RT_MAIN_THREAD_PRIORITY, 20); - if (RT_NULL != pLCD->tid) { - rt_thread_startup(pLCD->tid); - } else { - LOG_E("create thread '%s' failed.", pLCD->name); - } - - return 0; -} - #if 1 static int lcdsend(rt_uint8_t argc, char **argv) diff --git a/apps/chrg/applications/thread/chrg_lcd.h b/apps/chrg/applications/thread/chrg_lcd.h index e734d06..6d21dde 100644 --- a/apps/chrg/applications/thread/chrg_lcd.h +++ b/apps/chrg/applications/thread/chrg_lcd.h @@ -9,10 +9,7 @@ #define DEV_NAME_LCD "uart2" struct chrg_lcd_t { - const char *name; const char *devname; - struct rt_thread *tid; - struct rt_mutex lock; struct chrg_tty_t *tty; rt_uint8_t rx_buf[SIZE_BUF_TTY]; @@ -23,8 +20,6 @@ extern struct chrg_lcd_t chrglcd; extern int chrg_lcd_send (char *cmd); -extern int chrg_lcd_init (void); - extern void chrg_lcd_thread_entry (void *data); diff --git a/apps/chrg/applications/thread/chrg_north.c b/apps/chrg/applications/thread/chrg_north.c index 34361cf..98c713b 100644 --- a/apps/chrg/applications/thread/chrg_north.c +++ b/apps/chrg/applications/thread/chrg_north.c @@ -9,8 +9,9 @@ #include "chrg_roll_nor.h" #include "chrg_switch.h" #include "chrg_utils.h" +#include "ulog.h" -#define LOG_TAG "chrg.nor" +//#define LOG_TAG "chrg.nor" #define DBG_LEVEL DBG_LOG #include @@ -51,6 +52,7 @@ int chrg_north_send (rt_uint8_t *data, rt_size_t length) struct chrg_tty_t *pTTY = chrgnorth.tty; if (RT_NULL != pTTY) { + LOG_HEX("sendN", 32, data, length); ret = chrg_tty_send(pTTY, data, length); } @@ -249,6 +251,7 @@ void chrg_north_thread_entry (void *data) } rt_ringbuffer_put(pNOR->rb, pNOR->rx_buf, len); + LOG_HEX("recvN", 32, pNOR->rx_buf, len); if (1 == pNOR->frame.findhead) { if (rt_tick_get() >= pNOR->frame.last_tick + 100) { // 100ms diff --git a/apps/chrg/applications/thread/chrg_roll_nor.c b/apps/chrg/applications/thread/chrg_roll_nor.c index bba3f1f..14e8a6b 100644 --- a/apps/chrg/applications/thread/chrg_roll_nor.c +++ b/apps/chrg/applications/thread/chrg_roll_nor.c @@ -1,7 +1,9 @@ #include +#include #include #include "chrg_gpio.h" +#include "chrg_led.h" #include "chrg_thread.h" #include "chrg_sink.h" #include "chrg_source.h" @@ -13,6 +15,7 @@ #define LOG_TAG "chrg.rollnor" #include +rt_uint8_t nor_run = 1; rt_uint8_t nor_ch = IDX_NOR_CH1; const rt_base_t sw_uart[TOTAL_NOR_CHS] = { @@ -65,6 +68,10 @@ void chrg_roll_nor_thread_entry (void *data) chrg_north_switch((eIDX_NOR_CH)nor_ch); source_get_vc(5000, 1000); } else { + if (0 == nor_run) { + rt_thread_mdelay(1000); + continue; + } pNOR->idx = idx%TOTAL_NOR_CHS; @@ -73,6 +80,7 @@ void chrg_roll_nor_thread_entry (void *data) rt_thread_mdelay(1); continue; } else { + chrg_led_flashing(IDX_LED2, TIMES_ONE, PULSE_TIME*2, PULSE_TIME*2); chrg_north_switch(pNOR->idx); pSW = &pNOR->sw[pNOR->idx]; @@ -90,7 +98,7 @@ void chrg_roll_nor_thread_entry (void *data) idx++; } - ret = rt_mb_recv(pTN->mb, (rt_uint32_t *)&pMB_R, 100); // 超时 100ms + ret = rt_mb_recv(pTN->mb, (rt_uint32_t *)&pMB_R, 200); // 超时 200ms if ((RT_EOK == ret)&&(RT_NULL != pMB_R)) { crc = calc_crc8(pMB_R->payload, pMB_R->length-1); if (crc == pMB_R->payload[pMB_R->length-1]) { @@ -115,7 +123,7 @@ void chrg_roll_nor_thread_entry (void *data) } rt_thread_mdelay(50); // 间隔 50ms - } else if (RT_ETIMEOUT == ret) { + } else { rt_mutex_take(pTHR->mutex, RT_WAITING_FOREVER); pNOR->manual = 0; rt_mutex_release(pTHR->mutex); @@ -150,6 +158,27 @@ static int north_send(rt_uint8_t argc, char **argv) MSH_CMD_EXPORT(north_send, north send test); +static int north_run (int argc, char **argv) +{ + if (2 != argc) { + rt_kprintf("help : %s start|stop\r\n", argv[0]); + return -1; + } + + if (rt_strcmp(argv[1], "start") == 0) { + nor_run = 1; + } else if (rt_strcmp(argv[1], "stop") == 0) { + nor_run = 0; + } else { + rt_kprintf("help : %s start|stop\r\n", argv[0]); + return -1; + } + + return 0; +} + +MSH_CMD_EXPORT(north_run, north auto run); + #endif diff --git a/apps/chrg/applications/thread/chrg_roll_sou.c b/apps/chrg/applications/thread/chrg_roll_sou.c index 592ccf7..455f8ae 100644 --- a/apps/chrg/applications/thread/chrg_roll_sou.c +++ b/apps/chrg/applications/thread/chrg_roll_sou.c @@ -1,7 +1,8 @@ #include +#include #include - +#include "chrg_led.h" #include "chrg_thread.h" #include "chrg_roll_sou.h" #include "chrg_eload.h" @@ -10,6 +11,7 @@ #define LOG_TAG "chrg.rollsou" #include +rt_uint8_t sou_run = 1; rt_uint8_t sou_ch = IDX_SOU_CH1; rt_uint8_t sou_pt = MB_R_PART1; @@ -37,6 +39,11 @@ void chrg_roll_sou_thread_entry (void *data) chrg_eload_refresh(ID_ELOAD, sou_pt); } else { // 轮巡4个通道,每个通道3条读取命令 + if (0 == sou_run) { + rt_thread_mdelay(1000); + continue; + } + part = index%(TOTAL_SOU_CHS*TOTAL_MB_R); // [0, 11] idx = part/TOTAL_MB_R; // [0, 3] pt = part%TOTAL_MB_R; @@ -47,6 +54,7 @@ void chrg_roll_sou_thread_entry (void *data) rt_thread_mdelay(10); continue; } else { + chrg_led_flashing(IDX_LED3, TIMES_ONE, PULSE_TIME*2, PULSE_TIME*2); if (idx != (rt_uint8_t)pSOU->idx) { pSOU->idx = (eIDX_SOU_CH)idx; chrg_south_switch(pSOU->idx); @@ -83,7 +91,7 @@ void chrg_roll_sou_thread_entry (void *data) } rt_thread_mdelay(50); // 间隔 50ms - } else if (RT_ETIMEOUT == ret) { + } else { rt_mutex_take(pTHR->mutex, RT_WAITING_FOREVER); pSOU->manual = 0; rt_mutex_release(pTHR->mutex); @@ -125,6 +133,27 @@ static int south_send(rt_uint8_t argc, char **argv) MSH_CMD_EXPORT(south_send, south send test); +static int south_run (int argc, char **argv) +{ + if (2 != argc) { + rt_kprintf("help : %s start|stop\r\n", argv[0]); + return -1; + } + + if (rt_strcmp(argv[1], "start") == 0) { + sou_run = 1; + } else if (rt_strcmp(argv[1], "stop") == 0) { + sou_run = 0; + } else { + rt_kprintf("help : %s start|stop\r\n", argv[0]); + return -1; + } + + return 0; +} + +MSH_CMD_EXPORT(south_run, south auto run); + #endif diff --git a/apps/chrg/applications/thread/chrg_south.c b/apps/chrg/applications/thread/chrg_south.c index 3a67d9e..0954c17 100644 --- a/apps/chrg/applications/thread/chrg_south.c +++ b/apps/chrg/applications/thread/chrg_south.c @@ -7,8 +7,9 @@ #include "chrg_roll_sou.h" #include "chrg_switch.h" #include "chrg_utils.h" +#include "ulog.h" -#define LOG_TAG "chrg.sou" +//#define LOG_TAG "chrg.sou" #define DBG_LEVEL DBG_LOG #include @@ -108,6 +109,7 @@ int chrg_south_send (rt_uint8_t *data, rt_size_t length) struct chrg_tty_t *pTTY = chrgsouth.tty; if (RT_NULL != pTTY) { + LOG_HEX("sendS", 32, data, length); ret = chrg_tty_send(pTTY, data, length); } @@ -309,6 +311,7 @@ void chrg_south_thread_entry (void *data) } rt_ringbuffer_put(pSOU->rb, pSOU->rx_buf, len); + LOG_HEX("recvS", 32, pSOU->rx_buf, len); if (1 == pSOU->frame.findhead) { if (rt_tick_get() >= pSOU->frame.last_tick + 100) { // 100ms diff --git a/apps/chrg/applications/utils/chrg_eload.c b/apps/chrg/applications/utils/chrg_eload.c index 1ad1822..91456b1 100644 --- a/apps/chrg/applications/utils/chrg_eload.c +++ b/apps/chrg/applications/utils/chrg_eload.c @@ -15,7 +15,7 @@ int chrg_eload_read_regs (rt_uint8_t addr, rt_uint16_t reg, rt_uint16_t len) u16_to_u8v(reg, &buf[2]); u16_to_u8v(len, &buf[4]); crc = mb_crc16(buf, 6); - u16_to_u8v(crc, &buf[6]); + u16_to_u8v(swap_u16(crc), &buf[6]); return chrg_south_send(buf, 8); } @@ -30,7 +30,7 @@ int chrg_eload_write_reg (rt_uint8_t addr, rt_uint16_t reg, rt_uint16_t value) u16_to_u8v(reg, &buf[2]); u16_to_u8v(value, &buf[4]); crc = mb_crc16(buf, 6); - u16_to_u8v(crc, &buf[6]); + u16_to_u8v(swap_u16(crc), &buf[6]); return chrg_south_send(buf, 8); } diff --git a/apps/chrg/applications/utils/chrg_sink.c b/apps/chrg/applications/utils/chrg_sink.c index c329f75..8e278b2 100644 --- a/apps/chrg/applications/utils/chrg_sink.c +++ b/apps/chrg/applications/utils/chrg_sink.c @@ -1,10 +1,26 @@ +#include #include "chrg_sink.h" +#include "chrg_north.h" +#include "chrg_north_pkg.h" +#include "chrg_utils.h" + + int sink_get_vc (rt_uint16_t vol, rt_uint16_t cur) { + rt_uint16_t len = 0; + rt_uint8_t data[12] = {0}; + rt_uint8_t frame[16] = {0}; - return 0; + u16_to_u8v(vol, &data[0]); + u16_to_u8v(cur, &data[2]); + data[4] = 0x00; + data[5] = 0x00; + + chrg_north_pkg_encode(ID_SINK, SINK_CMD_GET_VOLTAGE, data, 6, frame, &len); + + return chrg_north_send(frame, len); } diff --git a/apps/chrg/applications/utils/chrg_utils.c b/apps/chrg/applications/utils/chrg_utils.c index 6aa0e6e..8c0d384 100644 --- a/apps/chrg/applications/utils/chrg_utils.c +++ b/apps/chrg/applications/utils/chrg_utils.c @@ -119,5 +119,20 @@ rt_uint16_t u8v_to_u16 (rt_uint8_t *buf) return 0; } +// rt_uint16_t 高低位互换 +rt_uint16_t swap_u16 (rt_uint16_t x) +{ + return ((x & 0x00FF) << 8) | + ((x & 0xFF00) >> 8); +} + +// rt_uint32_t 高低位互换 +rt_uint32_t swap_u32 (rt_uint32_t x) +{ + return ((x & 0x000000FF) << 24) | + ((x & 0x0000FF00) << 8) | + ((x & 0x00FF0000) >> 8) | + ((x & 0xFF000000) >> 24); +} diff --git a/apps/chrg/applications/utils/chrg_utils.h b/apps/chrg/applications/utils/chrg_utils.h index e41e281..93f65c3 100644 --- a/apps/chrg/applications/utils/chrg_utils.h +++ b/apps/chrg/applications/utils/chrg_utils.h @@ -11,6 +11,10 @@ extern rt_uint8_t u16_to_u8v (rt_uint16_t value, rt_uint8_t *buf); extern rt_uint16_t u8v_to_u16 (rt_uint8_t *buf); +extern rt_uint16_t swap_u16 (rt_uint16_t x); + +extern rt_uint32_t swap_u32 (rt_uint32_t x); + #endif diff --git a/apps/chrg/chrg.uvprojx b/apps/chrg/chrg.uvprojx index a2fb3d4..72be180 100644 --- a/apps/chrg/chrg.uvprojx +++ b/apps/chrg/chrg.uvprojx @@ -10,6 +10,7 @@ chrg 0x4 ARM-ADS + 6160000::V6.16::ARMCLANG 1 @@ -336,9 +337,9 @@ 0 - RT_USING_LIBC, __CLK_TCK=RT_TICK_PER_SECOND, RT_USING_ARMLIBC, __RTTHREAD__, __STDC_LIMIT_MACROS, USE_HAL_DRIVER, STM32F405xx + RT_USING_ARMLIBC, __CLK_TCK=RT_TICK_PER_SECOND, USE_HAL_DRIVER, __RTTHREAD__, RT_USING_LIBC, __STDC_LIMIT_MACROS, STM32F405xx - ..\..\rt-thread\components\finsh;applications\bsp;..\..\libs\cmsis-core\Include;..\..\rt-thread\components\drivers\include;..\..\rt-thread\bsp\stm32\libraries\HAL_Drivers\drivers;..\..\rt-thread\components\libc\posix\ipc;..\..\libs\stm32f4\STM32F4_HAL\Inc;..\..\rt-thread\components\legacy\usb\usbdevice;..\..\rt-thread\bsp\stm32\libraries\HAL_Drivers\drivers\config;..\..\libs\stm32f4\STM32F4_CMSIS\Include;..\..\rt-thread\components\drivers\include;board\CubeMX_Config\Inc;..\..\rt-thread\components\libc\compilers\common\extension;..\..\rt-thread\components\drivers\include;..\..\rt-thread\bsp\stm32\libraries\HAL_Drivers\drivers\drv_flash;..\..\libs\stm32f4\STM32F4_HAL\Inc\Legacy;..\..\rt-thread\components\drivers\phy;..\..\rt-thread\components\libc\compilers\common\extension\fcntl\octal;..\..\rt-thread\components\libc\posix\io\poll;applications\utils;..\..\rt-thread\components\fal\inc;..\..\rt-thread\components\libc\compilers\common\include;..\..\rt-thread\components\libc\posix\io\eventfd;..\..\rt-thread\components\drivers\include;..\..\rt-thread\components\drivers\include;..\..\rt-thread\components\drivers\smp_call;..\..\rt-thread\libcpu\arm\common;..\..\rt-thread\components\drivers\include;applications;.;..\..\rt-thread\bsp\stm32\libraries\HAL_Drivers;board;applications\thread;..\..\rt-thread\include;..\..\rt-thread\components\drivers\include;..\..\rt-thread\components\libc\posix\io\epoll;board\ports;..\..\rt-thread\libcpu\arm\cortex-m4 + ..\..\rt-thread\libcpu\arm\common;..\..\rt-thread\components\libc\posix\ipc;..\..\rt-thread\components\drivers\include;..\..\rt-thread\bsp\stm32\libraries\HAL_Drivers\drivers;..\..\rt-thread\components\finsh;..\..\rt-thread\components\libc\posix\io\eventfd;.;..\..\libs\cmsis-core\Include;..\..\rt-thread\components\drivers\include;board;..\..\rt-thread\bsp\stm32\libraries\HAL_Drivers\drivers\drv_flash;..\..\rt-thread\components\drivers\phy;..\..\rt-thread\include;board\ports;..\..\libs\stm32f4\STM32F4_HAL\Inc;board\CubeMX_Config\Inc;..\..\libs\stm32f4\STM32F4_CMSIS\Include;..\..\rt-thread\components\utilities\ulog;..\..\rt-thread\components\drivers\include;..\..\libs\stm32f4\STM32F4_HAL\Inc\Legacy;..\..\rt-thread\components\libc\compilers\common\include;..\..\rt-thread\components\libc\posix\io\poll;..\..\rt-thread\components\drivers\smp_call;..\..\rt-thread\components\drivers\include;applications\bsp;..\..\rt-thread\components\drivers\include;applications\thread;..\..\rt-thread\bsp\stm32\libraries\HAL_Drivers;applications;..\..\rt-thread\components\libc\compilers\common\extension;..\..\rt-thread\components\fal\inc;..\..\rt-thread\components\drivers\include;..\..\rt-thread\libcpu\arm\cortex-m4;..\..\rt-thread\components\libc\posix\io\epoll;..\..\rt-thread\components\drivers\include;..\..\rt-thread\components\libc\compilers\common\extension\fcntl\octal;applications\utils;..\..\rt-thread\components\legacy\usb\usbdevice;..\..\rt-thread\bsp\stm32\libraries\HAL_Drivers\drivers\config @@ -392,11 +393,6 @@ Applications/bsp - - chrg_vcom.c - 1 - applications\bsp\chrg_vcom.c - chrg_gpio.c 1 @@ -407,26 +403,6 @@ 1 applications\bsp\chrg_tty.c - - chrg_switch.c - 1 - applications\bsp\chrg_switch.c - - - chrg_led.c - 1 - applications\bsp\chrg_led.c - - - chrg_wdt.c - 1 - applications\bsp\chrg_wdt.c - - - chrg_clk.c - 1 - applications\bsp\chrg_clk.c - chrg_tmr.c 1 @@ -437,25 +413,45 @@ 1 applications\bsp\chrg_fal.c + + chrg_switch.c + 1 + applications\bsp\chrg_switch.c + + + chrg_vcom.c + 1 + applications\bsp\chrg_vcom.c + + + chrg_led.c + 1 + applications\bsp\chrg_led.c + + + chrg_wdt.c + 1 + applications\bsp\chrg_wdt.c + chrg_rel.c 1 applications\bsp\chrg_rel.c + + chrg_clk.c + 1 + applications\bsp\chrg_clk.c + Applications/thread - chrg_roll_sou.c + chrg_roll_nor.c 1 - applications\thread\chrg_roll_sou.c - - - chrg_lcd.c - 1 - applications\thread\chrg_lcd.c + applications\thread\chrg_roll_nor.c chrg_comm.c @@ -463,55 +459,60 @@ applications\thread\chrg_comm.c - chrg_roll_nor.c + chrg_lcd.c 1 - applications\thread\chrg_roll_nor.c + applications\thread\chrg_lcd.c chrg_north.c 1 applications\thread\chrg_north.c - - chrg_south.c - 1 - applications\thread\chrg_south.c - chrg_thread.c 1 applications\thread\chrg_thread.c + + chrg_roll_sou.c + 1 + applications\thread\chrg_roll_sou.c + + + chrg_south.c + 1 + applications\thread\chrg_south.c + Applications/utils - chrg_utils.c + chrg_sink.c 1 - applications\utils\chrg_utils.c - - - chrg_north_pkg.c - 1 - applications\utils\chrg_north_pkg.c + applications\utils\chrg_sink.c chrg_eload.c 1 applications\utils\chrg_eload.c - - chrg_sink.c - 1 - applications\utils\chrg_sink.c - chrg_source.c 1 applications\utils\chrg_source.c + + chrg_north_pkg.c + 1 + applications\utils\chrg_north_pkg.c + + + chrg_utils.c + 1 + applications\utils\chrg_utils.c + @@ -612,7 +613,7 @@ __RT_IPC_SOURCE__ - + @@ -668,7 +669,7 @@ __RT_IPC_SOURCE__ - + @@ -724,7 +725,7 @@ __RT_IPC_SOURCE__ - + @@ -780,7 +781,7 @@ __RT_IPC_SOURCE__ - + @@ -836,7 +837,7 @@ __RT_IPC_SOURCE__ - + @@ -892,7 +893,7 @@ __RT_IPC_SOURCE__ - + @@ -948,7 +949,7 @@ __RT_IPC_SOURCE__ - + @@ -1004,7 +1005,7 @@ __RT_IPC_SOURCE__ - + @@ -1060,7 +1061,7 @@ __RT_IPC_SOURCE__ - + @@ -1116,7 +1117,7 @@ __RT_IPC_SOURCE__ - + @@ -1172,7 +1173,7 @@ __RT_IPC_SOURCE__ - + @@ -1228,7 +1229,7 @@ __RT_IPC_SOURCE__ - + @@ -1284,7 +1285,7 @@ __RT_IPC_SOURCE__ - + @@ -1340,7 +1341,7 @@ __RT_IPC_SOURCE__ - + @@ -1401,6 +1402,11 @@ Fal + + fal_partition.c + 1 + ..\..\rt-thread\components\fal\src\fal_partition.c + fal_flash.c 1 @@ -1411,11 +1417,6 @@ 1 ..\..\rt-thread\components\fal\src\fal_rtt.c - - fal_partition.c - 1 - ..\..\rt-thread\components\fal\src\fal_partition.c - fal.c 1 @@ -1426,16 +1427,16 @@ Finsh - - msh_parse.c - 1 - ..\..\rt-thread\components\finsh\msh_parse.c - shell.c 1 ..\..\rt-thread\components\finsh\shell.c + + msh_parse.c + 1 + ..\..\rt-thread\components\finsh\msh_parse.c + cmd.c 1 @@ -1501,7 +1502,7 @@ __RT_KERNEL_SOURCE__ - + @@ -1557,7 +1558,7 @@ __RT_KERNEL_SOURCE__ - + @@ -1613,7 +1614,7 @@ __RT_KERNEL_SOURCE__ - + @@ -1669,7 +1670,7 @@ __RT_KERNEL_SOURCE__ - + @@ -1725,7 +1726,7 @@ __RT_KERNEL_SOURCE__ - + @@ -1781,7 +1782,7 @@ __RT_KERNEL_SOURCE__ - + @@ -1837,7 +1838,7 @@ __RT_KERNEL_SOURCE__ - + @@ -1893,7 +1894,7 @@ __RT_KERNEL_SOURCE__ - + @@ -1949,7 +1950,7 @@ __RT_KERNEL_SOURCE__ - + @@ -2005,7 +2006,7 @@ __RT_KERNEL_SOURCE__ - + @@ -2061,7 +2062,7 @@ __RT_KERNEL_SOURCE__ - + @@ -2117,7 +2118,7 @@ __RT_KERNEL_SOURCE__ - + @@ -2173,7 +2174,7 @@ __RT_KERNEL_SOURCE__ - + @@ -2229,7 +2230,7 @@ __RT_KERNEL_SOURCE__ - + @@ -2285,7 +2286,7 @@ __RT_KERNEL_SOURCE__ - + @@ -2296,16 +2297,6 @@ klibc - - kstring.c - 1 - ..\..\rt-thread\src\klibc\kstring.c - - - rt_vsnprintf_tiny.c - 1 - ..\..\rt-thread\src\klibc\rt_vsnprintf_tiny.c - kstdio.c 1 @@ -2316,11 +2307,21 @@ 1 ..\..\rt-thread\src\klibc\rt_vsscanf.c + + rt_vsnprintf_tiny.c + 1 + ..\..\rt-thread\src\klibc\rt_vsnprintf_tiny.c + kerrno.c 1 ..\..\rt-thread\src\klibc\kerrno.c + + kstring.c + 1 + ..\..\rt-thread\src\klibc\kstring.c + @@ -2356,6 +2357,11 @@ rt_usbd + + cdc_vcom.c + 1 + ..\..\rt-thread\components\legacy\usb\usbdevice\class\cdc_vcom.c + usbdevice_core.c 1 @@ -2366,45 +2372,40 @@ 1 ..\..\rt-thread\components\legacy\usb\usbdevice\core\usbdevice.c - - cdc_vcom.c - 1 - ..\..\rt-thread\components\legacy\usb\usbdevice\class\cdc_vcom.c - STM32F4-CMSIS - - startup_stm32f405xx.s - 2 - ..\..\libs\stm32f4\STM32F4_CMSIS\Source\Templates\arm\startup_stm32f405xx.s - system_stm32f4xx.c 1 ..\..\libs\stm32f4\STM32F4_CMSIS\Source\Templates\system_stm32f4xx.c + + startup_stm32f405xx.s + 2 + ..\..\libs\stm32f4\STM32F4_CMSIS\Source\Templates\arm\startup_stm32f405xx.s + STM32F4-HAL - stm32f4xx_hal_flash_ex.c + stm32f4xx_hal_pccard.c 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_flash_ex.c + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_pccard.c - stm32f4xx_hal_tim.c + stm32f4xx_hal.c 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_tim.c + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal.c - stm32f4xx_hal_iwdg.c + stm32f4xx_hal_flash.c 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_iwdg.c + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_flash.c stm32f4xx_hal_cryp_ex.c @@ -2417,60 +2418,35 @@ ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_flash_ramfunc.c - stm32f4xx_hal_usart.c + stm32f4xx_hal_pcd_ex.c 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_usart.c + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_pcd_ex.c - stm32f4xx_hal_rcc_ex.c + stm32f4xx_hal_uart.c 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_rcc_ex.c + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_uart.c - stm32f4xx_hal_rcc.c + stm32f4xx_hal_dma.c 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_rcc.c + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_dma.c - stm32f4xx_hal_cortex.c + stm32f4xx_hal_flash_ex.c 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_cortex.c - - - stm32f4xx_hal.c - 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal.c - - - stm32f4xx_hal_pwr.c - 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_pwr.c - - - stm32f4xx_hal_hcd.c - 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_hcd.c - - - stm32f4xx_hal_cryp.c - 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_cryp.c - - - stm32f4xx_hal_pwr_ex.c - 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_pwr_ex.c - - - stm32f4xx_ll_usb.c - 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_ll_usb.c + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_flash_ex.c stm32f4xx_hal_cec.c 1 ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_cec.c + + stm32f4xx_hal_pcd.c + 1 + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_pcd.c + stm32f4xx_hal_lptim.c 1 @@ -2482,24 +2458,9 @@ ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_wwdg.c - stm32f4xx_hal_dma_ex.c + stm32f4xx_ll_usb.c 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_dma_ex.c - - - stm32f4xx_hal_flash.c - 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_flash.c - - - stm32f4xx_hal_rng.c - 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_rng.c - - - stm32f4xx_hal_pcd.c - 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_pcd.c + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_ll_usb.c stm32f4xx_hal_crc.c @@ -2507,24 +2468,39 @@ ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_crc.c - stm32f4xx_hal_dma.c + stm32f4xx_hal_rcc.c 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_dma.c + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_rcc.c - stm32f4xx_hal_pccard.c + stm32f4xx_hal_hcd.c 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_pccard.c + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_hcd.c - stm32f4xx_hal_pcd_ex.c + stm32f4xx_hal_tim_ex.c 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_pcd_ex.c + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_tim_ex.c - stm32f4xx_hal_uart.c + stm32f4xx_hal_cortex.c 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_uart.c + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_cortex.c + + + stm32f4xx_hal_pwr.c + 1 + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_pwr.c + + + stm32f4xx_hal_cryp.c + 1 + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_cryp.c + + + stm32f4xx_hal_pwr_ex.c + 1 + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_pwr_ex.c stm32f4xx_hal_gpio.c @@ -2532,9 +2508,49 @@ ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_gpio.c - stm32f4xx_hal_tim_ex.c + stm32f4xx_hal_rcc_ex.c 1 - ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_tim_ex.c + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_rcc_ex.c + + + stm32f4xx_hal_dma_ex.c + 1 + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_dma_ex.c + + + stm32f4xx_hal_usart.c + 1 + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_usart.c + + + stm32f4xx_hal_iwdg.c + 1 + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_iwdg.c + + + stm32f4xx_hal_rng.c + 1 + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_rng.c + + + stm32f4xx_hal_tim.c + 1 + ..\..\libs\stm32f4\STM32F4_HAL\Src\stm32f4xx_hal_tim.c + + + + + Utilities + + + console_be.c + 1 + ..\..\rt-thread\components\utilities\ulog\backend\console_be.c + + + ulog.c + 1 + ..\..\rt-thread\components\utilities\ulog\ulog.c diff --git a/apps/chrg/rtconfig.h b/apps/chrg/rtconfig.h index 5ac74da..fb65be8 100644 --- a/apps/chrg/rtconfig.h +++ b/apps/chrg/rtconfig.h @@ -194,6 +194,19 @@ /* Utilities */ +#define RT_USING_ULOG +#define ULOG_OUTPUT_LVL_D +#define ULOG_OUTPUT_LVL 7 +#define ULOG_ASSERT_ENABLE +#define ULOG_LINE_BUF_SIZE 128 + +/* log format */ + +#define ULOG_OUTPUT_TIME +#define ULOG_OUTPUT_LEVEL +#define ULOG_OUTPUT_TAG +/* end of log format */ +#define ULOG_BACKEND_USING_CONSOLE /* end of Utilities */ /* Using USB legacy version */