diff --git a/package/RTthreadBooter/pika_config.c b/package/RTthreadBooter/pika_config.c deleted file mode 100644 index 6dddb4e06..000000000 --- a/package/RTthreadBooter/pika_config.c +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2006-2021, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2021-12-07 lyon the first version - */ - -#include -#include "pikaPlatform.h" - -/* sprintf support */ -int __platform_sprintf(char* buff, char* fmt, ...) { - va_list args; - va_start(args, fmt); - int res = rt_vsprintf(buff, fmt, args); - va_end(args); - return res; -} -int __platform_vsprintf(char* buff, char* fmt, va_list args){ - return rt_vsprintf(buff, fmt, args); -} -int __platform_vsnprintf(char* buff, size_t size, const char* fmt, va_list args){ - return rt_vsnprintf(buff, size, fmt, args); -} diff --git a/package/RTthreadBooter/pika_config.h b/package/RTthreadBooter/pika_config.h deleted file mode 100644 index 490a363e1..000000000 --- a/package/RTthreadBooter/pika_config.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (c) 2006-2021, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2021-12-07 lyon the first version - */ -#ifndef PACKAGES_PIKASCRIPT_LATEST_PIKASCRIPT_LIB_RTBOOTER_PIKA_CONFIG_H_ -#define PACKAGES_PIKASCRIPT_LATEST_PIKASCRIPT_LIB_RTBOOTER_PIKA_CONFIG_H_ -#include - - -#endif /* PACKAGES_PIKASCRIPT_LATEST_PIKASCRIPT_LIB_RTBOOTER_PIKA_CONFIG_H_ */ diff --git a/package/RTthreadBooter/rt_main.c b/package/RTthreadBooter/rt_main.c deleted file mode 100644 index e2e348f0d..000000000 --- a/package/RTthreadBooter/rt_main.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2006-2021, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2021-12-07 lyon the first version - */ -#include -#include - -#define SAMPLE_UART_NAME RT_CONSOLE_DEVICE_NAME /* 串口设备名称 */ -static rt_device_t serial; /* 串口设备句柄 */ -static struct rt_semaphore rx_sem; /* 用于接收消息的信号量 */ - -#define RX_Buff_SIZE 256 -char rxBuff[RX_Buff_SIZE] = { 0 }; -Args *rxArgs; -uint8_t isRxOk = 0; -PikaObj *pikaMain; - -void rx_single_line_handle(char *line) { - rt_kprintf("\r\n"); - obj_run(pikaMain, line); - rt_kprintf(">>>"); -} - -/* 接收数据回调函数 */ -static rt_err_t uart_input_callback(rt_device_t dev, rt_size_t size) { - /* 串口接收到数据后产生中断,调用此回调函数,然后发送接收信号量 */ - char inputChar; - rt_device_read(serial, -1, &inputChar, 1); - rt_device_write(serial, 0, &inputChar, 1); - if (inputChar == '\b'){ - rt_device_write(serial, 0, " ", 1); - rt_device_write(serial, 0, &inputChar, 1); - uint32_t size = strGetSize(rxBuff); - rxBuff[size - 1] = 0; - return RT_EOK; - } - if (inputChar != '\r' && inputChar != '\n') { - strAppendWithSize(rxBuff, &inputChar, 1); - } - if (inputChar == '\r') { - isRxOk = 1; - } - return RT_EOK; -} - -static void clearBuff(char *buff, uint32_t size) { - for (int i = 0; i < size; i++) { - buff[i] = 0; - } -} - -static void uart_init() { - serial = rt_device_find(SAMPLE_UART_NAME); - - /* 以中断接收及轮询发送模式打开串口设备 */ - rt_device_open(serial, RT_DEVICE_FLAG_INT_RX); - - /* 初始化信号量 */ - rt_sem_init(&rx_sem, "rx_sem", 0, RT_IPC_FLAG_FIFO); - - /* 设置接收回调函数 */ - rt_device_set_rx_indicate(serial, uart_input_callback); -} - -static int rt_pika_main(void) -{ - uart_init(); - pikaMain = pikaScriptInit(); - clearBuff(rxBuff, RX_Buff_SIZE); - rt_kprintf(">>>"); - while (1) { - if (isRxOk) { - isRxOk = 0; - rx_single_line_handle(rxBuff); - clearBuff(rxBuff, RX_Buff_SIZE); - } - } - return RT_EOK; -} -INIT_APP_EXPORT(rt_pika_main); diff --git a/packages.toml b/packages.toml index fb5c2ed6b..897653de2 100644 --- a/packages.toml +++ b/packages.toml @@ -172,7 +172,7 @@ releases = [ ] [[packages]] -name = "RTthreadBooter" +name = "rtthread" releases = [ - "v1.0.0 132e970dc8e67245f1a6271f5ca97813050b2812", + "v1.0.0 294328067257b0be99ecb116cf0be8390a7226ed", ] diff --git a/port/rt-thread/requestment.txt b/port/rt-thread/requestment.txt index 0bf638133..56ab22742 100644 --- a/port/rt-thread/requestment.txt +++ b/port/rt-thread/requestment.txt @@ -1,3 +1,3 @@ pikascript-core==v1.2.7 PikaStdLib==v1.2.3 -RTthreadBooter==v1.0.0 +rtthread==v1.0.0