From 916bcc141f222360f01b4076eae36580d6948c03 Mon Sep 17 00:00:00 2001 From: thread-liu Date: Thu, 26 Nov 2020 15:11:48 +0800 Subject: [PATCH] [update] openamp. --- .../board/ports/OpenAMP/drv_openamp.c | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/bsp/stm32/stm32mp157a-st-ev1/board/ports/OpenAMP/drv_openamp.c b/bsp/stm32/stm32mp157a-st-ev1/board/ports/OpenAMP/drv_openamp.c index 2705f068a3..12651efa1a 100644 --- a/bsp/stm32/stm32mp157a-st-ev1/board/ports/OpenAMP/drv_openamp.c +++ b/bsp/stm32/stm32mp157a-st-ev1/board/ports/OpenAMP/drv_openamp.c @@ -12,6 +12,7 @@ #ifdef BSP_USING_OPENAMP +#include #include #include #include @@ -235,7 +236,10 @@ int rt_hw_openamp_init(void) rt_hw_openamp_register(&dev_openamp, "openamp", 0, NULL); - rt_console_set_device("openamp"); + if (RT_CONSOLE_DEVICE_NAME == "openamp") + { + rt_console_set_device(RT_CONSOLE_DEVICE_NAME); + } return RT_EOK; } @@ -289,4 +293,36 @@ static int creat_openamp_thread(void) } INIT_APP_EXPORT(creat_openamp_thread); +#ifdef FINSH_USING_MSH + +static int console(int argc, char **argv) +{ + rt_err_t result = RT_EOK; + + if (argc > 1) + { + if (!strcmp(argv[1], "set")) + { + rt_kprintf("console change to %s\n", argv[2]); + rt_console_set_device(argv[2]); + finsh_set_device(argv[2]); + } + else + { + rt_kprintf("Unknown command. Please enter 'console' for help\n"); + result = -RT_ERROR; + } + } + else + { + rt_kprintf("Usage: \n"); + rt_kprintf("console set - change console by name\n"); + result = -RT_ERROR; + } + return result; +} +MSH_CMD_EXPORT(console, set console name); + +#endif /* FINSH_USING_MSH */ + #endif