diff --git a/MDK_405_dr/.config b/MDK_405_dr/.config index 66b7771..9dc91ce 100644 --- a/MDK_405_dr/.config +++ b/MDK_405_dr/.config @@ -77,7 +77,7 @@ CONFIG_RT_USING_DEVICE=y # CONFIG_RT_USING_INTERRUPT_INFO is not set CONFIG_RT_USING_CONSOLE=y CONFIG_RT_CONSOLEBUF_SIZE=128 -CONFIG_RT_CONSOLE_DEVICE_NAME="uart1" +CONFIG_RT_CONSOLE_DEVICE_NAME="block_r" CONFIG_RT_VER_NUM=0x50000 CONFIG_ARCH_ARM=y CONFIG_RT_USING_CPU_FFS=y @@ -142,8 +142,8 @@ CONFIG_RT_DFS_ELM_MUTEX_TIMEOUT=3000 # CONFIG_RT_USING_DFS_ROMFS is not set # CONFIG_RT_USING_DFS_RAMFS is not set CONFIG_RT_USING_FAL=y -CONFIG_FAL_DEBUG_CONFIG=y -CONFIG_FAL_DEBUG=1 +# CONFIG_FAL_DEBUG_CONFIG is not set +CONFIG_FAL_DEBUG=0 CONFIG_FAL_PART_HAS_TABLE_CFG=y # CONFIG_FAL_USING_SFUD_PORT is not set # CONFIG_RT_USING_LWP is not set @@ -254,9 +254,7 @@ CONFIG_RT_USING_CPLUSPLUS=y # # Utilities # -CONFIG_RT_USING_RYM=y -# CONFIG_YMODEM_USING_CRC_TABLE is not set -CONFIG_YMODEM_USING_FILE_TRANSFER=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_VAR_EXPORT is not set diff --git a/MDK_405_dr/SConstruct b/MDK_405_dr/SConstruct index e21c682..3d31f99 100644 --- a/MDK_405_dr/SConstruct +++ b/MDK_405_dr/SConstruct @@ -60,7 +60,7 @@ objs.extend(SConscript(os.path.join(libraries_path_prefix, stm32_library, 'SCons # include drivers objs.extend(SConscript(os.path.join(libraries_path_prefix, 'HAL_Drivers', 'SConscript'))) -objs.extend(SConscript(os.path.join(SDK_ROOT, 'iap', 'SConscript'))) +# objs.extend(SConscript(os.path.join(SDK_ROOT, 'iap', 'SConscript'))) objs.extend(SConscript(os.path.join(SDK_ROOT, 'packages', 'SConscript'))) diff --git a/MDK_405_dr/board/board.c b/MDK_405_dr/board/board.c index 4394b6d..7cfba22 100644 --- a/MDK_405_dr/board/board.c +++ b/MDK_405_dr/board/board.c @@ -59,8 +59,8 @@ void SystemClock_Config(void) HAL_RCC_EnableCSS(); } -#include "shell.h" -INIT_APP_EXPORT(finsh_system_init); +//#include "shell.h" +//INIT_APP_EXPORT(finsh_system_init); extern void fal(uint8_t argc, char **argv); MSH_CMD_EXPORT(fal, FAL (Flash Abstraction Layer) operate.); diff --git a/MDK_405_dr/project.uvprojx b/MDK_405_dr/project.uvprojx index 16f1464..eea5274 100644 --- a/MDK_405_dr/project.uvprojx +++ b/MDK_405_dr/project.uvprojx @@ -10,7 +10,6 @@ rt-thread 0x4 ARM-ADS - 5060960::V5.06 update 7 (build 960)::.\ARMCC 0 @@ -339,7 +338,7 @@ __STDC_LIMIT_MACROS, USE_HAL_DRIVER, RT_USING_LIBC, __CLK_TCK=RT_TICK_PER_SECOND, __RTTHREAD__, STM32F405xx, RT_USING_ARM_LIBC - ..\rt-thread\components\drivers\usb\usbdevice;..\rt-thread\components\utilities\ymodem;..\rt-thread\components\libc\compilers\common\extension;..\rt-thread\components\libc\posix\io\poll;..\rt-thread\components\drivers\include;..\libraries\HAL_Drivers\CMSIS\Include;..\rt-thread\components\libc\posix\io\stdio;..\rt-thread\components\drivers\include;..\rt-thread\include;..\iap;..\rt-thread\components\drivers\spi;..\libraries\HAL_Drivers\config;board;..\rt-thread\components\dfs\include;..\rt-thread\components\drivers\include;..\libraries\STM32F4xx_HAL\CMSIS\Device\ST\STM32F4xx\Include;..\rt-thread\components\drivers\include;..\libraries\HAL_Drivers\drv_flash;board\CubeMX_Config\Inc;..\rt-thread\components\finsh;..\rt-thread\components\dfs\filesystems\elmfat;..\rt-thread\components\libc\cplusplus;..\rt-thread\libcpu\arm\cortex-m4;..\rt-thread\components\drivers\include;..\libraries\STM32F4xx_HAL\STM32F4xx_HAL_Driver\Inc;..\rt-thread\components\libc\posix\ipc;..\rt-thread\components\libc\compilers\common\include;..\rt-thread\components\drivers\include;.;..\rt-thread\components\libc\compilers\common\extension\fcntl\octal;..\rt-thread\components\fal\inc;..\rt-thread\libcpu\arm\common;..\libraries\HAL_Drivers + ..\rt-thread\components\drivers\usb\usbdevice;..\rt-thread\components\libc\compilers\common\extension;..\rt-thread\components\libc\posix\io\poll;..\rt-thread\components\drivers\include;..\libraries\HAL_Drivers\CMSIS\Include;..\rt-thread\components\libc\posix\io\stdio;..\rt-thread\components\drivers\include;..\rt-thread\include;..\rt-thread\components\drivers\spi;..\libraries\HAL_Drivers\config;board;..\rt-thread\components\dfs\include;..\rt-thread\components\drivers\include;..\libraries\STM32F4xx_HAL\CMSIS\Device\ST\STM32F4xx\Include;..\rt-thread\components\drivers\include;..\libraries\HAL_Drivers\drv_flash;board\CubeMX_Config\Inc;..\rt-thread\components\finsh;..\rt-thread\components\dfs\filesystems\elmfat;..\rt-thread\components\libc\cplusplus;..\rt-thread\libcpu\arm\cortex-m4;..\rt-thread\components\drivers\include;..\libraries\STM32F4xx_HAL\STM32F4xx_HAL_Driver\Inc;..\rt-thread\components\libc\posix\ipc;..\rt-thread\components\libc\compilers\common\include;..\rt-thread\components\drivers\include;.;..\rt-thread\components\libc\compilers\common\extension\fcntl\octal;..\rt-thread\components\fal\inc;..\rt-thread\libcpu\arm\common;..\libraries\HAL_Drivers @@ -428,20 +427,20 @@ CPlusPlus - - cxx_crt.cpp - 8 - ..\rt-thread\components\libc\cplusplus\cxx_crt.cpp - cxx_Mutex.cpp 8 ..\rt-thread\components\libc\cplusplus\cxx_Mutex.cpp - cxx_crt_init.c - 1 - ..\rt-thread\components\libc\cplusplus\cxx_crt_init.c + cxx_Thread.cpp + 8 + ..\rt-thread\components\libc\cplusplus\cxx_Thread.cpp + + + cxx_crt.cpp + 8 + ..\rt-thread\components\libc\cplusplus\cxx_crt.cpp cxx_Semaphore.cpp @@ -449,9 +448,9 @@ ..\rt-thread\components\libc\cplusplus\cxx_Semaphore.cpp - cxx_Thread.cpp - 8 - ..\rt-thread\components\libc\cplusplus\cxx_Thread.cpp + cxx_crt_init.c + 1 + ..\rt-thread\components\libc\cplusplus\cxx_crt_init.c @@ -638,6 +637,11 @@ Fal + + fal_flash.c + 1 + ..\rt-thread\components\fal\src\fal_flash.c + fal_rtt.c 1 @@ -653,11 +657,6 @@ 1 ..\rt-thread\components\fal\src\fal_partition.c - - fal_flash.c - 1 - ..\rt-thread\components\fal\src\fal_flash.c - @@ -730,16 +729,6 @@ - - IAP - - - iap.c - 1 - ..\iap\iap.c - - - Kernel @@ -1000,21 +989,6 @@ - - Utilities - - - ry_sy.c - 1 - ..\rt-thread\components\utilities\ymodem\ry_sy.c - - - ymodem.c - 1 - ..\rt-thread\components\utilities\ymodem\ymodem.c - - - diff --git a/MDK_405_dr/rtconfig.h b/MDK_405_dr/rtconfig.h index d102f28..a0d5a99 100644 --- a/MDK_405_dr/rtconfig.h +++ b/MDK_405_dr/rtconfig.h @@ -43,7 +43,7 @@ #define RT_USING_DEVICE #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 -#define RT_CONSOLE_DEVICE_NAME "uart1" +#define RT_CONSOLE_DEVICE_NAME "block_r" #define RT_VER_NUM 0x50000 #define ARCH_ARM #define RT_USING_CPU_FFS @@ -91,8 +91,7 @@ #define RT_DFS_ELM_REENTRANT #define RT_DFS_ELM_MUTEX_TIMEOUT 3000 #define RT_USING_FAL -#define FAL_DEBUG_CONFIG -#define FAL_DEBUG 1 +#define FAL_DEBUG 0 #define FAL_PART_HAS_TABLE_CFG /* Device Drivers */ @@ -143,8 +142,6 @@ /* Utilities */ -#define RT_USING_RYM -#define YMODEM_USING_FILE_TRANSFER /* RT-Thread online packages */ diff --git a/MDK_405_iap/.config b/MDK_405_iap/.config index 1cee8e0..82b98ff 100644 --- a/MDK_405_iap/.config +++ b/MDK_405_iap/.config @@ -110,8 +110,8 @@ CONFIG_FINSH_USING_DESCRIPTION=y CONFIG_FINSH_ARG_MAX=10 # CONFIG_RT_USING_DFS is not set CONFIG_RT_USING_FAL=y -CONFIG_FAL_DEBUG_CONFIG=y -CONFIG_FAL_DEBUG=1 +# CONFIG_FAL_DEBUG_CONFIG is not set +CONFIG_FAL_DEBUG=0 CONFIG_FAL_PART_HAS_TABLE_CFG=y # CONFIG_FAL_USING_SFUD_PORT is not set # CONFIG_RT_USING_LWP is not set diff --git a/MDK_405_iap/rtconfig.h b/MDK_405_iap/rtconfig.h index b4a4709..f25ed65 100644 --- a/MDK_405_iap/rtconfig.h +++ b/MDK_405_iap/rtconfig.h @@ -70,8 +70,7 @@ #define FINSH_USING_DESCRIPTION #define FINSH_ARG_MAX 10 #define RT_USING_FAL -#define FAL_DEBUG_CONFIG -#define FAL_DEBUG 1 +#define FAL_DEBUG 0 #define FAL_PART_HAS_TABLE_CFG /* Device Drivers */ diff --git a/iap/iap.c b/iap/iap.c index 350f275..f9bc9a0 100644 --- a/iap/iap.c +++ b/iap/iap.c @@ -149,23 +149,7 @@ static const char *port_list[] = { #define PORTS_NUM (sizeof(port_list)/sizeof(port_list[0])) -void rt_hw_shell_relink(const char *name, rt_uint32_t baud) -{ - struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT; - config.baud_rate = baud; - rt_device_t dev = rt_device_find(name); - RT_ASSERT(dev); - rt_device_control(dev, RT_DEVICE_CTRL_CONFIG, &config); - - rt_console_set_device(name); - - rt_thread_t tid = rt_thread_find(FINSH_THREAD_NAME); - if (tid) - { - rt_thread_resume(tid); - rt_schedule(); - } -} +void rt_hw_shell_relink(const char *name, rt_uint32_t baud); static rt_device_t _read_ports(rt_device_t ports[], rt_uint8_t want) { @@ -621,18 +605,6 @@ static void _cmd_iap(void) } MSH_CMD_EXPORT_ALIAS(_cmd_iap, iap, iap bootloader / app start); -static void shell_relink(int argc, char **argv) -{ - if (argc < 2) - { - rt_kprintf("%s prt_name\n", argv[0]); - return; - } - - rt_hw_shell_relink(argv[1], BAUD_RATE_460800); -} -MSH_CMD_EXPORT(shell_relink, relink msh to other port); - #ifdef IAP_DBG void iap_log() { @@ -650,19 +622,3 @@ void iap_log() } MSH_CMD_EXPORT(iap_log, iap log); #endif - -static struct rt_device blocked_reader_ = {0}; - -static rt_size_t _blocked_reader_read (rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size) -{ - return 0; -} - -int init_block_reader() -{ - blocked_reader_.read = _blocked_reader_read; - rt_device_register(&blocked_reader_, "block_r", RT_DEVICE_FLAG_RDWR); - - return 0; -} -INIT_BOARD_EXPORT(init_block_reader); diff --git a/libraries/HAL_Drivers/drv_common.c b/libraries/HAL_Drivers/drv_common.c index d37381a..81dd44c 100644 --- a/libraries/HAL_Drivers/drv_common.c +++ b/libraries/HAL_Drivers/drv_common.c @@ -214,3 +214,48 @@ void rt_hw_board_init(void) #endif } +static struct rt_device blocked_reader_ = {0}; + +static rt_size_t _blocked_reader_read (rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size) +{ + return 0; +} + +int init_block_reader() +{ + blocked_reader_.read = _blocked_reader_read; + rt_device_register(&blocked_reader_, "block_r", RT_DEVICE_FLAG_RDWR); + + return 0; +} +INIT_BOARD_EXPORT(init_block_reader); + +void rt_hw_shell_relink(const char *name, rt_uint32_t baud) +{ + struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT; + config.baud_rate = baud; + rt_device_t dev = rt_device_find(name); + RT_ASSERT(dev); + rt_device_control(dev, RT_DEVICE_CTRL_CONFIG, &config); + + rt_console_set_device(name); + + rt_thread_t tid = rt_thread_find(FINSH_THREAD_NAME); + if (tid) + { + rt_thread_resume(tid); + rt_schedule(); + } +} + +static void shell_relink(int argc, char **argv) +{ + if (argc < 2) + { + rt_kprintf("%s prt_name\n", argv[0]); + return; + } + + rt_hw_shell_relink(argv[1], BAUD_RATE_460800); +} +MSH_CMD_EXPORT(shell_relink, relink msh to other port);