From 5fb6cb8b4159d8913e2b6dcd6d61f3a005204ddc Mon Sep 17 00:00:00 2001 From: malongwei <2544047213@qq.com> Date: Wed, 1 Sep 2021 19:58:23 +0800 Subject: 修复ringblk_buf在不使用动态内存时报错的问题 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/drivers/include/ipc/ringblk_buf.h | 5 ++++- components/drivers/src/ringblk_buf.c | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'components') diff --git a/components/drivers/include/ipc/ringblk_buf.h b/components/drivers/include/ipc/ringblk_buf.h index 5b2971b800..df05659f3e 100644 --- a/components/drivers/include/ipc/ringblk_buf.h +++ b/components/drivers/include/ipc/ringblk_buf.h @@ -76,9 +76,12 @@ typedef struct rt_rbb *rt_rbb_t; /* rbb (ring block buffer) API */ void rt_rbb_init(rt_rbb_t rbb, rt_uint8_t *buf, rt_size_t buf_size, rt_rbb_blk_t block_set, rt_size_t blk_max_num); +rt_size_t rt_rbb_get_buf_size(rt_rbb_t rbb); + +#ifdef RT_USING_HEAP rt_rbb_t rt_rbb_create(rt_size_t buf_size, rt_size_t blk_max_num); void rt_rbb_destroy(rt_rbb_t rbb); -rt_size_t rt_rbb_get_buf_size(rt_rbb_t rbb); +#endif /* rbb block API */ rt_rbb_blk_t rt_rbb_blk_alloc(rt_rbb_t rbb, rt_size_t blk_size); diff --git a/components/drivers/src/ringblk_buf.c b/components/drivers/src/ringblk_buf.c index c6688b3d2b..b966da3d36 100644 --- a/components/drivers/src/ringblk_buf.c +++ b/components/drivers/src/ringblk_buf.c @@ -44,6 +44,8 @@ void rt_rbb_init(rt_rbb_t rbb, rt_uint8_t *buf, rt_size_t buf_size, rt_rbb_blk_t } RTM_EXPORT(rt_rbb_init); +#ifdef RT_USING_HEAP + /** * ring block buffer object create * @@ -102,6 +104,8 @@ void rt_rbb_destroy(rt_rbb_t rbb) } RTM_EXPORT(rt_rbb_destroy); +#endif + static rt_rbb_blk_t find_empty_blk_in_set(rt_rbb_t rbb) { rt_size_t i; -- cgit v1.3.1 From c229d8b2b5bdeca592189f0833361b855ef12d69 Mon Sep 17 00:00:00 2001 From: malongwei <2544047213@qq.com> Date: Wed, 1 Sep 2021 21:19:22 +0800 Subject: fix at_client.c --- components/net/at/src/at_client.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'components') diff --git a/components/net/at/src/at_client.c b/components/net/at/src/at_client.c index 948020f4cf..a696a408be 100644 --- a/components/net/at/src/at_client.c +++ b/components/net/at/src/at_client.c @@ -310,7 +310,6 @@ int at_obj_exec_cmd(at_client_t client, at_response_t resp, const char *cmd_expr rt_mutex_take(client->lock, RT_WAITING_FOREVER); client->resp_status = AT_RESP_OK; - client->resp = resp; if (resp != RT_NULL) { @@ -318,6 +317,9 @@ int at_obj_exec_cmd(at_client_t client, at_response_t resp, const char *cmd_expr resp->line_counts = 0; } + client->resp = resp; + rt_sem_control(client->resp_notice, RT_IPC_CMD_RESET, RT_NULL); + va_start(args, cmd_expr); at_vprintfln(client->device, cmd_expr, args); va_end(args); @@ -327,7 +329,7 @@ int at_obj_exec_cmd(at_client_t client, at_response_t resp, const char *cmd_expr if (rt_sem_take(client->resp_notice, resp->timeout) != RT_EOK) { cmd = at_get_last_cmd(&cmd_size); - LOG_D("execute command (%.*s) timeout (%d ticks)!", cmd_size, cmd, resp->timeout); + LOG_W("execute command (%.*s) timeout (%d ticks)!", cmd_size, cmd, resp->timeout); client->resp_status = AT_RESP_TIMEOUT; result = -RT_ETIMEOUT; goto __exit; @@ -381,6 +383,7 @@ int at_client_obj_wait_connect(at_client_t client, rt_uint32_t timeout) rt_mutex_take(client->lock, RT_WAITING_FOREVER); client->resp = resp; + rt_sem_control(client->resp_notice, RT_IPC_CMD_RESET, RT_NULL); start_time = rt_tick_get(); @@ -480,9 +483,7 @@ static rt_err_t at_client_getchar(at_client_t client, char *ch, rt_int32_t timeo */ rt_size_t at_client_obj_recv(at_client_t client, char *buf, rt_size_t size, rt_int32_t timeout) { - rt_size_t read_idx = 0; - rt_err_t result = RT_EOK; - char ch; + rt_size_t len = 0; RT_ASSERT(buf); @@ -494,28 +495,28 @@ rt_size_t at_client_obj_recv(at_client_t client, char *buf, rt_size_t size, rt_i while (1) { - if (read_idx < size) + rt_sem_control(client->rx_notice, RT_IPC_CMD_RESET, RT_NULL); + + rt_size_t read_len = rt_device_read(client->device, 0, buf + len, size); + if(read_len > 0) { - result = at_client_getchar(client, &ch, timeout); - if (result != RT_EOK) - { - LOG_E("AT Client receive failed, uart device get data error(%d)", result); - return 0; - } + len += read_len; + size -= read_len; + if(size == 0) + break; - buf[read_idx++] = ch; + continue; } - else - { + + if(rt_sem_take(client->rx_notice, rt_tick_from_millisecond(timeout)) != RT_EOK) break; - } } #ifdef AT_PRINT_RAW_CMD - at_print_raw_cmd("urc_recv", buf, size); + at_print_raw_cmd("urc_recv", buf, len); #endif - return read_idx; + return len; } /** -- cgit v1.3.1 From f1e1b6b2e39ac7c62fbe4b60d5c03fe60fb7d5c9 Mon Sep 17 00:00:00 2001 From: malongwei <2544047213@qq.com> Date: Fri, 3 Sep 2021 20:16:35 +0800 Subject: fix at_client.c --- components/net/at/src/at_client.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'components') diff --git a/components/net/at/src/at_client.c b/components/net/at/src/at_client.c index a696a408be..845d8c0fa6 100644 --- a/components/net/at/src/at_client.c +++ b/components/net/at/src/at_client.c @@ -429,6 +429,8 @@ int at_client_obj_wait_connect(at_client_t client, rt_uint32_t timeout) */ rt_size_t at_client_obj_send(at_client_t client, const char *buf, rt_size_t size) { + rt_size_t len; + RT_ASSERT(buf); if (client == RT_NULL) @@ -443,7 +445,7 @@ rt_size_t at_client_obj_send(at_client_t client, const char *buf, rt_size_t size rt_mutex_take(client->lock, RT_WAITING_FOREVER); - rt_size_t len = at_utils_send(client->device, 0, buf, size); + len = at_utils_send(client->device, 0, buf, size); rt_mutex_release(client->lock); @@ -495,9 +497,11 @@ rt_size_t at_client_obj_recv(at_client_t client, char *buf, rt_size_t size, rt_i while (1) { + rt_size_t read_len; + rt_sem_control(client->rx_notice, RT_IPC_CMD_RESET, RT_NULL); - rt_size_t read_len = rt_device_read(client->device, 0, buf + len, size); + read_len = rt_device_read(client->device, 0, buf + len, size); if(read_len > 0) { len += read_len; -- cgit v1.3.1 From e18d44940f966b1c132bf242786c62e2b6e57b7a Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Sun, 5 Sep 2021 01:50:58 -0400 Subject: [finsh] 修复由于移除finsh导致__cmd_xxx命令无法使用的问题 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bsp/at91sam9260/platform/interrupt.c | 4 +--- bsp/at91sam9260/platform/reset.c | 5 ++--- bsp/at91sam9g45/platform/interrupt.c | 4 +--- bsp/at91sam9g45/platform/reset.c | 6 ++---- bsp/beaglebone/applications/board.c | 3 +-- bsp/dm365/drivers/davinci_emac.c | 2 +- bsp/dm365/platform/interrupt.c | 3 +-- bsp/dm365/platform/reset.c | 6 ++---- bsp/fm33lc026/libraries/HAL_Drivers/drv_common.c | 2 +- bsp/hk32/hk32f030c8-mini/board/board.c | 2 +- bsp/mb9bf506r/drivers/nand.c | 2 +- bsp/nuvoton/libraries/n9h30/rtt_port/drv_sys.c | 6 ++---- bsp/nuvoton/libraries/nuc980/rtt_port/drv_sys.c | 7 +++---- bsp/nv32f100x/board/src/board.c | 11 ++--------- bsp/qemu-vexpress-a9/drivers/audio/drv_ac97.c | 2 +- bsp/qemu-vexpress-a9/drivers/audio/drv_pl041.c | 3 ++- bsp/simulator/drivers/board.c | 2 +- bsp/w60x/drivers/drv_standby.c | 2 +- components/drivers/can/can.c | 3 +-- components/drivers/rtc/alarm.c | 2 +- components/drivers/wlan/wlan_cmd.c | 2 +- components/net/lwip-1.4.1/src/apps/ping/ping.c | 2 +- components/net/lwip-2.0.2/src/apps/ping/ping.c | 2 +- components/net/lwip-2.0.3/src/apps/ping/ping.c | 2 +- components/net/lwip-2.1.2/src/apps/ping/ping.c | 2 +- components/net/netdev/src/netdev.c | 9 ++++----- components/vbus/vbus.c | 2 +- examples/file/readspeed.c | 2 +- examples/file/readwrite.c | 2 +- examples/file/writespeed.c | 2 +- 30 files changed, 41 insertions(+), 63 deletions(-) (limited to 'components') diff --git a/bsp/at91sam9260/platform/interrupt.c b/bsp/at91sam9260/platform/interrupt.c index 7c40ffbdad..dc98fe7c4d 100644 --- a/bsp/at91sam9260/platform/interrupt.c +++ b/bsp/at91sam9260/platform/interrupt.c @@ -413,7 +413,6 @@ void list_irq(void) } #include -FINSH_FUNCTION_EXPORT(list_irq, list system irq); #ifdef FINSH_USING_MSH int cmd_list_irq(int argc, char** argv) @@ -421,8 +420,7 @@ int cmd_list_irq(int argc, char** argv) list_irq(); return 0; } -FINSH_FUNCTION_EXPORT_ALIAS(cmd_list_irq, __cmd_list_irq, list system irq.); - +MSH_CMD_EXPORT_ALIAS(cmd_list_irq, list_irq, list system irq); #endif #endif #endif diff --git a/bsp/at91sam9260/platform/reset.c b/bsp/at91sam9260/platform/reset.c index 4b5462a9e1..6679ab57fe 100644 --- a/bsp/at91sam9260/platform/reset.c +++ b/bsp/at91sam9260/platform/reset.c @@ -38,15 +38,14 @@ int cmd_reset(int argc, char** argv) rt_hw_cpu_reset(); return 0; } +MSH_CMD_EXPORT_ALIAS(cmd_reset, reset, restart the system); int cmd_shutdown(int argc, char** argv) { rt_hw_cpu_shutdown(); return 0; } - -FINSH_FUNCTION_EXPORT_ALIAS(cmd_reset, __cmd_reset, restart the system.); -FINSH_FUNCTION_EXPORT_ALIAS(cmd_shutdown, __cmd_shutdown, shutdown the system.); +MSH_CMD_EXPORT_ALIAS(cmd_shutdown, shutdown, shutdown the system); #endif #endif diff --git a/bsp/at91sam9g45/platform/interrupt.c b/bsp/at91sam9g45/platform/interrupt.c index c8afc998f1..c3dd99e798 100644 --- a/bsp/at91sam9g45/platform/interrupt.c +++ b/bsp/at91sam9g45/platform/interrupt.c @@ -445,7 +445,6 @@ void list_irq(void) } #include -FINSH_FUNCTION_EXPORT(list_irq, list system irq); #ifdef FINSH_USING_MSH int cmd_list_irq(int argc, char** argv) @@ -453,8 +452,7 @@ int cmd_list_irq(int argc, char** argv) list_irq(); return 0; } -FINSH_FUNCTION_EXPORT_ALIAS(cmd_list_irq, __cmd_list_irq, list system irq.); - +MSH_CMD_EXPORT_ALIAS(cmd_list_irq, list_irq, list system irq); #endif #endif #endif diff --git a/bsp/at91sam9g45/platform/reset.c b/bsp/at91sam9g45/platform/reset.c index 8abbf7a9fb..33d6f97283 100644 --- a/bsp/at91sam9g45/platform/reset.c +++ b/bsp/at91sam9g45/platform/reset.c @@ -30,7 +30,6 @@ void machine_shutdown(void) #ifdef RT_USING_FINSH #include -FINSH_FUNCTION_EXPORT_ALIAS(rt_hw_cpu_reset, reset, restart the system); #ifdef FINSH_USING_MSH int cmd_reset(int argc, char** argv) @@ -38,15 +37,14 @@ int cmd_reset(int argc, char** argv) rt_hw_cpu_reset(); return 0; } +MSH_CMD_EXPORT_ALIAS(cmd_reset, reset, restart the system); int cmd_shutdown(int argc, char** argv) { rt_hw_cpu_shutdown(); return 0; } - -FINSH_FUNCTION_EXPORT_ALIAS(cmd_reset, __cmd_reset, restart the system.); -FINSH_FUNCTION_EXPORT_ALIAS(cmd_shutdown, __cmd_shutdown, shutdown the system.); +MSH_CMD_EXPORT_ALIAS(cmd_shutdown, shutdown, shutdown the system); #endif #endif diff --git a/bsp/beaglebone/applications/board.c b/bsp/beaglebone/applications/board.c index ff25dd7dd7..e1e1f8cae2 100644 --- a/bsp/beaglebone/applications/board.c +++ b/bsp/beaglebone/applications/board.c @@ -163,5 +163,4 @@ void rt_hw_cpu_reset(void) REG32(PRM_DEVICE(prcm_base)) = 0x1; RT_ASSERT(0); } -FINSH_FUNCTION_EXPORT_ALIAS(rt_hw_cpu_reset, reboot, reboot the cpu); -FINSH_FUNCTION_EXPORT_ALIAS(rt_hw_cpu_reset, __cmd_reboot, reboot the cpu); +MSH_CMD_EXPORT_ALIAS(rt_hw_cpu_reset, reboot, reboot the cpu); diff --git a/bsp/dm365/drivers/davinci_emac.c b/bsp/dm365/drivers/davinci_emac.c index 7ad539fb09..b164bf7aaa 100644 --- a/bsp/dm365/drivers/davinci_emac.c +++ b/bsp/dm365/drivers/davinci_emac.c @@ -1751,7 +1751,7 @@ int cmd_dump_emac_stats(int argc, char** argv) dump_emac_stats(); return 0; } -FINSH_FUNCTION_EXPORT_ALIAS(cmd_dump_emac_stats, __cmd_dump_emac_stats, dump emac statistics.); +MSH_CMD_EXPORT_ALIAS(cmd_dump_emac_stats, dump_emac_stats, dump emac statistics); #endif #endif diff --git a/bsp/dm365/platform/interrupt.c b/bsp/dm365/platform/interrupt.c index 6334072bcd..fb0d4d3d3e 100644 --- a/bsp/dm365/platform/interrupt.c +++ b/bsp/dm365/platform/interrupt.c @@ -286,8 +286,7 @@ int cmd_list_irq(int argc, char** argv) list_irq(); return 0; } -FINSH_FUNCTION_EXPORT_ALIAS(cmd_list_irq, __cmd_list_irq, list system irq.); - +MSH_CMD_EXPORT_ALIAS(cmd_list_irq, list_irq, list system irq); #endif #endif #endif diff --git a/bsp/dm365/platform/reset.c b/bsp/dm365/platform/reset.c index dc80fac76e..b706e5a4cc 100644 --- a/bsp/dm365/platform/reset.c +++ b/bsp/dm365/platform/reset.c @@ -39,7 +39,6 @@ void machine_shutdown() #ifdef RT_USING_FINSH #include -FINSH_FUNCTION_EXPORT_ALIAS(rt_hw_cpu_reset, reset, restart the system); #ifdef FINSH_USING_MSH int cmd_reset(int argc, char** argv) @@ -47,15 +46,14 @@ int cmd_reset(int argc, char** argv) rt_hw_cpu_reset(); return 0; } +MSH_CMD_EXPORT_ALIAS(cmd_reset, reset, restart the system); int cmd_shutdown(int argc, char** argv) { rt_hw_cpu_shutdown(); return 0; } - -FINSH_FUNCTION_EXPORT_ALIAS(cmd_reset, __cmd_reset, restart the system.); -FINSH_FUNCTION_EXPORT_ALIAS(cmd_shutdown, __cmd_shutdown, shutdown the system.); +MSH_CMD_EXPORT_ALIAS(cmd_shutdown, shutdown, shutdown the system); #endif #endif diff --git a/bsp/fm33lc026/libraries/HAL_Drivers/drv_common.c b/bsp/fm33lc026/libraries/HAL_Drivers/drv_common.c index 9decb78d6d..27eb76cc84 100644 --- a/bsp/fm33lc026/libraries/HAL_Drivers/drv_common.c +++ b/bsp/fm33lc026/libraries/HAL_Drivers/drv_common.c @@ -22,7 +22,7 @@ static void reboot(uint8_t argc, char **argv) { rt_hw_cpu_reset(); } -FINSH_FUNCTION_EXPORT_ALIAS(reboot, __cmd_reboot, Reboot System); +MSH_CMD_EXPORT(reboot, reboot system); #endif /* RT_USING_FINSH */ /* SysTick configuration */ diff --git a/bsp/hk32/hk32f030c8-mini/board/board.c b/bsp/hk32/hk32f030c8-mini/board/board.c index e659a2f718..8d3aeaf117 100644 --- a/bsp/hk32/hk32f030c8-mini/board/board.c +++ b/bsp/hk32/hk32f030c8-mini/board/board.c @@ -21,7 +21,7 @@ static void reboot(uint8_t argc, char **argv) { rt_hw_cpu_reset(); } -FINSH_FUNCTION_EXPORT_ALIAS(reboot, __cmd_reboot, Reboot System); +MSH_CMD_EXPORT(reboot, reboot system); #endif /* RT_USING_FINSH */ /** System Clock Configuration diff --git a/bsp/mb9bf506r/drivers/nand.c b/bsp/mb9bf506r/drivers/nand.c index fcd8cf42d4..1c03120d14 100644 --- a/bsp/mb9bf506r/drivers/nand.c +++ b/bsp/mb9bf506r/drivers/nand.c @@ -646,7 +646,7 @@ void nand_readoob(int block, int page) } FINSH_FUNCTION_EXPORT_ALIAS(nand_readoob, readoob, read oob[block/page]); -void nand_erase_chip() +void nand_erase_chip(void) { int i; unsigned char id; diff --git a/bsp/nuvoton/libraries/n9h30/rtt_port/drv_sys.c b/bsp/nuvoton/libraries/n9h30/rtt_port/drv_sys.c index 43b0c2cfb8..6bd1e90c6d 100644 --- a/bsp/nuvoton/libraries/n9h30/rtt_port/drv_sys.c +++ b/bsp/nuvoton/libraries/n9h30/rtt_port/drv_sys.c @@ -271,7 +271,6 @@ E_SYS_USB0_ID nu_sys_usb0_role(void) #ifdef RT_USING_FINSH #include -FINSH_FUNCTION_EXPORT_ALIAS(rt_hw_cpu_reset, reset, restart the system); #ifdef FINSH_USING_MSH int cmd_reset(int argc, char **argv) @@ -279,15 +278,14 @@ int cmd_reset(int argc, char **argv) rt_hw_cpu_reset(); return 0; } +MSH_CMD_EXPORT_ALIAS(cmd_reset, reset, restart the system); int cmd_shutdown(int argc, char **argv) { rt_hw_cpu_shutdown(); return 0; } - -FINSH_FUNCTION_EXPORT_ALIAS(cmd_reset, __cmd_reset, restart the system.); -FINSH_FUNCTION_EXPORT_ALIAS(cmd_shutdown, __cmd_shutdown, shutdown the system.); +MSH_CMD_EXPORT_ALIAS(cmd_shutdown, shutdown, shutdown the system); int nu_clocks(int argc, char **argv) { diff --git a/bsp/nuvoton/libraries/nuc980/rtt_port/drv_sys.c b/bsp/nuvoton/libraries/nuc980/rtt_port/drv_sys.c index c19d2dd34a..8d4538576b 100644 --- a/bsp/nuvoton/libraries/nuc980/rtt_port/drv_sys.c +++ b/bsp/nuvoton/libraries/nuc980/rtt_port/drv_sys.c @@ -310,15 +310,14 @@ int cmd_reset(int argc, char **argv) rt_hw_cpu_reset(); return 0; } +MSH_CMD_EXPORT_ALIAS(cmd_reset, reset, restart the system); int cmd_shutdown(int argc, char **argv) { rt_hw_cpu_shutdown(); return 0; } - -FINSH_FUNCTION_EXPORT_ALIAS(cmd_reset, __cmd_reset, restart the system.); -FINSH_FUNCTION_EXPORT_ALIAS(cmd_shutdown, __cmd_shutdown, shutdown the system.); +MSH_CMD_EXPORT_ALIAS(cmd_shutdown, shutdown, shutdown the system); int nu_clocks(int argc, char **argv) { @@ -345,7 +344,7 @@ int nu_clocks(int argc, char **argv) return 0; } -MSH_CMD_EXPORT(nu_clocks, Get all system clocks); +MSH_CMD_EXPORT(nu_clocks, get all system clocks); #endif #ifdef RT_USING_INTERRUPT_INFO diff --git a/bsp/nv32f100x/board/src/board.c b/bsp/nv32f100x/board/src/board.c index 372099a6ba..75da79f9ee 100644 --- a/bsp/nv32f100x/board/src/board.c +++ b/bsp/nv32f100x/board/src/board.c @@ -98,21 +98,14 @@ void rt_hw_board_init() #ifdef RT_USING_HEAP rt_system_heap_init((void*)NV32_SRAM_BEGIN, (void*)NV32_SRAM_END); #endif - - - - } -long cmd_reset(int argc, char** argv) +int cmd_reset(int argc, char** argv) { NVIC_SystemReset(); return 0; } - -FINSH_FUNCTION_EXPORT_ALIAS(cmd_reset, __cmd_reset, Reset Board.); - - +MSH_CMD_EXPORT_ALIAS(cmd_reset, reset, restart the system); /*@}*/ diff --git a/bsp/qemu-vexpress-a9/drivers/audio/drv_ac97.c b/bsp/qemu-vexpress-a9/drivers/audio/drv_ac97.c index cf88ebed5e..d8ab4eda8a 100644 --- a/bsp/qemu-vexpress-a9/drivers/audio/drv_ac97.c +++ b/bsp/qemu-vexpress-a9/drivers/audio/drv_ac97.c @@ -102,6 +102,6 @@ int _ac97_reg_dump(int argc, char **argv) AC97_DUMP(AC97_ADC_SLOT_MAP); return 0; } -FINSH_FUNCTION_EXPORT_ALIAS(_ac97_reg_dump, __cmd_ac97_dump, ac97 dump reg.); +MSH_CMD_EXPORT_ALIAS(_ac97_reg_dump, ac97_dump, ac97 dump reg); #endif diff --git a/bsp/qemu-vexpress-a9/drivers/audio/drv_pl041.c b/bsp/qemu-vexpress-a9/drivers/audio/drv_pl041.c index 3498031d7b..9de431ed9b 100644 --- a/bsp/qemu-vexpress-a9/drivers/audio/drv_pl041.c +++ b/bsp/qemu-vexpress-a9/drivers/audio/drv_pl041.c @@ -391,5 +391,6 @@ int _aaci_pl041_reg_dump(int argc, char **argv) PL041_DUMP(PL041->dr4[0]); return 0; } -FINSH_FUNCTION_EXPORT_ALIAS(_aaci_pl041_reg_dump, __cmd_pl041_dump, aaci pl041 dump reg.); +MSH_CMD_EXPORT_ALIAS(_aaci_pl041_reg_dump, pl041_dump, aaci pl041 dump reg); + #endif diff --git a/bsp/simulator/drivers/board.c b/bsp/simulator/drivers/board.c index 4facdfa1b2..17339d4e1a 100755 --- a/bsp/simulator/drivers/board.c +++ b/bsp/simulator/drivers/board.c @@ -84,7 +84,7 @@ void rt_hw_exit(void) #if defined(RT_USING_FINSH) #include FINSH_FUNCTION_EXPORT_ALIAS(rt_hw_exit, exit, exit rt - thread); -FINSH_FUNCTION_EXPORT_ALIAS(rt_hw_exit, __cmd_quit, exit rt-thread); +MSH_CMD_EXPORT_ALIAS(rt_hw_exit, quit, exit rt-thread); #endif /* RT_USING_FINSH */ /** diff --git a/bsp/w60x/drivers/drv_standby.c b/bsp/w60x/drivers/drv_standby.c index dfe699bf32..8e35f4cca8 100644 --- a/bsp/w60x/drivers/drv_standby.c +++ b/bsp/w60x/drivers/drv_standby.c @@ -97,7 +97,7 @@ static void standby(uint8_t argc, char **argv) sys_start_standby(atoi(argv[1])); } } -FINSH_FUNCTION_EXPORT_ALIAS(standby, __cmd_standby, sleep System); +MSH_CMD_EXPORT(standby, sleep system); #endif /* RT_USING_FINSH */ #endif /* BSP_USING_STANDBY */ diff --git a/components/drivers/can/can.c b/components/drivers/can/can.c index 55444c3a0e..358220013f 100644 --- a/components/drivers/can/can.c +++ b/components/drivers/can/can.c @@ -966,6 +966,5 @@ int cmd_canstat(int argc, void **argv) } return 0; } -FINSH_FUNCTION_EXPORT_ALIAS(cmd_canstat, __cmd_canstat, Stat Can Device Status.); +MSH_CMD_EXPORT_ALIAS(cmd_canstat, canstat, stat can device status); #endif - diff --git a/components/drivers/rtc/alarm.c b/components/drivers/rtc/alarm.c index cd0a976328..2bcc51f2ee 100644 --- a/components/drivers/rtc/alarm.c +++ b/components/drivers/rtc/alarm.c @@ -777,7 +777,7 @@ void rt_alarm_dump(void) rt_kprintf("+----+---------------------+------+------+----+\n"); } -FINSH_FUNCTION_EXPORT_ALIAS(rt_alarm_dump, __cmd_alarm_dump, dump alarm info); +MSH_CMD_EXPORT_ALIAS(rt_alarm_dump, rt_alarm_dump, dump alarm info); /** \brief initialize alarm service system * diff --git a/components/drivers/wlan/wlan_cmd.c b/components/drivers/wlan/wlan_cmd.c index 3b8a119784..52c25f6755 100644 --- a/components/drivers/wlan/wlan_cmd.c +++ b/components/drivers/wlan/wlan_cmd.c @@ -587,7 +587,7 @@ static int wifi_msh(int argc, char *argv[]) } #if defined(RT_USING_FINSH) -FINSH_FUNCTION_EXPORT_ALIAS(wifi_msh, __cmd_wifi, wifi command.); +MSH_CMD_EXPORT_ALIAS(wifi_msh, wifi, wifi command); #endif #endif diff --git a/components/net/lwip-1.4.1/src/apps/ping/ping.c b/components/net/lwip-1.4.1/src/apps/ping/ping.c index 6d3cfe0fc3..6251504f59 100644 --- a/components/net/lwip-1.4.1/src/apps/ping/ping.c +++ b/components/net/lwip-1.4.1/src/apps/ping/ping.c @@ -236,7 +236,7 @@ int cmd_ping(int argc, char **argv) return 0; } -FINSH_FUNCTION_EXPORT_ALIAS(cmd_ping, __cmd_ping, ping network host); +MSH_CMD_EXPORT_ALIAS(cmd_ping, ping, ping network host); #endif /* RT_USING_FINSH */ #endif /* RT_USING_NETDEV */ diff --git a/components/net/lwip-2.0.2/src/apps/ping/ping.c b/components/net/lwip-2.0.2/src/apps/ping/ping.c index 6d3cfe0fc3..6251504f59 100644 --- a/components/net/lwip-2.0.2/src/apps/ping/ping.c +++ b/components/net/lwip-2.0.2/src/apps/ping/ping.c @@ -236,7 +236,7 @@ int cmd_ping(int argc, char **argv) return 0; } -FINSH_FUNCTION_EXPORT_ALIAS(cmd_ping, __cmd_ping, ping network host); +MSH_CMD_EXPORT_ALIAS(cmd_ping, ping, ping network host); #endif /* RT_USING_FINSH */ #endif /* RT_USING_NETDEV */ diff --git a/components/net/lwip-2.0.3/src/apps/ping/ping.c b/components/net/lwip-2.0.3/src/apps/ping/ping.c index 6d3cfe0fc3..6251504f59 100644 --- a/components/net/lwip-2.0.3/src/apps/ping/ping.c +++ b/components/net/lwip-2.0.3/src/apps/ping/ping.c @@ -236,7 +236,7 @@ int cmd_ping(int argc, char **argv) return 0; } -FINSH_FUNCTION_EXPORT_ALIAS(cmd_ping, __cmd_ping, ping network host); +MSH_CMD_EXPORT_ALIAS(cmd_ping, ping, ping network host); #endif /* RT_USING_FINSH */ #endif /* RT_USING_NETDEV */ diff --git a/components/net/lwip-2.1.2/src/apps/ping/ping.c b/components/net/lwip-2.1.2/src/apps/ping/ping.c index 6d3cfe0fc3..6251504f59 100644 --- a/components/net/lwip-2.1.2/src/apps/ping/ping.c +++ b/components/net/lwip-2.1.2/src/apps/ping/ping.c @@ -236,7 +236,7 @@ int cmd_ping(int argc, char **argv) return 0; } -FINSH_FUNCTION_EXPORT_ALIAS(cmd_ping, __cmd_ping, ping network host); +MSH_CMD_EXPORT_ALIAS(cmd_ping, ping, ping network host); #endif /* RT_USING_FINSH */ #endif /* RT_USING_NETDEV */ diff --git a/components/net/netdev/src/netdev.c b/components/net/netdev/src/netdev.c index f722909cc8..26451cb007 100644 --- a/components/net/netdev/src/netdev.c +++ b/components/net/netdev/src/netdev.c @@ -1047,7 +1047,7 @@ int netdev_ifconfig(int argc, char **argv) return 0; } -FINSH_FUNCTION_EXPORT_ALIAS(netdev_ifconfig, __cmd_ifconfig, list the information of all network interfaces); +MSH_CMD_EXPORT_ALIAS(netdev_ifconfig, ifconfig, list the information of all network interfaces); #endif /* NETDEV_USING_IFCONFIG */ #ifdef NETDEV_USING_PING @@ -1152,7 +1152,7 @@ int netdev_ping(int argc, char **argv) return 0; } -FINSH_FUNCTION_EXPORT_ALIAS(netdev_ping, __cmd_ping, ping network host); +MSH_CMD_EXPORT_ALIAS(netdev_ping, ping, ping network host); #endif /* NETDEV_USING_IFCONFIG */ static void netdev_list_dns(void) @@ -1222,8 +1222,7 @@ int netdev_dns(int argc, char **argv) return 0; } -FINSH_FUNCTION_EXPORT_ALIAS(netdev_dns, __cmd_dns, list and set the information of dns); - +MSH_CMD_EXPORT_ALIAS(netdev_dns, dns, list and set the information of dns); #ifdef NETDEV_USING_NETSTAT static void netdev_cmd_netstat(void) { @@ -1270,7 +1269,7 @@ int netdev_netstat(int argc, char **argv) return 0; } -FINSH_FUNCTION_EXPORT_ALIAS(netdev_netstat, __cmd_netstat, list the information of TCP / IP); +MSH_CMD_EXPORT_ALIAS(netdev_netstat, netstat, list the information of TCP / IP); #endif /* NETDEV_USING_NETSTAT */ #endif /* RT_USING_FINSH */ diff --git a/components/vbus/vbus.c b/components/vbus/vbus.c index 2adaad9449..cb28b33fca 100644 --- a/components/vbus/vbus.c +++ b/components/vbus/vbus.c @@ -1308,7 +1308,7 @@ void rt_vbus_chm_wm_dump(void) #ifdef RT_USING_FINSH #include -FINSH_FUNCTION_EXPORT_ALIAS(rt_vbus_rb_dump, vbrb, dump vbus ringbuffer status); +FINSH_FUNCTION_EXPORT_ALIAS(rt_vbus_rb_dump, vbrb, dump vbus ringbuffer status); FINSH_FUNCTION_EXPORT_ALIAS(rt_vbus_chn_dump, vbchn, dump vbus channel status); FINSH_FUNCTION_EXPORT_ALIAS(rt_vbus_sess_dump, vbses, dump vbus session status); FINSH_FUNCTION_EXPORT_ALIAS(rt_vbus_que_dump, vbque, dump vbus out queue status); diff --git a/examples/file/readspeed.c b/examples/file/readspeed.c index 61b1a8a696..5f4cad3190 100644 --- a/examples/file/readspeed.c +++ b/examples/file/readspeed.c @@ -81,5 +81,5 @@ static void cmd_readspeed(int argc, char *argv[]) } readspeed(filename, block_size); } -FINSH_FUNCTION_EXPORT_ALIAS(cmd_readspeed, __cmd_readspeed, test file system read speed); +MSH_CMD_EXPORT_ALIAS(cmd_readspeed, readspeed, test file system read speed); #endif /* RT_USING_FINSH */ diff --git a/examples/file/readwrite.c b/examples/file/readwrite.c index 9b27da1b01..d1dd5bc038 100644 --- a/examples/file/readwrite.c +++ b/examples/file/readwrite.c @@ -162,5 +162,5 @@ static void cmd_readwrite(int argc, char *argv[]) } readwrite(filename); } -FINSH_FUNCTION_EXPORT_ALIAS(cmd_readwrite, __cmd_readwrite, perform file read and write test); +MSH_CMD_EXPORT_ALIAS(cmd_readwrite, readwrite, perform file read and write test); #endif /* RT_USING_FINSH */ diff --git a/examples/file/writespeed.c b/examples/file/writespeed.c index 8ae6f6e5a8..f76027d28b 100644 --- a/examples/file/writespeed.c +++ b/examples/file/writespeed.c @@ -92,5 +92,5 @@ static void cmd_writespeed(int argc, char *argv[]) } writespeed(filename, length, block_size); } -FINSH_FUNCTION_EXPORT_ALIAS(cmd_writespeed, __cmd_writespeed, test file system write speed); +MSH_CMD_EXPORT_ALIAS(cmd_writespeed, writespeed, test file system write speed); #endif /* RT_USING_FINSH */ -- cgit v1.3.1 From 099dc437ea0a7dbe6cd931b29bf89adf1dd4c32f Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Sun, 5 Sep 2021 14:03:33 -0400 Subject: [finsh] 恢复FINSH_USING_MSH定义以保持兼容性 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/finsh/Kconfig | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'components') diff --git a/components/finsh/Kconfig b/components/finsh/Kconfig index cf4e673c75..cc891e3951 100644 --- a/components/finsh/Kconfig +++ b/components/finsh/Kconfig @@ -11,6 +11,10 @@ config RT_USING_MSH if RT_USING_MSH + config FINSH_USING_MSH + bool + default y + config FINSH_THREAD_NAME string "The msh thread name" default "tshell" -- cgit v1.3.1 From fca920751761da33a58fb9565fea31f7099f826d Mon Sep 17 00:00:00 2001 From: Jackistang Date: Mon, 6 Sep 2021 13:27:40 +0800 Subject: serial: add CTS/RTS flowcontrol. --- bsp/stm32/libraries/HAL_Drivers/drv_usart.c | 14 +++++++++++++- components/drivers/include/drivers/serial.h | 7 ++++++- 2 files changed, 19 insertions(+), 2 deletions(-) (limited to 'components') diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_usart.c b/bsp/stm32/libraries/HAL_Drivers/drv_usart.c index be8b50bba1..06c1d81dfd 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_usart.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_usart.c @@ -107,10 +107,22 @@ static rt_err_t stm32_configure(struct rt_serial_device *serial, struct serial_c uart = rt_container_of(serial, struct stm32_uart, serial); uart->handle.Instance = uart->config->Instance; uart->handle.Init.BaudRate = cfg->baud_rate; - uart->handle.Init.HwFlowCtl = UART_HWCONTROL_NONE; uart->handle.Init.Mode = UART_MODE_TX_RX; uart->handle.Init.OverSampling = UART_OVERSAMPLING_16; + switch (cfg->flowcontrol) + { + case RT_SERIAL_FLOWCONTROL_NONE: + uart->handle.Init.HwFlowCtl = UART_HWCONTROL_NONE; + break; + case RT_SERIAL_FLOWCONTROL_CTSRTS: + uart->handle.Init.HwFlowCtl = UART_HWCONTROL_RTS_CTS; + break; + default: + uart->handle.Init.HwFlowCtl = UART_HWCONTROL_NONE; + break; + } + switch (cfg->data_bits) { case DATA_BITS_8: diff --git a/components/drivers/include/drivers/serial.h b/components/drivers/include/drivers/serial.h index c2e951e9b1..f0d0edbfad 100644 --- a/components/drivers/include/drivers/serial.h +++ b/components/drivers/include/drivers/serial.h @@ -77,6 +77,9 @@ #define RT_SERIAL_TX_DATAQUEUE_SIZE 2048 #define RT_SERIAL_TX_DATAQUEUE_LWM 30 +#define RT_SERIAL_FLOWCONTROL_CTSRTS 1 +#define RT_SERIAL_FLOWCONTROL_NONE 0 + /* Default config for serial_configure structure */ #define RT_SERIAL_CONFIG_DEFAULT \ { \ @@ -87,6 +90,7 @@ BIT_ORDER_LSB, /* LSB first sent */ \ NRZ_NORMAL, /* Normal mode */ \ RT_SERIAL_RB_BUFSZ, /* Buffer size */ \ + RT_SERIAL_FLOWCONTROL_NONE, /* Off flowcontrol */ \ 0 \ } @@ -100,7 +104,8 @@ struct serial_configure rt_uint32_t bit_order :1; rt_uint32_t invert :1; rt_uint32_t bufsz :16; - rt_uint32_t reserved :6; + rt_uint32_t flowcontrol :1; + rt_uint32_t reserved :5; }; /* -- cgit v1.3.1 From e4a404c3efd19bbddc5ebdc14807d1702550c507 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Sun, 5 Sep 2021 12:07:35 -0400 Subject: [msh] add comments --- components/finsh/finsh.h | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'components') diff --git a/components/finsh/finsh.h b/components/finsh/finsh.h index 380cade403..98048ebad4 100644 --- a/components/finsh/finsh.h +++ b/components/finsh/finsh.h @@ -116,15 +116,25 @@ typedef long (*syscall_func)(void); #define FINSH_FUNCTION_EXPORT_ALIAS(name, alias, desc) /** - * @ingroup finsh + * @ingroup msh * * This macro exports a command to module shell. * - * @param command the name of command. - * @param desc the description of command, which will show in help. + * @param command is the name of the command. + * @param desc is the description of the command, which will show in help list. */ #define MSH_CMD_EXPORT(command, desc) \ MSH_FUNCTION_EXPORT_CMD(command, command, desc) + +/** + * @ingroup msh + * + * This macro exports a command with alias to module shell. + * + * @param command is the name of the command. + * @param alias is the alias of the command. + * @param desc is the description of the command, which will show in help list. + */ #define MSH_CMD_EXPORT_ALIAS(command, alias, desc) \ MSH_FUNCTION_EXPORT_CMD(command, alias, desc) -- cgit v1.3.1 From ab86b7490dc8fc8176e2f2d3b6f90fd862d0c514 Mon Sep 17 00:00:00 2001 From: shishirong <769442772@qq.com> Date: Thu, 9 Sep 2021 17:02:21 +0800 Subject: fix Macro definition syntax error in ulog.c --- components/utilities/ulog/ulog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'components') diff --git a/components/utilities/ulog/ulog.c b/components/utilities/ulog/ulog.c index 89ba58cf48..0e227e39f3 100644 --- a/components/utilities/ulog/ulog.c +++ b/components/utilities/ulog/ulog.c @@ -1075,7 +1075,7 @@ const char *ulog_global_filter_kw_get(void) return ulog.filter.keyword; } -#ifdef(RT_USING_FINSH) +#ifdef RT_USING_FINSH #include static void _print_lvl_info(void) -- cgit v1.3.1 From c1c63fc10c541ebea342413f917716e40a439b0f Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Thu, 9 Sep 2021 13:31:41 -0400 Subject: [serial] 优化RT_USING_POSIX_TERMIOS预编译 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/drivers/serial/serial.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'components') diff --git a/components/drivers/serial/serial.c b/components/drivers/serial/serial.c index 97068b30aa..c567e34b52 100644 --- a/components/drivers/serial/serial.c +++ b/components/drivers/serial/serial.c @@ -1112,6 +1112,7 @@ static rt_err_t rt_serial_control(struct rt_device *dev, break; case TCXONC: break; +#endif /*RT_USING_POSIX_TERMIOS*/ case TIOCSWINSZ: { struct winsize* p_winsize; @@ -1202,7 +1203,6 @@ static rt_err_t rt_serial_control(struct rt_device *dev, p_winsize->ws_ypixel = 0;/* unused */ } break; -#endif /*RT_USING_POSIX_TERMIOS*/ case FIONREAD: { rt_size_t recved = 0; -- cgit v1.3.1 From 8da9f78d7274f462852096ca2cae3d6e284fd51f Mon Sep 17 00:00:00 2001 From: Bernard Xiong Date: Sat, 11 Sep 2021 11:07:51 +0800 Subject: [libc] remove rtlibc --- bsp/qemu-riscv-virt64/driver/plic.c | 3 +- bsp/qemu-riscv-virt64/driver/sbi.c | 4 +- bsp/qemu-riscv-virt64/driver/sbi.h | 1 + components/dfs/include/dfs.h | 2 + components/dfs/include/dfs_posix.h | 16 +-- components/drivers/rtc/rtc.c | 7 +- components/libc/compilers/common/fcntl.h | 72 ++++++++++++++ components/libc/compilers/common/none-gcc/fcntl.h | 18 ---- .../libc/compilers/common/none-gcc/sys/stat.h | 76 +++++++++++++- components/libc/compilers/common/sys/ioctl.h | 2 + components/libc/compilers/dlib/libc.c | 2 +- components/libc/compilers/newlib/stdio.c | 2 +- components/libc/libdl/dlelf.h | 7 +- components/net/lwip-1.4.1/src/lwipopts.h | 1 + components/net/lwip-2.0.2/src/lwipopts.h | 1 + components/net/lwip-2.0.3/src/lwipopts.h | 1 + components/net/lwip-2.1.2/src/lwipopts.h | 1 + components/net/netdev/src/netdev_ipaddr.c | 2 +- components/net/sal_socket/socket/net_netdb.c | 1 + include/libc/libc_fcntl.h | 98 ------------------ include/libc/libc_stat.h | 110 --------------------- include/rtdef.h | 3 - include/rtlibc.h | 31 ------ libcpu/mips/common/ptrace.h | 2 +- libcpu/risc-v/virt64/cpuport.c | 2 +- 25 files changed, 171 insertions(+), 294 deletions(-) create mode 100644 components/libc/compilers/common/fcntl.h delete mode 100644 components/libc/compilers/common/none-gcc/fcntl.h delete mode 100644 include/libc/libc_fcntl.h delete mode 100644 include/libc/libc_stat.h delete mode 100644 include/rtlibc.h (limited to 'components') diff --git a/bsp/qemu-riscv-virt64/driver/plic.c b/bsp/qemu-riscv-virt64/driver/plic.c index f502bc9da0..6e2ec5e84e 100644 --- a/bsp/qemu-riscv-virt64/driver/plic.c +++ b/bsp/qemu-riscv-virt64/driver/plic.c @@ -7,7 +7,8 @@ * Date Author Notes * 2021-05-20 bigmagic first version */ -#include "rtthread.h" +#include +#include #include "plic.h" #include #include "encoding.h" diff --git a/bsp/qemu-riscv-virt64/driver/sbi.c b/bsp/qemu-riscv-virt64/driver/sbi.c index f848ec7810..129e8fcb0e 100644 --- a/bsp/qemu-riscv-virt64/driver/sbi.c +++ b/bsp/qemu-riscv-virt64/driver/sbi.c @@ -72,8 +72,8 @@ sbi_get_impl_version(void) void sbi_print_version(void) { - u_int major; - u_int minor; + int major; + int minor; /* For legacy SBI implementations. */ if (sbi_spec_version == 0) diff --git a/bsp/qemu-riscv-virt64/driver/sbi.h b/bsp/qemu-riscv-virt64/driver/sbi.h index b42d558f53..1e7ad6b4b8 100644 --- a/bsp/qemu-riscv-virt64/driver/sbi.h +++ b/bsp/qemu-riscv-virt64/driver/sbi.h @@ -48,6 +48,7 @@ #ifndef _MACHINE_SBI_H_ #define _MACHINE_SBI_H_ +#include #include /* SBI Specification Version */ diff --git a/components/dfs/include/dfs.h b/components/dfs/include/dfs.h index 0fd8c2dccc..9f112f9656 100644 --- a/components/dfs/include/dfs.h +++ b/components/dfs/include/dfs.h @@ -16,6 +16,8 @@ #include #include #include +#include +#include #include #include diff --git a/components/dfs/include/dfs_posix.h b/components/dfs/include/dfs_posix.h index ec7cdc9de4..98da0f854f 100644 --- a/components/dfs/include/dfs_posix.h +++ b/components/dfs/include/dfs_posix.h @@ -16,22 +16,15 @@ #define __DFS_POSIX_H__ #include +#include #ifdef __cplusplus extern "C" { #endif -/* directory api*/ -int mkdir(const char *path, mode_t mode); -DIR *opendir(const char *name); -struct dirent *readdir(DIR *d); -long telldir(DIR *d); -void seekdir(DIR *d, off_t offset); -void rewinddir(DIR *d); -int closedir(DIR *d); /* file api*/ -int open(const char *file, int flags, ...); + int close(int d); #if defined(RT_USING_NEWLIB) && defined(_EXFUN) @@ -45,11 +38,7 @@ int write(int fd, const void *buf, size_t len); off_t lseek(int fd, off_t offset, int whence); int rename(const char *from, const char *to); int unlink(const char *pathname); -int stat(const char *file, struct stat *buf); -int fstat(int fildes, struct stat *buf); int fsync(int fildes); -int fcntl(int fildes, int cmd, ...); -int ioctl(int fildes, int cmd, ...); int ftruncate(int fd, off_t length); /* directory api*/ @@ -62,7 +51,6 @@ int statfs(const char *path, struct statfs *buf); int access(const char *path, int amode); int pipe(int fildes[2]); -int mkfifo(const char *path, mode_t mode); #ifdef __cplusplus } diff --git a/components/drivers/rtc/rtc.c b/components/drivers/rtc/rtc.c index 35e7ddc3c4..bc75c83e7d 100644 --- a/components/drivers/rtc/rtc.c +++ b/components/drivers/rtc/rtc.c @@ -223,7 +223,7 @@ rt_err_t set_time(rt_uint32_t hour, rt_uint32_t minute, rt_uint32_t second) /** * get date and time or set (local timezone) [year month day hour min sec] */ -static void date(uint8_t argc, char **argv) +static void date(int argc, char **argv) { if (argc == 1) { @@ -235,8 +235,9 @@ static void date(uint8_t argc, char **argv) else if (argc >= 7) { /* set time and date */ - uint16_t year; - uint8_t month, day, hour, min, sec; + rt_uint16_t year; + rt_uint8_t month, day, hour, min, sec; + year = atoi(argv[1]); month = atoi(argv[2]); day = atoi(argv[3]); diff --git a/components/libc/compilers/common/fcntl.h b/components/libc/compilers/common/fcntl.h new file mode 100644 index 0000000000..b98f540627 --- /dev/null +++ b/components/libc/compilers/common/fcntl.h @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2021-09-02 Meco Man First version + */ +#ifndef __FCNTL_H__ +#define __FCNTL_H__ + +#include + +#if defined(_WIN32) +#define O_ACCMODE (_O_RDONLY | _O_WRONLY | _O_RDWR) +#endif + +#define O_RDONLY 00 +#define O_WRONLY 01 +#define O_RDWR 02 + +#define O_CREAT 0100 +#define O_EXCL 0200 +#define O_NOCTTY 0400 +#define O_TRUNC 01000 +#define O_APPEND 02000 +#define O_NONBLOCK 04000 +#define O_DSYNC 010000 +#define O_SYNC 04010000 +#define O_RSYNC 04010000 +#define O_BINARY 0100000 +#define O_DIRECTORY 0200000 +#define O_NOFOLLOW 0400000 +#define O_CLOEXEC 02000000 +#define O_ASYNC 020000 +#define O_DIRECT 040000 +#define O_LARGEFILE 0100000 +#define O_NOATIME 01000000 +#define O_PATH 010000000 +#define O_TMPFILE 020200000 +#define O_NDELAY O_NONBLOCK +#define O_SEARCH O_PATH +#define O_EXEC O_PATH + +#define O_ACCMODE (03|O_SEARCH) + +#define F_DUPFD 0 +#define F_GETFD 1 +#define F_SETFD 2 +#define F_GETFL 3 +#define F_SETFL 4 + +#define F_SETOWN 8 +#define F_GETOWN 9 +#define F_SETSIG 10 +#define F_GETSIG 11 + +#define F_GETLK 12 +#define F_SETLK 13 +#define F_SETLKW 14 + +#define F_SETOWN_EX 15 +#define F_GETOWN_EX 16 + +#define F_GETOWNER_UIDS 17 + +int open(const char *file, int flags, ...); +int fcntl(int fildes, int cmd, ...); +int creat(const char *, mode_t); + +#endif diff --git a/components/libc/compilers/common/none-gcc/fcntl.h b/components/libc/compilers/common/none-gcc/fcntl.h deleted file mode 100644 index f247b926e9..0000000000 --- a/components/libc/compilers/common/none-gcc/fcntl.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (c) 2006-2021, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - */ -#ifndef FCNTL_H__ -#define FCNTL_H__ - -#include - -#ifdef RT_USING_DFS -#include -#endif - -#endif diff --git a/components/libc/compilers/common/none-gcc/sys/stat.h b/components/libc/compilers/common/none-gcc/sys/stat.h index c8f65df435..107c15decf 100644 --- a/components/libc/compilers/common/none-gcc/sys/stat.h +++ b/components/libc/compilers/common/none-gcc/sys/stat.h @@ -5,9 +5,79 @@ * * Change Logs: * Date Author Notes + * 2021-09-02 Meco Man First version */ - #ifndef __SYS_STAT_H__ - #define __SYS_STAT_H__ +#ifndef __SYS_STAT_H__ +#define __SYS_STAT_H__ - #endif +#include +#include + +#define S_IFMT 00170000 +#define S_IFSOCK 0140000 +#define S_IFLNK 0120000 +#define S_IFREG 0100000 +#define S_IFBLK 0060000 +#define S_IFDIR 0040000 +#define S_IFCHR 0020000 +#define S_IFIFO 0010000 +#define S_ISUID 0004000 +#define S_ISGID 0002000 +#define S_ISVTX 0001000 + +#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) +#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) +#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) +#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) +#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) +#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) + +#define S_IRWXU 00700 +#define S_IRUSR 00400 +#define S_IWUSR 00200 +#define S_IXUSR 00100 + +#define S_IRWXG 00070 +#define S_IRGRP 00040 +#define S_IWGRP 00020 +#define S_IXGRP 00010 + +#define S_IRWXO 00007 +#define S_IROTH 00004 +#define S_IWOTH 00002 +#define S_IXOTH 00001 + +struct stat +{ + struct rt_device *st_dev; + uint16_t st_ino; + uint16_t st_mode; + uint16_t st_nlink; + uint16_t st_uid; + uint16_t st_gid; + struct rt_device *st_rdev; + uint32_t st_size; + time_t st_atime; + long st_spare1; + time_t st_mtime; + long st_spare2; + time_t st_ctime; + long st_spare3; + uint32_t st_blksize; + uint32_t st_blocks; + long st_spare4[2]; +}; + +int chmod(const char *, mode_t); +int fchmod(int, mode_t); +int fstat(int, struct stat *); +int lstat(const char *, struct stat *); +int mkdir(const char *, mode_t); +int mkfifo(const char *, mode_t); +int mknod(const char *, mode_t, dev_t); +int stat(const char *, struct stat *); +mode_t umask(mode_t); + +#endif diff --git a/components/libc/compilers/common/sys/ioctl.h b/components/libc/compilers/common/sys/ioctl.h index 51f51f2ea4..b926a71875 100644 --- a/components/libc/compilers/common/sys/ioctl.h +++ b/components/libc/compilers/common/sys/ioctl.h @@ -235,4 +235,6 @@ struct winsize { #define SIOCDEVPRIVATE 0x89F0 #define SIOCPROTOPRIVATE 0x89E0 +int ioctl(int fildes, int cmd, ...); + #endif diff --git a/components/libc/compilers/dlib/libc.c b/components/libc/compilers/dlib/libc.c index d0dca7c5f6..097d736bfe 100644 --- a/components/libc/compilers/dlib/libc.c +++ b/components/libc/compilers/dlib/libc.c @@ -9,7 +9,7 @@ */ #include #include - +#include #include #include "libc.h" diff --git a/components/libc/compilers/newlib/stdio.c b/components/libc/compilers/newlib/stdio.c index ce5bdb75cb..baccafad87 100644 --- a/components/libc/compilers/newlib/stdio.c +++ b/components/libc/compilers/newlib/stdio.c @@ -9,7 +9,7 @@ */ #include #include - +#include #include #include "libc.h" diff --git a/components/libc/libdl/dlelf.h b/components/libc/libdl/dlelf.h index 540fe2c8aa..ab6cc5565d 100644 --- a/components/libc/libdl/dlelf.h +++ b/components/libc/libdl/dlelf.h @@ -28,12 +28,7 @@ typedef rt_int32_t Elf64_Sword; typedef rt_uint32_t Elf64_Word; typedef rt_uint64_t Elf64_Xword; typedef rt_int64_t Elf64_Sxword; -typedef uint16_t Elf64_Section; - - - - - +typedef rt_uint16_t Elf64_Section; /* e_ident[] magic number */ #define ELFMAG0 0x7f /* e_ident[EI_MAG0] */ diff --git a/components/net/lwip-1.4.1/src/lwipopts.h b/components/net/lwip-1.4.1/src/lwipopts.h index 9148066d50..a5e035b53a 100644 --- a/components/net/lwip-1.4.1/src/lwipopts.h +++ b/components/net/lwip-1.4.1/src/lwipopts.h @@ -533,6 +533,7 @@ #ifndef LWIP_SOCKET #define LWIP_SOCKET 1 #endif +#include /* * LWIP_COMPAT_SOCKETS==1: Enable BSD-style sockets functions names. diff --git a/components/net/lwip-2.0.2/src/lwipopts.h b/components/net/lwip-2.0.2/src/lwipopts.h index fdfe1437b2..fe6e2fef6f 100644 --- a/components/net/lwip-2.0.2/src/lwipopts.h +++ b/components/net/lwip-2.0.2/src/lwipopts.h @@ -572,6 +572,7 @@ #ifndef LWIP_SOCKET #define LWIP_SOCKET 1 #endif +#include /* * LWIP_COMPAT_SOCKETS==1: Enable BSD-style sockets functions names. diff --git a/components/net/lwip-2.0.3/src/lwipopts.h b/components/net/lwip-2.0.3/src/lwipopts.h index fdfe1437b2..fe6e2fef6f 100644 --- a/components/net/lwip-2.0.3/src/lwipopts.h +++ b/components/net/lwip-2.0.3/src/lwipopts.h @@ -572,6 +572,7 @@ #ifndef LWIP_SOCKET #define LWIP_SOCKET 1 #endif +#include /* * LWIP_COMPAT_SOCKETS==1: Enable BSD-style sockets functions names. diff --git a/components/net/lwip-2.1.2/src/lwipopts.h b/components/net/lwip-2.1.2/src/lwipopts.h index a964ab13ac..81409a9d0a 100644 --- a/components/net/lwip-2.1.2/src/lwipopts.h +++ b/components/net/lwip-2.1.2/src/lwipopts.h @@ -579,6 +579,7 @@ #ifndef LWIP_SOCKET #define LWIP_SOCKET 1 #endif +#include /* * LWIP_COMPAT_SOCKETS==1: Enable BSD-style sockets functions names. diff --git a/components/net/netdev/src/netdev_ipaddr.c b/components/net/netdev/src/netdev_ipaddr.c index 9abb41bd14..afb6d1d962 100644 --- a/components/net/netdev/src/netdev_ipaddr.c +++ b/components/net/netdev/src/netdev_ipaddr.c @@ -7,7 +7,7 @@ * Date Author Notes * 2018-05-18 ChenYong First version */ - +#include #include #include diff --git a/components/net/sal_socket/socket/net_netdb.c b/components/net/sal_socket/socket/net_netdb.c index 03b995c68d..1eb84e1c32 100644 --- a/components/net/sal_socket/socket/net_netdb.c +++ b/components/net/sal_socket/socket/net_netdb.c @@ -9,6 +9,7 @@ * 2108-05-24 ChenYong Add socket abstraction layer */ +#include #include #include diff --git a/include/libc/libc_fcntl.h b/include/libc/libc_fcntl.h deleted file mode 100644 index 945e674d35..0000000000 --- a/include/libc/libc_fcntl.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2006-2021, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2018-02-07 Bernard Add O_DIRECTORY definition in NEWLIB mode. - * 2018-02-09 Bernard Add O_BINARY definition - */ - -#ifndef LIBC_FCNTL_H__ -#define LIBC_FCNTL_H__ - -#if defined(RT_USING_NEWLIB) || defined(_WIN32) || (defined( __GNUC__ ) && !defined(__ARMCC_VERSION)) -#include - -#ifndef O_NONBLOCK -#define O_NONBLOCK 0x4000 -#endif - -#if defined(_WIN32) -#define O_ACCMODE (_O_RDONLY | _O_WRONLY | _O_RDWR) -#endif - -#ifndef F_GETFL -#define F_GETFL 3 -#endif -#ifndef F_SETFL -#define F_SETFL 4 -#endif - -#ifndef O_DIRECTORY -#define O_DIRECTORY 0x200000 -#endif - -#ifndef O_BINARY -#ifdef _O_BINARY -#define O_BINARY _O_BINARY -#else -#define O_BINARY 0 -#endif -#endif - -#else -#define O_RDONLY 00 -#define O_WRONLY 01 -#define O_RDWR 02 - -#define O_CREAT 0100 -#define O_EXCL 0200 -#define O_NOCTTY 0400 -#define O_TRUNC 01000 -#define O_APPEND 02000 -#define O_NONBLOCK 04000 -#define O_DSYNC 010000 -#define O_SYNC 04010000 -#define O_RSYNC 04010000 -#define O_BINARY 0100000 -#define O_DIRECTORY 0200000 -#define O_NOFOLLOW 0400000 -#define O_CLOEXEC 02000000 - -#define O_ASYNC 020000 -#define O_DIRECT 040000 -#define O_LARGEFILE 0100000 -#define O_NOATIME 01000000 -#define O_PATH 010000000 -#define O_TMPFILE 020200000 -#define O_NDELAY O_NONBLOCK - -#define O_SEARCH O_PATH -#define O_EXEC O_PATH - -#define O_ACCMODE (03|O_SEARCH) - -#define F_DUPFD 0 -#define F_GETFD 1 -#define F_SETFD 2 -#define F_GETFL 3 -#define F_SETFL 4 - -#define F_SETOWN 8 -#define F_GETOWN 9 -#define F_SETSIG 10 -#define F_GETSIG 11 - -#define F_GETLK 12 -#define F_SETLK 13 -#define F_SETLKW 14 - -#define F_SETOWN_EX 15 -#define F_GETOWN_EX 16 - -#define F_GETOWNER_UIDS 17 -#endif - -#endif diff --git a/include/libc/libc_stat.h b/include/libc/libc_stat.h deleted file mode 100644 index f680de4e06..0000000000 --- a/include/libc/libc_stat.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2006-2021, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - */ - -#ifndef LIBC_STAT_H__ -#define LIBC_STAT_H__ - -#include - -#if defined(RT_USING_NEWLIB) || (defined( __GNUC__ ) && !defined(__ARMCC_VERSION)) -/* use header file of newlib */ -#include - -#elif defined(_WIN32) -#include - -#define S_IRWXU 00700 -#define S_IRUSR 00400 -#define S_IWUSR 00200 -#define S_IXUSR 00100 - -#define S_IRWXG 00070 -#define S_IRGRP 00040 -#define S_IWGRP 00020 -#define S_IXGRP 00010 - -#define S_IRWXO 00007 -#define S_IROTH 00004 -#define S_IWOTH 00002 -#define S_IXOTH 00001 - -#define S_IFSOCK 0140000 -#define S_IFLNK 0120000 -#define S_IFBLK 0060000 -#define S_IFIFO 0010000 -#define S_ISUID 0004000 -#define S_ISGID 0002000 -#define S_ISVTX 0001000 - -#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) - -#else -#define S_IFMT 00170000 -#define S_IFSOCK 0140000 -#define S_IFLNK 0120000 -#define S_IFREG 0100000 -#define S_IFBLK 0060000 -#define S_IFDIR 0040000 -#define S_IFCHR 0020000 -#define S_IFIFO 0010000 -#define S_ISUID 0004000 -#define S_ISGID 0002000 -#define S_ISVTX 0001000 - -#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) -#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) -#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) -#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) -#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) -#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) -#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) - -#define S_IRWXU 00700 -#define S_IRUSR 00400 -#define S_IWUSR 00200 -#define S_IXUSR 00100 - -#define S_IRWXG 00070 -#define S_IRGRP 00040 -#define S_IWGRP 00020 -#define S_IXGRP 00010 - -#define S_IRWXO 00007 -#define S_IROTH 00004 -#define S_IWOTH 00002 -#define S_IXOTH 00001 - -/* stat structure */ -#include -#include - -struct stat -{ - struct rt_device *st_dev; - uint16_t st_ino; - uint16_t st_mode; - uint16_t st_nlink; - uint16_t st_uid; - uint16_t st_gid; - struct rt_device *st_rdev; - uint32_t st_size; - time_t st_atime; - long st_spare1; - time_t st_mtime; - long st_spare2; - time_t st_ctime; - long st_spare3; - uint32_t st_blksize; - uint32_t st_blocks; - long st_spare4[2]; -}; - -#endif - -#endif diff --git a/include/rtdef.h b/include/rtdef.h index c0fcb8fce1..3f5f4c5ef9 100644 --- a/include/rtdef.h +++ b/include/rtdef.h @@ -1146,9 +1146,6 @@ struct rt_device_graphic_ops /**@}*/ #endif -/* definitions for libc */ -#include "rtlibc.h" - #ifdef __cplusplus } #endif diff --git a/include/rtlibc.h b/include/rtlibc.h deleted file mode 100644 index b59a29dadb..0000000000 --- a/include/rtlibc.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2006-2021, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2017-01-21 Bernard the first version - */ - -#ifndef RTLIBC_H__ -#define RTLIBC_H__ - -/* definitions for libc if toolchain has no these definitions */ -#include "libc/libc_stat.h" -#include "libc/libc_fcntl.h" - -#ifndef RT_USING_LIBC -#if defined(__ARMCC_VERSION) || defined(__IAR_SYSTEMS_ICC__) -typedef signed long off_t; -typedef int mode_t; -#endif -#endif - -#if defined(__MINGW32__) || defined(_WIN32) -typedef signed long off_t; -typedef int mode_t; -#endif - -#endif - diff --git a/libcpu/mips/common/ptrace.h b/libcpu/mips/common/ptrace.h index 8b82cca5d6..da800e05dc 100644 --- a/libcpu/mips/common/ptrace.h +++ b/libcpu/mips/common/ptrace.h @@ -63,7 +63,7 @@ struct pt_regs { * so it should be a part of pt_regs */ struct mips_fpu_struct fpu; #endif -} __aligned(8); +} __attribute__((aligned(8))); #endif /* Note: For call stack o32 ABI has 0x8 shadowsoace Here */ diff --git a/libcpu/risc-v/virt64/cpuport.c b/libcpu/risc-v/virt64/cpuport.c index 33cab19488..9b0c2cce6b 100644 --- a/libcpu/risc-v/virt64/cpuport.c +++ b/libcpu/risc-v/virt64/cpuport.c @@ -9,13 +9,13 @@ * 2021-02-11 lizhirui add gp support */ +#include #include #include #include "cpuport.h" #include "stack.h" - /** * @brief from thread used interrupt context switch * -- cgit v1.3.1 From 1ebf7b5196b069c9efefe558d5b5abf492244511 Mon Sep 17 00:00:00 2001 From: Grissiom Date: Sat, 11 Sep 2021 13:11:57 +0800 Subject: [Netif] Fix the eth_tx_msg protection The ethernetif use semaphore netif->tx_ack to protect the local variable `struct eth_tx_msg msg` in function `ethernetif_linkoutput`. But the function could be called in multiple context: LwIP "tcpip" thread, "erx" thread(on linkup) and any user thread that call `udp_sendto`. So the global semaphore protection is not sufficient. It could only wakeup the top priority waiting thread instead of the thread that owns the `msg` and may result the `msg` next in the mailbox got destructed. So to use a `rt_completion` within the `struct eth_tx_msg` and synchronize on that. This could deal the ownership issue in an easy way. --- components/net/lwip-2.1.2/src/include/netif/ethernetif.h | 1 - components/net/lwip-2.1.2/src/netif/ethernetif.c | 13 +++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'components') diff --git a/components/net/lwip-2.1.2/src/include/netif/ethernetif.h b/components/net/lwip-2.1.2/src/include/netif/ethernetif.h index 1459e3241d..6d5044b1b7 100644 --- a/components/net/lwip-2.1.2/src/include/netif/ethernetif.h +++ b/components/net/lwip-2.1.2/src/include/netif/ethernetif.h @@ -22,7 +22,6 @@ struct eth_device /* network interface for lwip */ struct netif *netif; - struct rt_semaphore tx_ack; rt_uint16_t flags; rt_uint8_t link_changed; diff --git a/components/net/lwip-2.1.2/src/netif/ethernetif.c b/components/net/lwip-2.1.2/src/netif/ethernetif.c index bd4db225ee..e9c2a20a15 100644 --- a/components/net/lwip-2.1.2/src/netif/ethernetif.c +++ b/components/net/lwip-2.1.2/src/netif/ethernetif.c @@ -39,6 +39,7 @@ * 2013-02-28 aozima fixed list_tcps bug: ipaddr_ntoa isn't reentrant. * 2016-08-18 Bernard port to lwIP 2.0.0 * 2018-11-02 MurphyZhao port to lwIP 2.1.0 + * 2021-09-07 Grissiom fix eth_tx_msg ack bug */ #include "lwip/opt.h" @@ -58,6 +59,8 @@ #include "lwip/inet.h" +#include + #if LWIP_IPV6 #include "lwip/ethip6.h" #endif /* LWIP_IPV6 */ @@ -79,6 +82,7 @@ struct eth_tx_msg { struct netif *netif; struct pbuf *buf; + struct rt_completion ack; }; static struct rt_mailbox eth_tx_thread_mb; @@ -387,18 +391,17 @@ static err_t ethernetif_linkoutput(struct netif *netif, struct pbuf *p) { #ifndef LWIP_NO_TX_THREAD struct eth_tx_msg msg; - struct eth_device* enetif; RT_ASSERT(netif != RT_NULL); - enetif = (struct eth_device*)netif->state; /* send a message to eth tx thread */ msg.netif = netif; msg.buf = p; + rt_completion_init(&msg.ack); if (rt_mb_send(ð_tx_thread_mb, (rt_uint32_t) &msg) == RT_EOK) { /* waiting for ack */ - rt_sem_take(&(enetif->tx_ack), RT_WAITING_FOREVER); + rt_completion_wait(&msg.ack, RT_WAITING_FOREVER); } #else struct eth_device* enetif; @@ -519,7 +522,6 @@ rt_err_t eth_device_init_with_flag(struct eth_device *dev, const char *name, rt_ dev->parent.type = RT_Device_Class_NetIf; /* register to RT-Thread device manager */ rt_device_register(&(dev->parent), name, RT_DEVICE_FLAG_RDWR); - rt_sem_init(&(dev->tx_ack), name, 0, RT_IPC_FLAG_FIFO); /* set name */ netif->name[0] = name[0]; @@ -595,7 +597,6 @@ void eth_device_deinit(struct eth_device *dev) #endif rt_device_close(&(dev->parent)); rt_device_unregister(&(dev->parent)); - rt_sem_detach(&(dev->tx_ack)); rt_free(netif); } @@ -673,7 +674,7 @@ static void eth_tx_thread_entry(void* parameter) } /* send ACK */ - rt_sem_release(&(enetif->tx_ack)); + rt_completion_done(&msg->ack); } } } -- cgit v1.3.1 From a25dbad37f90d28b8d3303b65b964babb228962b Mon Sep 17 00:00:00 2001 From: BernardXiong Date: Sat, 11 Sep 2021 15:58:18 +0800 Subject: [libdl] fix formatting issue --- components/libc/libdl/dlelf.h | 106 +++++++++++++++++++----------------------- 1 file changed, 47 insertions(+), 59 deletions(-) (limited to 'components') diff --git a/components/libc/libdl/dlelf.h b/components/libc/libdl/dlelf.h index ab6cc5565d..339e172bb4 100644 --- a/components/libc/libdl/dlelf.h +++ b/components/libc/libdl/dlelf.h @@ -4,9 +4,9 @@ * SPDX-License-Identifier: Apache-2.0 * * Change Logs: - * Date Author Notes - * 2018/08/29 Bernard first version - * 2021/04/23 chunyexixiaoyu distinguish 32-bit and 64-bit + * Date Author Notes + * 2018/08/29 Bernard first version + * 2021/04/23 chunyexixiaoyu distinguish 32-bit and 64-bit */ #ifndef DL_ELF_H__ @@ -20,14 +20,14 @@ typedef rt_int32_t Elf32_Sword; /* Signed large integer */ typedef rt_uint32_t Elf32_Word; /* Unsigned large integer */ typedef rt_uint16_t Elf32_Half; /* Unsigned medium integer */ -typedef rt_uint64_t Elf64_Addr; -typedef rt_uint16_t Elf64_Half; -typedef rt_int16_t Elf64_SHalf; -typedef rt_uint64_t Elf64_Off; -typedef rt_int32_t Elf64_Sword; -typedef rt_uint32_t Elf64_Word; -typedef rt_uint64_t Elf64_Xword; -typedef rt_int64_t Elf64_Sxword; +typedef rt_uint64_t Elf64_Addr; +typedef rt_uint16_t Elf64_Half; +typedef rt_int16_t Elf64_SHalf; +typedef rt_uint64_t Elf64_Off; +typedef rt_int32_t Elf64_Sword; +typedef rt_uint32_t Elf64_Word; +typedef rt_uint64_t Elf64_Xword; +typedef rt_int64_t Elf64_Sxword; typedef rt_uint16_t Elf64_Section; /* e_ident[] magic number */ @@ -86,24 +86,24 @@ typedef struct elfhdr header string table" entry offset */ } Elf32_Ehdr; - -typedef struct elf64_hdr { - unsigned char e_ident[EI_NIDENT]; /* ELF Identification */ - Elf64_Half e_type; /* object file type */ - Elf64_Half e_machine; /* machine */ - Elf64_Word e_version; /* object file version */ - Elf64_Addr e_entry; /* virtual entry point */ - Elf64_Off e_phoff; /* program header table offset */ - Elf64_Off e_shoff; /* section header table offset */ - Elf64_Word e_flags; /* processor-specific flags */ - Elf64_Half e_ehsize; /* ELF header size */ - Elf64_Half e_phentsize; /* program header entry size */ - Elf64_Half e_phnum; /* number of program header entries */ - Elf64_Half e_shentsize; /* section header entry size */ - Elf64_Half e_shnum; /* number of section header entries */ - Elf64_Half e_shstrndx; /* section header table's "section +typedef struct elf64_hdr +{ + unsigned char e_ident[EI_NIDENT]; /* ELF Identification */ + Elf64_Half e_type; /* object file type */ + Elf64_Half e_machine; /* machine */ + Elf64_Word e_version; /* object file version */ + Elf64_Addr e_entry; /* virtual entry point */ + Elf64_Off e_phoff; /* program header table offset */ + Elf64_Off e_shoff; /* section header table offset */ + Elf64_Word e_flags; /* processor-specific flags */ + Elf64_Half e_ehsize; /* ELF header size */ + Elf64_Half e_phentsize; /* program header entry size */ + Elf64_Half e_phnum; /* number of program header entries */ + Elf64_Half e_shentsize; /* section header entry size */ + Elf64_Half e_shnum; /* number of section header entries */ + Elf64_Half e_shstrndx; /* section header table's "section header string table" entry offset */ -} Elf64_Ehdr; +} Elf64_Ehdr; /* Section Header */ typedef struct @@ -123,19 +123,18 @@ typedef struct typedef struct { - Elf64_Word sh_name; /* Section name (string tbl index) */ - Elf64_Word sh_type; /* Section type */ - Elf64_Xword sh_flags; /* Section flags */ - Elf64_Addr sh_addr; /* Section virtual addr at execution */ - Elf64_Off sh_offset; /* Section file offset */ - Elf64_Xword sh_size; /* Section size in bytes */ - Elf64_Word sh_link; /* Link to another section */ - Elf64_Word sh_info; /* Additional section information */ - Elf64_Xword sh_addralign; /* Section alignment */ - Elf64_Xword sh_entsize; /* Entry size if section holds table */ + Elf64_Word sh_name; /* Section name (string tbl index) */ + Elf64_Word sh_type; /* Section type */ + Elf64_Xword sh_flags; /* Section flags */ + Elf64_Addr sh_addr; /* Section virtual addr at execution */ + Elf64_Off sh_offset; /* Section file offset */ + Elf64_Xword sh_size; /* Section size in bytes */ + Elf64_Word sh_link; /* Link to another section */ + Elf64_Word sh_info; /* Additional section information */ + Elf64_Xword sh_addralign; /* Section alignment */ + Elf64_Xword sh_entsize; /* Entry size if section holds table */ } Elf64_Shdr; - /* Section names */ #define ELF_BSS ".bss" /* uninitialized data */ #define ELF_DATA ".data" /* initialized data */ @@ -171,19 +170,16 @@ typedef struct elf32_sym Elf32_Half st_shndx; /* section header index */ } Elf32_Sym; - typedef struct { - Elf64_Word st_name; /* Symbol name (string tbl index) */ - unsigned char st_info; /* Symbol type and binding */ - unsigned char st_other; /* Symbol visibility */ - Elf64_Section st_shndx; /* Section index */ - Elf64_Addr st_value; /* Symbol value */ - Elf64_Xword st_size; /* Symbol size */ + Elf64_Word st_name; /* Symbol name (string tbl index) */ + unsigned char st_info; /* Symbol type and binding */ + unsigned char st_other; /* Symbol visibility */ + Elf64_Section st_shndx; /* Section index */ + Elf64_Addr st_value; /* Symbol value */ + Elf64_Xword st_size; /* Symbol size */ } Elf64_Sym; - - #define STB_LOCAL 0 /* BIND */ #define STB_GLOBAL 1 #define STB_WEAK 2 @@ -244,8 +240,6 @@ typedef struct #define ELF32_R_TYPE(i) ((unsigned char) (i)) #define ELF32_R_INFO(s,t) (((s) << 8) + (unsigned char)(t)) - - #define ELF64_R_SYM(i) ((i) >> 32) #define ELF64_R_TYPE(i) ((i) & 0xffffffff) #define ELF64_R_INFO(sym,type) ((((Elf64_Xword) (sym)) << 32) + (type)) @@ -296,7 +290,6 @@ typedef struct Elf32_Word p_align; /* memory alignment */ } Elf32_Phdr; - typedef struct { Elf64_Word p_type; /* Segment type */ @@ -309,10 +302,6 @@ typedef struct Elf64_Xword p_align; /* Segment alignment */ } Elf64_Phdr; - - - - /* p_type */ #define PT_NULL 0 #define PT_LOAD 1 @@ -384,10 +373,9 @@ typedef Elf64_Sym Elf_Sym; typedef Elf64_Rela Elf_Rel; typedef Elf64_Addr Elf_Addr; #endif -int dlmodule_relocate(struct rt_dlmodule *module, Elf_Rel *rel, Elf_Addr sym_val); -rt_err_t dlmodule_load_shared_object(struct rt_dlmodule* module, void *module_ptr); -rt_err_t dlmodule_load_relocated_object(struct rt_dlmodule* module, void *module_ptr); - +int dlmodule_relocate(struct rt_dlmodule *module, Elf_Rel *rel, Elf_Addr sym_val); +rt_err_t dlmodule_load_shared_object(struct rt_dlmodule *module, void *module_ptr); +rt_err_t dlmodule_load_relocated_object(struct rt_dlmodule *module, void *module_ptr); #endif -- cgit v1.3.1 From 3dc820b3717637c4b2a54f12ab09f64037e97e9f Mon Sep 17 00:00:00 2001 From: BernardXiong Date: Sat, 11 Sep 2021 16:00:00 +0800 Subject: [drivers] fix stdint issue in cputime --- components/drivers/include/drivers/cputime.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'components') diff --git a/components/drivers/include/drivers/cputime.h b/components/drivers/include/drivers/cputime.h index 0141f24805..26a1e40f8e 100644 --- a/components/drivers/include/drivers/cputime.h +++ b/components/drivers/include/drivers/cputime.h @@ -11,6 +11,8 @@ #ifndef CPUTIME_H__ #define CPUTIME_H__ +#include + struct rt_clock_cputime_ops { float (*cputime_getres) (void); -- cgit v1.3.1 From 0b13409c16326f142597570b50bdea8e138da606 Mon Sep 17 00:00:00 2001 From: BernardXiong Date: Sat, 11 Sep 2021 18:09:22 +0800 Subject: [BSP] fix compiling issue with libc --- bsp/gd32vf103v-eval/board/board.c | 2 +- bsp/gd32vf103v-eval/libraries/SConscript | 1 - bsp/lpc1114/driver/drv_uart.c | 2 +- bsp/mini2440/drivers/uart.c | 140 +++++++++++++++------------- bsp/raspberry-pi/raspi4-32/driver/drv_eth.c | 40 ++++---- bsp/raspberry-pi/raspi4-32/driver/mbox.h | 1 + bsp/tm4c123bsp/libraries/Drivers/drv_pwm.h | 1 + bsp/tm4c123bsp/libraries/Drivers/drv_spi.h | 1 + components/drivers/include/drivers/pm.h | 1 + components/drivers/phy/phy.c | 2 +- components/net/netdev/src/netdev.c | 1 + libcpu/arm/zynqmp-r5/cache.c | 68 ++++++++------ 12 files changed, 146 insertions(+), 114 deletions(-) (limited to 'components') diff --git a/bsp/gd32vf103v-eval/board/board.c b/bsp/gd32vf103v-eval/board/board.c index 5df6fa722f..3c03e3fc83 100644 --- a/bsp/gd32vf103v-eval/board/board.c +++ b/bsp/gd32vf103v-eval/board/board.c @@ -8,7 +8,7 @@ * 2019-07-23 tyustli first version * */ - +#include #include #include #include "board.h" diff --git a/bsp/gd32vf103v-eval/libraries/SConscript b/bsp/gd32vf103v-eval/libraries/SConscript index e7a4f5c3eb..932d0eef17 100644 --- a/bsp/gd32vf103v-eval/libraries/SConscript +++ b/bsp/gd32vf103v-eval/libraries/SConscript @@ -8,7 +8,6 @@ cwd = GetCurrentDir() src = Glob('GD32VF103_standard_peripheral/Source/*.c') src += Glob('n22/env_Eclipse/*.c') -src += Glob('n22/stubs/*.c') src += ['GD32VF103_standard_peripheral/system_gd32vf103.c', 'n22/drivers/n22_func.c', 'n22/env_Eclipse/start.S', diff --git a/bsp/lpc1114/driver/drv_uart.c b/bsp/lpc1114/driver/drv_uart.c index 10956140c1..515310ed5f 100644 --- a/bsp/lpc1114/driver/drv_uart.c +++ b/bsp/lpc1114/driver/drv_uart.c @@ -8,7 +8,7 @@ * 2013-05-18 Bernard The first version for LPC40xx * 2019-05-05 jg1uaa port to LPC1114 */ - +#include #include #include #include diff --git a/bsp/mini2440/drivers/uart.c b/bsp/mini2440/drivers/uart.c index 6226a3cb17..9a9db5a76b 100644 --- a/bsp/mini2440/drivers/uart.c +++ b/bsp/mini2440/drivers/uart.c @@ -1,29 +1,32 @@ /* - * File : uart.c - * Drivers for s3c2440 uarts. + * Copyright (c) 2006-2021, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * * Change Logs: * Date Author Notes * 2020-04-09 Jonne Code refactoring for new bsp */ +#include #include #include #include -#define ULCON_OFS 0x00 -#define UCON_OFS 0x04 -#define UFCON_OFS 0x08 -#define UMCON_OFS 0x0c -#define UTRSTAT_OFS 0x10 -#define UERSTAT_OFS 0x14 -#define UFSTAT_OFS 0x18 -#define UMSTAT_OFS 0x1c -#define UTXH_OFS 0x20 -#define URXH_OFS 0x24 -#define UBRDIV_OFS 0x28 +#define ULCON_OFS 0x00 +#define UCON_OFS 0x04 +#define UFCON_OFS 0x08 +#define UMCON_OFS 0x0c +#define UTRSTAT_OFS 0x10 +#define UERSTAT_OFS 0x14 +#define UFSTAT_OFS 0x18 +#define UMSTAT_OFS 0x1c +#define UTXH_OFS 0x20 +#define URXH_OFS 0x24 +#define UBRDIV_OFS 0x28 #define readl(addr) (*(volatile unsigned long *)(addr)) -#define writel(addr, value) (*(volatile unsigned long *)(addr) = value) +#define writel(addr, value) (*(volatile unsigned long *)(addr) = value) #define PCLK_HZ 50000000 @@ -33,9 +36,9 @@ struct hw_uart_device rt_uint32_t irqno; }; -static rt_err_t s3c2440_serial_configure(struct rt_serial_device *serial, struct serial_configure *cfg) +static rt_err_t s3c2440_serial_configure(struct rt_serial_device *serial, struct serial_configure *cfg) { - struct hw_uart_device* uart = serial->parent.user_data; + struct hw_uart_device *uart = serial->parent.user_data; writel(uart->hw_base + UBRDIV_OFS, PCLK_HZ / (cfg->baud_rate * 16)); @@ -44,22 +47,22 @@ static rt_err_t s3c2440_serial_configure(struct rt_serial_device *serial, struct writel(uart->hw_base + UFCON_OFS, 0x00); writel(uart->hw_base + UMCON_OFS, 0x00); - return RT_EOK; + return RT_EOK; } static rt_err_t s3c2440_serial_control(struct rt_serial_device *serial, int cmd, void *arg) { - struct hw_uart_device *uart; + struct hw_uart_device *uart; int mask; - RT_ASSERT(serial != RT_NULL); + RT_ASSERT(serial != RT_NULL); uart = (struct hw_uart_device *)serial->parent.user_data; - if(uart->irqno == INTUART0) + if (uart->irqno == INTUART0) { mask = BIT_SUB_RXD0; } - else if(uart->irqno == INTUART1) + else if (uart->irqno == INTUART1) { mask = BIT_SUB_RXD1; } @@ -73,7 +76,7 @@ static rt_err_t s3c2440_serial_control(struct rt_serial_device *serial, int cmd, case RT_DEVICE_CTRL_CLR_INT: /* disable rx irq */ INTSUBMSK |= mask; - + break; case RT_DEVICE_CTRL_SET_INT: @@ -86,28 +89,28 @@ static rt_err_t s3c2440_serial_control(struct rt_serial_device *serial, int cmd, } static int s3c2440_putc(struct rt_serial_device *serial, char c) { - struct hw_uart_device* uart = serial->parent.user_data; + struct hw_uart_device *uart = serial->parent.user_data; - while(!(readl(uart->hw_base + UTRSTAT_OFS) & (1<<2))) + while (!(readl(uart->hw_base + UTRSTAT_OFS) & (1 << 2))) { } writel(uart->hw_base + UTXH_OFS, c); - + return 0; - + } static int s3c2440_getc(struct rt_serial_device *serial) { - struct hw_uart_device* uart = serial->parent.user_data; + struct hw_uart_device *uart = serial->parent.user_data; int ch = -1; - if(readl(uart->hw_base + UTRSTAT_OFS) & (1<<0)) + if (readl(uart->hw_base + UTRSTAT_OFS) & (1 << 0)) { ch = readl(uart->hw_base + URXH_OFS) & 0x000000FF; } - + return ch; } @@ -116,61 +119,68 @@ static void rt_hw_uart_isr(int irqno, void *param) struct rt_serial_device *serial = (struct rt_serial_device *)param; rt_hw_serial_isr(serial, RT_SERIAL_EVENT_RX_IND); - - /*clear SUBSRCPND*/ - if(irqno == INTUART0) + + /*clear SUBSRCPND*/ + if (irqno == INTUART0) { SUBSRCPND = BIT_SUB_RXD0; - } - else if(irqno == INTUART1) + } + else if (irqno == INTUART1) { SUBSRCPND = BIT_SUB_RXD1; } - else + else { SUBSRCPND = BIT_SUB_RXD2; } } -static struct rt_uart_ops s3c2440_uart_ops = { - .configure = s3c2440_serial_configure, - .control = s3c2440_serial_control, - .putc = s3c2440_putc, - .getc = s3c2440_getc +static struct rt_uart_ops s3c2440_uart_ops = +{ + .configure = s3c2440_serial_configure, + .control = s3c2440_serial_control, + .putc = s3c2440_putc, + .getc = s3c2440_getc }; -static struct rt_serial_device _serial0 = { - .ops = &s3c2440_uart_ops, - .config = RT_SERIAL_CONFIG_DEFAULT, - .serial_rx = NULL, - .serial_tx = NULL +static struct rt_serial_device _serial0 = +{ + .ops = &s3c2440_uart_ops, + .config = RT_SERIAL_CONFIG_DEFAULT, + .serial_rx = NULL, + .serial_tx = NULL }; -static struct hw_uart_device _hwserial0 = { - .hw_base = 0x50000000, - .irqno = INTUART0 +static struct hw_uart_device _hwserial0 = +{ + .hw_base = 0x50000000, + .irqno = INTUART0 }; -static struct rt_serial_device _serial1 = { - .ops = &s3c2440_uart_ops, - .config = RT_SERIAL_CONFIG_DEFAULT, - .serial_rx = NULL, - .serial_tx = NULL +static struct rt_serial_device _serial1 = +{ + .ops = &s3c2440_uart_ops, + .config = RT_SERIAL_CONFIG_DEFAULT, + .serial_rx = NULL, + .serial_tx = NULL }; -static struct hw_uart_device _hwserial1 = { - .hw_base = 0x50004000, - .irqno = INTUART1 +static struct hw_uart_device _hwserial1 = +{ + .hw_base = 0x50004000, + .irqno = INTUART1 }; -static struct rt_serial_device _serial2 = { - .ops = &s3c2440_uart_ops, - .config = RT_SERIAL_CONFIG_DEFAULT, - .serial_rx = NULL, - .serial_tx = NULL +static struct rt_serial_device _serial2 = +{ + .ops = &s3c2440_uart_ops, + .config = RT_SERIAL_CONFIG_DEFAULT, + .serial_rx = NULL, + .serial_tx = NULL }; -static struct hw_uart_device _hwserial2 = { - .hw_base = 0x50008000, - .irqno = INTUART2 +static struct hw_uart_device _hwserial2 = +{ + .hw_base = 0x50008000, + .irqno = INTUART2 }; @@ -185,7 +195,7 @@ int rt_hw_uart_init(void) rt_hw_serial_register(&_serial0, "uart0", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX, &_hwserial0); rt_hw_interrupt_install(_hwserial0.irqno, rt_hw_uart_isr, &_serial0, "uart0"); rt_hw_interrupt_umask(INTUART0); - + /* register UART1 device */ rt_hw_serial_register(&_serial1, "uart1", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX, &_hwserial1); rt_hw_interrupt_install(_hwserial1.irqno, rt_hw_uart_isr, &_serial1, "uart1"); diff --git a/bsp/raspberry-pi/raspi4-32/driver/drv_eth.c b/bsp/raspberry-pi/raspi4-32/driver/drv_eth.c index a11707f7a2..5375955086 100644 --- a/bsp/raspberry-pi/raspi4-32/driver/drv_eth.c +++ b/bsp/raspberry-pi/raspi4-32/driver/drv_eth.c @@ -9,9 +9,12 @@ * 2020-10-30 bigmagic first version */ -#include #include + +#include #include +#include "board.h" + #include #include @@ -72,12 +75,12 @@ static struct rt_semaphore link_ack; static inline rt_uint32_t read32(void *addr) { - return (*((volatile unsigned int*)(addr))); + return (*((volatile unsigned int *)(addr))); } static inline void write32(void *addr, rt_uint32_t value) { - (*((volatile unsigned int*)(addr))) = value; + (*((volatile unsigned int *)(addr))) = value; } static void eth_rx_irq(int irq, void *param) @@ -380,7 +383,7 @@ static int bcmgenet_gmac_eth_start(void) /* Update MAC registers based on PHY property */ ret = bcmgenet_adjust_link(); - if(ret) + if (ret) { rt_kprintf("bcmgenet: adjust PHY link failed: %d\n", ret); return ret; @@ -416,10 +419,10 @@ static rt_uint32_t prev_recv_cnt = 0; static rt_uint32_t cur_recv_cnt = 0; static rt_uint32_t bcmgenet_gmac_eth_recv(rt_uint8_t **packetp) { - void* desc_base; + void *desc_base; rt_uint32_t length = 0, addr = 0; rt_uint32_t prod_index = read32(MAC_REG + RDMA_PROD_INDEX); - if(prod_index == index_flag) + if (prod_index == index_flag) { cur_recv_cnt = index_flag; index_flag = 0x7fffffff; @@ -428,7 +431,7 @@ static rt_uint32_t bcmgenet_gmac_eth_recv(rt_uint8_t **packetp) } else { - if(prev_recv_cnt == prod_index & 0xffff) + if (prev_recv_cnt == (prod_index & 0xffff)) { return 0; } @@ -437,15 +440,16 @@ static rt_uint32_t bcmgenet_gmac_eth_recv(rt_uint8_t **packetp) length = read32(desc_base + DMA_DESC_LENGTH_STATUS); length = (length >> DMA_BUFLENGTH_SHIFT) & DMA_BUFLENGTH_MASK; addr = read32(desc_base + DMA_DESC_ADDRESS_LO); + /* To cater for the IP headepr alignment the hardware does. - * This would actually not be needed if we don't program - * RBUF_ALIGN_2B - */ - rt_hw_cpu_dcache_invalidate(addr,length); + * This would actually not be needed if we don't program + * RBUF_ALIGN_2B + */ + rt_hw_cpu_dcache_ops(RT_HW_CACHE_INVALIDATE, (void *) addr, length); *packetp = (rt_uint8_t *)(addr + RX_BUF_OFFSET); rx_index = rx_index + 1; - if(rx_index >= RX_DESCS) + if (rx_index >= RX_DESCS) { rx_index = 0; } @@ -453,7 +457,7 @@ static rt_uint32_t bcmgenet_gmac_eth_recv(rt_uint8_t **packetp) cur_recv_cnt = cur_recv_cnt + 1; - if(cur_recv_cnt > 0xffff) + if (cur_recv_cnt > 0xffff) { cur_recv_cnt = 0; } @@ -468,16 +472,16 @@ static int bcmgenet_gmac_eth_send(void *packet, int length) void *desc_base = (TX_DESC_BASE + tx_index * DMA_DESC_SIZE); rt_uint32_t len_stat = length << DMA_BUFLENGTH_SHIFT; - rt_uint32_t prod_index, cons; - rt_uint32_t tries = 100; + rt_uint32_t prod_index; prod_index = read32(MAC_REG + TDMA_PROD_INDEX); len_stat |= 0x3F << DMA_TX_QTAG_SHIFT; len_stat |= DMA_TX_APPEND_CRC | DMA_SOP | DMA_EOP; - rt_hw_cpu_dcache_clean((void*)packet, length); - write32((desc_base + DMA_DESC_ADDRESS_LO), packet); + rt_hw_cpu_dcache_ops(RT_HW_CACHE_FLUSH, (void *)packet, length); + + write32((desc_base + DMA_DESC_ADDRESS_LO), (rt_uint32_t)packet); write32((desc_base + DMA_DESC_ADDRESS_HI), 0); write32((desc_base + DMA_DESC_LENGTH_STATUS), len_stat); @@ -631,7 +635,7 @@ struct pbuf *rt_eth_rx(rt_device_t device) if (recv_len > 0) { pbuf = pbuf_alloc(PBUF_LINK, recv_len, PBUF_RAM); - if(pbuf) + if (pbuf) { rt_memcpy(pbuf->payload, addr_point, recv_len); } diff --git a/bsp/raspberry-pi/raspi4-32/driver/mbox.h b/bsp/raspberry-pi/raspi4-32/driver/mbox.h index 2c69bcf55a..7d59add27f 100644 --- a/bsp/raspberry-pi/raspi4-32/driver/mbox.h +++ b/bsp/raspberry-pi/raspi4-32/driver/mbox.h @@ -12,6 +12,7 @@ #define __MBOX_H__ #include +#include "board.h" //https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface //https://github.com/hermanhermitage/videocoreiv diff --git a/bsp/tm4c123bsp/libraries/Drivers/drv_pwm.h b/bsp/tm4c123bsp/libraries/Drivers/drv_pwm.h index 906680fe3d..dfbd655188 100644 --- a/bsp/tm4c123bsp/libraries/Drivers/drv_pwm.h +++ b/bsp/tm4c123bsp/libraries/Drivers/drv_pwm.h @@ -11,6 +11,7 @@ #ifndef __DRV_PWM_H__ #define __DRV_PWM_H__ +#include #include #include diff --git a/bsp/tm4c123bsp/libraries/Drivers/drv_spi.h b/bsp/tm4c123bsp/libraries/Drivers/drv_spi.h index 33b28146bc..f657f304b6 100644 --- a/bsp/tm4c123bsp/libraries/Drivers/drv_spi.h +++ b/bsp/tm4c123bsp/libraries/Drivers/drv_spi.h @@ -11,6 +11,7 @@ #ifndef __DRV_SPI_H__ #define __DRV_SPI_H__ +#include #include #include #include "drivers/spi.h" diff --git a/components/drivers/include/drivers/pm.h b/components/drivers/include/drivers/pm.h index 51bff54ebb..d38c0a4e2a 100644 --- a/components/drivers/include/drivers/pm.h +++ b/components/drivers/include/drivers/pm.h @@ -15,6 +15,7 @@ #ifndef __PM_H__ #define __PM_H__ +#include #include #ifndef PM_HAS_CUSTOM_CONFIG diff --git a/components/drivers/phy/phy.c b/components/drivers/phy/phy.c index 6d408ce612..87152a306e 100644 --- a/components/drivers/phy/phy.c +++ b/components/drivers/phy/phy.c @@ -8,7 +8,7 @@ * Date Author Notes * 2020-09-27 wangqiang first version */ - +#include #include #include #include diff --git a/components/net/netdev/src/netdev.c b/components/net/netdev/src/netdev.c index 26451cb007..4c5d524510 100644 --- a/components/net/netdev/src/netdev.c +++ b/components/net/netdev/src/netdev.c @@ -10,6 +10,7 @@ #include #include +#include #include #include diff --git a/libcpu/arm/zynqmp-r5/cache.c b/libcpu/arm/zynqmp-r5/cache.c index 6053b2fe47..a6ee643271 100644 --- a/libcpu/arm/zynqmp-r5/cache.c +++ b/libcpu/arm/zynqmp-r5/cache.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2021, RT-Thread Development Team + * Copyright (c) 2006 - 2021, RT-Thread Development Team * Copyright (c) 2014 - 2020 Xilinx, Inc. All rights reserved. * Copyright (c) 2021 WangHuachen. All rights reserved. * SPDX-License-Identifier: MIT @@ -9,6 +9,8 @@ * 2020-03-19 WangHuachen first version * 2021-05-10 WangHuachen add more functions */ + +#include #include #include @@ -69,9 +71,10 @@ void Xil_DCacheEnable(void) #if defined (__GNUC__) CtrlReg = mfcp(XREG_CP15_SYS_CONTROL); #elif defined (__ICCARM__) - mfcp(XREG_CP15_SYS_CONTROL,CtrlReg); + mfcp(XREG_CP15_SYS_CONTROL, CtrlReg); #endif - if ((CtrlReg & XREG_CP15_CONTROL_C_BIT)==0x00000000U) { + if ((CtrlReg & XREG_CP15_CONTROL_C_BIT) == 0x00000000U) + { /* invalidate the Data cache */ Xil_DCacheInvalidate(); @@ -93,7 +96,7 @@ void Xil_DCacheDisable(void) #if defined (__GNUC__) CtrlReg = mfcp(XREG_CP15_SYS_CONTROL); #elif defined (__ICCARM__) - mfcp(XREG_CP15_SYS_CONTROL,CtrlReg); + mfcp(XREG_CP15_SYS_CONTROL, CtrlReg); #endif CtrlReg &= ~(XREG_CP15_CONTROL_C_BIT); @@ -126,7 +129,7 @@ void Xil_DCacheInvalidateLine(INTPTR adr) mtcp(XREG_CP15_CACHE_SIZE_SEL, 0); mtcp(XREG_CP15_INVAL_DC_LINE_MVA_POC, (adr & (~0x1F))); - /* Wait for invalidate to complete */ + /* Wait for invalidate to complete */ dsb(); mtcpsr(currmask); @@ -143,29 +146,33 @@ void Xil_DCacheInvalidateRange(INTPTR adr, u32 len) currmask = mfcpsr(); mtcpsr(currmask | IRQ_FIQ_MASK); - if (len != 0U) { + if (len != 0U) + { end = tempadr + len; tempend = end; /* Select L1 Data cache in CSSR */ mtcp(XREG_CP15_CACHE_SIZE_SEL, 0U); - if ((tempadr & (cacheline-1U)) != 0U) { + if ((tempadr & (cacheline - 1U)) != 0U) + { tempadr &= (~(cacheline - 1U)); Xil_DCacheFlushLine(tempadr); } - if ((tempend & (cacheline-1U)) != 0U) { + if ((tempend & (cacheline - 1U)) != 0U) + { tempend &= (~(cacheline - 1U)); Xil_DCacheFlushLine(tempend); } - while (tempadr < tempend) { + while (tempadr < tempend) + { - /* Invalidate Data cache line */ - asm_inval_dc_line_mva_poc(tempadr); + /* Invalidate Data cache line */ + asm_inval_dc_line_mva_poc(tempadr); - tempadr += cacheline; + tempadr += cacheline; } } @@ -189,7 +196,7 @@ void Xil_DCacheFlush(void) #if defined (__GNUC__) CsidReg = mfcp(XREG_CP15_CACHE_SIZE_ID); #elif defined (__ICCARM__) - mfcp(XREG_CP15_CACHE_SIZE_ID,CsidReg); + mfcp(XREG_CP15_CACHE_SIZE_ID, CsidReg); #endif /* Determine Cache Size */ @@ -204,15 +211,17 @@ void Xil_DCacheFlush(void) /* Get the cacheline size, way size, index size from csidr */ LineSize = (CsidReg & 0x00000007U) + 0x00000004U; - NumSet = CacheSize/NumWays; + NumSet = CacheSize / NumWays; NumSet /= (0x00000001U << LineSize); Way = 0U; Set = 0U; /* Invalidate all the cachelines */ - for (WayIndex = 0U; WayIndex < NumWays; WayIndex++) { - for (SetIndex = 0U; SetIndex < NumSet; SetIndex++) { + for (WayIndex = 0U; WayIndex < NumWays; WayIndex++) + { + for (SetIndex = 0U; SetIndex < NumSet; SetIndex++) + { C7Reg = Way | Set; /* Flush by Set/Way */ asm_clean_inval_dc_line_sw(C7Reg); @@ -241,7 +250,7 @@ void Xil_DCacheFlushLine(INTPTR adr) mtcp(XREG_CP15_CLEAN_INVAL_DC_LINE_MVA_POC, (adr & (~0x1F))); - /* Wait for flush to complete */ + /* Wait for flush to complete */ dsb(); mtcpsr(currmask); } @@ -256,14 +265,16 @@ void Xil_DCacheFlushRange(INTPTR adr, u32 len) currmask = mfcpsr(); mtcpsr(currmask | IRQ_FIQ_MASK); - if (len != 0x00000000U) { + if (len != 0x00000000U) + { /* Back the starting address up to the start of a cache line * perform cache operations until adr+len */ end = LocalAddr + len; LocalAddr &= ~(cacheline - 1U); - while (LocalAddr < end) { + while (LocalAddr < end) + { /* Flush Data cache line */ asm_clean_inval_dc_line_mva_poc(LocalAddr); @@ -301,7 +312,8 @@ void Xil_ICacheEnable(void) #elif defined (__ICCARM__) mfcp(XREG_CP15_SYS_CONTROL, CtrlReg); #endif - if ((CtrlReg & XREG_CP15_CONTROL_I_BIT)==0x00000000U) { + if ((CtrlReg & XREG_CP15_CONTROL_I_BIT) == 0x00000000U) + { /* invalidate the instruction cache */ mtcp(XREG_CP15_INVAL_IC_POU, 0); @@ -321,11 +333,11 @@ void Xil_ICacheDisable(void) /* invalidate the instruction cache */ mtcp(XREG_CP15_INVAL_IC_POU, 0); - /* disable the instruction cache */ + /* disable the instruction cache */ #if defined (__GNUC__) CtrlReg = mfcp(XREG_CP15_SYS_CONTROL); #elif defined (__ICCARM__) - mfcp(XREG_CP15_SYS_CONTROL,CtrlReg); + mfcp(XREG_CP15_SYS_CONTROL, CtrlReg); #endif CtrlReg &= ~(XREG_CP15_CONTROL_I_BIT); @@ -360,7 +372,7 @@ void Xil_ICacheInvalidateLine(INTPTR adr) mtcp(XREG_CP15_CACHE_SIZE_SEL, 1); mtcp(XREG_CP15_INVAL_IC_LINE_MVA_POU, (adr & (~0x1F))); - /* Wait for invalidate to complete */ + /* Wait for invalidate to complete */ dsb(); mtcpsr(currmask); } @@ -374,7 +386,8 @@ void Xil_ICacheInvalidateRange(INTPTR adr, u32 len) currmask = mfcpsr(); mtcpsr(currmask | IRQ_FIQ_MASK); - if (len != 0x00000000U) { + if (len != 0x00000000U) + { /* Back the starting address up to the start of a cache line * perform cache operations until adr+len */ @@ -384,7 +397,8 @@ void Xil_ICacheInvalidateRange(INTPTR adr, u32 len) /* Select cache L0 I-cache in CSSR */ mtcp(XREG_CP15_CACHE_SIZE_SEL, 1U); - while (LocalAddr < end) { + while (LocalAddr < end) + { /* Invalidate L1 I-cache line */ asm_inval_ic_line_mva_pou(LocalAddr); @@ -418,7 +432,7 @@ rt_base_t rt_hw_cpu_icache_status(void) #if defined (__GNUC__) CtrlReg = mfcp(XREG_CP15_SYS_CONTROL); #elif defined (__ICCARM__) - mfcp(XREG_CP15_SYS_CONTROL,CtrlReg); + mfcp(XREG_CP15_SYS_CONTROL, CtrlReg); #endif return CtrlReg & XREG_CP15_CONTROL_I_BIT; } @@ -429,7 +443,7 @@ rt_base_t rt_hw_cpu_dcache_status(void) #if defined (__GNUC__) CtrlReg = mfcp(XREG_CP15_SYS_CONTROL); #elif defined (__ICCARM__) - mfcp(XREG_CP15_SYS_CONTROL,CtrlReg); + mfcp(XREG_CP15_SYS_CONTROL, CtrlReg); #endif return CtrlReg & XREG_CP15_CONTROL_C_BIT; } -- cgit v1.3.1 From 51e055963127f443595e29fc493dcd22f33ac0f1 Mon Sep 17 00:00:00 2001 From: BernardXiong Date: Sat, 11 Sep 2021 18:34:13 +0800 Subject: [utest] fix libc issue --- components/utilities/utest/utest_assert.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'components') diff --git a/components/utilities/utest/utest_assert.h b/components/utilities/utest/utest_assert.h index 2e2007e773..ba76fc39ee 100644 --- a/components/utilities/utest/utest_assert.h +++ b/components/utilities/utest/utest_assert.h @@ -50,8 +50,8 @@ void utest_assert_buf(const char *a, const char *b, rt_size_t sz, rt_bool_t equa */ #define uassert_true(value) __utest_assert(value, "(" #value ") is false") #define uassert_false(value) __utest_assert(!(value), "(" #value ") is true") -#define uassert_null(value) __utest_assert((const char *)(value) == NULL, "(" #value ") is not null") -#define uassert_not_null(value) __utest_assert((const char *)(value) != NULL, "(" #value ") is null") +#define uassert_null(value) __utest_assert((const char *)(value) == RT_NULL, "(" #value ") is not null") +#define uassert_not_null(value) __utest_assert((const char *)(value) != RT_NULL, "(" #value ") is null") #define uassert_int_equal(a, b) __utest_assert((a) == (b), "(" #a ") not equal to (" #b ")") #define uassert_int_not_equal(a, b) __utest_assert((a) != (b), "(" #a ") equal to (" #b ")") -- cgit v1.3.1 From b5c31a98789e1c467c0e456d9bdb80e5827c9bd4 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Sat, 11 Sep 2021 08:40:07 -0400 Subject: [libc] 修复keil编译不过的问题 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/libc/compilers/armlibc/libc.c | 5 +---- components/libc/compilers/armlibc/mem_std.c | 3 ++- components/libc/compilers/dlib/libc.c | 3 --- 3 files changed, 3 insertions(+), 8 deletions(-) (limited to 'components') diff --git a/components/libc/compilers/armlibc/libc.c b/components/libc/compilers/armlibc/libc.c index 971ddb8d49..889c687309 100644 --- a/components/libc/compilers/armlibc/libc.c +++ b/components/libc/compilers/armlibc/libc.c @@ -7,11 +7,8 @@ * Date Author Notes * 2017/10/15 bernard the first version */ -#include -#include - +#include #include - #include "libc.h" #ifdef RT_USING_PTHREADS diff --git a/components/libc/compilers/armlibc/mem_std.c b/components/libc/compilers/armlibc/mem_std.c index c350aa68fa..fbfd17eee1 100644 --- a/components/libc/compilers/armlibc/mem_std.c +++ b/components/libc/compilers/armlibc/mem_std.c @@ -7,7 +7,8 @@ * 2014-08-03 bernard Add file header. */ -#include "rtthread.h" +#include +#include #ifdef RT_USING_HEAP diff --git a/components/libc/compilers/dlib/libc.c b/components/libc/compilers/dlib/libc.c index 097d736bfe..f540ac955f 100644 --- a/components/libc/compilers/dlib/libc.c +++ b/components/libc/compilers/dlib/libc.c @@ -7,11 +7,8 @@ * Date Author Notes * 2017/10/15 bernard the first version */ -#include -#include #include #include - #include "libc.h" #ifdef RT_USING_PTHREADS -- cgit v1.3.1 From 92c62a8fab541a89aa5d37d15d43864ca072dd13 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Sat, 11 Sep 2021 11:25:43 -0400 Subject: 标准化 弱化 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/dfs/SConscript | 2 +- components/dfs/include/dfs_poll.h | 33 +--- components/dfs/src/dfs_poll.c | 235 ++++++++++++++++++++++++++++ components/dfs/src/dfs_select.c | 183 ++++++++++++++++++++++ components/dfs/src/poll.c | 235 ---------------------------- components/dfs/src/select.c | 183 ---------------------- components/libc/compilers/common/poll.h | 40 +++++ components/libc/compilers/common/sys/time.h | 6 +- 8 files changed, 463 insertions(+), 454 deletions(-) create mode 100644 components/dfs/src/dfs_poll.c create mode 100644 components/dfs/src/dfs_select.c delete mode 100644 components/dfs/src/poll.c delete mode 100644 components/dfs/src/select.c create mode 100644 components/libc/compilers/common/poll.h (limited to 'components') diff --git a/components/dfs/SConscript b/components/dfs/SConscript index 3ccaeb1080..e449c84911 100644 --- a/components/dfs/SConscript +++ b/components/dfs/SConscript @@ -11,7 +11,7 @@ cwd = GetCurrentDir() CPPPATH = [cwd + "/include"] if GetDepend('RT_USING_POSIX'): - src += ['src/poll.c', 'src/select.c'] + src += ['src/dfs_poll.c', 'src/dfs_select.c'] group = DefineGroup('Filesystem', src, depend = ['RT_USING_DFS'], CPPPATH = CPPPATH) diff --git a/components/dfs/include/dfs_poll.h b/components/dfs/include/dfs_poll.h index 096a5fe712..11d17cc1ff 100644 --- a/components/dfs/include/dfs_poll.h +++ b/components/dfs/include/dfs_poll.h @@ -10,37 +10,6 @@ #ifndef DFS_POLL_H__ #define DFS_POLL_H__ -#include - -#ifdef RT_USING_POSIX -#include /* for struct timeval */ - -#if !defined(POLLIN) && !defined(POLLOUT) -#define POLLIN (0x01) -#define POLLRDNORM (0x01) -#define POLLRDBAND (0x01) -#define POLLPRI (0x01) - -#define POLLOUT (0x02) -#define POLLWRNORM (0x02) -#define POLLWRBAND (0x02) - -#define POLLERR (0x04) -#define POLLHUP (0x08) -#define POLLNVAL (0x10) - -typedef unsigned int nfds_t; - -struct pollfd -{ - int fd; - short events; - short revents; -}; -#endif /* !defined(POLLIN) && !defined(POLLOUT) */ - -#define POLLMASK_DEFAULT (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM) -int poll(struct pollfd *fds, nfds_t nfds, int timeout); -#endif /* RT_USING_POSIX */ +#include #endif /* DFS_POLL_H__ */ diff --git a/components/dfs/src/dfs_poll.c b/components/dfs/src/dfs_poll.c new file mode 100644 index 0000000000..d1e0372494 --- /dev/null +++ b/components/dfs/src/dfs_poll.c @@ -0,0 +1,235 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2016-12-28 Bernard first version + * 2018-03-09 Bernard Add protection for pt->triggered. + */ +#include + +#include +#include +#include + +#include +#include +#include +#include + +#ifdef RT_USING_POSIX + +struct rt_poll_node; + +struct rt_poll_table +{ + rt_pollreq_t req; + rt_uint32_t triggered; /* the waited thread whether triggered */ + rt_thread_t polling_thread; + struct rt_poll_node *nodes; +}; + +struct rt_poll_node +{ + struct rt_wqueue_node wqn; + struct rt_poll_table *pt; + struct rt_poll_node *next; +}; + +static int __wqueue_pollwake(struct rt_wqueue_node *wait, void *key) +{ + struct rt_poll_node *pn; + + if (key && !((rt_ubase_t)key & wait->key)) + return -1; + + pn = rt_container_of(wait, struct rt_poll_node, wqn); + pn->pt->triggered = 1; + + return __wqueue_default_wake(wait, key); +} + +static void _poll_add(rt_wqueue_t *wq, rt_pollreq_t *req) +{ + struct rt_poll_table *pt; + struct rt_poll_node *node; + + node = (struct rt_poll_node *)rt_malloc(sizeof(struct rt_poll_node)); + if (node == RT_NULL) + return; + + pt = rt_container_of(req, struct rt_poll_table, req); + + node->wqn.key = req->_key; + rt_list_init(&(node->wqn.list)); + node->wqn.polling_thread = pt->polling_thread; + node->wqn.wakeup = __wqueue_pollwake; + node->next = pt->nodes; + node->pt = pt; + pt->nodes = node; + rt_wqueue_add(wq, &node->wqn); +} + +static void poll_table_init(struct rt_poll_table *pt) +{ + pt->req._proc = _poll_add; + pt->triggered = 0; + pt->nodes = RT_NULL; + pt->polling_thread = rt_thread_self(); +} + +static int poll_wait_timeout(struct rt_poll_table *pt, int msec) +{ + rt_int32_t timeout; + int ret = 0; + struct rt_thread *thread; + rt_base_t level; + + thread = pt->polling_thread; + + timeout = rt_tick_from_millisecond(msec); + + level = rt_hw_interrupt_disable(); + + if (timeout != 0 && !pt->triggered) + { + rt_thread_suspend(thread); + if (timeout > 0) + { + rt_timer_control(&(thread->thread_timer), + RT_TIMER_CTRL_SET_TIME, + &timeout); + rt_timer_start(&(thread->thread_timer)); + } + + rt_hw_interrupt_enable(level); + + rt_schedule(); + + level = rt_hw_interrupt_disable(); + } + + ret = !pt->triggered; + rt_hw_interrupt_enable(level); + + return ret; +} + +static int do_pollfd(struct pollfd *pollfd, rt_pollreq_t *req) +{ + int mask = 0; + int fd; + + fd = pollfd->fd; + + if (fd >= 0) + { + struct dfs_fd *f = fd_get(fd); + mask = POLLNVAL; + + if (f) + { + mask = POLLMASK_DEFAULT; + if (f->fops->poll) + { + req->_key = pollfd->events | POLLERR | POLLHUP; + + mask = f->fops->poll(f, req); + + /* dealwith the device return error -1*/ + if (mask < 0) + { + fd_put(f); + pollfd->revents = 0; + return mask; + } + } + /* Mask out unneeded events. */ + mask &= pollfd->events | POLLERR | POLLHUP; + fd_put(f); + } + } + pollfd->revents = mask; + + return mask; +} + +static int poll_do(struct pollfd *fds, nfds_t nfds, struct rt_poll_table *pt, int msec) +{ + int num; + int istimeout = 0; + int n; + struct pollfd *pf; + int ret = 0; + + if (msec == 0) + { + pt->req._proc = RT_NULL; + istimeout = 1; + } + + while (1) + { + pf = fds; + num = 0; + + for (n = 0; n < nfds; n ++) + { + ret = do_pollfd(pf, &pt->req); + if(ret < 0) + { + /*dealwith the device return error -1 */ + pt->req._proc = RT_NULL; + return ret; + } + else if(ret > 0) + { + num ++; + pt->req._proc = RT_NULL; + } + pf ++; + } + + pt->req._proc = RT_NULL; + + if (num || istimeout) + break; + + if (poll_wait_timeout(pt, msec)) + istimeout = 1; + } + + return num; +} + +static void poll_teardown(struct rt_poll_table *pt) +{ + struct rt_poll_node *node, *next; + + next = pt->nodes; + while (next) + { + node = next; + rt_wqueue_remove(&node->wqn); + next = node->next; + rt_free(node); + } +} + +int poll(struct pollfd *fds, nfds_t nfds, int timeout) +{ + int num; + struct rt_poll_table table; + + poll_table_init(&table); + + num = poll_do(fds, nfds, &table, timeout); + + poll_teardown(&table); + + return num; +} + +#endif diff --git a/components/dfs/src/dfs_select.c b/components/dfs/src/dfs_select.c new file mode 100644 index 0000000000..c9286ca97f --- /dev/null +++ b/components/dfs/src/dfs_select.c @@ -0,0 +1,183 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2016-12-28 Bernard first version + */ +#include +#include +#include + +#include +#include + +#ifdef RT_USING_POSIX + +static void fdszero(fd_set *set, int nfds) +{ + fd_mask *m; + int n; + + /* + The 'sizeof(fd_set)' of the system space may differ from user space, + so the actual size of the 'fd_set' is determined here with the parameter 'nfds' + */ + m = (fd_mask *)set; + for (n = 0; n < nfds; n += (sizeof(fd_mask) * 8)) + { + rt_memset(m, 0, sizeof(fd_mask)); + m ++; + } +} + +int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout) +{ + int fd; + int npfds; + int msec; + int ndx; + int ret; + struct pollfd *pollset = RT_NULL; + + /* How many pollfd structures do we need to allocate? */ + for (fd = 0, npfds = 0; fd < nfds; fd++) + { + /* Check if any monitor operation is requested on this fd */ + if ((readfds && FD_ISSET(fd, readfds)) || + (writefds && FD_ISSET(fd, writefds)) || + (exceptfds && FD_ISSET(fd, exceptfds))) + { + npfds++; + } + } + + /* Allocate the descriptor list for poll() */ + if (npfds > 0) + { + pollset = (struct pollfd *)rt_calloc(npfds, sizeof(struct pollfd)); + if (!pollset) + { + return -1; + } + } + + /* Initialize the descriptor list for poll() */ + for (fd = 0, ndx = 0; fd < nfds; fd++) + { + int incr = 0; + + /* The readfs set holds the set of FDs that the caller can be assured + * of reading from without blocking. Note that POLLHUP is included as + * a read-able condition. POLLHUP will be reported at the end-of-file + * or when a connection is lost. In either case, the read() can then + * be performed without blocking. + */ + + if (readfds && FD_ISSET(fd, readfds)) + { + pollset[ndx].fd = fd; + pollset[ndx].events |= POLLIN; + incr = 1; + } + + if (writefds && FD_ISSET(fd, writefds)) + { + pollset[ndx].fd = fd; + pollset[ndx].events |= POLLOUT; + incr = 1; + } + + if (exceptfds && FD_ISSET(fd, exceptfds)) + { + pollset[ndx].fd = fd; + incr = 1; + } + + ndx += incr; + } + + RT_ASSERT(ndx == npfds); + + /* Convert the timeout to milliseconds */ + if (timeout) + { + msec = timeout->tv_sec * 1000 + timeout->tv_usec / 1000; + } + else + { + msec = -1; + } + + /* Then let poll do all of the real work. */ + + ret = poll(pollset, npfds, msec); + + /* Now set up the return values */ + if (readfds) + { + fdszero(readfds, nfds); + } + + if (writefds) + { + fdszero(writefds, nfds); + } + + if (exceptfds) + { + fdszero(exceptfds, nfds); + } + + /* Convert the poll descriptor list back into selects 3 bitsets */ + + if (ret > 0) + { + ret = 0; + for (ndx = 0; ndx < npfds; ndx++) + { + /* Check for read conditions. Note that POLLHUP is included as a + * read condition. POLLHUP will be reported when no more data will + * be available (such as when a connection is lost). In either + * case, the read() can then be performed without blocking. + */ + + if (readfds) + { + if (pollset[ndx].revents & (POLLIN | POLLHUP)) + { + FD_SET(pollset[ndx].fd, readfds); + ret++; + } + } + + /* Check for write conditions */ + if (writefds) + { + if (pollset[ndx].revents & POLLOUT) + { + FD_SET(pollset[ndx].fd, writefds); + ret++; + } + } + + /* Check for exceptions */ + if (exceptfds) + { + if (pollset[ndx].revents & POLLERR) + { + FD_SET(pollset[ndx].fd, exceptfds); + ret++; + } + } + } + } + + if (pollset) rt_free(pollset); + + return ret; +} + +#endif diff --git a/components/dfs/src/poll.c b/components/dfs/src/poll.c deleted file mode 100644 index d1e0372494..0000000000 --- a/components/dfs/src/poll.c +++ /dev/null @@ -1,235 +0,0 @@ -/* - * Copyright (c) 2006-2021, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2016-12-28 Bernard first version - * 2018-03-09 Bernard Add protection for pt->triggered. - */ -#include - -#include -#include -#include - -#include -#include -#include -#include - -#ifdef RT_USING_POSIX - -struct rt_poll_node; - -struct rt_poll_table -{ - rt_pollreq_t req; - rt_uint32_t triggered; /* the waited thread whether triggered */ - rt_thread_t polling_thread; - struct rt_poll_node *nodes; -}; - -struct rt_poll_node -{ - struct rt_wqueue_node wqn; - struct rt_poll_table *pt; - struct rt_poll_node *next; -}; - -static int __wqueue_pollwake(struct rt_wqueue_node *wait, void *key) -{ - struct rt_poll_node *pn; - - if (key && !((rt_ubase_t)key & wait->key)) - return -1; - - pn = rt_container_of(wait, struct rt_poll_node, wqn); - pn->pt->triggered = 1; - - return __wqueue_default_wake(wait, key); -} - -static void _poll_add(rt_wqueue_t *wq, rt_pollreq_t *req) -{ - struct rt_poll_table *pt; - struct rt_poll_node *node; - - node = (struct rt_poll_node *)rt_malloc(sizeof(struct rt_poll_node)); - if (node == RT_NULL) - return; - - pt = rt_container_of(req, struct rt_poll_table, req); - - node->wqn.key = req->_key; - rt_list_init(&(node->wqn.list)); - node->wqn.polling_thread = pt->polling_thread; - node->wqn.wakeup = __wqueue_pollwake; - node->next = pt->nodes; - node->pt = pt; - pt->nodes = node; - rt_wqueue_add(wq, &node->wqn); -} - -static void poll_table_init(struct rt_poll_table *pt) -{ - pt->req._proc = _poll_add; - pt->triggered = 0; - pt->nodes = RT_NULL; - pt->polling_thread = rt_thread_self(); -} - -static int poll_wait_timeout(struct rt_poll_table *pt, int msec) -{ - rt_int32_t timeout; - int ret = 0; - struct rt_thread *thread; - rt_base_t level; - - thread = pt->polling_thread; - - timeout = rt_tick_from_millisecond(msec); - - level = rt_hw_interrupt_disable(); - - if (timeout != 0 && !pt->triggered) - { - rt_thread_suspend(thread); - if (timeout > 0) - { - rt_timer_control(&(thread->thread_timer), - RT_TIMER_CTRL_SET_TIME, - &timeout); - rt_timer_start(&(thread->thread_timer)); - } - - rt_hw_interrupt_enable(level); - - rt_schedule(); - - level = rt_hw_interrupt_disable(); - } - - ret = !pt->triggered; - rt_hw_interrupt_enable(level); - - return ret; -} - -static int do_pollfd(struct pollfd *pollfd, rt_pollreq_t *req) -{ - int mask = 0; - int fd; - - fd = pollfd->fd; - - if (fd >= 0) - { - struct dfs_fd *f = fd_get(fd); - mask = POLLNVAL; - - if (f) - { - mask = POLLMASK_DEFAULT; - if (f->fops->poll) - { - req->_key = pollfd->events | POLLERR | POLLHUP; - - mask = f->fops->poll(f, req); - - /* dealwith the device return error -1*/ - if (mask < 0) - { - fd_put(f); - pollfd->revents = 0; - return mask; - } - } - /* Mask out unneeded events. */ - mask &= pollfd->events | POLLERR | POLLHUP; - fd_put(f); - } - } - pollfd->revents = mask; - - return mask; -} - -static int poll_do(struct pollfd *fds, nfds_t nfds, struct rt_poll_table *pt, int msec) -{ - int num; - int istimeout = 0; - int n; - struct pollfd *pf; - int ret = 0; - - if (msec == 0) - { - pt->req._proc = RT_NULL; - istimeout = 1; - } - - while (1) - { - pf = fds; - num = 0; - - for (n = 0; n < nfds; n ++) - { - ret = do_pollfd(pf, &pt->req); - if(ret < 0) - { - /*dealwith the device return error -1 */ - pt->req._proc = RT_NULL; - return ret; - } - else if(ret > 0) - { - num ++; - pt->req._proc = RT_NULL; - } - pf ++; - } - - pt->req._proc = RT_NULL; - - if (num || istimeout) - break; - - if (poll_wait_timeout(pt, msec)) - istimeout = 1; - } - - return num; -} - -static void poll_teardown(struct rt_poll_table *pt) -{ - struct rt_poll_node *node, *next; - - next = pt->nodes; - while (next) - { - node = next; - rt_wqueue_remove(&node->wqn); - next = node->next; - rt_free(node); - } -} - -int poll(struct pollfd *fds, nfds_t nfds, int timeout) -{ - int num; - struct rt_poll_table table; - - poll_table_init(&table); - - num = poll_do(fds, nfds, &table, timeout); - - poll_teardown(&table); - - return num; -} - -#endif diff --git a/components/dfs/src/select.c b/components/dfs/src/select.c deleted file mode 100644 index c9286ca97f..0000000000 --- a/components/dfs/src/select.c +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright (c) 2006-2021, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2016-12-28 Bernard first version - */ -#include -#include -#include - -#include -#include - -#ifdef RT_USING_POSIX - -static void fdszero(fd_set *set, int nfds) -{ - fd_mask *m; - int n; - - /* - The 'sizeof(fd_set)' of the system space may differ from user space, - so the actual size of the 'fd_set' is determined here with the parameter 'nfds' - */ - m = (fd_mask *)set; - for (n = 0; n < nfds; n += (sizeof(fd_mask) * 8)) - { - rt_memset(m, 0, sizeof(fd_mask)); - m ++; - } -} - -int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout) -{ - int fd; - int npfds; - int msec; - int ndx; - int ret; - struct pollfd *pollset = RT_NULL; - - /* How many pollfd structures do we need to allocate? */ - for (fd = 0, npfds = 0; fd < nfds; fd++) - { - /* Check if any monitor operation is requested on this fd */ - if ((readfds && FD_ISSET(fd, readfds)) || - (writefds && FD_ISSET(fd, writefds)) || - (exceptfds && FD_ISSET(fd, exceptfds))) - { - npfds++; - } - } - - /* Allocate the descriptor list for poll() */ - if (npfds > 0) - { - pollset = (struct pollfd *)rt_calloc(npfds, sizeof(struct pollfd)); - if (!pollset) - { - return -1; - } - } - - /* Initialize the descriptor list for poll() */ - for (fd = 0, ndx = 0; fd < nfds; fd++) - { - int incr = 0; - - /* The readfs set holds the set of FDs that the caller can be assured - * of reading from without blocking. Note that POLLHUP is included as - * a read-able condition. POLLHUP will be reported at the end-of-file - * or when a connection is lost. In either case, the read() can then - * be performed without blocking. - */ - - if (readfds && FD_ISSET(fd, readfds)) - { - pollset[ndx].fd = fd; - pollset[ndx].events |= POLLIN; - incr = 1; - } - - if (writefds && FD_ISSET(fd, writefds)) - { - pollset[ndx].fd = fd; - pollset[ndx].events |= POLLOUT; - incr = 1; - } - - if (exceptfds && FD_ISSET(fd, exceptfds)) - { - pollset[ndx].fd = fd; - incr = 1; - } - - ndx += incr; - } - - RT_ASSERT(ndx == npfds); - - /* Convert the timeout to milliseconds */ - if (timeout) - { - msec = timeout->tv_sec * 1000 + timeout->tv_usec / 1000; - } - else - { - msec = -1; - } - - /* Then let poll do all of the real work. */ - - ret = poll(pollset, npfds, msec); - - /* Now set up the return values */ - if (readfds) - { - fdszero(readfds, nfds); - } - - if (writefds) - { - fdszero(writefds, nfds); - } - - if (exceptfds) - { - fdszero(exceptfds, nfds); - } - - /* Convert the poll descriptor list back into selects 3 bitsets */ - - if (ret > 0) - { - ret = 0; - for (ndx = 0; ndx < npfds; ndx++) - { - /* Check for read conditions. Note that POLLHUP is included as a - * read condition. POLLHUP will be reported when no more data will - * be available (such as when a connection is lost). In either - * case, the read() can then be performed without blocking. - */ - - if (readfds) - { - if (pollset[ndx].revents & (POLLIN | POLLHUP)) - { - FD_SET(pollset[ndx].fd, readfds); - ret++; - } - } - - /* Check for write conditions */ - if (writefds) - { - if (pollset[ndx].revents & POLLOUT) - { - FD_SET(pollset[ndx].fd, writefds); - ret++; - } - } - - /* Check for exceptions */ - if (exceptfds) - { - if (pollset[ndx].revents & POLLERR) - { - FD_SET(pollset[ndx].fd, exceptfds); - ret++; - } - } - } - } - - if (pollset) rt_free(pollset); - - return ret; -} - -#endif diff --git a/components/libc/compilers/common/poll.h b/components/libc/compilers/common/poll.h new file mode 100644 index 0000000000..1862373559 --- /dev/null +++ b/components/libc/compilers/common/poll.h @@ -0,0 +1,40 @@ +#ifndef __POLL_H__ +#define __POLL_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(POLLIN) && !defined(POLLOUT) +#define POLLIN (0x01) +#define POLLRDNORM (0x01) +#define POLLRDBAND (0x01) +#define POLLPRI (0x01) + +#define POLLOUT (0x02) +#define POLLWRNORM (0x02) +#define POLLWRBAND (0x02) + +#define POLLERR (0x04) +#define POLLHUP (0x08) +#define POLLNVAL (0x10) + +typedef unsigned int nfds_t; + +struct pollfd +{ + int fd; + short events; + short revents; +}; +#endif /* !defined(POLLIN) && !defined(POLLOUT) */ + +#define POLLMASK_DEFAULT (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM) + +int poll(struct pollfd *fds, nfds_t nfds, int timeout); + +#ifdef __cplusplus +} +#endif + +#endif /* __POLL_H__ */ diff --git a/components/libc/compilers/common/sys/time.h b/components/libc/compilers/common/sys/time.h index c2320429e0..9d4422e17a 100644 --- a/components/libc/compilers/common/sys/time.h +++ b/components/libc/compilers/common/sys/time.h @@ -8,8 +8,8 @@ * 2020-09-07 Meco Man combine gcc armcc iccarm * 2021-02-12 Meco Man move all definitions located in to this file */ -#ifndef _SYS_TIME_H_ -#define _SYS_TIME_H_ +#ifndef __SYS_TIME_H__ +#define __SYS_TIME_H__ #include #include @@ -73,7 +73,7 @@ struct timespec { }; #endif -/* posix clock and timer */ +/* POSIX clock and timer */ #define MILLISECOND_PER_SECOND 1000UL #define MICROSECOND_PER_SECOND 1000000UL #define NANOSECOND_PER_SECOND 1000000000UL -- cgit v1.3.1 From c360688714d3aaf1f2114c45afaa3ee2ddc64fdd Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Sat, 11 Sep 2021 11:48:14 -0400 Subject: 使用poll.h代替dfs_poll.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/dfs/src/dfs_poll.c | 2 +- components/dfs/src/dfs_select.c | 2 +- components/drivers/serial/serial.c | 2 +- components/drivers/serial/serial_v2.c | 2 +- components/drivers/src/pipe.c | 2 +- components/libc/compilers/common/poll.h | 9 +++++++++ components/lwp/lwp_syscall.c | 2 +- components/net/at/at_socket/at_socket.c | 2 +- components/net/sal_socket/impl/af_inet_at.c | 2 +- components/net/sal_socket/impl/af_inet_lwip.c | 2 +- components/net/sal_socket/socket/net_sockets.c | 2 +- components/utilities/rt-link/src/rtlink_dev.c | 2 +- examples/rt-link/rtlink_dev_example.c | 2 +- 13 files changed, 21 insertions(+), 12 deletions(-) (limited to 'components') diff --git a/components/dfs/src/dfs_poll.c b/components/dfs/src/dfs_poll.c index d1e0372494..607b3487be 100644 --- a/components/dfs/src/dfs_poll.c +++ b/components/dfs/src/dfs_poll.c @@ -17,7 +17,7 @@ #include #include #include -#include +#include #ifdef RT_USING_POSIX diff --git a/components/dfs/src/dfs_select.c b/components/dfs/src/dfs_select.c index c9286ca97f..ca9c549259 100644 --- a/components/dfs/src/dfs_select.c +++ b/components/dfs/src/dfs_select.c @@ -11,7 +11,7 @@ #include #include -#include +#include #include #ifdef RT_USING_POSIX diff --git a/components/drivers/serial/serial.c b/components/drivers/serial/serial.c index c567e34b52..289d523bd2 100644 --- a/components/drivers/serial/serial.c +++ b/components/drivers/serial/serial.c @@ -38,7 +38,7 @@ #ifdef RT_USING_POSIX #include -#include +#include #include #ifdef RT_USING_POSIX_TERMIOS diff --git a/components/drivers/serial/serial_v2.c b/components/drivers/serial/serial_v2.c index 6e65457a5d..390dd31748 100644 --- a/components/drivers/serial/serial_v2.c +++ b/components/drivers/serial/serial_v2.c @@ -18,7 +18,7 @@ #ifdef RT_USING_POSIX #include -#include +#include #include #ifdef getc diff --git a/components/drivers/src/pipe.c b/components/drivers/src/pipe.c index 7fa5eb067d..af90f13c6f 100644 --- a/components/drivers/src/pipe.c +++ b/components/drivers/src/pipe.c @@ -16,7 +16,7 @@ #ifdef RT_USING_POSIX #include #include -#include +#include #include static int pipe_fops_open(struct dfs_fd *fd) diff --git a/components/libc/compilers/common/poll.h b/components/libc/compilers/common/poll.h index 1862373559..aea73d6eaf 100644 --- a/components/libc/compilers/common/poll.h +++ b/components/libc/compilers/common/poll.h @@ -1,3 +1,12 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2021-09-11 Meco Man First version + */ #ifndef __POLL_H__ #define __POLL_H__ diff --git a/components/lwp/lwp_syscall.c b/components/lwp/lwp_syscall.c index 02915ab1cc..d9112eed3e 100644 --- a/components/lwp/lwp_syscall.c +++ b/components/lwp/lwp_syscall.c @@ -13,7 +13,7 @@ #include #include -#include +#include #include #if (defined(RT_USING_SAL) && defined(SAL_USING_POSIX)) diff --git a/components/net/at/at_socket/at_socket.c b/components/net/at/at_socket/at_socket.c index 8215dd4417..96ea053f9c 100644 --- a/components/net/at/at_socket/at_socket.c +++ b/components/net/at/at_socket/at_socket.c @@ -19,7 +19,7 @@ #include #ifdef SAL_USING_POSIX -#include +#include #endif #include diff --git a/components/net/sal_socket/impl/af_inet_at.c b/components/net/sal_socket/impl/af_inet_at.c index c85dfe9f06..07dff0018c 100644 --- a/components/net/sal_socket/impl/af_inet_at.c +++ b/components/net/sal_socket/impl/af_inet_at.c @@ -19,7 +19,7 @@ #include #ifdef SAL_USING_POSIX -#include +#include #endif #ifdef SAL_USING_AT diff --git a/components/net/sal_socket/impl/af_inet_lwip.c b/components/net/sal_socket/impl/af_inet_lwip.c index 2e19275b5d..2cf0958ee4 100644 --- a/components/net/sal_socket/impl/af_inet_lwip.c +++ b/components/net/sal_socket/impl/af_inet_lwip.c @@ -17,7 +17,7 @@ #include #ifdef SAL_USING_POSIX -#include +#include #endif #include diff --git a/components/net/sal_socket/socket/net_sockets.c b/components/net/sal_socket/socket/net_sockets.c index 7d4db34327..1b6db50e6d 100644 --- a/components/net/sal_socket/socket/net_sockets.c +++ b/components/net/sal_socket/socket/net_sockets.c @@ -11,7 +11,7 @@ #include #include -#include +#include #include #include #include diff --git a/components/utilities/rt-link/src/rtlink_dev.c b/components/utilities/rt-link/src/rtlink_dev.c index 5eff1f9782..efebf37565 100644 --- a/components/utilities/rt-link/src/rtlink_dev.c +++ b/components/utilities/rt-link/src/rtlink_dev.c @@ -21,7 +21,7 @@ #ifdef RT_USING_POSIX #include -#include +#include int rtlink_fops_open(struct dfs_fd *fd) { diff --git a/examples/rt-link/rtlink_dev_example.c b/examples/rt-link/rtlink_dev_example.c index 0a026bcb3d..d00f916efd 100644 --- a/examples/rt-link/rtlink_dev_example.c +++ b/examples/rt-link/rtlink_dev_example.c @@ -47,7 +47,7 @@ static rt_err_t rtlink_dev_tx_done(rt_device_t dev, void *buffer) #ifdef RT_USING_POSIX #include -#include +#include #include #define RTLINK01_PATH "/dev/rtlink01" -- cgit v1.3.1 From b35fffd6596265773021539ad42a0b1012784e11 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Sat, 11 Sep 2021 14:43:09 -0400 Subject: [remove rtlibc]修复缺失的头文件导致的报错 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/net/at/include/at.h | 1 + components/net/at/src/at_cli.c | 2 +- components/net/sal_socket/include/sal_netdb.h | 1 + components/net/sal_socket/include/sal_socket.h | 1 + components/net/sal_socket/include/socket/netdb.h | 1 + 5 files changed, 5 insertions(+), 1 deletion(-) (limited to 'components') diff --git a/components/net/at/include/at.h b/components/net/at/include/at.h index 0e93720ff0..0a385058a0 100644 --- a/components/net/at/include/at.h +++ b/components/net/at/include/at.h @@ -12,6 +12,7 @@ #ifndef __AT_H__ #define __AT_H__ +#include #include #ifdef __cplusplus diff --git a/components/net/at/src/at_cli.c b/components/net/at/src/at_cli.c index 25fbb708f4..c589bb68a0 100644 --- a/components/net/at/src/at_cli.c +++ b/components/net/at/src/at_cli.c @@ -11,7 +11,7 @@ #include #include #include - +#include #include #include #include diff --git a/components/net/sal_socket/include/sal_netdb.h b/components/net/sal_socket/include/sal_netdb.h index 50064ce343..9b1421270f 100644 --- a/components/net/sal_socket/include/sal_netdb.h +++ b/components/net/sal_socket/include/sal_netdb.h @@ -10,6 +10,7 @@ #ifndef SAL_NETDB_H__ #define SAL_NETDB_H__ +#include #include "sal_socket.h" #ifdef __cplusplus diff --git a/components/net/sal_socket/include/sal_socket.h b/components/net/sal_socket/include/sal_socket.h index 497be47e41..c479d21c62 100644 --- a/components/net/sal_socket/include/sal_socket.h +++ b/components/net/sal_socket/include/sal_socket.h @@ -11,6 +11,7 @@ #ifndef SAL_SOCKET_H__ #define SAL_SOCKET_H__ +#include #include #ifdef __cplusplus diff --git a/components/net/sal_socket/include/socket/netdb.h b/components/net/sal_socket/include/socket/netdb.h index 9d54953681..8394fddea5 100644 --- a/components/net/sal_socket/include/socket/netdb.h +++ b/components/net/sal_socket/include/socket/netdb.h @@ -16,6 +16,7 @@ extern "C" { #endif +#include #include struct hostent *gethostbyname(const char *name); -- cgit v1.3.1 From 2c525ecd43cfee01cffd4d1d289ebdb5935674a5 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Sat, 11 Sep 2021 15:34:59 -0400 Subject: 将dfs_posix.h的函数声明转移到unix标准头文件中 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/dfs/include/dfs.h | 8 +-- components/dfs/include/dfs_posix.h | 41 +------------ .../libc/compilers/common/none-gcc/sys/types.h | 1 + .../libc/compilers/common/none-gcc/sys/unistd.h | 70 ++++++---------------- components/libc/compilers/common/sys/statfs.h | 15 +++-- components/libc/compilers/common/sys/vfs.h | 15 +++++ 6 files changed, 46 insertions(+), 104 deletions(-) create mode 100644 components/libc/compilers/common/sys/vfs.h (limited to 'components') diff --git a/components/dfs/include/dfs.h b/components/dfs/include/dfs.h index 9f112f9656..38f19aa7e7 100644 --- a/components/dfs/include/dfs.h +++ b/components/dfs/include/dfs.h @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -68,13 +69,6 @@ extern "C" { #define DFS_F_EOF 0x04000000 #define DFS_F_ERR 0x08000000 -struct statfs -{ - size_t f_bsize; /* block size */ - size_t f_blocks; /* total data blocks in file system */ - size_t f_bfree; /* free blocks in file system */ -}; - struct dfs_fdtable { uint32_t maxfd; diff --git a/components/dfs/include/dfs_posix.h b/components/dfs/include/dfs_posix.h index 98da0f854f..ee62cdde82 100644 --- a/components/dfs/include/dfs_posix.h +++ b/components/dfs/include/dfs_posix.h @@ -16,44 +16,9 @@ #define __DFS_POSIX_H__ #include +#include +#include /* rename() */ #include - -#ifdef __cplusplus -extern "C" { -#endif - - -/* file api*/ - -int close(int d); - -#if defined(RT_USING_NEWLIB) && defined(_EXFUN) -_READ_WRITE_RETURN_TYPE _EXFUN(read, (int __fd, void *__buf, size_t __nbyte)); -_READ_WRITE_RETURN_TYPE _EXFUN(write, (int __fd, const void *__buf, size_t __nbyte)); -#else -int read(int fd, void *buf, size_t len); -int write(int fd, const void *buf, size_t len); -#endif - -off_t lseek(int fd, off_t offset, int whence); -int rename(const char *from, const char *to); -int unlink(const char *pathname); -int fsync(int fildes); -int ftruncate(int fd, off_t length); - -/* directory api*/ -int rmdir(const char *path); -int chdir(const char *path); -char *getcwd(char *buf, size_t size); - -/* file system api */ -int statfs(const char *path, struct statfs *buf); - -int access(const char *path, int amode); -int pipe(int fildes[2]); - -#ifdef __cplusplus -} -#endif +#include /* statfs() */ #endif diff --git a/components/libc/compilers/common/none-gcc/sys/types.h b/components/libc/compilers/common/none-gcc/sys/types.h index e9f44f7762..a7c566f643 100644 --- a/components/libc/compilers/common/none-gcc/sys/types.h +++ b/components/libc/compilers/common/none-gcc/sys/types.h @@ -12,6 +12,7 @@ #define __SYS_TYPES_H__ #include +#include typedef int32_t clockid_t; typedef int32_t key_t; /* Used for interprocess communication. */ diff --git a/components/libc/compilers/common/none-gcc/sys/unistd.h b/components/libc/compilers/common/none-gcc/sys/unistd.h index ea2d674b0f..f86d56282c 100644 --- a/components/libc/compilers/common/none-gcc/sys/unistd.h +++ b/components/libc/compilers/common/none-gcc/sys/unistd.h @@ -6,68 +6,32 @@ * Change Logs: * Date Author Notes * 2020-12-16 Meco Man add usleep + * 2021-09-11 Meco Man move functions from dfs_posix.h to unistd.h */ #ifndef __SYS_UNISTD_H__ #define __SYS_UNISTD_H__ -#include -#include "types.h" - -#ifdef RT_USING_DFS +#include +#include "types.h" /* */ #define STDIN_FILENO 0 /* standard input file descriptor */ #define STDOUT_FILENO 1 /* standard output file descriptor */ #define STDERR_FILENO 2 /* standard error file descriptor */ -#include -#else -#define _FREAD 0x0001 /* read enabled */ -#define _FWRITE 0x0002 /* write enabled */ -#define _FAPPEND 0x0008 /* append (writes guaranteed at the end) */ -#define _FMARK 0x0010 /* internal; mark during gc() */ -#define _FDEFER 0x0020 /* internal; defer for next gc pass */ -#define _FASYNC 0x0040 /* signal pgrp when data ready */ -#define _FSHLOCK 0x0080 /* BSD flock() shared lock present */ -#define _FEXLOCK 0x0100 /* BSD flock() exclusive lock present */ -#define _FCREAT 0x0200 /* open with file create */ -#define _FTRUNC 0x0400 /* open with truncation */ -#define _FEXCL 0x0800 /* error on open if file exists */ -#define _FNBIO 0x1000 /* non blocking I/O (sys5 style) */ -#define _FSYNC 0x2000 /* do all writes synchronously */ -#define _FNONBLOCK 0x4000 /* non blocking I/O (POSIX style) */ -#define _FNDELAY _FNONBLOCK /* non blocking I/O (4.2 style) */ -#define _FNOCTTY 0x8000 /* don't assign a ctty on this open */ - - -#ifndef O_RDONLY -#define O_RDONLY 0 /* +1 == FREAD */ -#endif -#ifndef O_WRONLY -#define O_WRONLY 1 /* +1 == FWRITE */ -#endif -#ifndef O_RDWR -#define O_RDWR 2 /* +1 == FREAD|FWRITE */ -#endif -#ifndef O_APPEND -#define O_APPEND _FAPPEND -#endif -#ifndef O_CREAT -#define O_CREAT _FCREAT -#endif -#ifndef O_TRUNC -#define O_TRUNC _FTRUNC -#endif -#ifndef O_EXCL -#define O_EXCL _FEXCL -#endif -#ifndef O_SYNC -#define O_SYNC _FSYNC -#endif - -#endif - -int isatty (int fd); -char * ttyname (int desc); +int read(int fd, void *buf, size_t len); +int write(int fd, const void *buf, size_t len); +off_t lseek(int fd, off_t offset, int whence); +int fsync(int fildes); +int unlink(const char *pathname); +int close(int d); +int ftruncate(int fd, off_t length); +int rmdir(const char *path); +int chdir(const char *path); +char *getcwd(char *buf, size_t size); +int access(const char *path, int amode); +int pipe(int fildes[2]); +int isatty(int fd); +char *ttyname(int desc); unsigned int sleep(unsigned int seconds); int usleep(useconds_t usec); pid_t gettid(void); diff --git a/components/libc/compilers/common/sys/statfs.h b/components/libc/compilers/common/sys/statfs.h index 0996af9a18..0c6dc44df3 100644 --- a/components/libc/compilers/common/sys/statfs.h +++ b/components/libc/compilers/common/sys/statfs.h @@ -6,16 +6,19 @@ * Change Logs: * Date Author Notes */ -#ifndef __RTT_STATFS_H__ -#define __RTT_STATFS_H__ +#ifndef __SYS_STATFS_H__ +#define __SYS_STATFS_H__ -#include +#include struct statfs { - rt_size_t f_bsize; /* block size */ - rt_size_t f_blocks; /* total data blocks in file system */ - rt_size_t f_bfree; /* free blocks in file system */ + size_t f_bsize; /* block size */ + size_t f_blocks; /* total data blocks in file system */ + size_t f_bfree; /* free blocks in file system */ }; +int statfs(const char *path, struct statfs *buf); +int fstatfs(int fd, struct statfs *buf); + #endif diff --git a/components/libc/compilers/common/sys/vfs.h b/components/libc/compilers/common/sys/vfs.h new file mode 100644 index 0000000000..00739ab1c6 --- /dev/null +++ b/components/libc/compilers/common/sys/vfs.h @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2021-09-11 Meco Man First version + */ +#ifndef __SYS_VFS_H__ +#define __SYS_VFS_H__ + +#include "statfs.h" /* */ + +#endif -- cgit v1.3.1 From c48445a5f7cdf86d9724b1fa2ca9090b433845e7 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Sat, 11 Sep 2021 18:33:46 -0400 Subject: [标准化libc] fix CI warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/dfs/src/dfs_posix.c | 12 ++---------- components/libc/compilers/common/none-gcc/sys/unistd.h | 4 ++-- 2 files changed, 4 insertions(+), 12 deletions(-) (limited to 'components') diff --git a/components/dfs/src/dfs_posix.c b/components/dfs/src/dfs_posix.c index a7c306366f..be3b039818 100644 --- a/components/dfs/src/dfs_posix.c +++ b/components/dfs/src/dfs_posix.c @@ -110,11 +110,7 @@ RTM_EXPORT(close); * @return the actual read data buffer length. If the returned value is 0, it * may be reach the end of file, please check errno. */ -#if defined(RT_USING_NEWLIB) && defined(_EXFUN) -_READ_WRITE_RETURN_TYPE _EXFUN(read, (int fd, void *buf, size_t len)) -#else -int read(int fd, void *buf, size_t len) -#endif +ssize_t read(int fd, void *buf, size_t len) { int result; struct dfs_fd *d; @@ -154,11 +150,7 @@ RTM_EXPORT(read); * * @return the actual written data buffer length. */ -#if defined(RT_USING_NEWLIB) && defined(_EXFUN) -_READ_WRITE_RETURN_TYPE _EXFUN(write, (int fd, const void *buf, size_t len)) -#else -int write(int fd, const void *buf, size_t len) -#endif +ssize_t write(int fd, const void *buf, size_t len) { int result; struct dfs_fd *d; diff --git a/components/libc/compilers/common/none-gcc/sys/unistd.h b/components/libc/compilers/common/none-gcc/sys/unistd.h index f86d56282c..6195c4c2aa 100644 --- a/components/libc/compilers/common/none-gcc/sys/unistd.h +++ b/components/libc/compilers/common/none-gcc/sys/unistd.h @@ -18,8 +18,8 @@ #define STDOUT_FILENO 1 /* standard output file descriptor */ #define STDERR_FILENO 2 /* standard error file descriptor */ -int read(int fd, void *buf, size_t len); -int write(int fd, const void *buf, size_t len); +ssize_t read(int fd, void *buf, size_t len); +ssize_t write(int fd, const void *buf, size_t len); off_t lseek(int fd, off_t offset, int whence); int fsync(int fildes); int unlink(const char *pathname); -- cgit v1.3.1 From e91ffdd1a0af24831d0f7d99c88b6332975ed880 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Mon, 13 Sep 2021 11:34:10 -0400 Subject: [libc] fix the conflict warning of read and write functions --- bsp/x86/drivers/floppy.c | 2 +- components/dfs/src/dfs_posix.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'components') diff --git a/bsp/x86/drivers/floppy.c b/bsp/x86/drivers/floppy.c index c144eb02eb..be3ab4c179 100644 --- a/bsp/x86/drivers/floppy.c +++ b/bsp/x86/drivers/floppy.c @@ -357,7 +357,7 @@ void rt_floppy_init(void) device->read = rt_floppy_read; device->write = rt_floppy_write; device->control = rt_floppy_control; - device->user_data = NULL; + device->user_data = RT_NULL; rt_device_register(device, "floppy", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_REMOVABLE | RT_DEVICE_FLAG_STANDALONE); diff --git a/components/dfs/src/dfs_posix.c b/components/dfs/src/dfs_posix.c index be3b039818..ed3fdb2eeb 100644 --- a/components/dfs/src/dfs_posix.c +++ b/components/dfs/src/dfs_posix.c @@ -110,7 +110,11 @@ RTM_EXPORT(close); * @return the actual read data buffer length. If the returned value is 0, it * may be reach the end of file, please check errno. */ +#ifdef _READ_WRITE_RETURN_TYPE +_READ_WRITE_RETURN_TYPE read(int fd, void *buf, size_t len) /* some gcc tool chains will use different data structure */ +#else ssize_t read(int fd, void *buf, size_t len) +#endif { int result; struct dfs_fd *d; @@ -150,7 +154,11 @@ RTM_EXPORT(read); * * @return the actual written data buffer length. */ +#ifdef _READ_WRITE_RETURN_TYPE +_READ_WRITE_RETURN_TYPE write(int fd, const void *buf, size_t len) /* some gcc tool chains will use different data structure */ +#else ssize_t write(int fd, const void *buf, size_t len) +#endif { int result; struct dfs_fd *d; -- cgit v1.3.1 From dc5ee9ade72c5ca8049ee464bde261def0b8f5fc Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Mon, 13 Sep 2021 13:07:02 -0400 Subject: [libc标准化] 将dfs_select.h功能转移到sys/select.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/dfs/include/dfs_select.h | 11 ----------- components/libc/compilers/common/none-gcc/sys/types.h | 1 + components/libc/compilers/common/sys/select.h | 3 +++ 3 files changed, 4 insertions(+), 11 deletions(-) (limited to 'components') diff --git a/components/dfs/include/dfs_select.h b/components/dfs/include/dfs_select.h index e0572c5059..17291a60dc 100644 --- a/components/dfs/include/dfs_select.h +++ b/components/dfs/include/dfs_select.h @@ -12,15 +12,4 @@ #include -#ifdef __cplusplus -extern "C" { #endif - -int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/components/libc/compilers/common/none-gcc/sys/types.h b/components/libc/compilers/common/none-gcc/sys/types.h index a7c566f643..2c4c12055f 100644 --- a/components/libc/compilers/common/none-gcc/sys/types.h +++ b/components/libc/compilers/common/none-gcc/sys/types.h @@ -13,6 +13,7 @@ #include #include +#include typedef int32_t clockid_t; typedef int32_t key_t; /* Used for interprocess communication. */ diff --git a/components/libc/compilers/common/sys/select.h b/components/libc/compilers/common/sys/select.h index db42b6ebcc..08420b0d10 100644 --- a/components/libc/compilers/common/sys/select.h +++ b/components/libc/compilers/common/sys/select.h @@ -12,6 +12,7 @@ #define __SYS_SELECT_H__ #include +#include #include #ifndef FD_SETSIZE @@ -46,4 +47,6 @@ typedef struct _types_fd_set { #define FD_ZERO(p) memset((void*)(p), 0, sizeof(*(p))) #endif /* _SYS_TYPES_FD_SET */ +int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); + #endif /* __SYS_SELECT_H__ */ -- cgit v1.3.1 From aa8a493c3c0fbc269a8e66286e3c7b4c28a1b2d5 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Tue, 14 Sep 2021 20:49:44 -0400 Subject: move select.h to none-gcc --- .../libc/compilers/common/none-gcc/sys/select.h | 52 ++++++++++++++++++++++ components/libc/compilers/common/sys/select.h | 52 ---------------------- 2 files changed, 52 insertions(+), 52 deletions(-) create mode 100644 components/libc/compilers/common/none-gcc/sys/select.h delete mode 100644 components/libc/compilers/common/sys/select.h (limited to 'components') diff --git a/components/libc/compilers/common/none-gcc/sys/select.h b/components/libc/compilers/common/none-gcc/sys/select.h new file mode 100644 index 0000000000..575ad3a1b5 --- /dev/null +++ b/components/libc/compilers/common/none-gcc/sys/select.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2021-07-21 Meco Man The first version + */ + +#ifndef __SYS_SELECT_H__ +#define __SYS_SELECT_H__ + +#include +#include +#include + +#ifndef FD_SETSIZE +#define FD_SETSIZE 32 +#endif + +#ifdef SAL_USING_POSIX +#ifdef FD_SETSIZE +#undef FD_SETSIZE +#endif +#define FD_SETSIZE DFS_FD_MAX +#endif /* SAL_USING_POSIX */ + +#define NBBY 8 /* number of bits in a byte */ + +typedef long fd_mask; + +#define NFDBITS (sizeof (fd_mask) * NBBY) /* bits per mask */ +#ifndef howmany +#define howmany(x,y) (((x)+((y)-1))/(y)) +#endif + +#ifndef _SYS_TYPES_FD_SET /* MIPS */ +typedef struct _types_fd_set { + fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)]; +} _types_fd_set; +#define fd_set _types_fd_set + +#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1L << ((n) % NFDBITS))) +#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1L << ((n) % NFDBITS))) +#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1L << ((n) % NFDBITS))) +#define FD_ZERO(p) memset((void*)(p), 0, sizeof(*(p))) +#endif /* _SYS_TYPES_FD_SET */ + +int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); + +#endif /* __SYS_SELECT_H__ */ diff --git a/components/libc/compilers/common/sys/select.h b/components/libc/compilers/common/sys/select.h deleted file mode 100644 index 08420b0d10..0000000000 --- a/components/libc/compilers/common/sys/select.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2006-2021, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2021-07-21 Meco Man The first version - */ - -#ifndef __SYS_SELECT_H__ -#define __SYS_SELECT_H__ - -#include -#include -#include - -#ifndef FD_SETSIZE -#define FD_SETSIZE 32 -#endif - -#ifdef SAL_USING_POSIX -#ifdef FD_SETSIZE -#undef FD_SETSIZE -#endif -#define FD_SETSIZE DFS_FD_MAX -#endif /* SAL_USING_POSIX */ - -#define NBBY 8 /* number of bits in a byte */ - -typedef long fd_mask; - -#define NFDBITS (sizeof (fd_mask) * NBBY) /* bits per mask */ -#ifndef howmany -#define howmany(x,y) (((x)+((y)-1))/(y)) -#endif - -#ifndef _SYS_TYPES_FD_SET /* MIPS */ -typedef struct _types_fd_set { - fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)]; -} _types_fd_set; -#define fd_set _types_fd_set - -#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1L << ((n) % NFDBITS))) -#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1L << ((n) % NFDBITS))) -#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1L << ((n) % NFDBITS))) -#define FD_ZERO(p) memset((void*)(p), 0, sizeof(*(p))) -#endif /* _SYS_TYPES_FD_SET */ - -int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); - -#endif /* __SYS_SELECT_H__ */ -- cgit v1.3.1 From 42e61f7a631da09d9574448b9e4cf7183de00211 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Tue, 14 Sep 2021 22:21:13 -0400 Subject: [libc]解决龙芯内置工具链没有sys/select.h的问题 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/libc/compilers/common/nogcc/SConscript | 15 ++ components/libc/compilers/common/nogcc/readme.md | 3 + components/libc/compilers/common/nogcc/sys/errno.h | 197 +++++++++++++++++++++ .../libc/compilers/common/nogcc/sys/select.h | 52 ++++++ components/libc/compilers/common/nogcc/sys/stat.h | 83 +++++++++ components/libc/compilers/common/nogcc/sys/types.h | 38 ++++ .../libc/compilers/common/nogcc/sys/unistd.h | 45 +++++ components/libc/compilers/common/nogcc/unistd.h | 10 ++ .../libc/compilers/common/none-gcc/SConscript | 15 -- .../libc/compilers/common/none-gcc/readme.md | 3 - .../libc/compilers/common/none-gcc/sys/errno.h | 197 --------------------- .../libc/compilers/common/none-gcc/sys/select.h | 52 ------ .../libc/compilers/common/none-gcc/sys/stat.h | 83 --------- .../libc/compilers/common/none-gcc/sys/types.h | 38 ---- .../libc/compilers/common/none-gcc/sys/unistd.h | 45 ----- components/libc/compilers/common/none-gcc/unistd.h | 10 -- .../libc/compilers/common/partial/SConscript | 15 ++ .../libc/compilers/common/partial/ls1/SConscript | 18 ++ 18 files changed, 476 insertions(+), 443 deletions(-) create mode 100644 components/libc/compilers/common/nogcc/SConscript create mode 100644 components/libc/compilers/common/nogcc/readme.md create mode 100644 components/libc/compilers/common/nogcc/sys/errno.h create mode 100644 components/libc/compilers/common/nogcc/sys/select.h create mode 100644 components/libc/compilers/common/nogcc/sys/stat.h create mode 100644 components/libc/compilers/common/nogcc/sys/types.h create mode 100644 components/libc/compilers/common/nogcc/sys/unistd.h create mode 100644 components/libc/compilers/common/nogcc/unistd.h delete mode 100644 components/libc/compilers/common/none-gcc/SConscript delete mode 100644 components/libc/compilers/common/none-gcc/readme.md delete mode 100644 components/libc/compilers/common/none-gcc/sys/errno.h delete mode 100644 components/libc/compilers/common/none-gcc/sys/select.h delete mode 100644 components/libc/compilers/common/none-gcc/sys/stat.h delete mode 100644 components/libc/compilers/common/none-gcc/sys/types.h delete mode 100644 components/libc/compilers/common/none-gcc/sys/unistd.h delete mode 100644 components/libc/compilers/common/none-gcc/unistd.h create mode 100644 components/libc/compilers/common/partial/SConscript create mode 100644 components/libc/compilers/common/partial/ls1/SConscript (limited to 'components') diff --git a/components/libc/compilers/common/nogcc/SConscript b/components/libc/compilers/common/nogcc/SConscript new file mode 100644 index 0000000000..c766c8f82d --- /dev/null +++ b/components/libc/compilers/common/nogcc/SConscript @@ -0,0 +1,15 @@ +from building import * + +Import('rtconfig') + +src = [] +cwd = GetCurrentDir() +CPPPATH = [cwd] +group = [] + +if GetDepend('RT_USING_LIBC'): + src += Glob('*.c') + +if rtconfig.PLATFORM != 'gcc' or rtconfig.ARCH == 'sim': + group = DefineGroup('libc', src, depend = [], CPPPATH = CPPPATH) +Return('group') diff --git a/components/libc/compilers/common/nogcc/readme.md b/components/libc/compilers/common/nogcc/readme.md new file mode 100644 index 0000000000..b10940d003 --- /dev/null +++ b/components/libc/compilers/common/nogcc/readme.md @@ -0,0 +1,3 @@ +## Attentions + +This folder is "common" for toolchains excluding gcc. \ No newline at end of file diff --git a/components/libc/compilers/common/nogcc/sys/errno.h b/components/libc/compilers/common/nogcc/sys/errno.h new file mode 100644 index 0000000000..ff1abca387 --- /dev/null +++ b/components/libc/compilers/common/nogcc/sys/errno.h @@ -0,0 +1,197 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2021-05-22 Meco Man The first version. + */ +#ifndef __SYS_ERRNO_H__ +#define __SYS_ERRNO_H__ + +#if defined(__ARMCC_VERSION) +/* +defined in armcc/errno.h + +#define EDOM 1 +#define ERANGE 2 +#define EILSEQ 4 +#define ESIGNUM 3 +#define EINVAL 5 +#define ENOMEM 6 +*/ + +#define ERROR_BASE_NO 7 + +#elif defined(__IAR_SYSTEMS_ICC__) +/* defined in iar/errno.h +#define EDOM 33 +#define ERANGE 34 +#define EFPOS 35 +#define EILSEQ 36 +*/ +#define ERROR_BASE_NO 36 + +#else +#define ERROR_BASE_NO 0 +#endif + +#if defined(__ARMCC_VERSION) || defined(__IAR_SYSTEMS_ICC__) +#include +#define EPERM (ERROR_BASE_NO + 1) +#define ENOENT (ERROR_BASE_NO + 2) +#define ESRCH (ERROR_BASE_NO + 3) +#define EINTR (ERROR_BASE_NO + 4) +#define EIO (ERROR_BASE_NO + 5) +#define ENXIO (ERROR_BASE_NO + 6) +#define E2BIG (ERROR_BASE_NO + 7) +#define ENOEXEC (ERROR_BASE_NO + 8) +#define EBADF (ERROR_BASE_NO + 9) +#define ECHILD (ERROR_BASE_NO + 10) +#define EAGAIN (ERROR_BASE_NO + 11) + +#ifndef ENOMEM +#define ENOMEM (ERROR_BASE_NO + 12) +#endif + +#define EACCES (ERROR_BASE_NO + 13) +#define EFAULT (ERROR_BASE_NO + 14) +#define ENOTBLK (ERROR_BASE_NO + 15) +#define EBUSY (ERROR_BASE_NO + 16) +#define EEXIST (ERROR_BASE_NO + 17) +#define EXDEV (ERROR_BASE_NO + 18) +#define ENODEV (ERROR_BASE_NO + 19) +#define ENOTDIR (ERROR_BASE_NO + 20) +#define EISDIR (ERROR_BASE_NO + 21) + +#ifndef EINVAL +#define EINVAL (ERROR_BASE_NO + 22) +#endif + +#define ENFILE (ERROR_BASE_NO + 23) +#define EMFILE (ERROR_BASE_NO + 24) +#define ENOTTY (ERROR_BASE_NO + 25) +#define ETXTBSY (ERROR_BASE_NO + 26) +#define EFBIG (ERROR_BASE_NO + 27) +#define ENOSPC (ERROR_BASE_NO + 28) +#define ESPIPE (ERROR_BASE_NO + 29) +#define EROFS (ERROR_BASE_NO + 30) +#define EMLINK (ERROR_BASE_NO + 31) +#define EPIPE (ERROR_BASE_NO + 32) + +#ifndef EDOM +#define EDOM (ERROR_BASE_NO + 33) +#endif + +#ifndef ERANGE +#define ERANGE (ERROR_BASE_NO + 34) +#endif + +#define EDEADLK (ERROR_BASE_NO + 35) +#define ENAMETOOLONG (ERROR_BASE_NO + 36) +#define ENOLCK (ERROR_BASE_NO + 37) +#define ENOSYS (ERROR_BASE_NO + 38) +#define ENOTEMPTY (ERROR_BASE_NO + 39) +#define ELOOP (ERROR_BASE_NO + 40) +#define EWOULDBLOCK EAGAIN +#define ENOMSG (ERROR_BASE_NO + 42) +#define EIDRM (ERROR_BASE_NO + 43) +#define ECHRNG (ERROR_BASE_NO + 44) +#define EL2NSYNC (ERROR_BASE_NO + 45) +#define EL3HLT (ERROR_BASE_NO + 46) +#define EL3RST (ERROR_BASE_NO + 47) +#define ELNRNG (ERROR_BASE_NO + 48) +#define EUNATCH (ERROR_BASE_NO + 49) +#define ENOCSI (ERROR_BASE_NO + 50) +#define EL2HLT (ERROR_BASE_NO + 51) +#define EBADE (ERROR_BASE_NO + 52) +#define EBADR (ERROR_BASE_NO + 53) +#define EXFULL (ERROR_BASE_NO + 54) +#define ENOANO (ERROR_BASE_NO + 55) +#define EBADRQC (ERROR_BASE_NO + 56) +#define EBADSLT (ERROR_BASE_NO + 57) +#define EDEADLOCK EDEADLK +#define EBFONT (ERROR_BASE_NO + 59) +#define ENOSTR (ERROR_BASE_NO + 60) +#define ENODATA (ERROR_BASE_NO + 61) +#define ETIME (ERROR_BASE_NO + 62) +#define ENOSR (ERROR_BASE_NO + 63) +#define ENONET (ERROR_BASE_NO + 64) +#define ENOPKG (ERROR_BASE_NO + 65) +#define EREMOTE (ERROR_BASE_NO + 66) +#define ENOLINK (ERROR_BASE_NO + 67) +#define EADV (ERROR_BASE_NO + 68) +#define ESRMNT (ERROR_BASE_NO + 69) +#define ECOMM (ERROR_BASE_NO + 70) +#define EPROTO (ERROR_BASE_NO + 71) +#define EMULTIHOP (ERROR_BASE_NO + 72) +#define EDOTDOT (ERROR_BASE_NO + 73) +#define EBADMSG (ERROR_BASE_NO + 74) +#define EOVERFLOW (ERROR_BASE_NO + 75) +#define ENOTUNIQ (ERROR_BASE_NO + 76) +#define EBADFD (ERROR_BASE_NO + 77) +#define EREMCHG (ERROR_BASE_NO + 78) +#define ELIBACC (ERROR_BASE_NO + 79) +#define ELIBBAD (ERROR_BASE_NO + 80) +#define ELIBSCN (ERROR_BASE_NO + 81) +#define ELIBMAX (ERROR_BASE_NO + 82) +#define ELIBEXEC (ERROR_BASE_NO + 83) + +#ifndef EILSEQ +#define EILSEQ (ERROR_BASE_NO + 84) +#endif + +#define ERESTART (ERROR_BASE_NO + 85) +#define ESTRPIPE (ERROR_BASE_NO + 86) +#define EUSERS (ERROR_BASE_NO + 87) +#define ENOTSOCK (ERROR_BASE_NO + 88) +#define EDESTADDRREQ (ERROR_BASE_NO + 89) +#define EMSGSIZE (ERROR_BASE_NO + 90) +#define EPROTOTYPE (ERROR_BASE_NO + 91) +#define ENOPROTOOPT (ERROR_BASE_NO + 92) +#define EPROTONOSUPPORT (ERROR_BASE_NO + 93) +#define ESOCKTNOSUPPORT (ERROR_BASE_NO + 94) +#define EOPNOTSUPP (ERROR_BASE_NO + 95) +#define ENOTSUP EOPNOTSUPP +#define EPFNOSUPPORT (ERROR_BASE_NO + 96) +#define EAFNOSUPPORT (ERROR_BASE_NO + 97) +#define EADDRINUSE (ERROR_BASE_NO + 98) +#define EADDRNOTAVAIL (ERROR_BASE_NO + 99) +#define ENETDOWN (ERROR_BASE_NO + 100) +#define ENETUNREACH (ERROR_BASE_NO + 101) +#define ENETRESET (ERROR_BASE_NO + 102) +#define ECONNABORTED (ERROR_BASE_NO + 103) +#define ECONNRESET (ERROR_BASE_NO + 104) +#define ENOBUFS (ERROR_BASE_NO + 105) +#define EISCONN (ERROR_BASE_NO + 106) +#define ENOTCONN (ERROR_BASE_NO + 107) +#define ESHUTDOWN (ERROR_BASE_NO + 108) +#define ETOOMANYREFS (ERROR_BASE_NO + 109) +#define ETIMEDOUT (ERROR_BASE_NO + 110) +#define ECONNREFUSED (ERROR_BASE_NO + 111) +#define EHOSTDOWN (ERROR_BASE_NO + 112) +#define EHOSTUNREACH (ERROR_BASE_NO + 113) +#define EALREADY (ERROR_BASE_NO + 114) +#define EINPROGRESS (ERROR_BASE_NO + 115) +#define ESTALE (ERROR_BASE_NO + 116) +#define EUCLEAN (ERROR_BASE_NO + 117) +#define ENOTNAM (ERROR_BASE_NO + 118) +#define ENAVAIL (ERROR_BASE_NO + 119) +#define EISNAM (ERROR_BASE_NO + 120) +#define EREMOTEIO (ERROR_BASE_NO + 121) +#define EDQUOT (ERROR_BASE_NO + 122) +#define ENOMEDIUM (ERROR_BASE_NO + 123) +#define EMEDIUMTYPE (ERROR_BASE_NO + 124) +#define ECANCELED (ERROR_BASE_NO + 125) +#define ENOKEY (ERROR_BASE_NO + 126) +#define EKEYEXPIRED (ERROR_BASE_NO + 127) +#define EKEYREVOKED (ERROR_BASE_NO + 128) +#define EKEYREJECTED (ERROR_BASE_NO + 129) +#define EOWNERDEAD (ERROR_BASE_NO + 130) +#define ENOTRECOVERABLE (ERROR_BASE_NO + 131) +#define ERFKILL (ERROR_BASE_NO + 132) +#define EHWPOISON (ERROR_BASE_NO + 133) +#endif + +#endif diff --git a/components/libc/compilers/common/nogcc/sys/select.h b/components/libc/compilers/common/nogcc/sys/select.h new file mode 100644 index 0000000000..575ad3a1b5 --- /dev/null +++ b/components/libc/compilers/common/nogcc/sys/select.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2021-07-21 Meco Man The first version + */ + +#ifndef __SYS_SELECT_H__ +#define __SYS_SELECT_H__ + +#include +#include +#include + +#ifndef FD_SETSIZE +#define FD_SETSIZE 32 +#endif + +#ifdef SAL_USING_POSIX +#ifdef FD_SETSIZE +#undef FD_SETSIZE +#endif +#define FD_SETSIZE DFS_FD_MAX +#endif /* SAL_USING_POSIX */ + +#define NBBY 8 /* number of bits in a byte */ + +typedef long fd_mask; + +#define NFDBITS (sizeof (fd_mask) * NBBY) /* bits per mask */ +#ifndef howmany +#define howmany(x,y) (((x)+((y)-1))/(y)) +#endif + +#ifndef _SYS_TYPES_FD_SET /* MIPS */ +typedef struct _types_fd_set { + fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)]; +} _types_fd_set; +#define fd_set _types_fd_set + +#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1L << ((n) % NFDBITS))) +#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1L << ((n) % NFDBITS))) +#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1L << ((n) % NFDBITS))) +#define FD_ZERO(p) memset((void*)(p), 0, sizeof(*(p))) +#endif /* _SYS_TYPES_FD_SET */ + +int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); + +#endif /* __SYS_SELECT_H__ */ diff --git a/components/libc/compilers/common/nogcc/sys/stat.h b/components/libc/compilers/common/nogcc/sys/stat.h new file mode 100644 index 0000000000..107c15decf --- /dev/null +++ b/components/libc/compilers/common/nogcc/sys/stat.h @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2021-09-02 Meco Man First version + */ + +#ifndef __SYS_STAT_H__ +#define __SYS_STAT_H__ + +#include +#include + +#define S_IFMT 00170000 +#define S_IFSOCK 0140000 +#define S_IFLNK 0120000 +#define S_IFREG 0100000 +#define S_IFBLK 0060000 +#define S_IFDIR 0040000 +#define S_IFCHR 0020000 +#define S_IFIFO 0010000 +#define S_ISUID 0004000 +#define S_ISGID 0002000 +#define S_ISVTX 0001000 + +#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) +#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) +#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) +#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) +#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) +#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) + +#define S_IRWXU 00700 +#define S_IRUSR 00400 +#define S_IWUSR 00200 +#define S_IXUSR 00100 + +#define S_IRWXG 00070 +#define S_IRGRP 00040 +#define S_IWGRP 00020 +#define S_IXGRP 00010 + +#define S_IRWXO 00007 +#define S_IROTH 00004 +#define S_IWOTH 00002 +#define S_IXOTH 00001 + +struct stat +{ + struct rt_device *st_dev; + uint16_t st_ino; + uint16_t st_mode; + uint16_t st_nlink; + uint16_t st_uid; + uint16_t st_gid; + struct rt_device *st_rdev; + uint32_t st_size; + time_t st_atime; + long st_spare1; + time_t st_mtime; + long st_spare2; + time_t st_ctime; + long st_spare3; + uint32_t st_blksize; + uint32_t st_blocks; + long st_spare4[2]; +}; + +int chmod(const char *, mode_t); +int fchmod(int, mode_t); +int fstat(int, struct stat *); +int lstat(const char *, struct stat *); +int mkdir(const char *, mode_t); +int mkfifo(const char *, mode_t); +int mknod(const char *, mode_t, dev_t); +int stat(const char *, struct stat *); +mode_t umask(mode_t); + +#endif diff --git a/components/libc/compilers/common/nogcc/sys/types.h b/components/libc/compilers/common/nogcc/sys/types.h new file mode 100644 index 0000000000..2c4c12055f --- /dev/null +++ b/components/libc/compilers/common/nogcc/sys/types.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2020-09-05 Meco Man fix bugs + * 2020-12-16 Meco Man add useconds_t + */ +#ifndef __SYS_TYPES_H__ +#define __SYS_TYPES_H__ + +#include +#include +#include + +typedef int32_t clockid_t; +typedef int32_t key_t; /* Used for interprocess communication. */ +typedef int pid_t; /* Used for process IDs and process group IDs. */ +typedef unsigned short uid_t; +typedef unsigned short gid_t; +typedef signed long off_t; +typedef int mode_t; +#ifndef ARCH_CPU_64BIT +typedef signed int ssize_t; /* Used for a count of bytes or an error indication. */ +#else +typedef long signed int ssize_t; /* Used for a count of bytes or an error indication. */ +#endif +typedef unsigned long useconds_t; /* microseconds (unsigned) */ + +typedef unsigned long dev_t; + +typedef unsigned int u_int; +typedef unsigned char u_char; +typedef unsigned long u_long; + +#endif diff --git a/components/libc/compilers/common/nogcc/sys/unistd.h b/components/libc/compilers/common/nogcc/sys/unistd.h new file mode 100644 index 0000000000..6195c4c2aa --- /dev/null +++ b/components/libc/compilers/common/nogcc/sys/unistd.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2020-12-16 Meco Man add usleep + * 2021-09-11 Meco Man move functions from dfs_posix.h to unistd.h + */ +#ifndef __SYS_UNISTD_H__ +#define __SYS_UNISTD_H__ + +#include +#include "types.h" /* */ + +#define STDIN_FILENO 0 /* standard input file descriptor */ +#define STDOUT_FILENO 1 /* standard output file descriptor */ +#define STDERR_FILENO 2 /* standard error file descriptor */ + +ssize_t read(int fd, void *buf, size_t len); +ssize_t write(int fd, const void *buf, size_t len); +off_t lseek(int fd, off_t offset, int whence); +int fsync(int fildes); +int unlink(const char *pathname); +int close(int d); +int ftruncate(int fd, off_t length); +int rmdir(const char *path); +int chdir(const char *path); +char *getcwd(char *buf, size_t size); +int access(const char *path, int amode); +int pipe(int fildes[2]); +int isatty(int fd); +char *ttyname(int desc); +unsigned int sleep(unsigned int seconds); +int usleep(useconds_t usec); +pid_t gettid(void); +pid_t getpid(void); +pid_t getppid(void); +uid_t getuid(void); +uid_t geteuid(void); +gid_t getgid(void); +gid_t getegid(void); + +#endif /* _SYS_UNISTD_H */ diff --git a/components/libc/compilers/common/nogcc/unistd.h b/components/libc/compilers/common/nogcc/unistd.h new file mode 100644 index 0000000000..cd77a12e3b --- /dev/null +++ b/components/libc/compilers/common/nogcc/unistd.h @@ -0,0 +1,10 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + */ +#include "sys/unistd.h" + diff --git a/components/libc/compilers/common/none-gcc/SConscript b/components/libc/compilers/common/none-gcc/SConscript deleted file mode 100644 index c766c8f82d..0000000000 --- a/components/libc/compilers/common/none-gcc/SConscript +++ /dev/null @@ -1,15 +0,0 @@ -from building import * - -Import('rtconfig') - -src = [] -cwd = GetCurrentDir() -CPPPATH = [cwd] -group = [] - -if GetDepend('RT_USING_LIBC'): - src += Glob('*.c') - -if rtconfig.PLATFORM != 'gcc' or rtconfig.ARCH == 'sim': - group = DefineGroup('libc', src, depend = [], CPPPATH = CPPPATH) -Return('group') diff --git a/components/libc/compilers/common/none-gcc/readme.md b/components/libc/compilers/common/none-gcc/readme.md deleted file mode 100644 index b10940d003..0000000000 --- a/components/libc/compilers/common/none-gcc/readme.md +++ /dev/null @@ -1,3 +0,0 @@ -## Attentions - -This folder is "common" for toolchains excluding gcc. \ No newline at end of file diff --git a/components/libc/compilers/common/none-gcc/sys/errno.h b/components/libc/compilers/common/none-gcc/sys/errno.h deleted file mode 100644 index ff1abca387..0000000000 --- a/components/libc/compilers/common/none-gcc/sys/errno.h +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Copyright (c) 2006-2021, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2021-05-22 Meco Man The first version. - */ -#ifndef __SYS_ERRNO_H__ -#define __SYS_ERRNO_H__ - -#if defined(__ARMCC_VERSION) -/* -defined in armcc/errno.h - -#define EDOM 1 -#define ERANGE 2 -#define EILSEQ 4 -#define ESIGNUM 3 -#define EINVAL 5 -#define ENOMEM 6 -*/ - -#define ERROR_BASE_NO 7 - -#elif defined(__IAR_SYSTEMS_ICC__) -/* defined in iar/errno.h -#define EDOM 33 -#define ERANGE 34 -#define EFPOS 35 -#define EILSEQ 36 -*/ -#define ERROR_BASE_NO 36 - -#else -#define ERROR_BASE_NO 0 -#endif - -#if defined(__ARMCC_VERSION) || defined(__IAR_SYSTEMS_ICC__) -#include -#define EPERM (ERROR_BASE_NO + 1) -#define ENOENT (ERROR_BASE_NO + 2) -#define ESRCH (ERROR_BASE_NO + 3) -#define EINTR (ERROR_BASE_NO + 4) -#define EIO (ERROR_BASE_NO + 5) -#define ENXIO (ERROR_BASE_NO + 6) -#define E2BIG (ERROR_BASE_NO + 7) -#define ENOEXEC (ERROR_BASE_NO + 8) -#define EBADF (ERROR_BASE_NO + 9) -#define ECHILD (ERROR_BASE_NO + 10) -#define EAGAIN (ERROR_BASE_NO + 11) - -#ifndef ENOMEM -#define ENOMEM (ERROR_BASE_NO + 12) -#endif - -#define EACCES (ERROR_BASE_NO + 13) -#define EFAULT (ERROR_BASE_NO + 14) -#define ENOTBLK (ERROR_BASE_NO + 15) -#define EBUSY (ERROR_BASE_NO + 16) -#define EEXIST (ERROR_BASE_NO + 17) -#define EXDEV (ERROR_BASE_NO + 18) -#define ENODEV (ERROR_BASE_NO + 19) -#define ENOTDIR (ERROR_BASE_NO + 20) -#define EISDIR (ERROR_BASE_NO + 21) - -#ifndef EINVAL -#define EINVAL (ERROR_BASE_NO + 22) -#endif - -#define ENFILE (ERROR_BASE_NO + 23) -#define EMFILE (ERROR_BASE_NO + 24) -#define ENOTTY (ERROR_BASE_NO + 25) -#define ETXTBSY (ERROR_BASE_NO + 26) -#define EFBIG (ERROR_BASE_NO + 27) -#define ENOSPC (ERROR_BASE_NO + 28) -#define ESPIPE (ERROR_BASE_NO + 29) -#define EROFS (ERROR_BASE_NO + 30) -#define EMLINK (ERROR_BASE_NO + 31) -#define EPIPE (ERROR_BASE_NO + 32) - -#ifndef EDOM -#define EDOM (ERROR_BASE_NO + 33) -#endif - -#ifndef ERANGE -#define ERANGE (ERROR_BASE_NO + 34) -#endif - -#define EDEADLK (ERROR_BASE_NO + 35) -#define ENAMETOOLONG (ERROR_BASE_NO + 36) -#define ENOLCK (ERROR_BASE_NO + 37) -#define ENOSYS (ERROR_BASE_NO + 38) -#define ENOTEMPTY (ERROR_BASE_NO + 39) -#define ELOOP (ERROR_BASE_NO + 40) -#define EWOULDBLOCK EAGAIN -#define ENOMSG (ERROR_BASE_NO + 42) -#define EIDRM (ERROR_BASE_NO + 43) -#define ECHRNG (ERROR_BASE_NO + 44) -#define EL2NSYNC (ERROR_BASE_NO + 45) -#define EL3HLT (ERROR_BASE_NO + 46) -#define EL3RST (ERROR_BASE_NO + 47) -#define ELNRNG (ERROR_BASE_NO + 48) -#define EUNATCH (ERROR_BASE_NO + 49) -#define ENOCSI (ERROR_BASE_NO + 50) -#define EL2HLT (ERROR_BASE_NO + 51) -#define EBADE (ERROR_BASE_NO + 52) -#define EBADR (ERROR_BASE_NO + 53) -#define EXFULL (ERROR_BASE_NO + 54) -#define ENOANO (ERROR_BASE_NO + 55) -#define EBADRQC (ERROR_BASE_NO + 56) -#define EBADSLT (ERROR_BASE_NO + 57) -#define EDEADLOCK EDEADLK -#define EBFONT (ERROR_BASE_NO + 59) -#define ENOSTR (ERROR_BASE_NO + 60) -#define ENODATA (ERROR_BASE_NO + 61) -#define ETIME (ERROR_BASE_NO + 62) -#define ENOSR (ERROR_BASE_NO + 63) -#define ENONET (ERROR_BASE_NO + 64) -#define ENOPKG (ERROR_BASE_NO + 65) -#define EREMOTE (ERROR_BASE_NO + 66) -#define ENOLINK (ERROR_BASE_NO + 67) -#define EADV (ERROR_BASE_NO + 68) -#define ESRMNT (ERROR_BASE_NO + 69) -#define ECOMM (ERROR_BASE_NO + 70) -#define EPROTO (ERROR_BASE_NO + 71) -#define EMULTIHOP (ERROR_BASE_NO + 72) -#define EDOTDOT (ERROR_BASE_NO + 73) -#define EBADMSG (ERROR_BASE_NO + 74) -#define EOVERFLOW (ERROR_BASE_NO + 75) -#define ENOTUNIQ (ERROR_BASE_NO + 76) -#define EBADFD (ERROR_BASE_NO + 77) -#define EREMCHG (ERROR_BASE_NO + 78) -#define ELIBACC (ERROR_BASE_NO + 79) -#define ELIBBAD (ERROR_BASE_NO + 80) -#define ELIBSCN (ERROR_BASE_NO + 81) -#define ELIBMAX (ERROR_BASE_NO + 82) -#define ELIBEXEC (ERROR_BASE_NO + 83) - -#ifndef EILSEQ -#define EILSEQ (ERROR_BASE_NO + 84) -#endif - -#define ERESTART (ERROR_BASE_NO + 85) -#define ESTRPIPE (ERROR_BASE_NO + 86) -#define EUSERS (ERROR_BASE_NO + 87) -#define ENOTSOCK (ERROR_BASE_NO + 88) -#define EDESTADDRREQ (ERROR_BASE_NO + 89) -#define EMSGSIZE (ERROR_BASE_NO + 90) -#define EPROTOTYPE (ERROR_BASE_NO + 91) -#define ENOPROTOOPT (ERROR_BASE_NO + 92) -#define EPROTONOSUPPORT (ERROR_BASE_NO + 93) -#define ESOCKTNOSUPPORT (ERROR_BASE_NO + 94) -#define EOPNOTSUPP (ERROR_BASE_NO + 95) -#define ENOTSUP EOPNOTSUPP -#define EPFNOSUPPORT (ERROR_BASE_NO + 96) -#define EAFNOSUPPORT (ERROR_BASE_NO + 97) -#define EADDRINUSE (ERROR_BASE_NO + 98) -#define EADDRNOTAVAIL (ERROR_BASE_NO + 99) -#define ENETDOWN (ERROR_BASE_NO + 100) -#define ENETUNREACH (ERROR_BASE_NO + 101) -#define ENETRESET (ERROR_BASE_NO + 102) -#define ECONNABORTED (ERROR_BASE_NO + 103) -#define ECONNRESET (ERROR_BASE_NO + 104) -#define ENOBUFS (ERROR_BASE_NO + 105) -#define EISCONN (ERROR_BASE_NO + 106) -#define ENOTCONN (ERROR_BASE_NO + 107) -#define ESHUTDOWN (ERROR_BASE_NO + 108) -#define ETOOMANYREFS (ERROR_BASE_NO + 109) -#define ETIMEDOUT (ERROR_BASE_NO + 110) -#define ECONNREFUSED (ERROR_BASE_NO + 111) -#define EHOSTDOWN (ERROR_BASE_NO + 112) -#define EHOSTUNREACH (ERROR_BASE_NO + 113) -#define EALREADY (ERROR_BASE_NO + 114) -#define EINPROGRESS (ERROR_BASE_NO + 115) -#define ESTALE (ERROR_BASE_NO + 116) -#define EUCLEAN (ERROR_BASE_NO + 117) -#define ENOTNAM (ERROR_BASE_NO + 118) -#define ENAVAIL (ERROR_BASE_NO + 119) -#define EISNAM (ERROR_BASE_NO + 120) -#define EREMOTEIO (ERROR_BASE_NO + 121) -#define EDQUOT (ERROR_BASE_NO + 122) -#define ENOMEDIUM (ERROR_BASE_NO + 123) -#define EMEDIUMTYPE (ERROR_BASE_NO + 124) -#define ECANCELED (ERROR_BASE_NO + 125) -#define ENOKEY (ERROR_BASE_NO + 126) -#define EKEYEXPIRED (ERROR_BASE_NO + 127) -#define EKEYREVOKED (ERROR_BASE_NO + 128) -#define EKEYREJECTED (ERROR_BASE_NO + 129) -#define EOWNERDEAD (ERROR_BASE_NO + 130) -#define ENOTRECOVERABLE (ERROR_BASE_NO + 131) -#define ERFKILL (ERROR_BASE_NO + 132) -#define EHWPOISON (ERROR_BASE_NO + 133) -#endif - -#endif diff --git a/components/libc/compilers/common/none-gcc/sys/select.h b/components/libc/compilers/common/none-gcc/sys/select.h deleted file mode 100644 index 575ad3a1b5..0000000000 --- a/components/libc/compilers/common/none-gcc/sys/select.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2006-2021, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2021-07-21 Meco Man The first version - */ - -#ifndef __SYS_SELECT_H__ -#define __SYS_SELECT_H__ - -#include -#include -#include - -#ifndef FD_SETSIZE -#define FD_SETSIZE 32 -#endif - -#ifdef SAL_USING_POSIX -#ifdef FD_SETSIZE -#undef FD_SETSIZE -#endif -#define FD_SETSIZE DFS_FD_MAX -#endif /* SAL_USING_POSIX */ - -#define NBBY 8 /* number of bits in a byte */ - -typedef long fd_mask; - -#define NFDBITS (sizeof (fd_mask) * NBBY) /* bits per mask */ -#ifndef howmany -#define howmany(x,y) (((x)+((y)-1))/(y)) -#endif - -#ifndef _SYS_TYPES_FD_SET /* MIPS */ -typedef struct _types_fd_set { - fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)]; -} _types_fd_set; -#define fd_set _types_fd_set - -#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1L << ((n) % NFDBITS))) -#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1L << ((n) % NFDBITS))) -#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1L << ((n) % NFDBITS))) -#define FD_ZERO(p) memset((void*)(p), 0, sizeof(*(p))) -#endif /* _SYS_TYPES_FD_SET */ - -int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); - -#endif /* __SYS_SELECT_H__ */ diff --git a/components/libc/compilers/common/none-gcc/sys/stat.h b/components/libc/compilers/common/none-gcc/sys/stat.h deleted file mode 100644 index 107c15decf..0000000000 --- a/components/libc/compilers/common/none-gcc/sys/stat.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2006-2021, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2021-09-02 Meco Man First version - */ - -#ifndef __SYS_STAT_H__ -#define __SYS_STAT_H__ - -#include -#include - -#define S_IFMT 00170000 -#define S_IFSOCK 0140000 -#define S_IFLNK 0120000 -#define S_IFREG 0100000 -#define S_IFBLK 0060000 -#define S_IFDIR 0040000 -#define S_IFCHR 0020000 -#define S_IFIFO 0010000 -#define S_ISUID 0004000 -#define S_ISGID 0002000 -#define S_ISVTX 0001000 - -#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) -#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) -#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) -#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) -#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) -#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) -#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) - -#define S_IRWXU 00700 -#define S_IRUSR 00400 -#define S_IWUSR 00200 -#define S_IXUSR 00100 - -#define S_IRWXG 00070 -#define S_IRGRP 00040 -#define S_IWGRP 00020 -#define S_IXGRP 00010 - -#define S_IRWXO 00007 -#define S_IROTH 00004 -#define S_IWOTH 00002 -#define S_IXOTH 00001 - -struct stat -{ - struct rt_device *st_dev; - uint16_t st_ino; - uint16_t st_mode; - uint16_t st_nlink; - uint16_t st_uid; - uint16_t st_gid; - struct rt_device *st_rdev; - uint32_t st_size; - time_t st_atime; - long st_spare1; - time_t st_mtime; - long st_spare2; - time_t st_ctime; - long st_spare3; - uint32_t st_blksize; - uint32_t st_blocks; - long st_spare4[2]; -}; - -int chmod(const char *, mode_t); -int fchmod(int, mode_t); -int fstat(int, struct stat *); -int lstat(const char *, struct stat *); -int mkdir(const char *, mode_t); -int mkfifo(const char *, mode_t); -int mknod(const char *, mode_t, dev_t); -int stat(const char *, struct stat *); -mode_t umask(mode_t); - -#endif diff --git a/components/libc/compilers/common/none-gcc/sys/types.h b/components/libc/compilers/common/none-gcc/sys/types.h deleted file mode 100644 index 2c4c12055f..0000000000 --- a/components/libc/compilers/common/none-gcc/sys/types.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2006-2021, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2020-09-05 Meco Man fix bugs - * 2020-12-16 Meco Man add useconds_t - */ -#ifndef __SYS_TYPES_H__ -#define __SYS_TYPES_H__ - -#include -#include -#include - -typedef int32_t clockid_t; -typedef int32_t key_t; /* Used for interprocess communication. */ -typedef int pid_t; /* Used for process IDs and process group IDs. */ -typedef unsigned short uid_t; -typedef unsigned short gid_t; -typedef signed long off_t; -typedef int mode_t; -#ifndef ARCH_CPU_64BIT -typedef signed int ssize_t; /* Used for a count of bytes or an error indication. */ -#else -typedef long signed int ssize_t; /* Used for a count of bytes or an error indication. */ -#endif -typedef unsigned long useconds_t; /* microseconds (unsigned) */ - -typedef unsigned long dev_t; - -typedef unsigned int u_int; -typedef unsigned char u_char; -typedef unsigned long u_long; - -#endif diff --git a/components/libc/compilers/common/none-gcc/sys/unistd.h b/components/libc/compilers/common/none-gcc/sys/unistd.h deleted file mode 100644 index 6195c4c2aa..0000000000 --- a/components/libc/compilers/common/none-gcc/sys/unistd.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2006-2021, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2020-12-16 Meco Man add usleep - * 2021-09-11 Meco Man move functions from dfs_posix.h to unistd.h - */ -#ifndef __SYS_UNISTD_H__ -#define __SYS_UNISTD_H__ - -#include -#include "types.h" /* */ - -#define STDIN_FILENO 0 /* standard input file descriptor */ -#define STDOUT_FILENO 1 /* standard output file descriptor */ -#define STDERR_FILENO 2 /* standard error file descriptor */ - -ssize_t read(int fd, void *buf, size_t len); -ssize_t write(int fd, const void *buf, size_t len); -off_t lseek(int fd, off_t offset, int whence); -int fsync(int fildes); -int unlink(const char *pathname); -int close(int d); -int ftruncate(int fd, off_t length); -int rmdir(const char *path); -int chdir(const char *path); -char *getcwd(char *buf, size_t size); -int access(const char *path, int amode); -int pipe(int fildes[2]); -int isatty(int fd); -char *ttyname(int desc); -unsigned int sleep(unsigned int seconds); -int usleep(useconds_t usec); -pid_t gettid(void); -pid_t getpid(void); -pid_t getppid(void); -uid_t getuid(void); -uid_t geteuid(void); -gid_t getgid(void); -gid_t getegid(void); - -#endif /* _SYS_UNISTD_H */ diff --git a/components/libc/compilers/common/none-gcc/unistd.h b/components/libc/compilers/common/none-gcc/unistd.h deleted file mode 100644 index cd77a12e3b..0000000000 --- a/components/libc/compilers/common/none-gcc/unistd.h +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright (c) 2006-2021, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - */ -#include "sys/unistd.h" - diff --git a/components/libc/compilers/common/partial/SConscript b/components/libc/compilers/common/partial/SConscript new file mode 100644 index 0000000000..4c815c49b8 --- /dev/null +++ b/components/libc/compilers/common/partial/SConscript @@ -0,0 +1,15 @@ +# RT-Thread building script for bridge + +import os +from building import * + +cwd = GetCurrentDir() +objs = [] +list = os.listdir(cwd) + +for d in list: + path = os.path.join(cwd, d) + if os.path.isfile(os.path.join(path, 'SConscript')): + objs = objs + SConscript(os.path.join(d, 'SConscript')) + +Return('objs') diff --git a/components/libc/compilers/common/partial/ls1/SConscript b/components/libc/compilers/common/partial/ls1/SConscript new file mode 100644 index 0000000000..4820098b98 --- /dev/null +++ b/components/libc/compilers/common/partial/ls1/SConscript @@ -0,0 +1,18 @@ +from shutil import copy +from building import * + +Import('rtconfig') + +src = [] +cwd = GetCurrentDir() +CPPPATH = [cwd] +group = [] + +# There is no 'sys/select.h' in these bsp's gcc toolchain; thus, we need to copy this file from 'nogcc/sys/select.h' +if GetDepend('SOC_LS1B') or GetDepend('SOC_LS1C300'): + copy("../../nogcc/sys/select.h", "sys/select.h") + if GetDepend('RT_USING_LIBC'): + src += Glob('*.c') + group = DefineGroup('libc', src, depend = [], CPPPATH = CPPPATH) + +Return('group') -- cgit v1.3.1 From a3dfdadb7814bd5bbdd2c0a4c63b67bd363da3d1 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Tue, 14 Sep 2021 23:02:17 -0400 Subject: 增加parical/ls1文件夹readme MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/libc/compilers/common/partial/ls1/readme.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 components/libc/compilers/common/partial/ls1/readme.md (limited to 'components') diff --git a/components/libc/compilers/common/partial/ls1/readme.md b/components/libc/compilers/common/partial/ls1/readme.md new file mode 100644 index 0000000000..2139f4d85a --- /dev/null +++ b/components/libc/compilers/common/partial/ls1/readme.md @@ -0,0 +1,4 @@ +This folder will be included when compiling the BSPs as follow: + +- ls1bdev +- ls1cdev \ No newline at end of file -- cgit v1.3.1 From 5c058b624f01c0026b8683c3561124838a0a46cc Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Tue, 14 Sep 2021 23:41:13 -0400 Subject: [libc] 增加sys/select.h到partical/ls1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../libc/compilers/common/partial/ls1/SConscript | 17 ++++--- .../libc/compilers/common/partial/ls1/readme.md | 6 ++- .../libc/compilers/common/partial/ls1/sys/select.h | 52 ++++++++++++++++++++++ 3 files changed, 68 insertions(+), 7 deletions(-) create mode 100644 components/libc/compilers/common/partial/ls1/sys/select.h (limited to 'components') diff --git a/components/libc/compilers/common/partial/ls1/SConscript b/components/libc/compilers/common/partial/ls1/SConscript index 4820098b98..b988f7cf5f 100644 --- a/components/libc/compilers/common/partial/ls1/SConscript +++ b/components/libc/compilers/common/partial/ls1/SConscript @@ -8,11 +8,16 @@ cwd = GetCurrentDir() CPPPATH = [cwd] group = [] -# There is no 'sys/select.h' in these bsp's gcc toolchain; thus, we need to copy this file from 'nogcc/sys/select.h' -if GetDepend('SOC_LS1B') or GetDepend('SOC_LS1C300'): - copy("../../nogcc/sys/select.h", "sys/select.h") - if GetDepend('RT_USING_LIBC'): - src += Glob('*.c') - group = DefineGroup('libc', src, depend = [], CPPPATH = CPPPATH) +if rtconfig.PLATFORM == 'gcc': + if GetDepend('SOC_LS1B') or GetDepend('SOC_LS1C300'): + try: + # There is no 'sys/select.h' in these bsp's gcc toolchain; thus, we need to copy this file from 'nogcc/sys/select.h' + copy("../../nogcc/sys/select.h", "./sys/select.h") + except: + pass + if GetDepend('RT_USING_LIBC'): + src += Glob('*.c') + + group = DefineGroup('libc', src, depend = [], CPPPATH = CPPPATH) Return('group') diff --git a/components/libc/compilers/common/partial/ls1/readme.md b/components/libc/compilers/common/partial/ls1/readme.md index 2139f4d85a..575d713442 100644 --- a/components/libc/compilers/common/partial/ls1/readme.md +++ b/components/libc/compilers/common/partial/ls1/readme.md @@ -1,4 +1,8 @@ This folder will be included when compiling the BSPs as follow: - ls1bdev -- ls1cdev \ No newline at end of file +- ls1cdev + +These files will be generated by scons automatically , and **DO NOT** change them: + +- sys/select.h \ No newline at end of file diff --git a/components/libc/compilers/common/partial/ls1/sys/select.h b/components/libc/compilers/common/partial/ls1/sys/select.h new file mode 100644 index 0000000000..575ad3a1b5 --- /dev/null +++ b/components/libc/compilers/common/partial/ls1/sys/select.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2021-07-21 Meco Man The first version + */ + +#ifndef __SYS_SELECT_H__ +#define __SYS_SELECT_H__ + +#include +#include +#include + +#ifndef FD_SETSIZE +#define FD_SETSIZE 32 +#endif + +#ifdef SAL_USING_POSIX +#ifdef FD_SETSIZE +#undef FD_SETSIZE +#endif +#define FD_SETSIZE DFS_FD_MAX +#endif /* SAL_USING_POSIX */ + +#define NBBY 8 /* number of bits in a byte */ + +typedef long fd_mask; + +#define NFDBITS (sizeof (fd_mask) * NBBY) /* bits per mask */ +#ifndef howmany +#define howmany(x,y) (((x)+((y)-1))/(y)) +#endif + +#ifndef _SYS_TYPES_FD_SET /* MIPS */ +typedef struct _types_fd_set { + fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)]; +} _types_fd_set; +#define fd_set _types_fd_set + +#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1L << ((n) % NFDBITS))) +#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1L << ((n) % NFDBITS))) +#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1L << ((n) % NFDBITS))) +#define FD_ZERO(p) memset((void*)(p), 0, sizeof(*(p))) +#endif /* _SYS_TYPES_FD_SET */ + +int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); + +#endif /* __SYS_SELECT_H__ */ -- cgit v1.3.1 From 9f55c88ddde6d55524217a2ae609df83cd6c09d2 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Wed, 15 Sep 2021 11:39:01 -0400 Subject: 刷新龙芯工程 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bsp/ls1bdev/.config | 593 +++++++++++++++++++++ bsp/ls1bdev/Kconfig | 4 + bsp/ls1bdev/rtconfig.h | 43 +- bsp/ls1cdev/.config | 184 +++++-- bsp/ls1cdev/Kconfig | 4 + bsp/ls1cdev/rtconfig.h | 34 +- bsp/ls2kdev/.config | 196 +++++-- bsp/ls2kdev/Kconfig | 4 + bsp/ls2kdev/rtconfig.h | 38 +- .../libc/compilers/common/partial/ls/SConscript | 23 + .../libc/compilers/common/partial/ls/readme.md | 9 + .../libc/compilers/common/partial/ls/sys/select.h | 52 ++ .../libc/compilers/common/partial/ls1/SConscript | 23 - .../libc/compilers/common/partial/ls1/readme.md | 8 - .../libc/compilers/common/partial/ls1/sys/select.h | 52 -- 15 files changed, 1054 insertions(+), 213 deletions(-) create mode 100644 bsp/ls1bdev/.config create mode 100644 components/libc/compilers/common/partial/ls/SConscript create mode 100644 components/libc/compilers/common/partial/ls/readme.md create mode 100644 components/libc/compilers/common/partial/ls/sys/select.h delete mode 100644 components/libc/compilers/common/partial/ls1/SConscript delete mode 100644 components/libc/compilers/common/partial/ls1/readme.md delete mode 100644 components/libc/compilers/common/partial/ls1/sys/select.h (limited to 'components') diff --git a/bsp/ls1bdev/.config b/bsp/ls1bdev/.config new file mode 100644 index 0000000000..8cc34aa66c --- /dev/null +++ b/bsp/ls1bdev/.config @@ -0,0 +1,593 @@ +# +# Automatically generated file; DO NOT EDIT. +# RT-Thread Configuration +# + +# +# RT-Thread Kernel +# +CONFIG_RT_NAME_MAX=8 +# CONFIG_RT_USING_ARCH_DATA_TYPE is not set +# CONFIG_RT_USING_SMP is not set +CONFIG_RT_ALIGN_SIZE=4 +# CONFIG_RT_THREAD_PRIORITY_8 is not set +CONFIG_RT_THREAD_PRIORITY_32=y +# CONFIG_RT_THREAD_PRIORITY_256 is not set +CONFIG_RT_THREAD_PRIORITY_MAX=32 +CONFIG_RT_TICK_PER_SECOND=1000 +CONFIG_RT_USING_OVERFLOW_CHECK=y +CONFIG_RT_USING_HOOK=y +CONFIG_RT_USING_IDLE_HOOK=y +CONFIG_RT_IDLE_HOOK_LIST_SIZE=4 +CONFIG_IDLE_THREAD_STACK_SIZE=256 +CONFIG_RT_USING_TIMER_SOFT=y +CONFIG_RT_TIMER_THREAD_PRIO=4 +CONFIG_RT_TIMER_THREAD_STACK_SIZE=512 + +# +# kservice optimization +# +# CONFIG_RT_KSERVICE_USING_STDLIB is not set +# CONFIG_RT_KSERVICE_USING_TINY_SIZE is not set +# CONFIG_RT_USING_ASM_MEMCPY is not set +CONFIG_RT_DEBUG=y +# CONFIG_RT_DEBUG_COLOR is not set +# CONFIG_RT_DEBUG_INIT_CONFIG is not set +# CONFIG_RT_DEBUG_THREAD_CONFIG is not set +# CONFIG_RT_DEBUG_SCHEDULER_CONFIG is not set +# CONFIG_RT_DEBUG_IPC_CONFIG is not set +# CONFIG_RT_DEBUG_TIMER_CONFIG is not set +# CONFIG_RT_DEBUG_IRQ_CONFIG is not set +# CONFIG_RT_DEBUG_MEM_CONFIG is not set +# CONFIG_RT_DEBUG_SLAB_CONFIG is not set +# CONFIG_RT_DEBUG_MEMHEAP_CONFIG is not set +# CONFIG_RT_DEBUG_MODULE_CONFIG is not set + +# +# Inter-Thread communication +# +CONFIG_RT_USING_SEMAPHORE=y +CONFIG_RT_USING_MUTEX=y +CONFIG_RT_USING_EVENT=y +CONFIG_RT_USING_MAILBOX=y +CONFIG_RT_USING_MESSAGEQUEUE=y +# CONFIG_RT_USING_SIGNALS is not set + +# +# Memory Management +# +CONFIG_RT_USING_MEMPOOL=y +# CONFIG_RT_USING_MEMHEAP is not set +# CONFIG_RT_USING_NOHEAP is not set +CONFIG_RT_USING_SMALL_MEM=y +# CONFIG_RT_USING_SLAB is not set +# CONFIG_RT_USING_USERHEAP is not set +# CONFIG_RT_USING_MEMTRACE is not set +CONFIG_RT_USING_HEAP=y + +# +# Kernel Device Object +# +CONFIG_RT_USING_DEVICE=y +# CONFIG_RT_USING_DEVICE_OPS is not set +# CONFIG_RT_USING_INTERRUPT_INFO is not set +CONFIG_RT_USING_CONSOLE=y +CONFIG_RT_CONSOLEBUF_SIZE=128 +CONFIG_RT_CONSOLE_DEVICE_NAME="uart5" +# CONFIG_RT_PRINTF_LONGLONG is not set +CONFIG_RT_VER_NUM=0x40004 +# CONFIG_RT_USING_CPU_FFS is not set +# CONFIG_ARCH_CPU_STACK_GROWS_UPWARD is not set + +# +# RT-Thread Components +# +CONFIG_RT_USING_COMPONENTS_INIT=y +CONFIG_RT_USING_USER_MAIN=y +CONFIG_RT_MAIN_THREAD_STACK_SIZE=2048 +CONFIG_RT_MAIN_THREAD_PRIORITY=10 + +# +# C++ features +# +# CONFIG_RT_USING_CPLUSPLUS is not set + +# +# Command shell +# +CONFIG_RT_USING_FINSH=y +CONFIG_RT_USING_MSH=y +CONFIG_FINSH_USING_MSH=y +CONFIG_FINSH_THREAD_NAME="tshell" +CONFIG_FINSH_THREAD_PRIORITY=20 +CONFIG_FINSH_THREAD_STACK_SIZE=4096 +CONFIG_FINSH_USING_HISTORY=y +CONFIG_FINSH_HISTORY_LINES=5 +CONFIG_FINSH_USING_SYMTAB=y +CONFIG_FINSH_CMD_SIZE=80 +CONFIG_MSH_USING_BUILT_IN_COMMANDS=y +CONFIG_FINSH_USING_DESCRIPTION=y +# CONFIG_FINSH_ECHO_DISABLE_DEFAULT is not set +# CONFIG_FINSH_USING_AUTH is not set +CONFIG_FINSH_ARG_MAX=10 + +# +# Device virtual file system +# +CONFIG_RT_USING_DFS=y +CONFIG_DFS_USING_WORKDIR=y +CONFIG_DFS_FILESYSTEMS_MAX=4 +CONFIG_DFS_FILESYSTEM_TYPES_MAX=4 +CONFIG_DFS_FD_MAX=16 +# CONFIG_RT_USING_DFS_MNTTABLE is not set +# CONFIG_RT_USING_DFS_ELMFAT is not set +CONFIG_RT_USING_DFS_DEVFS=y +# CONFIG_RT_USING_DFS_ROMFS is not set +# CONFIG_RT_USING_DFS_RAMFS is not set + +# +# Device Drivers +# +CONFIG_RT_USING_DEVICE_IPC=y +CONFIG_RT_PIPE_BUFSZ=512 +# CONFIG_RT_USING_SYSTEM_WORKQUEUE is not set +CONFIG_RT_USING_SERIAL=y +CONFIG_RT_USING_SERIAL_V1=y +# CONFIG_RT_USING_SERIAL_V2 is not set +CONFIG_RT_SERIAL_USING_DMA=y +CONFIG_RT_SERIAL_RB_BUFSZ=64 +# CONFIG_RT_USING_CAN is not set +# CONFIG_RT_USING_HWTIMER is not set +# CONFIG_RT_USING_CPUTIME is not set +# CONFIG_RT_USING_I2C is not set +# CONFIG_RT_USING_PHY is not set +CONFIG_RT_USING_PIN=y +# CONFIG_RT_USING_ADC is not set +# CONFIG_RT_USING_DAC is not set +# CONFIG_RT_USING_PWM is not set +# CONFIG_RT_USING_MTD_NOR is not set +# CONFIG_RT_USING_MTD_NAND is not set +# CONFIG_RT_USING_PM is not set +# CONFIG_RT_USING_RTC is not set +# CONFIG_RT_USING_SDIO is not set +# CONFIG_RT_USING_SPI is not set +# CONFIG_RT_USING_WDT is not set +# CONFIG_RT_USING_AUDIO is not set +# CONFIG_RT_USING_SENSOR is not set +# CONFIG_RT_USING_TOUCH is not set +# CONFIG_RT_USING_HWCRYPTO is not set +# CONFIG_RT_USING_PULSE_ENCODER is not set +# CONFIG_RT_USING_INPUT_CAPTURE is not set +# CONFIG_RT_USING_WIFI is not set + +# +# Using USB +# +# CONFIG_RT_USING_USB_HOST is not set +# CONFIG_RT_USING_USB_DEVICE is not set + +# +# POSIX layer and C standard library +# +CONFIG_RT_USING_LIBC=y +# CONFIG_RT_USING_PTHREADS is not set +CONFIG_RT_USING_POSIX=y +# CONFIG_RT_USING_POSIX_MMAP is not set +# CONFIG_RT_USING_POSIX_TERMIOS is not set +# CONFIG_RT_USING_POSIX_GETLINE is not set +# CONFIG_RT_USING_POSIX_AIO is not set +# CONFIG_RT_USING_MODULE is not set +CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8 + +# +# Network +# + +# +# Socket abstraction layer +# +# CONFIG_RT_USING_SAL is not set + +# +# Network interface device +# +# CONFIG_RT_USING_NETDEV is not set + +# +# light weight TCP/IP stack +# +# CONFIG_RT_USING_LWIP is not set + +# +# AT commands +# +# CONFIG_RT_USING_AT is not set + +# +# VBUS(Virtual Software BUS) +# +# CONFIG_RT_USING_VBUS is not set + +# +# Utilities +# +# CONFIG_RT_USING_RYM is not set +# CONFIG_RT_USING_ULOG is not set +# CONFIG_RT_USING_UTEST is not set +# CONFIG_RT_USING_RT_LINK is not set + +# +# RT-Thread Utestcases +# +# CONFIG_RT_USING_UTESTCASES is not set + +# +# RT-Thread online packages +# + +# +# IoT - internet of things +# +# CONFIG_PKG_USING_LORAWAN_DRIVER is not set +# CONFIG_PKG_USING_PAHOMQTT is not set +# CONFIG_PKG_USING_UMQTT is not set +# CONFIG_PKG_USING_WEBCLIENT is not set +# CONFIG_PKG_USING_WEBNET is not set +# CONFIG_PKG_USING_MONGOOSE is not set +# CONFIG_PKG_USING_MYMQTT is not set +# CONFIG_PKG_USING_KAWAII_MQTT is not set +# CONFIG_PKG_USING_BC28_MQTT is not set +# CONFIG_PKG_USING_WEBTERMINAL is not set +# CONFIG_PKG_USING_CJSON is not set +# CONFIG_PKG_USING_JSMN is not set +# CONFIG_PKG_USING_LIBMODBUS is not set +# CONFIG_PKG_USING_FREEMODBUS is not set +# CONFIG_PKG_USING_LJSON is not set +# CONFIG_PKG_USING_EZXML is not set +# CONFIG_PKG_USING_NANOPB is not set + +# +# Wi-Fi +# + +# +# Marvell WiFi +# +# CONFIG_PKG_USING_WLANMARVELL is not set + +# +# Wiced WiFi +# +# CONFIG_PKG_USING_WLAN_WICED is not set +# CONFIG_PKG_USING_RW007 is not set +# CONFIG_PKG_USING_COAP is not set +# CONFIG_PKG_USING_NOPOLL is not set +# CONFIG_PKG_USING_NETUTILS is not set +# CONFIG_PKG_USING_CMUX is not set +# CONFIG_PKG_USING_PPP_DEVICE is not set +# CONFIG_PKG_USING_AT_DEVICE is not set +# CONFIG_PKG_USING_ATSRV_SOCKET is not set +# CONFIG_PKG_USING_WIZNET is not set +# CONFIG_PKG_USING_ZB_COORDINATOR is not set + +# +# IoT Cloud +# +# CONFIG_PKG_USING_ONENET is not set +# CONFIG_PKG_USING_GAGENT_CLOUD is not set +# CONFIG_PKG_USING_ALI_IOTKIT is not set +# CONFIG_PKG_USING_AZURE is not set +# CONFIG_PKG_USING_TENCENT_IOT_EXPLORER is not set +# CONFIG_PKG_USING_JIOT-C-SDK is not set +# CONFIG_PKG_USING_UCLOUD_IOT_SDK is not set +# CONFIG_PKG_USING_JOYLINK is not set +# CONFIG_PKG_USING_NIMBLE is not set +# CONFIG_PKG_USING_OTA_DOWNLOADER is not set +# CONFIG_PKG_USING_IPMSG is not set +# CONFIG_PKG_USING_LSSDP is not set +# CONFIG_PKG_USING_AIRKISS_OPEN is not set +# CONFIG_PKG_USING_LIBRWS is not set +# CONFIG_PKG_USING_TCPSERVER is not set +# CONFIG_PKG_USING_PROTOBUF_C is not set +# CONFIG_PKG_USING_DLT645 is not set +# CONFIG_PKG_USING_QXWZ is not set +# CONFIG_PKG_USING_SMTP_CLIENT is not set +# CONFIG_PKG_USING_ABUP_FOTA is not set +# CONFIG_PKG_USING_LIBCURL2RTT is not set +# CONFIG_PKG_USING_CAPNP is not set +# CONFIG_PKG_USING_RT_CJSON_TOOLS is not set +# CONFIG_PKG_USING_AGILE_TELNET is not set +# CONFIG_PKG_USING_NMEALIB is not set +# CONFIG_PKG_USING_AGILE_JSMN is not set +# CONFIG_PKG_USING_PDULIB is not set +# CONFIG_PKG_USING_BTSTACK is not set +# CONFIG_PKG_USING_LORAWAN_ED_STACK is not set +# CONFIG_PKG_USING_WAYZ_IOTKIT is not set +# CONFIG_PKG_USING_MAVLINK is not set +# CONFIG_PKG_USING_RAPIDJSON is not set +# CONFIG_PKG_USING_BSAL is not set +# CONFIG_PKG_USING_AGILE_MODBUS is not set +# CONFIG_PKG_USING_AGILE_FTP is not set +# CONFIG_PKG_USING_EMBEDDEDPROTO is not set +# CONFIG_PKG_USING_RT_LINK_HW is not set + +# +# security packages +# +# CONFIG_PKG_USING_MBEDTLS is not set +# CONFIG_PKG_USING_libsodium is not set +# CONFIG_PKG_USING_TINYCRYPT is not set +# CONFIG_PKG_USING_TFM is not set +# CONFIG_PKG_USING_YD_CRYPTO is not set + +# +# language packages +# +# CONFIG_PKG_USING_LUA is not set +# CONFIG_PKG_USING_JERRYSCRIPT is not set +# CONFIG_PKG_USING_MICROPYTHON is not set +# CONFIG_PKG_USING_PIKASCRIPT is not set + +# +# multimedia packages +# +# CONFIG_PKG_USING_OPENMV is not set +# CONFIG_PKG_USING_MUPDF is not set +# CONFIG_PKG_USING_STEMWIN is not set +# CONFIG_PKG_USING_WAVPLAYER is not set +# CONFIG_PKG_USING_TJPGD is not set +# CONFIG_PKG_USING_PDFGEN is not set +# CONFIG_PKG_USING_HELIX is not set +# CONFIG_PKG_USING_AZUREGUIX is not set +# CONFIG_PKG_USING_TOUCHGFX2RTT is not set +# CONFIG_PKG_USING_NUEMWIN is not set +# CONFIG_PKG_USING_MP3PLAYER is not set +# CONFIG_PKG_USING_TINYJPEG is not set + +# +# tools packages +# +# CONFIG_PKG_USING_CMBACKTRACE is not set +# CONFIG_PKG_USING_EASYFLASH is not set +# CONFIG_PKG_USING_EASYLOGGER is not set +# CONFIG_PKG_USING_SYSTEMVIEW is not set +# CONFIG_PKG_USING_SEGGER_RTT is not set +# CONFIG_PKG_USING_RDB is not set +# CONFIG_PKG_USING_QRCODE is not set +# CONFIG_PKG_USING_ULOG_EASYFLASH is not set +# CONFIG_PKG_USING_ULOG_FILE is not set +# CONFIG_PKG_USING_LOGMGR is not set +# CONFIG_PKG_USING_ADBD is not set +# CONFIG_PKG_USING_COREMARK is not set +# CONFIG_PKG_USING_DHRYSTONE is not set +# CONFIG_PKG_USING_MEMORYPERF is not set +# CONFIG_PKG_USING_NR_MICRO_SHELL is not set +# CONFIG_PKG_USING_CHINESE_FONT_LIBRARY is not set +# CONFIG_PKG_USING_LUNAR_CALENDAR is not set +# CONFIG_PKG_USING_BS8116A is not set +# CONFIG_PKG_USING_GPS_RMC is not set +# CONFIG_PKG_USING_URLENCODE is not set +# CONFIG_PKG_USING_UMCN is not set +# CONFIG_PKG_USING_LWRB2RTT is not set +# CONFIG_PKG_USING_CPU_USAGE is not set +# CONFIG_PKG_USING_GBK2UTF8 is not set +# CONFIG_PKG_USING_VCONSOLE is not set +# CONFIG_PKG_USING_KDB is not set +# CONFIG_PKG_USING_WAMR is not set +# CONFIG_PKG_USING_MICRO_XRCE_DDS_CLIENT is not set +# CONFIG_PKG_USING_LWLOG is not set +# CONFIG_PKG_USING_ANV_TRACE is not set +# CONFIG_PKG_USING_ANV_MEMLEAK is not set +# CONFIG_PKG_USING_ANV_TESTSUIT is not set +# CONFIG_PKG_USING_ANV_BENCH is not set +# CONFIG_PKG_USING_DEVMEM is not set +# CONFIG_PKG_USING_REGEX is not set +# CONFIG_PKG_USING_MEM_SANDBOX is not set +# CONFIG_PKG_USING_SOLAR_TERMS is not set +# CONFIG_PKG_USING_GAN_ZHI is not set + +# +# system packages +# + +# +# acceleration: Assembly language or algorithmic acceleration packages +# +# CONFIG_PKG_USING_RT_MEMCPY_CM is not set +# CONFIG_PKG_USING_QFPLIB_M0_FULL is not set +# CONFIG_PKG_USING_QFPLIB_M0_TINY is not set +# CONFIG_PKG_USING_QFPLIB_M3 is not set + +# +# Micrium: Micrium software products porting for RT-Thread +# +# CONFIG_PKG_USING_UCOSIII_WRAPPER is not set +# CONFIG_PKG_USING_UCOSII_WRAPPER is not set +# CONFIG_PKG_USING_UC_CRC is not set +# CONFIG_PKG_USING_UC_CLK is not set +# CONFIG_PKG_USING_UC_COMMON is not set +# CONFIG_PKG_USING_UC_MODBUS is not set +# CONFIG_PKG_USING_GUIENGINE is not set +# CONFIG_PKG_USING_CAIRO is not set +# CONFIG_PKG_USING_PIXMAN is not set +# CONFIG_PKG_USING_PARTITION is not set +# CONFIG_PKG_USING_FAL is not set +# CONFIG_PKG_USING_FLASHDB is not set +# CONFIG_PKG_USING_SQLITE is not set +# CONFIG_PKG_USING_RTI is not set +# CONFIG_PKG_USING_LITTLEVGL2RTT is not set +# CONFIG_PKG_USING_CMSIS is not set +# CONFIG_PKG_USING_DFS_YAFFS is not set +# CONFIG_PKG_USING_LITTLEFS is not set +# CONFIG_PKG_USING_DFS_JFFS2 is not set +# CONFIG_PKG_USING_DFS_UFFS is not set +# CONFIG_PKG_USING_LWEXT4 is not set +# CONFIG_PKG_USING_THREAD_POOL is not set +# CONFIG_PKG_USING_ROBOTS is not set +# CONFIG_PKG_USING_EV is not set +# CONFIG_PKG_USING_SYSWATCH is not set +# CONFIG_PKG_USING_SYS_LOAD_MONITOR is not set +# CONFIG_PKG_USING_PLCCORE is not set +# CONFIG_PKG_USING_RAMDISK is not set +# CONFIG_PKG_USING_MININI is not set +# CONFIG_PKG_USING_QBOOT is not set +# CONFIG_PKG_USING_PPOOL is not set +# CONFIG_PKG_USING_OPENAMP is not set +# CONFIG_PKG_USING_RT_KPRINTF_THREADSAFE is not set +# CONFIG_PKG_USING_LPM is not set +# CONFIG_PKG_USING_TLSF is not set +# CONFIG_PKG_USING_EVENT_RECORDER is not set +# CONFIG_PKG_USING_ARM_2D is not set +# CONFIG_PKG_USING_WCWIDTH is not set +# CONFIG_PKG_USING_MCUBOOT is not set + +# +# peripheral libraries and drivers +# +# CONFIG_PKG_USING_SENSORS_DRIVERS is not set +# CONFIG_PKG_USING_REALTEK_AMEBA is not set +# CONFIG_PKG_USING_SHT2X is not set +# CONFIG_PKG_USING_SHT3X is not set +# CONFIG_PKG_USING_AS7341 is not set +# CONFIG_PKG_USING_STM32_SDIO is not set +# CONFIG_PKG_USING_ICM20608 is not set +# CONFIG_PKG_USING_U8G2 is not set +# CONFIG_PKG_USING_BUTTON is not set +# CONFIG_PKG_USING_PCF8574 is not set +# CONFIG_PKG_USING_SX12XX is not set +# CONFIG_PKG_USING_SIGNAL_LED is not set +# CONFIG_PKG_USING_LEDBLINK is not set +# CONFIG_PKG_USING_LITTLED is not set +# CONFIG_PKG_USING_LKDGUI is not set +# CONFIG_PKG_USING_NRF5X_SDK is not set +# CONFIG_PKG_USING_NRFX is not set +# CONFIG_PKG_USING_WM_LIBRARIES is not set +# CONFIG_PKG_USING_KENDRYTE_SDK is not set +# CONFIG_PKG_USING_INFRARED is not set +# CONFIG_PKG_USING_AGILE_BUTTON is not set +# CONFIG_PKG_USING_AGILE_LED is not set +# CONFIG_PKG_USING_AT24CXX is not set +# CONFIG_PKG_USING_MOTIONDRIVER2RTT is not set +# CONFIG_PKG_USING_AD7746 is not set +# CONFIG_PKG_USING_PCA9685 is not set +# CONFIG_PKG_USING_I2C_TOOLS is not set +# CONFIG_PKG_USING_NRF24L01 is not set +# CONFIG_PKG_USING_TOUCH_DRIVERS is not set +# CONFIG_PKG_USING_MAX17048 is not set +# CONFIG_PKG_USING_RPLIDAR is not set +# CONFIG_PKG_USING_AS608 is not set +# CONFIG_PKG_USING_RC522 is not set +# CONFIG_PKG_USING_WS2812B is not set +# CONFIG_PKG_USING_EMBARC_BSP is not set +# CONFIG_PKG_USING_EXTERN_RTC_DRIVERS is not set +# CONFIG_PKG_USING_MULTI_RTIMER is not set +# CONFIG_PKG_USING_MAX7219 is not set +# CONFIG_PKG_USING_BEEP is not set +# CONFIG_PKG_USING_EASYBLINK is not set +# CONFIG_PKG_USING_PMS_SERIES is not set +# CONFIG_PKG_USING_CAN_YMODEM is not set +# CONFIG_PKG_USING_LORA_RADIO_DRIVER is not set +# CONFIG_PKG_USING_QLED is not set +# CONFIG_PKG_USING_PAJ7620 is not set +# CONFIG_PKG_USING_AGILE_CONSOLE is not set +# CONFIG_PKG_USING_LD3320 is not set +# CONFIG_PKG_USING_WK2124 is not set +# CONFIG_PKG_USING_LY68L6400 is not set +# CONFIG_PKG_USING_DM9051 is not set +# CONFIG_PKG_USING_SSD1306 is not set +# CONFIG_PKG_USING_QKEY is not set +# CONFIG_PKG_USING_RS485 is not set +# CONFIG_PKG_USING_NES is not set +# CONFIG_PKG_USING_VIRTUAL_SENSOR is not set +# CONFIG_PKG_USING_VDEVICE is not set +# CONFIG_PKG_USING_SGM706 is not set +# CONFIG_PKG_USING_STM32WB55_SDK is not set +# CONFIG_PKG_USING_RDA58XX is not set +# CONFIG_PKG_USING_LIBNFC is not set +# CONFIG_PKG_USING_MFOC is not set +# CONFIG_PKG_USING_TMC51XX is not set +# CONFIG_PKG_USING_TCA9534 is not set +# CONFIG_PKG_USING_KOBUKI is not set +# CONFIG_PKG_USING_ROSSERIAL is not set +# CONFIG_PKG_USING_MICRO_ROS is not set +# CONFIG_PKG_USING_MCP23008 is not set +# CONFIG_PKG_USING_BLUETRUM_SDK is not set +# CONFIG_PKG_USING_MISAKA_AT24CXX is not set + +# +# AI packages +# +# CONFIG_PKG_USING_LIBANN is not set +# CONFIG_PKG_USING_NNOM is not set +# CONFIG_PKG_USING_ONNX_BACKEND is not set +# CONFIG_PKG_USING_ONNX_PARSER is not set +# CONFIG_PKG_USING_TENSORFLOWLITEMICRO is not set +# CONFIG_PKG_USING_ELAPACK is not set +# CONFIG_PKG_USING_ULAPACK is not set +# CONFIG_PKG_USING_QUEST is not set +# CONFIG_PKG_USING_NAXOS is not set + +# +# miscellaneous packages +# + +# +# samples: kernel and components samples +# +# CONFIG_PKG_USING_KERNEL_SAMPLES is not set +# CONFIG_PKG_USING_FILESYSTEM_SAMPLES is not set +# CONFIG_PKG_USING_NETWORK_SAMPLES is not set +# CONFIG_PKG_USING_PERIPHERAL_SAMPLES is not set + +# +# entertainment: terminal games and other interesting software packages +# +# CONFIG_PKG_USING_CMATRIX is not set +# CONFIG_PKG_USING_SL is not set +# CONFIG_PKG_USING_CAL is not set +# CONFIG_PKG_USING_ACLOCK is not set +# CONFIG_PKG_USING_THREES is not set +# CONFIG_PKG_USING_2048 is not set +# CONFIG_PKG_USING_SNAKE is not set +# CONFIG_PKG_USING_TETRIS is not set +# CONFIG_PKG_USING_DONUT is not set +# CONFIG_PKG_USING_LIBCSV is not set +# CONFIG_PKG_USING_OPTPARSE is not set +# CONFIG_PKG_USING_FASTLZ is not set +# CONFIG_PKG_USING_MINILZO is not set +# CONFIG_PKG_USING_QUICKLZ is not set +# CONFIG_PKG_USING_LZMA is not set +# CONFIG_PKG_USING_MULTIBUTTON is not set +# CONFIG_PKG_USING_FLEXIBLE_BUTTON is not set +# CONFIG_PKG_USING_CANFESTIVAL is not set +# CONFIG_PKG_USING_ZLIB is not set +# CONFIG_PKG_USING_MINIZIP is not set +# CONFIG_PKG_USING_DSTR is not set +# CONFIG_PKG_USING_TINYFRAME is not set +# CONFIG_PKG_USING_KENDRYTE_DEMO is not set +# CONFIG_PKG_USING_DIGITALCTRL is not set +# CONFIG_PKG_USING_UPACKER is not set +# CONFIG_PKG_USING_UPARAM is not set +# CONFIG_PKG_USING_HELLO is not set +# CONFIG_PKG_USING_VI is not set +# CONFIG_PKG_USING_KI is not set +# CONFIG_PKG_USING_ARMv7M_DWT is not set +# CONFIG_PKG_USING_VT100 is not set +# CONFIG_PKG_USING_UKAL is not set +# CONFIG_PKG_USING_CRCLIB is not set +# CONFIG_PKG_USING_LWGPS is not set +# CONFIG_PKG_USING_STATE_MACHINE is not set +# CONFIG_PKG_USING_MCURSES is not set +# CONFIG_PKG_USING_COWSAY is not set +# CONFIG_PKG_USING_TERMBOX is not set +CONFIG_SOC_LS=y +CONFIG_SOC_LS1B=y +CONFIG_RT_MEM_SIZE=256 +CONFIG_RT_OSC_CLK=25000000 +# CONFIG_RT_USING_UART0 is not set +# CONFIG_RT_USING_UART1 is not set +# CONFIG_RT_USING_UART2 is not set +# CONFIG_RT_USING_UART3 is not set +# CONFIG_RT_USING_UART4 is not set +CONFIG_RT_USING_UART5=y +CONFIG_RT_UART_RX_BUFFER_SIZE=64 diff --git a/bsp/ls1bdev/Kconfig b/bsp/ls1bdev/Kconfig index b02aee337a..c9196af29d 100644 --- a/bsp/ls1bdev/Kconfig +++ b/bsp/ls1bdev/Kconfig @@ -18,6 +18,10 @@ config PKGS_DIR source "$RTT_DIR/Kconfig" source "$PKGS_DIR/Kconfig" +config SOC_LS + bool + default y + config SOC_LS1B bool select RT_USING_COMPONENTS_INIT diff --git a/bsp/ls1bdev/rtconfig.h b/bsp/ls1bdev/rtconfig.h index aede85d795..cb81b4ac56 100644 --- a/bsp/ls1bdev/rtconfig.h +++ b/bsp/ls1bdev/rtconfig.h @@ -15,7 +15,13 @@ #define RT_USING_HOOK #define RT_USING_IDLE_HOOK #define RT_IDLE_HOOK_LIST_SIZE 4 -#define IDLE_THREAD_STACK_SIZE 1024 +#define IDLE_THREAD_STACK_SIZE 256 +#define RT_USING_TIMER_SOFT +#define RT_TIMER_THREAD_PRIO 4 +#define RT_TIMER_THREAD_STACK_SIZE 512 + +/* kservice optimization */ + #define RT_DEBUG /* Inter-Thread communication */ @@ -38,7 +44,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart5" -#define RT_VER_NUM 0x40003 +#define RT_VER_NUM 0x40004 /* RT-Thread Components */ @@ -53,24 +59,25 @@ /* Command shell */ #define RT_USING_FINSH +#define RT_USING_MSH +#define FINSH_USING_MSH #define FINSH_THREAD_NAME "tshell" +#define FINSH_THREAD_PRIORITY 20 +#define FINSH_THREAD_STACK_SIZE 4096 #define FINSH_USING_HISTORY #define FINSH_HISTORY_LINES 5 #define FINSH_USING_SYMTAB -#define FINSH_USING_DESCRIPTION -#define FINSH_THREAD_PRIORITY 20 -#define FINSH_THREAD_STACK_SIZE 4096 #define FINSH_CMD_SIZE 80 -#define FINSH_USING_MSH -#define FINSH_USING_MSH_DEFAULT +#define MSH_USING_BUILT_IN_COMMANDS +#define FINSH_USING_DESCRIPTION #define FINSH_ARG_MAX 10 /* Device virtual file system */ #define RT_USING_DFS #define DFS_USING_WORKDIR -#define DFS_FILESYSTEMS_MAX 2 -#define DFS_FILESYSTEM_TYPES_MAX 2 +#define DFS_FILESYSTEMS_MAX 4 +#define DFS_FILESYSTEM_TYPES_MAX 4 #define DFS_FD_MAX 16 #define RT_USING_DFS_DEVFS @@ -79,6 +86,7 @@ #define RT_USING_DEVICE_IPC #define RT_PIPE_BUFSZ 512 #define RT_USING_SERIAL +#define RT_USING_SERIAL_V1 #define RT_SERIAL_USING_DMA #define RT_SERIAL_RB_BUFSZ 64 #define RT_USING_PIN @@ -90,6 +98,7 @@ #define RT_USING_LIBC #define RT_USING_POSIX +#define RT_LIBC_DEFAULT_TIMEZONE 8 /* Network */ @@ -111,6 +120,9 @@ /* Utilities */ +/* RT-Thread Utestcases */ + + /* RT-Thread online packages */ /* IoT - internet of things */ @@ -141,15 +153,26 @@ /* system packages */ +/* acceleration: Assembly language or algorithmic acceleration packages */ + + +/* Micrium: Micrium software products porting for RT-Thread */ + /* peripheral libraries and drivers */ -/* miscellaneous packages */ +/* AI packages */ + +/* miscellaneous packages */ /* samples: kernel and components samples */ + +/* entertainment: terminal games and other interesting software packages */ + +#define SOC_LS #define SOC_LS1B #define RT_MEM_SIZE 256 #define RT_OSC_CLK 25000000 diff --git a/bsp/ls1cdev/.config b/bsp/ls1cdev/.config index 28414b5870..e553870302 100644 --- a/bsp/ls1cdev/.config +++ b/bsp/ls1cdev/.config @@ -21,6 +21,13 @@ CONFIG_RT_USING_IDLE_HOOK=y CONFIG_RT_IDLE_HOOK_LIST_SIZE=4 CONFIG_IDLE_THREAD_STACK_SIZE=1024 # CONFIG_RT_USING_TIMER_SOFT is not set + +# +# kservice optimization +# +# CONFIG_RT_KSERVICE_USING_STDLIB is not set +# CONFIG_RT_KSERVICE_USING_TINY_SIZE is not set +# CONFIG_RT_USING_ASM_MEMCPY is not set CONFIG_RT_DEBUG=y CONFIG_RT_DEBUG_COLOR=y # CONFIG_RT_DEBUG_INIT_CONFIG is not set @@ -66,7 +73,8 @@ CONFIG_RT_USING_INTERRUPT_INFO=y CONFIG_RT_USING_CONSOLE=y CONFIG_RT_CONSOLEBUF_SIZE=128 CONFIG_RT_CONSOLE_DEVICE_NAME="uart2" -CONFIG_RT_VER_NUM=0x40003 +# CONFIG_RT_PRINTF_LONGLONG is not set +CONFIG_RT_VER_NUM=0x40004 # CONFIG_RT_USING_CPU_FFS is not set # CONFIG_ARCH_CPU_STACK_GROWS_UPWARD is not set @@ -87,19 +95,19 @@ CONFIG_RT_MAIN_THREAD_PRIORITY=10 # Command shell # CONFIG_RT_USING_FINSH=y +CONFIG_RT_USING_MSH=y +CONFIG_FINSH_USING_MSH=y CONFIG_FINSH_THREAD_NAME="tshell" +CONFIG_FINSH_THREAD_PRIORITY=20 +CONFIG_FINSH_THREAD_STACK_SIZE=4096 CONFIG_FINSH_USING_HISTORY=y CONFIG_FINSH_HISTORY_LINES=5 CONFIG_FINSH_USING_SYMTAB=y +CONFIG_FINSH_CMD_SIZE=80 +CONFIG_MSH_USING_BUILT_IN_COMMANDS=y CONFIG_FINSH_USING_DESCRIPTION=y # CONFIG_FINSH_ECHO_DISABLE_DEFAULT is not set -CONFIG_FINSH_THREAD_PRIORITY=20 -CONFIG_FINSH_THREAD_STACK_SIZE=4096 -CONFIG_FINSH_CMD_SIZE=80 # CONFIG_FINSH_USING_AUTH is not set -CONFIG_FINSH_USING_MSH=y -CONFIG_FINSH_USING_MSH_DEFAULT=y -# CONFIG_FINSH_USING_MSH_ONLY is not set CONFIG_FINSH_ARG_MAX=10 # @@ -136,8 +144,6 @@ CONFIG_RT_DFS_ELM_REENTRANT=y CONFIG_RT_USING_DFS_DEVFS=y # CONFIG_RT_USING_DFS_ROMFS is not set # CONFIG_RT_USING_DFS_RAMFS is not set -# CONFIG_RT_USING_DFS_UFFS is not set -# CONFIG_RT_USING_DFS_JFFS2 is not set # CONFIG_RT_USING_DFS_NFS is not set # @@ -147,6 +153,8 @@ CONFIG_RT_USING_DEVICE_IPC=y CONFIG_RT_PIPE_BUFSZ=512 # CONFIG_RT_USING_SYSTEM_WORKQUEUE is not set CONFIG_RT_USING_SERIAL=y +CONFIG_RT_USING_SERIAL_V1=y +# CONFIG_RT_USING_SERIAL_V2 is not set CONFIG_RT_SERIAL_USING_DMA=y CONFIG_RT_SERIAL_RB_BUFSZ=64 CONFIG_RT_USING_CAN=y @@ -200,6 +208,7 @@ CONFIG_RT_USING_POSIX=y # CONFIG_RT_USING_POSIX_GETLINE is not set # CONFIG_RT_USING_POSIX_AIO is not set # CONFIG_RT_USING_MODULE is not set +CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8 # # Network @@ -222,6 +231,7 @@ CONFIG_NETDEV_USING_PING=y CONFIG_RT_USING_LWIP=y CONFIG_RT_USING_LWIP141=y # CONFIG_RT_USING_LWIP202 is not set +# CONFIG_RT_USING_LWIP203 is not set # CONFIG_RT_USING_LWIP212 is not set CONFIG_RT_LWIP_MEM_ALIGNMENT=4 CONFIG_RT_LWIP_IGMP=y @@ -290,6 +300,12 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_RT_USING_RYM is not set # CONFIG_RT_USING_ULOG is not set # CONFIG_RT_USING_UTEST is not set +# CONFIG_RT_USING_RT_LINK is not set + +# +# RT-Thread Utestcases +# +# CONFIG_RT_USING_UTESTCASES is not set # # RT-Thread MIPS CPU @@ -343,6 +359,7 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_PKG_USING_AT_DEVICE is not set # CONFIG_PKG_USING_ATSRV_SOCKET is not set # CONFIG_PKG_USING_WIZNET is not set +# CONFIG_PKG_USING_ZB_COORDINATOR is not set # # IoT Cloud @@ -363,8 +380,6 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_PKG_USING_LIBRWS is not set # CONFIG_PKG_USING_TCPSERVER is not set # CONFIG_PKG_USING_PROTOBUF_C is not set -# CONFIG_PKG_USING_ONNX_PARSER is not set -# CONFIG_PKG_USING_ONNX_BACKEND is not set # CONFIG_PKG_USING_DLT645 is not set # CONFIG_PKG_USING_QXWZ is not set # CONFIG_PKG_USING_SMTP_CLIENT is not set @@ -379,6 +394,13 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_PKG_USING_BTSTACK is not set # CONFIG_PKG_USING_LORAWAN_ED_STACK is not set # CONFIG_PKG_USING_WAYZ_IOTKIT is not set +# CONFIG_PKG_USING_MAVLINK is not set +# CONFIG_PKG_USING_RAPIDJSON is not set +# CONFIG_PKG_USING_BSAL is not set +# CONFIG_PKG_USING_AGILE_MODBUS is not set +# CONFIG_PKG_USING_AGILE_FTP is not set +# CONFIG_PKG_USING_EMBEDDEDPROTO is not set +# CONFIG_PKG_USING_RT_LINK_HW is not set # # security packages @@ -395,6 +417,7 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_PKG_USING_LUA is not set # CONFIG_PKG_USING_JERRYSCRIPT is not set # CONFIG_PKG_USING_MICROPYTHON is not set +# CONFIG_PKG_USING_PIKASCRIPT is not set # # multimedia packages @@ -404,9 +427,13 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_PKG_USING_STEMWIN is not set # CONFIG_PKG_USING_WAVPLAYER is not set # CONFIG_PKG_USING_TJPGD is not set +# CONFIG_PKG_USING_PDFGEN is not set # CONFIG_PKG_USING_HELIX is not set # CONFIG_PKG_USING_AZUREGUIX is not set # CONFIG_PKG_USING_TOUCHGFX2RTT is not set +# CONFIG_PKG_USING_NUEMWIN is not set +# CONFIG_PKG_USING_MP3PLAYER is not set +# CONFIG_PKG_USING_TINYJPEG is not set # # tools packages @@ -415,6 +442,7 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_PKG_USING_EASYFLASH is not set # CONFIG_PKG_USING_EASYLOGGER is not set # CONFIG_PKG_USING_SYSTEMVIEW is not set +# CONFIG_PKG_USING_SEGGER_RTT is not set # CONFIG_PKG_USING_RDB is not set # CONFIG_PKG_USING_QRCODE is not set # CONFIG_PKG_USING_ULOG_EASYFLASH is not set @@ -436,14 +464,43 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_PKG_USING_GBK2UTF8 is not set # CONFIG_PKG_USING_VCONSOLE is not set # CONFIG_PKG_USING_KDB is not set +# CONFIG_PKG_USING_WAMR is not set +# CONFIG_PKG_USING_MICRO_XRCE_DDS_CLIENT is not set +# CONFIG_PKG_USING_LWLOG is not set +# CONFIG_PKG_USING_ANV_TRACE is not set +# CONFIG_PKG_USING_ANV_MEMLEAK is not set +# CONFIG_PKG_USING_ANV_TESTSUIT is not set +# CONFIG_PKG_USING_ANV_BENCH is not set +# CONFIG_PKG_USING_DEVMEM is not set +# CONFIG_PKG_USING_REGEX is not set +# CONFIG_PKG_USING_MEM_SANDBOX is not set +# CONFIG_PKG_USING_SOLAR_TERMS is not set +# CONFIG_PKG_USING_GAN_ZHI is not set # # system packages # + +# +# acceleration: Assembly language or algorithmic acceleration packages +# +# CONFIG_PKG_USING_RT_MEMCPY_CM is not set +# CONFIG_PKG_USING_QFPLIB_M0_FULL is not set +# CONFIG_PKG_USING_QFPLIB_M0_TINY is not set +# CONFIG_PKG_USING_QFPLIB_M3 is not set + +# +# Micrium: Micrium software products porting for RT-Thread +# +# CONFIG_PKG_USING_UCOSIII_WRAPPER is not set +# CONFIG_PKG_USING_UCOSII_WRAPPER is not set +# CONFIG_PKG_USING_UC_CRC is not set +# CONFIG_PKG_USING_UC_CLK is not set +# CONFIG_PKG_USING_UC_COMMON is not set +# CONFIG_PKG_USING_UC_MODBUS is not set # CONFIG_PKG_USING_GUIENGINE is not set # CONFIG_PKG_USING_CAIRO is not set # CONFIG_PKG_USING_PIXMAN is not set -# CONFIG_PKG_USING_LWEXT4 is not set # CONFIG_PKG_USING_PARTITION is not set # CONFIG_PKG_USING_FAL is not set # CONFIG_PKG_USING_FLASHDB is not set @@ -453,6 +510,9 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_PKG_USING_CMSIS is not set # CONFIG_PKG_USING_DFS_YAFFS is not set # CONFIG_PKG_USING_LITTLEFS is not set +# CONFIG_PKG_USING_DFS_JFFS2 is not set +# CONFIG_PKG_USING_DFS_UFFS is not set +# CONFIG_PKG_USING_LWEXT4 is not set # CONFIG_PKG_USING_THREAD_POOL is not set # CONFIG_PKG_USING_ROBOTS is not set # CONFIG_PKG_USING_EV is not set @@ -462,20 +522,15 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_PKG_USING_RAMDISK is not set # CONFIG_PKG_USING_MININI is not set # CONFIG_PKG_USING_QBOOT is not set - -# -# Micrium: Micrium software products porting for RT-Thread -# -# CONFIG_PKG_USING_UCOSIII_WRAPPER is not set -# CONFIG_PKG_USING_UCOSII_WRAPPER is not set -# CONFIG_PKG_USING_UC_CRC is not set -# CONFIG_PKG_USING_UC_CLK is not set -# CONFIG_PKG_USING_UC_COMMON is not set -# CONFIG_PKG_USING_UC_MODBUS is not set # CONFIG_PKG_USING_PPOOL is not set # CONFIG_PKG_USING_OPENAMP is not set -# CONFIG_PKG_USING_RT_PRINTF is not set -# CONFIG_PKG_USING_RT_MEMCPY_CM is not set +# CONFIG_PKG_USING_RT_KPRINTF_THREADSAFE is not set +# CONFIG_PKG_USING_LPM is not set +# CONFIG_PKG_USING_TLSF is not set +# CONFIG_PKG_USING_EVENT_RECORDER is not set +# CONFIG_PKG_USING_ARM_2D is not set +# CONFIG_PKG_USING_WCWIDTH is not set +# CONFIG_PKG_USING_MCUBOOT is not set # # peripheral libraries and drivers @@ -500,7 +555,6 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_PKG_USING_WM_LIBRARIES is not set # CONFIG_PKG_USING_KENDRYTE_SDK is not set # CONFIG_PKG_USING_INFRARED is not set -# CONFIG_PKG_USING_ROSSERIAL is not set # CONFIG_PKG_USING_AGILE_BUTTON is not set # CONFIG_PKG_USING_AGILE_LED is not set # CONFIG_PKG_USING_AT24CXX is not set @@ -538,10 +592,56 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_PKG_USING_VIRTUAL_SENSOR is not set # CONFIG_PKG_USING_VDEVICE is not set # CONFIG_PKG_USING_SGM706 is not set +# CONFIG_PKG_USING_STM32WB55_SDK is not set +# CONFIG_PKG_USING_RDA58XX is not set +# CONFIG_PKG_USING_LIBNFC is not set +# CONFIG_PKG_USING_MFOC is not set +# CONFIG_PKG_USING_TMC51XX is not set +# CONFIG_PKG_USING_TCA9534 is not set +# CONFIG_PKG_USING_KOBUKI is not set +# CONFIG_PKG_USING_ROSSERIAL is not set +# CONFIG_PKG_USING_MICRO_ROS is not set +# CONFIG_PKG_USING_MCP23008 is not set +# CONFIG_PKG_USING_BLUETRUM_SDK is not set +# CONFIG_PKG_USING_MISAKA_AT24CXX is not set + +# +# AI packages +# +# CONFIG_PKG_USING_LIBANN is not set +# CONFIG_PKG_USING_NNOM is not set +# CONFIG_PKG_USING_ONNX_BACKEND is not set +# CONFIG_PKG_USING_ONNX_PARSER is not set +# CONFIG_PKG_USING_TENSORFLOWLITEMICRO is not set +# CONFIG_PKG_USING_ELAPACK is not set +# CONFIG_PKG_USING_ULAPACK is not set +# CONFIG_PKG_USING_QUEST is not set +# CONFIG_PKG_USING_NAXOS is not set # # miscellaneous packages # + +# +# samples: kernel and components samples +# +# CONFIG_PKG_USING_KERNEL_SAMPLES is not set +# CONFIG_PKG_USING_FILESYSTEM_SAMPLES is not set +# CONFIG_PKG_USING_NETWORK_SAMPLES is not set +# CONFIG_PKG_USING_PERIPHERAL_SAMPLES is not set + +# +# entertainment: terminal games and other interesting software packages +# +# CONFIG_PKG_USING_CMATRIX is not set +# CONFIG_PKG_USING_SL is not set +# CONFIG_PKG_USING_CAL is not set +# CONFIG_PKG_USING_ACLOCK is not set +# CONFIG_PKG_USING_THREES is not set +# CONFIG_PKG_USING_2048 is not set +# CONFIG_PKG_USING_SNAKE is not set +# CONFIG_PKG_USING_TETRIS is not set +# CONFIG_PKG_USING_DONUT is not set # CONFIG_PKG_USING_LIBCSV is not set # CONFIG_PKG_USING_OPTPARSE is not set # CONFIG_PKG_USING_FASTLZ is not set @@ -552,42 +652,26 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_PKG_USING_FLEXIBLE_BUTTON is not set # CONFIG_PKG_USING_CANFESTIVAL is not set # CONFIG_PKG_USING_ZLIB is not set +# CONFIG_PKG_USING_MINIZIP is not set # CONFIG_PKG_USING_DSTR is not set # CONFIG_PKG_USING_TINYFRAME is not set # CONFIG_PKG_USING_KENDRYTE_DEMO is not set # CONFIG_PKG_USING_DIGITALCTRL is not set # CONFIG_PKG_USING_UPACKER is not set # CONFIG_PKG_USING_UPARAM is not set - -# -# samples: kernel and components samples -# -# CONFIG_PKG_USING_KERNEL_SAMPLES is not set -# CONFIG_PKG_USING_FILESYSTEM_SAMPLES is not set -# CONFIG_PKG_USING_NETWORK_SAMPLES is not set -# CONFIG_PKG_USING_PERIPHERAL_SAMPLES is not set # CONFIG_PKG_USING_HELLO is not set # CONFIG_PKG_USING_VI is not set # CONFIG_PKG_USING_KI is not set -# CONFIG_PKG_USING_NNOM is not set -# CONFIG_PKG_USING_LIBANN is not set -# CONFIG_PKG_USING_ELAPACK is not set # CONFIG_PKG_USING_ARMv7M_DWT is not set # CONFIG_PKG_USING_VT100 is not set -# CONFIG_PKG_USING_ULAPACK is not set # CONFIG_PKG_USING_UKAL is not set # CONFIG_PKG_USING_CRCLIB is not set - -# -# games: games run on RT-Thread console -# -# CONFIG_PKG_USING_THREES is not set -# CONFIG_PKG_USING_2048 is not set -# CONFIG_PKG_USING_SNAKE is not set -# CONFIG_PKG_USING_TETRIS is not set # CONFIG_PKG_USING_LWGPS is not set -# CONFIG_PKG_USING_TENSORFLOWLITEMICRO is not set # CONFIG_PKG_USING_STATE_MACHINE is not set +# CONFIG_PKG_USING_MCURSES is not set +# CONFIG_PKG_USING_COWSAY is not set +# CONFIG_PKG_USING_TERMBOX is not set +CONFIG_SOC_LS=y CONFIG_SOC_LS1C300=y CONFIG_RT_LS1C_OPENLOONGSON=y # CONFIG_RT_LS1C_BAICAIBOARD is not set @@ -599,9 +683,9 @@ CONFIG_RT_UART_RX_BUFFER_SIZE=64 CONFIG_RT_USING_GMAC_INT_MODE=y # CONFIG_RT_USING_SPI0 is not set # CONFIG_RT_USING_SPI1 is not set -CONFIG_RT_USING_I2C1=y -CONFIG_RT_USING_I2C2=y -CONFIG_USING_BXCAN0=y -CONFIG_USING_BXCAN1=y +# CONFIG_RT_USING_I2C1 is not set +# CONFIG_RT_USING_I2C2 is not set +# CONFIG_USING_BXCAN0 is not set +# CONFIG_USING_BXCAN1 is not set CONFIG_NO_TOUCH=y # CONFIG_TINA_USING_TOUCH is not set diff --git a/bsp/ls1cdev/Kconfig b/bsp/ls1cdev/Kconfig index 3fb6e3bbdf..59f7c43323 100644 --- a/bsp/ls1cdev/Kconfig +++ b/bsp/ls1cdev/Kconfig @@ -19,6 +19,10 @@ source "$RTT_DIR/Kconfig" source "$RTT_DIR/libcpu/mips/common/Kconfig" source "$PKGS_DIR/Kconfig" +config SOC_LS + bool + default y + config SOC_LS1C300 bool select RT_USING_COMPONENTS_INIT diff --git a/bsp/ls1cdev/rtconfig.h b/bsp/ls1cdev/rtconfig.h index 34be0a928c..d4075e371a 100644 --- a/bsp/ls1cdev/rtconfig.h +++ b/bsp/ls1cdev/rtconfig.h @@ -16,6 +16,9 @@ #define RT_USING_IDLE_HOOK #define RT_IDLE_HOOK_LIST_SIZE 4 #define IDLE_THREAD_STACK_SIZE 1024 + +/* kservice optimization */ + #define RT_DEBUG #define RT_DEBUG_COLOR @@ -41,7 +44,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart2" -#define RT_VER_NUM 0x40003 +#define RT_VER_NUM 0x40004 /* RT-Thread Components */ @@ -56,16 +59,17 @@ /* Command shell */ #define RT_USING_FINSH +#define RT_USING_MSH +#define FINSH_USING_MSH #define FINSH_THREAD_NAME "tshell" +#define FINSH_THREAD_PRIORITY 20 +#define FINSH_THREAD_STACK_SIZE 4096 #define FINSH_USING_HISTORY #define FINSH_HISTORY_LINES 5 #define FINSH_USING_SYMTAB -#define FINSH_USING_DESCRIPTION -#define FINSH_THREAD_PRIORITY 20 -#define FINSH_THREAD_STACK_SIZE 4096 #define FINSH_CMD_SIZE 80 -#define FINSH_USING_MSH -#define FINSH_USING_MSH_DEFAULT +#define MSH_USING_BUILT_IN_COMMANDS +#define FINSH_USING_DESCRIPTION #define FINSH_ARG_MAX 10 /* Device virtual file system */ @@ -96,6 +100,7 @@ #define RT_USING_DEVICE_IPC #define RT_PIPE_BUFSZ 512 #define RT_USING_SERIAL +#define RT_USING_SERIAL_V1 #define RT_SERIAL_USING_DMA #define RT_SERIAL_RB_BUFSZ 64 #define RT_USING_CAN @@ -114,6 +119,7 @@ #define RT_USING_PTHREADS #define PTHREAD_NUM_MAX 8 #define RT_USING_POSIX +#define RT_LIBC_DEFAULT_TIMEZONE 8 /* Network */ @@ -177,6 +183,9 @@ /* Utilities */ +/* RT-Thread Utestcases */ + + /* RT-Thread MIPS CPU */ @@ -210,6 +219,8 @@ /* system packages */ +/* acceleration: Assembly language or algorithmic acceleration packages */ + /* Micrium: Micrium software products porting for RT-Thread */ @@ -217,24 +228,23 @@ /* peripheral libraries and drivers */ -/* miscellaneous packages */ +/* AI packages */ +/* miscellaneous packages */ + /* samples: kernel and components samples */ -/* games: games run on RT-Thread console */ +/* entertainment: terminal games and other interesting software packages */ +#define SOC_LS #define SOC_LS1C300 #define RT_LS1C_OPENLOONGSON #define RT_USING_UART2 #define RT_USING_UART1 #define RT_UART_RX_BUFFER_SIZE 64 #define RT_USING_GMAC_INT_MODE -#define RT_USING_I2C1 -#define RT_USING_I2C2 -#define USING_BXCAN0 -#define USING_BXCAN1 #define NO_TOUCH #endif diff --git a/bsp/ls2kdev/.config b/bsp/ls2kdev/.config index 2d89bcb80b..133b7dca3a 100644 --- a/bsp/ls2kdev/.config +++ b/bsp/ls2kdev/.config @@ -21,6 +21,13 @@ CONFIG_RT_USING_IDLE_HOOK=y CONFIG_RT_IDLE_HOOK_LIST_SIZE=4 CONFIG_IDLE_THREAD_STACK_SIZE=16384 # CONFIG_RT_USING_TIMER_SOFT is not set + +# +# kservice optimization +# +# CONFIG_RT_KSERVICE_USING_STDLIB is not set +# CONFIG_RT_KSERVICE_USING_TINY_SIZE is not set +# CONFIG_RT_USING_ASM_MEMCPY is not set CONFIG_RT_DEBUG=y # CONFIG_RT_DEBUG_COLOR is not set # CONFIG_RT_DEBUG_INIT_CONFIG is not set @@ -64,8 +71,9 @@ CONFIG_RT_USING_DEVICE=y # CONFIG_RT_USING_INTERRUPT_INFO is not set CONFIG_RT_USING_CONSOLE=y CONFIG_RT_CONSOLEBUF_SIZE=256 -CONFIG_RT_CONSOLE_DEVICE_NAME="uart" -CONFIG_RT_VER_NUM=0x40003 +CONFIG_RT_CONSOLE_DEVICE_NAME="uart0" +# CONFIG_RT_PRINTF_LONGLONG is not set +CONFIG_RT_VER_NUM=0x40004 CONFIG_ARCH_CPU_64BIT=y # CONFIG_RT_USING_CPU_FFS is not set CONFIG_ARCH_MIPS64=y @@ -88,19 +96,19 @@ CONFIG_RT_MAIN_THREAD_PRIORITY=10 # Command shell # CONFIG_RT_USING_FINSH=y +CONFIG_RT_USING_MSH=y +CONFIG_FINSH_USING_MSH=y CONFIG_FINSH_THREAD_NAME="tshell" +CONFIG_FINSH_THREAD_PRIORITY=20 +CONFIG_FINSH_THREAD_STACK_SIZE=16384 CONFIG_FINSH_USING_HISTORY=y CONFIG_FINSH_HISTORY_LINES=5 CONFIG_FINSH_USING_SYMTAB=y +CONFIG_FINSH_CMD_SIZE=80 +CONFIG_MSH_USING_BUILT_IN_COMMANDS=y CONFIG_FINSH_USING_DESCRIPTION=y # CONFIG_FINSH_ECHO_DISABLE_DEFAULT is not set -CONFIG_FINSH_THREAD_PRIORITY=20 -CONFIG_FINSH_THREAD_STACK_SIZE=16384 -CONFIG_FINSH_CMD_SIZE=80 # CONFIG_FINSH_USING_AUTH is not set -CONFIG_FINSH_USING_MSH=y -CONFIG_FINSH_USING_MSH_DEFAULT=y -# CONFIG_FINSH_USING_MSH_ONLY is not set CONFIG_FINSH_ARG_MAX=10 # @@ -108,8 +116,8 @@ CONFIG_FINSH_ARG_MAX=10 # CONFIG_RT_USING_DFS=y CONFIG_DFS_USING_WORKDIR=y -CONFIG_DFS_FILESYSTEMS_MAX=10 -CONFIG_DFS_FILESYSTEM_TYPES_MAX=10 +CONFIG_DFS_FILESYSTEMS_MAX=4 +CONFIG_DFS_FILESYSTEM_TYPES_MAX=4 CONFIG_DFS_FD_MAX=16 # CONFIG_RT_USING_DFS_MNTTABLE is not set CONFIG_RT_USING_DFS_ELMFAT=y @@ -124,6 +132,11 @@ CONFIG_RT_DFS_ELM_WORD_ACCESS=y # CONFIG_RT_DFS_ELM_USE_LFN_2 is not set CONFIG_RT_DFS_ELM_USE_LFN_3=y CONFIG_RT_DFS_ELM_USE_LFN=3 +CONFIG_RT_DFS_ELM_LFN_UNICODE_0=y +# CONFIG_RT_DFS_ELM_LFN_UNICODE_1 is not set +# CONFIG_RT_DFS_ELM_LFN_UNICODE_2 is not set +# CONFIG_RT_DFS_ELM_LFN_UNICODE_3 is not set +CONFIG_RT_DFS_ELM_LFN_UNICODE=0 CONFIG_RT_DFS_ELM_MAX_LFN=255 CONFIG_RT_DFS_ELM_DRIVES=9 CONFIG_RT_DFS_ELM_MAX_SECTOR_SIZE=512 @@ -132,8 +145,6 @@ CONFIG_RT_DFS_ELM_REENTRANT=y CONFIG_RT_USING_DFS_DEVFS=y # CONFIG_RT_USING_DFS_ROMFS is not set # CONFIG_RT_USING_DFS_RAMFS is not set -# CONFIG_RT_USING_DFS_UFFS is not set -# CONFIG_RT_USING_DFS_JFFS2 is not set # CONFIG_RT_USING_DFS_NFS is not set # @@ -145,6 +156,8 @@ CONFIG_RT_USING_SYSTEM_WORKQUEUE=y CONFIG_RT_SYSTEM_WORKQUEUE_STACKSIZE=16384 CONFIG_RT_SYSTEM_WORKQUEUE_PRIORITY=5 CONFIG_RT_USING_SERIAL=y +CONFIG_RT_USING_SERIAL_V1=y +# CONFIG_RT_USING_SERIAL_V2 is not set CONFIG_RT_SERIAL_USING_DMA=y CONFIG_RT_SERIAL_RB_BUFSZ=64 # CONFIG_RT_USING_CAN is not set @@ -193,6 +206,7 @@ CONFIG_RT_USING_POSIX=y # CONFIG_RT_USING_POSIX_GETLINE is not set # CONFIG_RT_USING_POSIX_AIO is not set # CONFIG_RT_USING_MODULE is not set +CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8 # # Network @@ -202,6 +216,7 @@ CONFIG_RT_USING_POSIX=y # Socket abstraction layer # CONFIG_RT_USING_SAL=y +CONFIG_SAL_INTERNET_CHECK=y # # protocol stack implement @@ -229,6 +244,7 @@ CONFIG_NETDEV_IPV6=0 CONFIG_RT_USING_LWIP=y # CONFIG_RT_USING_LWIP141 is not set CONFIG_RT_USING_LWIP202=y +# CONFIG_RT_USING_LWIP203 is not set # CONFIG_RT_USING_LWIP212 is not set # CONFIG_RT_USING_LWIP_IPV6 is not set CONFIG_RT_LWIP_MEM_ALIGNMENT=8 @@ -298,6 +314,12 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_RT_USING_RYM is not set # CONFIG_RT_USING_ULOG is not set # CONFIG_RT_USING_UTEST is not set +# CONFIG_RT_USING_RT_LINK is not set + +# +# RT-Thread Utestcases +# +# CONFIG_RT_USING_UTESTCASES is not set # # RT-Thread MIPS CPU @@ -351,6 +373,7 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_PKG_USING_AT_DEVICE is not set # CONFIG_PKG_USING_ATSRV_SOCKET is not set # CONFIG_PKG_USING_WIZNET is not set +# CONFIG_PKG_USING_ZB_COORDINATOR is not set # # IoT Cloud @@ -371,8 +394,6 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_PKG_USING_LIBRWS is not set # CONFIG_PKG_USING_TCPSERVER is not set # CONFIG_PKG_USING_PROTOBUF_C is not set -# CONFIG_PKG_USING_ONNX_PARSER is not set -# CONFIG_PKG_USING_ONNX_BACKEND is not set # CONFIG_PKG_USING_DLT645 is not set # CONFIG_PKG_USING_QXWZ is not set # CONFIG_PKG_USING_SMTP_CLIENT is not set @@ -387,6 +408,13 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_PKG_USING_BTSTACK is not set # CONFIG_PKG_USING_LORAWAN_ED_STACK is not set # CONFIG_PKG_USING_WAYZ_IOTKIT is not set +# CONFIG_PKG_USING_MAVLINK is not set +# CONFIG_PKG_USING_RAPIDJSON is not set +# CONFIG_PKG_USING_BSAL is not set +# CONFIG_PKG_USING_AGILE_MODBUS is not set +# CONFIG_PKG_USING_AGILE_FTP is not set +# CONFIG_PKG_USING_EMBEDDEDPROTO is not set +# CONFIG_PKG_USING_RT_LINK_HW is not set # # security packages @@ -403,6 +431,7 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_PKG_USING_LUA is not set # CONFIG_PKG_USING_JERRYSCRIPT is not set # CONFIG_PKG_USING_MICROPYTHON is not set +# CONFIG_PKG_USING_PIKASCRIPT is not set # # multimedia packages @@ -412,9 +441,13 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_PKG_USING_STEMWIN is not set # CONFIG_PKG_USING_WAVPLAYER is not set # CONFIG_PKG_USING_TJPGD is not set +# CONFIG_PKG_USING_PDFGEN is not set # CONFIG_PKG_USING_HELIX is not set # CONFIG_PKG_USING_AZUREGUIX is not set # CONFIG_PKG_USING_TOUCHGFX2RTT is not set +# CONFIG_PKG_USING_NUEMWIN is not set +# CONFIG_PKG_USING_MP3PLAYER is not set +# CONFIG_PKG_USING_TINYJPEG is not set # # tools packages @@ -423,9 +456,12 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_PKG_USING_EASYFLASH is not set # CONFIG_PKG_USING_EASYLOGGER is not set # CONFIG_PKG_USING_SYSTEMVIEW is not set +# CONFIG_PKG_USING_SEGGER_RTT is not set # CONFIG_PKG_USING_RDB is not set # CONFIG_PKG_USING_QRCODE is not set # CONFIG_PKG_USING_ULOG_EASYFLASH is not set +# CONFIG_PKG_USING_ULOG_FILE is not set +# CONFIG_PKG_USING_LOGMGR is not set # CONFIG_PKG_USING_ADBD is not set # CONFIG_PKG_USING_COREMARK is not set # CONFIG_PKG_USING_DHRYSTONE is not set @@ -441,16 +477,44 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_PKG_USING_CPU_USAGE is not set # CONFIG_PKG_USING_GBK2UTF8 is not set # CONFIG_PKG_USING_VCONSOLE is not set +# CONFIG_PKG_USING_KDB is not set +# CONFIG_PKG_USING_WAMR is not set +# CONFIG_PKG_USING_MICRO_XRCE_DDS_CLIENT is not set +# CONFIG_PKG_USING_LWLOG is not set +# CONFIG_PKG_USING_ANV_TRACE is not set +# CONFIG_PKG_USING_ANV_MEMLEAK is not set +# CONFIG_PKG_USING_ANV_TESTSUIT is not set +# CONFIG_PKG_USING_ANV_BENCH is not set +# CONFIG_PKG_USING_DEVMEM is not set +# CONFIG_PKG_USING_REGEX is not set +# CONFIG_PKG_USING_MEM_SANDBOX is not set +# CONFIG_PKG_USING_SOLAR_TERMS is not set +# CONFIG_PKG_USING_GAN_ZHI is not set # # system packages # + +# +# acceleration: Assembly language or algorithmic acceleration packages +# +# CONFIG_PKG_USING_RT_MEMCPY_CM is not set +# CONFIG_PKG_USING_QFPLIB_M0_FULL is not set +# CONFIG_PKG_USING_QFPLIB_M0_TINY is not set +# CONFIG_PKG_USING_QFPLIB_M3 is not set + +# +# Micrium: Micrium software products porting for RT-Thread +# +# CONFIG_PKG_USING_UCOSIII_WRAPPER is not set +# CONFIG_PKG_USING_UCOSII_WRAPPER is not set +# CONFIG_PKG_USING_UC_CRC is not set +# CONFIG_PKG_USING_UC_CLK is not set +# CONFIG_PKG_USING_UC_COMMON is not set +# CONFIG_PKG_USING_UC_MODBUS is not set # CONFIG_PKG_USING_GUIENGINE is not set # CONFIG_PKG_USING_CAIRO is not set # CONFIG_PKG_USING_PIXMAN is not set -# CONFIG_PKG_USING_LWEXT4 is not set -# CONFIG_PKG_USING_LWEXT4_LATEST_VERSION is not set -# CONFIG_PKG_USING_LWEXT4_V100 is not set # CONFIG_PKG_USING_PARTITION is not set # CONFIG_PKG_USING_FAL is not set # CONFIG_PKG_USING_FLASHDB is not set @@ -460,6 +524,9 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_PKG_USING_CMSIS is not set # CONFIG_PKG_USING_DFS_YAFFS is not set # CONFIG_PKG_USING_LITTLEFS is not set +# CONFIG_PKG_USING_DFS_JFFS2 is not set +# CONFIG_PKG_USING_DFS_UFFS is not set +# CONFIG_PKG_USING_LWEXT4 is not set # CONFIG_PKG_USING_THREAD_POOL is not set # CONFIG_PKG_USING_ROBOTS is not set # CONFIG_PKG_USING_EV is not set @@ -469,18 +536,15 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_PKG_USING_RAMDISK is not set # CONFIG_PKG_USING_MININI is not set # CONFIG_PKG_USING_QBOOT is not set - -# -# Micrium: Micrium software products porting for RT-Thread -# -# CONFIG_PKG_USING_UCOSIII_WRAPPER is not set -# CONFIG_PKG_USING_UCOSII_WRAPPER is not set -# CONFIG_PKG_USING_UC_CRC is not set -# CONFIG_PKG_USING_UC_CLK is not set -# CONFIG_PKG_USING_UC_COMMON is not set -# CONFIG_PKG_USING_UC_MODBUS is not set # CONFIG_PKG_USING_PPOOL is not set # CONFIG_PKG_USING_OPENAMP is not set +# CONFIG_PKG_USING_RT_KPRINTF_THREADSAFE is not set +# CONFIG_PKG_USING_LPM is not set +# CONFIG_PKG_USING_TLSF is not set +# CONFIG_PKG_USING_EVENT_RECORDER is not set +# CONFIG_PKG_USING_ARM_2D is not set +# CONFIG_PKG_USING_WCWIDTH is not set +# CONFIG_PKG_USING_MCUBOOT is not set # # peripheral libraries and drivers @@ -489,6 +553,7 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_PKG_USING_REALTEK_AMEBA is not set # CONFIG_PKG_USING_SHT2X is not set # CONFIG_PKG_USING_SHT3X is not set +# CONFIG_PKG_USING_AS7341 is not set # CONFIG_PKG_USING_STM32_SDIO is not set # CONFIG_PKG_USING_ICM20608 is not set # CONFIG_PKG_USING_U8G2 is not set @@ -504,7 +569,6 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_PKG_USING_WM_LIBRARIES is not set # CONFIG_PKG_USING_KENDRYTE_SDK is not set # CONFIG_PKG_USING_INFRARED is not set -# CONFIG_PKG_USING_ROSSERIAL is not set # CONFIG_PKG_USING_AGILE_BUTTON is not set # CONFIG_PKG_USING_AGILE_LED is not set # CONFIG_PKG_USING_AT24CXX is not set @@ -541,10 +605,57 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_PKG_USING_NES is not set # CONFIG_PKG_USING_VIRTUAL_SENSOR is not set # CONFIG_PKG_USING_VDEVICE is not set +# CONFIG_PKG_USING_SGM706 is not set +# CONFIG_PKG_USING_STM32WB55_SDK is not set +# CONFIG_PKG_USING_RDA58XX is not set +# CONFIG_PKG_USING_LIBNFC is not set +# CONFIG_PKG_USING_MFOC is not set +# CONFIG_PKG_USING_TMC51XX is not set +# CONFIG_PKG_USING_TCA9534 is not set +# CONFIG_PKG_USING_KOBUKI is not set +# CONFIG_PKG_USING_ROSSERIAL is not set +# CONFIG_PKG_USING_MICRO_ROS is not set +# CONFIG_PKG_USING_MCP23008 is not set +# CONFIG_PKG_USING_BLUETRUM_SDK is not set +# CONFIG_PKG_USING_MISAKA_AT24CXX is not set + +# +# AI packages +# +# CONFIG_PKG_USING_LIBANN is not set +# CONFIG_PKG_USING_NNOM is not set +# CONFIG_PKG_USING_ONNX_BACKEND is not set +# CONFIG_PKG_USING_ONNX_PARSER is not set +# CONFIG_PKG_USING_TENSORFLOWLITEMICRO is not set +# CONFIG_PKG_USING_ELAPACK is not set +# CONFIG_PKG_USING_ULAPACK is not set +# CONFIG_PKG_USING_QUEST is not set +# CONFIG_PKG_USING_NAXOS is not set # # miscellaneous packages # + +# +# samples: kernel and components samples +# +# CONFIG_PKG_USING_KERNEL_SAMPLES is not set +# CONFIG_PKG_USING_FILESYSTEM_SAMPLES is not set +# CONFIG_PKG_USING_NETWORK_SAMPLES is not set +# CONFIG_PKG_USING_PERIPHERAL_SAMPLES is not set + +# +# entertainment: terminal games and other interesting software packages +# +# CONFIG_PKG_USING_CMATRIX is not set +# CONFIG_PKG_USING_SL is not set +# CONFIG_PKG_USING_CAL is not set +# CONFIG_PKG_USING_ACLOCK is not set +# CONFIG_PKG_USING_THREES is not set +# CONFIG_PKG_USING_2048 is not set +# CONFIG_PKG_USING_SNAKE is not set +# CONFIG_PKG_USING_TETRIS is not set +# CONFIG_PKG_USING_DONUT is not set # CONFIG_PKG_USING_LIBCSV is not set # CONFIG_PKG_USING_OPTPARSE is not set # CONFIG_PKG_USING_FASTLZ is not set @@ -555,39 +666,26 @@ CONFIG_RT_LWIP_USING_PING=y # CONFIG_PKG_USING_FLEXIBLE_BUTTON is not set # CONFIG_PKG_USING_CANFESTIVAL is not set # CONFIG_PKG_USING_ZLIB is not set +# CONFIG_PKG_USING_MINIZIP is not set # CONFIG_PKG_USING_DSTR is not set # CONFIG_PKG_USING_TINYFRAME is not set # CONFIG_PKG_USING_KENDRYTE_DEMO is not set # CONFIG_PKG_USING_DIGITALCTRL is not set # CONFIG_PKG_USING_UPACKER is not set # CONFIG_PKG_USING_UPARAM is not set - -# -# samples: kernel and components samples -# -# CONFIG_PKG_USING_KERNEL_SAMPLES is not set -# CONFIG_PKG_USING_FILESYSTEM_SAMPLES is not set -# CONFIG_PKG_USING_NETWORK_SAMPLES is not set -# CONFIG_PKG_USING_PERIPHERAL_SAMPLES is not set # CONFIG_PKG_USING_HELLO is not set # CONFIG_PKG_USING_VI is not set # CONFIG_PKG_USING_KI is not set -# CONFIG_PKG_USING_NNOM is not set -# CONFIG_PKG_USING_LIBANN is not set -# CONFIG_PKG_USING_ELAPACK is not set # CONFIG_PKG_USING_ARMv7M_DWT is not set # CONFIG_PKG_USING_VT100 is not set -# CONFIG_PKG_USING_ULAPACK is not set # CONFIG_PKG_USING_UKAL is not set # CONFIG_PKG_USING_CRCLIB is not set - -# -# games: games run on RT-Thread console -# -# CONFIG_PKG_USING_THREES is not set -# CONFIG_PKG_USING_2048 is not set -# CONFIG_PKG_USING_SNAKE is not set -# CONFIG_PKG_USING_TETRIS is not set # CONFIG_PKG_USING_LWGPS is not set -# CONFIG_PKG_USING_TENSORFLOWLITEMICRO is not set +# CONFIG_PKG_USING_STATE_MACHINE is not set +# CONFIG_PKG_USING_MCURSES is not set +# CONFIG_PKG_USING_COWSAY is not set +# CONFIG_PKG_USING_TERMBOX is not set +CONFIG_SOC_LS=y CONFIG_SOC_LS2K1000=y +CONFIG_RT_USING_UART0=y +CONFIG_RT_USING_UART4=y diff --git a/bsp/ls2kdev/Kconfig b/bsp/ls2kdev/Kconfig index fc2dfe1328..57dd99e53a 100644 --- a/bsp/ls2kdev/Kconfig +++ b/bsp/ls2kdev/Kconfig @@ -22,6 +22,10 @@ source "$RTT_DIR/Kconfig" source "$RTT_DIR/libcpu/mips/common/Kconfig" source "$PKGS_DIR/Kconfig" +config SOC_LS + bool + default y + config SOC_LS2K1000 bool select ARCH_MIPS64 diff --git a/bsp/ls2kdev/rtconfig.h b/bsp/ls2kdev/rtconfig.h index 4fd46f8874..90dcf2ad91 100644 --- a/bsp/ls2kdev/rtconfig.h +++ b/bsp/ls2kdev/rtconfig.h @@ -16,6 +16,9 @@ #define RT_USING_IDLE_HOOK #define RT_IDLE_HOOK_LIST_SIZE 4 #define IDLE_THREAD_STACK_SIZE 16384 + +/* kservice optimization */ + #define RT_DEBUG /* Inter-Thread communication */ @@ -38,7 +41,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 256 #define RT_CONSOLE_DEVICE_NAME "uart0" -#define RT_VER_NUM 0x40003 +#define RT_VER_NUM 0x40004 #define ARCH_CPU_64BIT #define ARCH_MIPS64 @@ -55,24 +58,25 @@ /* Command shell */ #define RT_USING_FINSH +#define RT_USING_MSH +#define FINSH_USING_MSH #define FINSH_THREAD_NAME "tshell" +#define FINSH_THREAD_PRIORITY 20 +#define FINSH_THREAD_STACK_SIZE 16384 #define FINSH_USING_HISTORY #define FINSH_HISTORY_LINES 5 #define FINSH_USING_SYMTAB -#define FINSH_USING_DESCRIPTION -#define FINSH_THREAD_PRIORITY 20 -#define FINSH_THREAD_STACK_SIZE 16384 #define FINSH_CMD_SIZE 80 -#define FINSH_USING_MSH -#define FINSH_USING_MSH_DEFAULT +#define MSH_USING_BUILT_IN_COMMANDS +#define FINSH_USING_DESCRIPTION #define FINSH_ARG_MAX 10 /* Device virtual file system */ #define RT_USING_DFS #define DFS_USING_WORKDIR -#define DFS_FILESYSTEMS_MAX 10 -#define DFS_FILESYSTEM_TYPES_MAX 10 +#define DFS_FILESYSTEMS_MAX 4 +#define DFS_FILESYSTEM_TYPES_MAX 4 #define DFS_FD_MAX 16 #define RT_USING_DFS_ELMFAT @@ -98,6 +102,7 @@ #define RT_SYSTEM_WORKQUEUE_STACKSIZE 16384 #define RT_SYSTEM_WORKQUEUE_PRIORITY 5 #define RT_USING_SERIAL +#define RT_USING_SERIAL_V1 #define RT_SERIAL_USING_DMA #define RT_SERIAL_RB_BUFSZ 64 #define RT_USING_PIN @@ -110,6 +115,7 @@ #define RT_USING_LIBC #define RT_USING_POSIX +#define RT_LIBC_DEFAULT_TIMEZONE 8 /* Network */ @@ -189,6 +195,9 @@ /* Utilities */ +/* RT-Thread Utestcases */ + + /* RT-Thread MIPS CPU */ @@ -222,15 +231,26 @@ /* system packages */ +/* acceleration: Assembly language or algorithmic acceleration packages */ + + +/* Micrium: Micrium software products porting for RT-Thread */ + /* peripheral libraries and drivers */ -/* miscellaneous packages */ +/* AI packages */ + +/* miscellaneous packages */ /* samples: kernel and components samples */ + +/* entertainment: terminal games and other interesting software packages */ + +#define SOC_LS #define SOC_LS2K1000 #define RT_USING_UART0 #define RT_USING_UART4 diff --git a/components/libc/compilers/common/partial/ls/SConscript b/components/libc/compilers/common/partial/ls/SConscript new file mode 100644 index 0000000000..2665bee078 --- /dev/null +++ b/components/libc/compilers/common/partial/ls/SConscript @@ -0,0 +1,23 @@ +from shutil import copy +from building import * + +Import('rtconfig') + +src = [] +cwd = GetCurrentDir() +CPPPATH = [cwd] +group = [] + +if rtconfig.PLATFORM == 'gcc' and GetDepend('SOC_LS'): + try: + # There is no 'sys/select.h' in these bsp's gcc toolchain; thus, we need to copy this file from 'nogcc/sys/select.h' + copy("../../nogcc/sys/select.h", "./sys/select.h") + except: + pass + + if GetDepend('RT_USING_LIBC'): + src += Glob('*.c') + + group = DefineGroup('libc', src, depend = [], CPPPATH = CPPPATH) + +Return('group') diff --git a/components/libc/compilers/common/partial/ls/readme.md b/components/libc/compilers/common/partial/ls/readme.md new file mode 100644 index 0000000000..fa68e1e84a --- /dev/null +++ b/components/libc/compilers/common/partial/ls/readme.md @@ -0,0 +1,9 @@ +This folder will be included when compiling the BSPs as follow: + +- ls1bdev +- ls1cdev +- ls2kdev + +These files will be generated by scons automatically , and **DO NOT** change them: + +- sys/select.h \ No newline at end of file diff --git a/components/libc/compilers/common/partial/ls/sys/select.h b/components/libc/compilers/common/partial/ls/sys/select.h new file mode 100644 index 0000000000..575ad3a1b5 --- /dev/null +++ b/components/libc/compilers/common/partial/ls/sys/select.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2021-07-21 Meco Man The first version + */ + +#ifndef __SYS_SELECT_H__ +#define __SYS_SELECT_H__ + +#include +#include +#include + +#ifndef FD_SETSIZE +#define FD_SETSIZE 32 +#endif + +#ifdef SAL_USING_POSIX +#ifdef FD_SETSIZE +#undef FD_SETSIZE +#endif +#define FD_SETSIZE DFS_FD_MAX +#endif /* SAL_USING_POSIX */ + +#define NBBY 8 /* number of bits in a byte */ + +typedef long fd_mask; + +#define NFDBITS (sizeof (fd_mask) * NBBY) /* bits per mask */ +#ifndef howmany +#define howmany(x,y) (((x)+((y)-1))/(y)) +#endif + +#ifndef _SYS_TYPES_FD_SET /* MIPS */ +typedef struct _types_fd_set { + fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)]; +} _types_fd_set; +#define fd_set _types_fd_set + +#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1L << ((n) % NFDBITS))) +#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1L << ((n) % NFDBITS))) +#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1L << ((n) % NFDBITS))) +#define FD_ZERO(p) memset((void*)(p), 0, sizeof(*(p))) +#endif /* _SYS_TYPES_FD_SET */ + +int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); + +#endif /* __SYS_SELECT_H__ */ diff --git a/components/libc/compilers/common/partial/ls1/SConscript b/components/libc/compilers/common/partial/ls1/SConscript deleted file mode 100644 index b988f7cf5f..0000000000 --- a/components/libc/compilers/common/partial/ls1/SConscript +++ /dev/null @@ -1,23 +0,0 @@ -from shutil import copy -from building import * - -Import('rtconfig') - -src = [] -cwd = GetCurrentDir() -CPPPATH = [cwd] -group = [] - -if rtconfig.PLATFORM == 'gcc': - if GetDepend('SOC_LS1B') or GetDepend('SOC_LS1C300'): - try: - # There is no 'sys/select.h' in these bsp's gcc toolchain; thus, we need to copy this file from 'nogcc/sys/select.h' - copy("../../nogcc/sys/select.h", "./sys/select.h") - except: - pass - if GetDepend('RT_USING_LIBC'): - src += Glob('*.c') - - group = DefineGroup('libc', src, depend = [], CPPPATH = CPPPATH) - -Return('group') diff --git a/components/libc/compilers/common/partial/ls1/readme.md b/components/libc/compilers/common/partial/ls1/readme.md deleted file mode 100644 index 575d713442..0000000000 --- a/components/libc/compilers/common/partial/ls1/readme.md +++ /dev/null @@ -1,8 +0,0 @@ -This folder will be included when compiling the BSPs as follow: - -- ls1bdev -- ls1cdev - -These files will be generated by scons automatically , and **DO NOT** change them: - -- sys/select.h \ No newline at end of file diff --git a/components/libc/compilers/common/partial/ls1/sys/select.h b/components/libc/compilers/common/partial/ls1/sys/select.h deleted file mode 100644 index 575ad3a1b5..0000000000 --- a/components/libc/compilers/common/partial/ls1/sys/select.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2006-2021, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2021-07-21 Meco Man The first version - */ - -#ifndef __SYS_SELECT_H__ -#define __SYS_SELECT_H__ - -#include -#include -#include - -#ifndef FD_SETSIZE -#define FD_SETSIZE 32 -#endif - -#ifdef SAL_USING_POSIX -#ifdef FD_SETSIZE -#undef FD_SETSIZE -#endif -#define FD_SETSIZE DFS_FD_MAX -#endif /* SAL_USING_POSIX */ - -#define NBBY 8 /* number of bits in a byte */ - -typedef long fd_mask; - -#define NFDBITS (sizeof (fd_mask) * NBBY) /* bits per mask */ -#ifndef howmany -#define howmany(x,y) (((x)+((y)-1))/(y)) -#endif - -#ifndef _SYS_TYPES_FD_SET /* MIPS */ -typedef struct _types_fd_set { - fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)]; -} _types_fd_set; -#define fd_set _types_fd_set - -#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1L << ((n) % NFDBITS))) -#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1L << ((n) % NFDBITS))) -#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1L << ((n) % NFDBITS))) -#define FD_ZERO(p) memset((void*)(p), 0, sizeof(*(p))) -#endif /* _SYS_TYPES_FD_SET */ - -int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); - -#endif /* __SYS_SELECT_H__ */ -- cgit v1.3.1