From 3c8799cfeb457b0e1f5c06bb7eb045116cc94711 Mon Sep 17 00:00:00 2001 From: chenyingchun0312 Date: Sun, 19 Sep 2021 00:10:31 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90bsp/nrf5x=E3=80=91=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E9=A9=B1=E5=8A=A8=E4=BB=A3=E7=A0=81=EF=BC=8C=E6=B6=88=E9=99=A4?= =?UTF-8?q?warning=20&=20=E9=BB=98=E8=AE=A4=E5=85=B3=E9=97=ADlibc=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bsp/nrf5x/libraries/drivers/drv_flash.c | 2 +- bsp/nrf5x/libraries/drivers/drv_gpio.c | 10 ++-- bsp/nrf5x/libraries/drivers/drv_uart.c | 5 +- bsp/nrf5x/nrf52832/.config | 80 ++++++------------------- bsp/nrf5x/nrf52832/rtconfig.h | 25 +++++--- 5 files changed, 43 insertions(+), 79 deletions(-) diff --git a/bsp/nrf5x/libraries/drivers/drv_flash.c b/bsp/nrf5x/libraries/drivers/drv_flash.c index 61948fc373..f4ae713132 100644 --- a/bsp/nrf5x/libraries/drivers/drv_flash.c +++ b/bsp/nrf5x/libraries/drivers/drv_flash.c @@ -129,7 +129,7 @@ int mcu_flash_write(rt_uint32_t addr, const uint8_t *buf, size_t size) */ int mcu_flash_erase(rt_uint32_t addr, size_t size) { - nrfx_err_t result = RT_EOK; + nrfx_err_t result = NRFX_SUCCESS; uint32_t FirstPage = 0, NbOfPages = 0; diff --git a/bsp/nrf5x/libraries/drivers/drv_gpio.c b/bsp/nrf5x/libraries/drivers/drv_gpio.c index 7138261223..a948533207 100644 --- a/bsp/nrf5x/libraries/drivers/drv_gpio.c +++ b/bsp/nrf5x/libraries/drivers/drv_gpio.c @@ -446,8 +446,6 @@ void button_4_callback(void *args) void gpio_sample(void) { - rt_err_t err_code; - rt_pin_mode(DK_BOARD_LED_1, PIN_MODE_OUTPUT); rt_pin_mode(DK_BOARD_LED_2, PIN_MODE_OUTPUT); rt_pin_mode(DK_BOARD_LED_3, PIN_MODE_OUTPUT); @@ -458,19 +456,19 @@ void gpio_sample(void) rt_pin_write(DK_BOARD_LED_3, PIN_HIGH); rt_pin_write(DK_BOARD_LED_4, PIN_HIGH); - err_code = rt_pin_attach_irq(DK_BOARD_BUTTON_1, PIN_IRQ_MODE_FALLING, + rt_pin_attach_irq(DK_BOARD_BUTTON_1, PIN_IRQ_MODE_FALLING, button_1_callback, (void*) true); //true: hi_accuracy(IN_EVENT),false: lo_accuracy(PORT_EVENT) rt_pin_irq_enable(DK_BOARD_BUTTON_1, PIN_IRQ_ENABLE); - err_code = rt_pin_attach_irq(DK_BOARD_BUTTON_2, PIN_IRQ_MODE_FALLING, + rt_pin_attach_irq(DK_BOARD_BUTTON_2, PIN_IRQ_MODE_FALLING, button_2_callback, (void*) true); //true: hi_accuracy(IN_EVENT),false: lo_accuracy(PORT_EVENT) rt_pin_irq_enable(DK_BOARD_BUTTON_2, PIN_IRQ_ENABLE); - err_code = rt_pin_attach_irq(DK_BOARD_BUTTON_3, PIN_IRQ_MODE_FALLING, + rt_pin_attach_irq(DK_BOARD_BUTTON_3, PIN_IRQ_MODE_FALLING, button_3_callback, (void*) true); //true: hi_accuracy(IN_EVENT),false: lo_accuracy(PORT_EVENT) rt_pin_irq_enable(DK_BOARD_BUTTON_3, PIN_IRQ_ENABLE); - err_code = rt_pin_attach_irq(DK_BOARD_BUTTON_4, PIN_IRQ_MODE_FALLING, + rt_pin_attach_irq(DK_BOARD_BUTTON_4, PIN_IRQ_MODE_FALLING, button_4_callback, (void*) false); //true: hi_accuracy(IN_EVENT),false: lo_accuracy(PORT_EVENT) rt_pin_irq_enable(DK_BOARD_BUTTON_4, PIN_IRQ_ENABLE); } diff --git a/bsp/nrf5x/libraries/drivers/drv_uart.c b/bsp/nrf5x/libraries/drivers/drv_uart.c index 217d5fc3db..db78c003e3 100644 --- a/bsp/nrf5x/libraries/drivers/drv_uart.c +++ b/bsp/nrf5x/libraries/drivers/drv_uart.c @@ -240,14 +240,15 @@ static struct rt_uart_ops _uart_ops = { int rt_hw_uart_init(void) { struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT; + rt_err_t result = RT_EOK; #ifdef BSP_USING_UART0 _serial_0.config = config; _serial_0.ops = &_uart_ops; m_uart0_cfg.serial = &_serial_0; - rt_hw_serial_register(&_serial_0, "uart0", \ + result = rt_hw_serial_register(&_serial_0, "uart0", \ RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX, &m_uart0_cfg); #endif /* BSP_USING_UART0 */ - + return result; } #endif /* BSP_USING_UART */ diff --git a/bsp/nrf5x/nrf52832/.config b/bsp/nrf5x/nrf52832/.config index 5936d29741..4b0357f7a3 100644 --- a/bsp/nrf5x/nrf52832/.config +++ b/bsp/nrf5x/nrf52832/.config @@ -29,6 +29,7 @@ CONFIG_RT_TIMER_THREAD_STACK_SIZE=512 # # 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 @@ -73,6 +74,7 @@ CONFIG_RT_USING_DEVICE=y CONFIG_RT_USING_CONSOLE=y CONFIG_RT_CONSOLEBUF_SIZE=128 CONFIG_RT_CONSOLE_DEVICE_NAME="uart0" +# 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 @@ -94,34 +96,25 @@ 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=y 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 +# CONFIG_RT_USING_DFS is not set # # Device Drivers @@ -143,7 +136,7 @@ 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=y +# 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 @@ -167,15 +160,9 @@ CONFIG_RT_USING_MTD_NOR=y # # POSIX layer and C standard library # -CONFIG_RT_USING_LIBC=y +# CONFIG_RT_USING_LIBC is not set # 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_FIXED_TIMEZONE=8 +# CONFIG_RT_LIBC_USING_TIME is not set # # Network @@ -266,6 +253,7 @@ CONFIG_RT_LIBC_FIXED_TIMEZONE=8 # 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 @@ -406,47 +394,14 @@ CONFIG_RT_LIBC_FIXED_TIMEZONE=8 # 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=y -CONFIG_PKG_FAL_PATH="/packages/system/fal" -CONFIG_FAL_DEBUG_CONFIG=y -CONFIG_FAL_DEBUG=1 -CONFIG_FAL_PART_HAS_TABLE_CFG=y -# CONFIG_FAL_USING_SFUD_PORT is not set -CONFIG_PKG_USING_FAL_V00500=y -# CONFIG_PKG_USING_FAL_V00400 is not set -# CONFIG_PKG_USING_FAL_V00300 is not set -# CONFIG_PKG_USING_FAL_V00200 is not set -# CONFIG_PKG_USING_FAL_V00100 is not set -# CONFIG_PKG_USING_FAL_LATEST_VERSION is not set -CONFIG_PKG_FAL_VER="v0.5.0" -CONFIG_PKG_FAL_VER_NUM=0x00500 +# 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=y -CONFIG_PKG_LITTLEFS_PATH="/packages/system/littlefs" -# CONFIG_PKG_USING_LITTLEFS_V090 is not set -# CONFIG_PKG_USING_LITTLEFS_V170 is not set -# CONFIG_PKG_USING_LITTLEFS_V172 is not set -# CONFIG_PKG_USING_LITTLEFS_V201 is not set -# CONFIG_PKG_USING_LITTLEFS_V205 is not set -# CONFIG_PKG_USING_LITTLEFS_V214 is not set -# CONFIG_PKG_USING_LITTLEFS_V220 is not set -# CONFIG_PKG_USING_LITTLEFS_V221 is not set -# CONFIG_PKG_USING_LITTLEFS_V230 is not set -CONFIG_PKG_USING_LITTLEFS_LATEST_VERSION=y -CONFIG_LFS_READ_SIZE=256 -CONFIG_LFS_PROG_SIZE=256 -CONFIG_LFS_BLOCK_SIZE=4096 -CONFIG_LFS_CACHE_SIZE=256 -CONFIG_LFS_BLOCK_CYCLES=-1 -# CONFIG_DFS_LFS_READONLY is not set -CONFIG_LFS_THREADSAFE=y -CONFIG_LFS_LOOKAHEAD_MAX=128 -CONFIG_PKG_LITTLEFS_VER="latest" +# 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 @@ -539,6 +494,7 @@ CONFIG_PKG_NRFX_VER="latest" # 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 # # AI packages @@ -634,8 +590,8 @@ CONFIG_BSP_UART0_RX_PIN=8 CONFIG_BSP_UART0_TX_PIN=6 # CONFIG_BSP_USING_I2C is not set # CONFIG_BSP_USING_SPI is not set -CONFIG_BSP_USING_ON_CHIP_FLASH=y -CONFIG_BSP_USING_ON_CHIP_FS=y +# CONFIG_BSP_USING_ON_CHIP_FLASH is not set +# CONFIG_BSP_USING_ON_CHIP_FS is not set # # On-chip flash config diff --git a/bsp/nrf5x/nrf52832/rtconfig.h b/bsp/nrf5x/nrf52832/rtconfig.h index ee2691d102..8a012b7cd1 100644 --- a/bsp/nrf5x/nrf52832/rtconfig.h +++ b/bsp/nrf5x/nrf52832/rtconfig.h @@ -59,17 +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 FINSH_USING_MSH_ONLY +#define MSH_USING_BUILT_IN_COMMANDS +#define FINSH_USING_DESCRIPTION #define FINSH_ARG_MAX 10 /* Device virtual file system */ @@ -89,8 +89,6 @@ /* POSIX layer and C standard library */ -#define RT_USING_LIBC -#define RT_LIBC_FIXED_TIMEZONE 8 /* Network */ @@ -145,18 +143,29 @@ /* system packages */ +/* acceleration: Assembly language or algorithmic acceleration packages */ + + +/* Micrium: Micrium software products porting for RT-Thread */ + /* peripheral libraries and drivers */ #define PKG_USING_NRFX #define PKG_USING_NRFX_LATEST_VERSION +/* AI packages */ + + /* miscellaneous packages */ /* samples: kernel and components samples */ +/* entertainment: terminal games and other interesting software packages */ + + /* Hardware Drivers Config */ #define SOC_NRF52832