diff --git a/bsp/stm32/README.md b/bsp/stm32/README.md index fae71750f1..a993ce3423 100644 --- a/bsp/stm32/README.md +++ b/bsp/stm32/README.md @@ -58,6 +58,8 @@ STM32 系列 BSP 目前支持情况如下表所示: | **MP1 系列** | | | [stm32mp157a-st-discovery](stm32mp157a-st-discovery) | ST 官方 STM32MP157A-DK1 开发板 | | [stm32mp157a-st-ev1](stm32mp157a-st-ev1) | ST 官方 STM32MP157A-EV1 开发板 | +| **WB 系列** | | +| [stm32wb55-st-nucleo](stm32wb55-st-nucleo) | ST 官方 STM32WB55-nucleo 开发板 | 可以通过阅读相应 BSP 下的 README 来快速上手,如果想要使用 BSP 更多功能可参考 docs 文件夹下提供的说明文档,如下表所示: diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_adc.c b/bsp/stm32/libraries/HAL_Drivers/drv_adc.c index 93d3008d7d..4d44c968fc 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_adc.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_adc.c @@ -193,7 +193,7 @@ static rt_err_t stm32_get_adc_value(struct rt_adc_device *device, rt_uint32_t ch return -RT_ERROR; } -#if defined(SOC_SERIES_STM32MP1) || defined (SOC_SERIES_STM32H7) +#if defined(SOC_SERIES_STM32MP1) || defined (SOC_SERIES_STM32H7) || defined (SOC_SERIES_STM32WB) ADC_ChanConf.Rank = ADC_REGULAR_RANK_1; #else ADC_ChanConf.Rank = 1; @@ -205,22 +205,24 @@ static rt_err_t stm32_get_adc_value(struct rt_adc_device *device, rt_uint32_t ch ADC_ChanConf.SamplingTime = ADC_SAMPLETIME_55CYCLES_5; #elif defined(SOC_SERIES_STM32F2) || defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32F7) ADC_ChanConf.SamplingTime = ADC_SAMPLETIME_112CYCLES; -#elif defined(SOC_SERIES_STM32L4) || defined (SOC_SERIES_STM32WB) +#elif defined(SOC_SERIES_STM32L4) ADC_ChanConf.SamplingTime = ADC_SAMPLETIME_247CYCLES_5; #elif defined(SOC_SERIES_STM32MP1) ADC_ChanConf.SamplingTime = ADC_SAMPLETIME_810CYCLES_5; #elif defined(SOC_SERIES_STM32H7) ADC_ChanConf.SamplingTime = ADC_SAMPLETIME_64CYCLES_5; + #elif defined (SOC_SERIES_STM32WB) + ADC_ChanConf.SamplingTime = ADC_SAMPLETIME_2CYCLES_5; #endif #if defined(SOC_SERIES_STM32F2) || defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32F7) || defined(SOC_SERIES_STM32L4) || defined (SOC_SERIES_STM32WB) ADC_ChanConf.Offset = 0; #endif -#if defined(SOC_SERIES_STM32L4) || defined (SOC_SERIES_STM32WB) +#if defined(SOC_SERIES_STM32L4) ADC_ChanConf.OffsetNumber = ADC_OFFSET_NONE; ADC_ChanConf.SingleDiff = LL_ADC_SINGLE_ENDED; -#elif defined(SOC_SERIES_STM32MP1) || defined(SOC_SERIES_STM32H7) +#elif defined(SOC_SERIES_STM32MP1) || defined(SOC_SERIES_STM32H7) || defined (SOC_SERIES_STM32WB) ADC_ChanConf.OffsetNumber = ADC_OFFSET_NONE; /* ADC channel affected to offset number */ ADC_ChanConf.Offset = 0; ADC_ChanConf.SingleDiff = ADC_SINGLE_ENDED; /* ADC channel differential mode */ diff --git a/bsp/stm32/libraries/STM32WBxx_HAL/SConscript b/bsp/stm32/libraries/STM32WBxx_HAL/SConscript index a0353c076c..d2f47a473d 100644 --- a/bsp/stm32/libraries/STM32WBxx_HAL/SConscript +++ b/bsp/stm32/libraries/STM32WBxx_HAL/SConscript @@ -8,73 +8,73 @@ cwd = GetCurrentDir() src = Split(''' CMSIS/Device/ST/STM32WBxx/Source/Templates/system_stm32wbxx.c -STM32WBxx_HAL_Driver/Src/STM32wbxx_hal.c -STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_comp.c -STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_cortex.c -STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_crc.c -STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_crc_ex.c -STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_cryp.c -STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_cryp_ex.c -STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_dma.c -STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_dma_ex.c -STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_exti.c -STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_pwr.c -STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_pwr_ex.c -STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_rcc.c -STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_rcc_ex.c -STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_rng.c -STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_gpio.c +STM32WBxx_HAL_Driver/Src/stm32wbxx_hal.c +STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_comp.c +STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_cortex.c +STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_crc.c +STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_crc_ex.c +STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_cryp.c +STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_cryp_ex.c +STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_dma.c +STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_dma_ex.c +STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_exti.c +STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_pwr.c +STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_pwr_ex.c +STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_rcc.c +STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_rcc_ex.c +STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_rng.c +STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_gpio.c ''') if GetDepend(['RT_USING_SERIAL']): - src += ['STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_uart.c'] - src += ['STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_uart_ex.c'] - src += ['STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_usart.c'] - src += ['STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_usart_ex.c'] + src += ['STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_uart.c'] + src += ['STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_uart_ex.c'] + src += ['STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_usart.c'] + src += ['STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_usart_ex.c'] if GetDepend(['RT_USING_I2C']): - src += ['STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_i2c.c'] - src += ['STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_i2c_ex.c'] + src += ['STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_i2c.c'] + src += ['STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_i2c_ex.c'] if GetDepend(['RT_USING_SPI']): - src += ['STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_spi.c'] - src += ['STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_spi_ex.c'] - src += ['STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_qspi.c'] + src += ['STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_spi.c'] + src += ['STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_spi_ex.c'] + src += ['STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_qspi.c'] if GetDepend(['RT_USING_USB_HOST']) or GetDepend(['RT_USING_USB_DEVICE']): -# src += ['STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_hcd.c'] - src += ['STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_pcd.c'] - src += ['STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_pcd_ex.c'] -# src += ['STM32WBxx_HAL_Driver/Src/STM32wbxx_ll_usb.c'] +# src += ['STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_hcd.c'] + src += ['STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_pcd.c'] + src += ['STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_pcd_ex.c'] +# src += ['STM32WBxx_HAL_Driver/Src/stm32wbxx_ll_usb.c'] if GetDepend(['RT_USING_HWTIMER']) or GetDepend(['RT_USING_PWM']): - src += ['STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_lptim.c'] - src += ['STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_tim.c'] - src += ['STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_tim_ex.c'] + src += ['STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_lptim.c'] + src += ['STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_tim.c'] + src += ['STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_tim_ex.c'] if GetDepend(['RT_USING_ADC']): - src += ['STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_adc.c'] - src += ['STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_adc_ex.c'] + src += ['STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_adc.c'] + src += ['STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_adc_ex.c'] if GetDepend(['RT_USING_RTC']): - src += ['STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_rtc.c'] - src += ['STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_rtc_ex.c'] + src += ['STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_rtc.c'] + src += ['STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_rtc_ex.c'] if GetDepend(['RT_USING_WDT']): - src += ['STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_iwdg.c'] - src += ['STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_wwdg.c'] + src += ['STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_iwdg.c'] + src += ['STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_wwdg.c'] if GetDepend(['RT_USING_AUDIO']): - src += ['STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_sai.c'] - src += ['STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_sai_ex.c'] + src += ['STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_sai.c'] + src += ['STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_sai_ex.c'] if GetDepend(['RT_USING_PM']): - src += ['STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_lptim.c'] + src += ['STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_lptim.c'] if GetDepend(['BSP_USING_ON_CHIP_FLASH']): - src += ['STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_flash.c'] - src += ['STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_flash_ex.c'] -# src += ['STM32WBxx_HAL_Driver/Src/STM32wbxx_hal_flash_ramfunc.c'] + src += ['STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_flash.c'] + src += ['STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_flash_ex.c'] +# src += ['STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_flash_ramfunc.c'] diff --git a/bsp/stm32/stm32wb55-st-nucleo/.config b/bsp/stm32/stm32wb55-st-nucleo/.config index 6f880b4b87..fefa10fef8 100644 --- a/bsp/stm32/stm32wb55-st-nucleo/.config +++ b/bsp/stm32/stm32wb55-st-nucleo/.config @@ -65,7 +65,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="uart" +CONFIG_RT_CONSOLE_DEVICE_NAME="uart1" CONFIG_RT_VER_NUM=0x40003 CONFIG_ARCH_ARM=y CONFIG_RT_USING_CPU_FFS=y @@ -108,18 +108,7 @@ CONFIG_FINSH_ARG_MAX=10 # # Device virtual file system # -CONFIG_RT_USING_DFS=y -CONFIG_DFS_USING_WORKDIR=y -CONFIG_DFS_FILESYSTEMS_MAX=2 -CONFIG_DFS_FILESYSTEM_TYPES_MAX=2 -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_UFFS is not set -# CONFIG_RT_USING_DFS_JFFS2 is not set +# CONFIG_RT_USING_DFS is not set # # Device Drivers @@ -164,11 +153,7 @@ CONFIG_RT_USING_PIN=y # 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 # diff --git a/bsp/stm32/stm32wb55-st-nucleo/board/linker_scripts/link.lds b/bsp/stm32/stm32wb55-st-nucleo/board/linker_scripts/link.lds index b4936af7aa..fb39eb5783 100644 --- a/bsp/stm32/stm32wb55-st-nucleo/board/linker_scripts/link.lds +++ b/bsp/stm32/stm32wb55-st-nucleo/board/linker_scripts/link.lds @@ -5,7 +5,7 @@ /* Program Entry, set to mark it as "used" and avoid gc */ MEMORY { - ROM (rx) : ORIGIN = 0x08000000, LENGTH = 1024 /* 1024KB flash */ + ROM (rx) : ORIGIN = 0x08000000, LENGTH = 1024k /* 1024KB flash */ RAM (rw) : ORIGIN = 0x20000000, LENGTH = 192k /* 192KB sram */ } ENTRY(Reset_Handler) @@ -153,4 +153,10 @@ SECTIONS .debug_funcnames 0 : { *(.debug_funcnames) } .debug_typenames 0 : { *(.debug_typenames) } .debug_varnames 0 : { *(.debug_varnames) } + + .ARM.attributes 0 : { *(.ARM.attributes) } + MAPPING_TABLE (NOLOAD) : { *(MAPPING_TABLE) } >RAM_SHARED + MB_MEM1 (NOLOAD) : { *(MB_MEM1) } >RAM_SHARED + MB_MEM2 (NOLOAD) : { _sMB_MEM2 = . ; *(MB_MEM2) ; _eMB_MEM2 = . ; } >RAM_SHARED + } diff --git a/bsp/stm32/stm32wb55-st-nucleo/rtconfig.h b/bsp/stm32/stm32wb55-st-nucleo/rtconfig.h index 7ba6a2581b..c21b1c4357 100644 --- a/bsp/stm32/stm32wb55-st-nucleo/rtconfig.h +++ b/bsp/stm32/stm32wb55-st-nucleo/rtconfig.h @@ -40,7 +40,7 @@ #define RT_USING_DEVICE #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 -#define RT_CONSOLE_DEVICE_NAME "uart" +#define RT_CONSOLE_DEVICE_NAME "uart1" #define RT_VER_NUM 0x40003 #define ARCH_ARM #define RT_USING_CPU_FFS @@ -74,12 +74,6 @@ /* 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_FD_MAX 16 -#define RT_USING_DFS_DEVFS /* Device Drivers */ @@ -96,7 +90,7 @@ /* POSIX layer and C standard library */ #define RT_USING_LIBC -#define RT_USING_POSIX + /* Network */