diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index 3b657b3f65..8383ab5977 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -109,6 +109,7 @@ jobs: - {RTT_BSP: "stm32/stm32h747-st-discovery", RTT_TOOL_CHAIN: "sourcery-arm"} - {RTT_BSP: "stm32/stm32h750-artpi-h750", RTT_TOOL_CHAIN: "sourcery-arm"} - {RTT_BSP: "stm32/stm32l4r9-st-eval", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "stm32/stm32l4r9-st-sensortile-box", RTT_TOOL_CHAIN: "sourcery-arm"} - {RTT_BSP: "stm32/stm32l010-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"} - {RTT_BSP: "stm32/stm32l053-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"} - {RTT_BSP: "stm32/stm32l412-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"} diff --git a/bsp/nrf5x/libraries/drivers/drv_wdt.c b/bsp/nrf5x/libraries/drivers/drv_wdt.c index 168b1b8ac5..43769b2c10 100644 --- a/bsp/nrf5x/libraries/drivers/drv_wdt.c +++ b/bsp/nrf5x/libraries/drivers/drv_wdt.c @@ -6,6 +6,7 @@ * Change Logs: * Date Author Notes * 2020-08-18 ylz0923 first version + * 2021-08-12 chenyingchun optimize wdt_control arg usage */ #include @@ -42,7 +43,7 @@ static rt_err_t wdt_control(rt_watchdog_t *wdt, int cmd, void *arg) break; /* set watchdog timeout */ case RT_DEVICE_CTRL_WDT_SET_TIMEOUT: - nrf5x_wdt_cfg.reload_value = (rt_uint32_t)arg * 1000; + nrf5x_wdt_cfg.reload_value = (*((rt_uint32_t*)arg)) * 1000; break; case RT_DEVICE_CTRL_WDT_GET_TIMEOUT: *((rt_uint32_t*)arg) = nrf5x_wdt_cfg.reload_value; @@ -79,9 +80,10 @@ INIT_BOARD_EXPORT(rt_wdt_init); static int wdt_sample(int argc, char *argv[]) { + rt_uint32_t timeout = 2; /* 溢出时间,单位:秒*/ rt_device_t wdt = rt_device_find("wdt"); rt_device_init(wdt); - rt_device_control(wdt, RT_DEVICE_CTRL_WDT_SET_TIMEOUT, (void *)2); + rt_device_control(wdt, RT_DEVICE_CTRL_WDT_SET_TIMEOUT, &timeout); rt_device_control(wdt, RT_DEVICE_CTRL_WDT_START, RT_NULL); } MSH_CMD_EXPORT(wdt_sample, wdt sample); diff --git a/bsp/stm32/libraries/STM32L4xx_HAL/CMSIS/Device/ST/STM32L4xx/Source/Templates/arm/startup_stm32l4r9xx.s b/bsp/stm32/libraries/STM32L4xx_HAL/CMSIS/Device/ST/STM32L4xx/Source/Templates/arm/startup_stm32l4r9xx.s index 8c35ea53ee..c476aa275f 100644 --- a/bsp/stm32/libraries/STM32L4xx_HAL/CMSIS/Device/ST/STM32L4xx/Source/Templates/arm/startup_stm32l4r9xx.s +++ b/bsp/stm32/libraries/STM32L4xx_HAL/CMSIS/Device/ST/STM32L4xx/Source/Templates/arm/startup_stm32l4r9xx.s @@ -10,26 +10,25 @@ ;* calls main()). ;* After Reset the Cortex-M4 processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. -;* <<< Use Configuration Wizard in Context Menu >>> ;******************************************************************************* ;* ;*

© Copyright (c) 2017 STMicroelectronics. ;* All rights reserved.

;* -;* This software component is licensed by ST under BSD 3-Clause license, +;* This software component is licensed by ST under Apache License, Version 2.0, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: -;* opensource.org/licenses/BSD-3-Clause +;* opensource.org/licenses/Apache-2.0 ;* ;******************************************************************************* -; +;* <<< Use Configuration Wizard in Context Menu >>> ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; Stack Configuration ; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; -Stack_Size EQU 0x400; +Stack_Size EQU 0x400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size @@ -40,7 +39,7 @@ __initial_sp ; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; -Heap_Size EQU 0x200; +Heap_Size EQU 0x200 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base diff --git a/bsp/stm32/stm32l496-st-nucleo/README_zh.md b/bsp/stm32/stm32l496-st-nucleo/README_zh.md index d07e0e83c8..90a2f03160 100644 --- a/bsp/stm32/stm32l496-st-nucleo/README_zh.md +++ b/bsp/stm32/stm32l496-st-nucleo/README_zh.md @@ -96,6 +96,10 @@ msh > 本章节更多详细的介绍请参考 [STM32 系列 BSP 外设驱动使用教程](../docs/STM32系列BSP外设驱动使用教程.md)。 + + +5. USBD CDC使用,参考文章[STM32L496 USB CDC适配](https://club.rt-thread.org/ask/article/2959.html) + ## 注意事项 - 开机时如果不能打印 RT-Thread 版本信息,请重新选择 PC 端串口调试软件的串口号或将 BSP 中串口的 GPIO 速率调低 diff --git a/bsp/stm32/stm32l496-st-nucleo/applications/SConscript b/bsp/stm32/stm32l496-st-nucleo/applications/SConscript index f45bd21bc2..a868c92232 100644 --- a/bsp/stm32/stm32l496-st-nucleo/applications/SConscript +++ b/bsp/stm32/stm32l496-st-nucleo/applications/SConscript @@ -6,12 +6,6 @@ src = Split(''' main.c ''') -if GetDepend(['BSP_USING_SPI_LCD']): - src += ['lcd_sample.c'] - -if GetDepend(['PKG_USING_NRF24L01']): - src += ['nrf24l01_init.c'] - CPPPATH = [str(Dir('#')), cwd] group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH) diff --git a/bsp/stm32/stm32l496-st-nucleo/board/Kconfig b/bsp/stm32/stm32l496-st-nucleo/board/Kconfig index 10594671ea..6a2a2c0b4c 100644 --- a/bsp/stm32/stm32l496-st-nucleo/board/Kconfig +++ b/bsp/stm32/stm32l496-st-nucleo/board/Kconfig @@ -60,6 +60,11 @@ menu "On-chip Peripheral Drivers" config BSP_USING_ON_CHIP_FLASH bool "Enable on-chip FLASH" default n + + config BSP_USING_USBD + bool "Enable OTGFS as USB device" + select RT_USING_USB_DEVICE + default n source "../libraries/HAL_Drivers/Kconfig" diff --git a/bsp/stm32/stm32l4r9-st-sensortile-box/.config b/bsp/stm32/stm32l4r9-st-sensortile-box/.config new file mode 100644 index 0000000000..fea9d8c932 --- /dev/null +++ b/bsp/stm32/stm32l4r9-st-sensortile-box/.config @@ -0,0 +1,578 @@ +# +# 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 is not set + +# +# kservice optimization +# +# CONFIG_RT_KSERVICE_USING_STDLIB is not set +# CONFIG_RT_KSERVICE_USING_TINY_SIZE is not set +CONFIG_RT_DEBUG=y +CONFIG_RT_DEBUG_COLOR=y +# 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=y +# CONFIG_RT_USING_NOHEAP is not set +# CONFIG_RT_USING_SMALL_MEM is not set +# CONFIG_RT_USING_SLAB is not set +CONFIG_RT_USING_MEMHEAP_AS_HEAP=y +# 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=256 +CONFIG_RT_CONSOLE_DEVICE_NAME="uart1" +# CONFIG_RT_PRINTF_LONGLONG is not set +CONFIG_RT_VER_NUM=0x40004 +CONFIG_ARCH_ARM=y +CONFIG_RT_USING_CPU_FFS=y +CONFIG_ARCH_ARM_CORTEX_M=y +CONFIG_ARCH_ARM_CORTEX_M4=y +# 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_FINSH_THREAD_NAME="tshell" +CONFIG_FINSH_USING_HISTORY=y +CONFIG_FINSH_HISTORY_LINES=5 +CONFIG_FINSH_USING_SYMTAB=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 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 is not set +# CONFIG_RT_USING_PTHREADS is not set +# CONFIG_RT_LIBC_USING_TIME is not set + +# +# 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 +# CONFIG_RT_USING_LWP 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 + +# +# 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 + +# +# 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 + +# +# 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_SEGGER_RTT_V100 is not set +# CONFIG_PKG_USING_SEGGER_RTT_V110 is not set +# CONFIG_PKG_USING_SEGGER_RTT_LATEST_VERSION 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_PERSIMMON 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 + +# +# 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 + +# +# 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 +# +# 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 + +# +# 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_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 + +# +# entertainment: terminal games and other interesting software packages +# +# 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_ACLOCK 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_SOC_FAMILY_STM32=y +CONFIG_SOC_SERIES_STM32L4=y + +# +# Hardware Drivers Config +# +CONFIG_SOC_STM32L4R9ZI=y + +# +# On-chip Peripheral Drivers +# +CONFIG_BSP_USING_GPIO=y +CONFIG_BSP_USING_UART=y +CONFIG_BSP_USING_UART1=y +# CONFIG_BSP_USING_USBD is not set +# CONFIG_BSP_USING_CRC is not set +# CONFIG_BSP_USING_RNG is not set +# CONFIG_BSP_USING_UDID is not set diff --git a/bsp/stm32/stm32l4r9-st-sensortile-box/.gitignore b/bsp/stm32/stm32l4r9-st-sensortile-box/.gitignore new file mode 100644 index 0000000000..7221bde019 --- /dev/null +++ b/bsp/stm32/stm32l4r9-st-sensortile-box/.gitignore @@ -0,0 +1,42 @@ +*.pyc +*.map +*.dblite +*.elf +*.bin +*.hex +*.axf +*.exe +*.pdb +*.idb +*.ilk +*.old +build +Debug +documentation/html +packages/ +*~ +*.o +*.obj +*.out +*.bak +*.dep +*.lib +*.i +*.d +.DS_Stor* +.config 3 +.config 4 +.config 5 +Midea-X1 +*.uimg +GPATH +GRTAGS +GTAGS +.vscode +JLinkLog.txt +JLinkSettings.ini +DebugConfig/ +RTE/ +settings/ +*.uvguix* +cconfig.h diff --git a/bsp/stm32/stm32l4r9-st-sensortile-box/Kconfig b/bsp/stm32/stm32l4r9-st-sensortile-box/Kconfig new file mode 100644 index 0000000000..8cbc7b71a8 --- /dev/null +++ b/bsp/stm32/stm32l4r9-st-sensortile-box/Kconfig @@ -0,0 +1,21 @@ +mainmenu "RT-Thread Configuration" + +config BSP_DIR + string + option env="BSP_ROOT" + default "." + +config RTT_DIR + string + option env="RTT_ROOT" + default "../../.." + +config PKGS_DIR + string + option env="PKGS_ROOT" + default "packages" + +source "$RTT_DIR/Kconfig" +source "$PKGS_DIR/Kconfig" +source "../libraries/Kconfig" +source "board/Kconfig" diff --git a/bsp/stm32/stm32l4r9-st-sensortile-box/README.md b/bsp/stm32/stm32l4r9-st-sensortile-box/README.md new file mode 100644 index 0000000000..c09f2a0552 --- /dev/null +++ b/bsp/stm32/stm32l4r9-st-sensortile-box/README.md @@ -0,0 +1,123 @@ +# STM32L4R9ZI-MKSBOX1V1 开发板bsp说明 + +## 简介 + +由 supperthomas 为 STM32L4R9ZI-MKSBOX1V1 开发板提供的 BSP (板级支持包) 说明。 + +主要内容如下: + +- 开发板资源介绍 +- BSP 快速上手 +- 进阶使用方法 + +通过阅读快速上手章节开发者可以快速地上手该 BSP,将 RT-Thread 运行在开发板上。在进阶使用指南章节,将会介绍更多高级功能,帮助开发者利用 RT-Thread 驱动更多板载资源。 + +## 开发板介绍 + +开发板外观如下图所示: + +![board](figures/board.png) + +该开发板常用 **板载资源** 如下: + +- MCU:STM32L4R9,主频 120MHz,2048KB FLASH ,640KB RAM +- 常用外设 + - 状态指示灯:2个,LED1(PB5)LED 2(PF2) + - UART1: RX(PA9) TX(PA10) + - 按键:1个,USER_PB1(PG1) + - 板载 BLE 模组SPBTLE-1S(SPI/UART) + - 温度传感器STTS751(I2C3_SDA PG8 I2C3_SCL PG7 ) + - 温湿度HTS221 压力传感器LPS22HH I2C3_SDA(PB7) I2C3_SCL(PB6) + - 加速度LIS2DW12 CS_ACC(PE11) + - +- 常用接口:SD 卡接口、USB OTG Micro USB 接口 +- 调试接口,ST-LINK Micro USB 接口 +开发板更多详细信息请参考 ST 的 [STM32L4R9ZI-MKSBOX1V1](https://www.st.com/zh/evaluation-tools/steval-mksbox1v1.html)介绍。 + +## 外设支持 + +本 BSP 目前对外设的支持情况如下: + +| **板载外设** | **支持情况** | **备注** | +| ---- | ---- | ---- | +| 板载 ST-LINK 转串口 | 支持 | RX(PA9) TX(PA10) 需要外接ST-LINK 有ST-LINK插槽 | +| BLE 模组SPBTLE-1S | 待支持 | | +| 传感器 | 待支持 | | +| | | | +| **片上外设** | **支持情况** | **备注** | +| GPIO | 支持 | LED1(PB5)LED 2(PF2) USER_PB1(PG1) | +| UART | 支持 | UART1: RX(PA9) TX(PA10) CONSOLE | +| USBD | 支持 | USBD CDC 虚拟串口已验证 | +| SPI1 | 待支持 | SPI1_MOSI(PE15) SPI1_MISO(PE14) SPI1_CLK(PE13) | +| SPI2 | 待支持 | SPI2_MOSI(PC3) SPI2_MISO(PD3) SPI2_SCK(PD1) SPI2_CS(PD0) | +| IIC1 | 待支持 | I2C1_SCL(PB6) I2C_SDA(PB7) | + + +## 使用说明 + +使用说明分为如下两个章节: + +- 快速上手 + + 本章节是为刚接触 RT-Thread 的新手准备的使用说明,遵循简单的步骤即可将 RT-Thread 操作系统运行在该开发板上,看到实验效果 。 + +- 进阶使用 + + 本章节是为需要在 RT-Thread 操作系统上使用更多开发板资源的开发者准备的。通过使用 ENV 工具对 BSP 进行配置,可以开启更多板载资源,实现更多高级功能。 + + +### 快速上手 + +本 BSP 为开发者提供 MDK5 和 IAR 工程,并且支持 GCC 开发环境。下面以 MDK5 开发环境为例,介绍如何将系统运行起来。 + +#### 硬件连接 + +使用数据线连接开发板到 PC,打开电源开关。 + +#### 编译下载 + +双击 project.uvprojx 文件,打开 MDK5 工程,编译并下载程序到开发板。 + +> 工程默认配置使用 STLINK 仿真器下载程序,你可以在你的其他NUCLEO板上接一个STLINK到开发板的SWD接口上 + +下载程序成功之后,系统会自动运行,观察开发板上 LED 的运行效果, LED 会周期性闪烁。 + +连接开发板对应串口到 PC , 在终端工具里打开相应的串口(由STLINK连接的串口)(115200-8-1-N),复位设备后,可以看到 RT-Thread 的输出信息: + +```bash + \ | / +- RT - Thread Operating System + / | \ 4.0.3 build Mar 22 2020 + 2006 - 2020 Copyright by rt-thread team +msh > +``` +### 进阶使用 + +此 BSP 默认只开启了 GPIO 和 串口1的功能,如果需使用 SD 卡、Flash 等更多高级功能,需要利用 ENV 工具对BSP 进行配置,步骤如下: + +1. 在 bsp 下打开 env 工具。 + +2. 输入`menuconfig`命令配置工程,配置好之后保存退出。 + +3. 输入`pkgs --update`命令更新软件包。 + +4. 输入`scons --target=mdk5/iar` 命令重新生成工程。 + +本章节更多详细的介绍请参考 [STM32 系列 BSP 外设驱动使用教程](../docs/STM32系列BSP外设驱动使用教程.md)。 + +## 注意事项 + +- 调试串口为串口1 映射到PA9 PA10,由ST-LINK连接 +- 板子上的外接接口有限,建议使用官方提供的转接板ST-LINK进行调试,也可以用DFU的方式进行烧入 + + +## 联系人信息 + +- 维护人: + + - [super_mcu] 邮箱:[super_mcu@qq.com](mailto:super_mcu@qq.com) + +- 更详细的资料会整理在 + + [STM32L4R9ZI-MKSBOX1V1](https://github.com/supperthomas/BSP_BOARD_STM32L4R9ZI_MKSBOX1V1.git) + diff --git a/bsp/stm32/stm32l4r9-st-sensortile-box/SConscript b/bsp/stm32/stm32l4r9-st-sensortile-box/SConscript new file mode 100644 index 0000000000..20f7689c53 --- /dev/null +++ b/bsp/stm32/stm32l4r9-st-sensortile-box/SConscript @@ -0,0 +1,15 @@ +# for module compiling +import os +Import('RTT_ROOT') +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/bsp/stm32/stm32l4r9-st-sensortile-box/SConstruct b/bsp/stm32/stm32l4r9-st-sensortile-box/SConstruct new file mode 100644 index 0000000000..44df6b339e --- /dev/null +++ b/bsp/stm32/stm32l4r9-st-sensortile-box/SConstruct @@ -0,0 +1,60 @@ +import os +import sys +import rtconfig + +if os.getenv('RTT_ROOT'): + RTT_ROOT = os.getenv('RTT_ROOT') +else: + RTT_ROOT = os.path.normpath(os.getcwd() + '/../../..') + +sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')] +try: + from building import * +except: + print('Cannot found RT-Thread root directory, please check RTT_ROOT') + print(RTT_ROOT) + exit(-1) + +TARGET = 'rtthread.' + rtconfig.TARGET_EXT + +DefaultEnvironment(tools=[]) +env = Environment(tools = ['mingw'], + AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, + CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS, + AR = rtconfig.AR, ARFLAGS = '-rc', + CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS, + LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS) +env.PrependENVPath('PATH', rtconfig.EXEC_PATH) + +if rtconfig.PLATFORM == 'iar': + env.Replace(CCCOM = ['$CC $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -o $TARGET $SOURCES']) + env.Replace(ARFLAGS = ['']) + env.Replace(LINKCOM = env["LINKCOM"] + ' --map rtthread.map') + +Export('RTT_ROOT') +Export('rtconfig') + +SDK_ROOT = os.path.abspath('./') + +if os.path.exists(SDK_ROOT + '/libraries'): + libraries_path_prefix = SDK_ROOT + '/libraries' +else: + libraries_path_prefix = os.path.dirname(SDK_ROOT) + '/libraries' + +SDK_LIB = libraries_path_prefix +Export('SDK_LIB') + +# prepare building environment +objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False) + +stm32_library = 'STM32L4xx_HAL' +rtconfig.BSP_LIBRARY_TYPE = stm32_library + +# include libraries +objs.extend(SConscript(os.path.join(libraries_path_prefix, stm32_library, 'SConscript'))) + +# include drivers +objs.extend(SConscript(os.path.join(libraries_path_prefix, 'HAL_Drivers', 'SConscript'))) + +# make a building +DoBuilding(TARGET, objs) diff --git a/bsp/stm32/stm32l4r9-st-sensortile-box/applications/SConscript b/bsp/stm32/stm32l4r9-st-sensortile-box/applications/SConscript new file mode 100644 index 0000000000..3ec48cc840 --- /dev/null +++ b/bsp/stm32/stm32l4r9-st-sensortile-box/applications/SConscript @@ -0,0 +1,9 @@ +from building import * + +cwd = GetCurrentDir() +src = Glob('*.c') +CPPPATH = [cwd] + +group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH) + +Return('group') diff --git a/bsp/stm32/stm32l4r9-st-sensortile-box/applications/main.c b/bsp/stm32/stm32l4r9-st-sensortile-box/applications/main.c new file mode 100644 index 0000000000..e7f57327e0 --- /dev/null +++ b/bsp/stm32/stm32l4r9-st-sensortile-box/applications/main.c @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2021-08-09 supperthomas first version + */ + +#include +#include +#include + +/* defined the LED0 pin: PB15 */ +#define LED0_PIN GET_PIN(B, 15) + +int main(void) +{ + /* set LED0 pin mode to output */ + rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT); + while (1) + { + rt_pin_write(LED0_PIN, PIN_HIGH); + rt_thread_mdelay(500); + rt_pin_write(LED0_PIN, PIN_LOW); + rt_thread_mdelay(500); + } +} diff --git a/bsp/stm32/stm32l4r9-st-sensortile-box/board/CubeMX_Config/.mxproject b/bsp/stm32/stm32l4r9-st-sensortile-box/board/CubeMX_Config/.mxproject new file mode 100644 index 0000000000..682d6171c6 --- /dev/null +++ b/bsp/stm32/stm32l4r9-st-sensortile-box/board/CubeMX_Config/.mxproject @@ -0,0 +1,70 @@ +[PreviousLibFiles] +LibFiles=Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_pcd.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_pcd_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_ll_usb.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_def.h;Drivers/STM32L4xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_i2c.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_i2c_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rcc.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rcc_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_flash.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_flash_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_flash_ramfunc.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_gpio.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_gpio_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_dma.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_dma_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_pwr.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_pwr_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_cortex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_exti.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_adc.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_ll_adc.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_adc_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_dfsdm.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_dfsdm_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rtc.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rtc_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_ll_sdmmc.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_sd.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_sd_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_spi.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_spi_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart_ex.h;Middlewares/Third_Party/FatFs/src/diskio.h;Middlewares/Third_Party/FatFs/src/ff.h;Middlewares/Third_Party/FatFs/src/ff_gen_drv.h;Middlewares/Third_Party/FatFs/src/integer.h;Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_core.h;Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_ctlreq.h;Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_def.h;Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_ioreq.h;Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc/usbd_cdc.h;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pcd.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pcd_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_ll_usb.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ramfunc.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_gpio.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_cortex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_exti.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_adc.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_adc_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dfsdm.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dfsdm_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rtc.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rtc_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_ll_sdmmc.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_sd.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_sd_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_spi.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_spi_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart_ex.c;Middlewares/Third_Party/FatFs/src/diskio.c;Middlewares/Third_Party/FatFs/src/ff.c;Middlewares/Third_Party/FatFs/src/ff_gen_drv.c;Middlewares/Third_Party/FatFs/src/option/syscall.c;Middlewares/Third_Party/FatFs/src/option/ccsbcs.c;Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c;Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c;Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c;Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_pcd.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_pcd_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_ll_usb.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_def.h;Drivers/STM32L4xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_i2c.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_i2c_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rcc.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rcc_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_flash.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_flash_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_flash_ramfunc.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_gpio.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_gpio_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_dma.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_dma_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_pwr.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_pwr_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_cortex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_exti.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_adc.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_ll_adc.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_adc_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_dfsdm.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_dfsdm_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rtc.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rtc_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_ll_sdmmc.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_sd.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_sd_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_spi.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_spi_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart_ex.h;Middlewares/Third_Party/FatFs/src/diskio.h;Middlewares/Third_Party/FatFs/src/ff.h;Middlewares/Third_Party/FatFs/src/ff_gen_drv.h;Middlewares/Third_Party/FatFs/src/integer.h;Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_core.h;Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_ctlreq.h;Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_def.h;Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_ioreq.h;Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc/usbd_cdc.h;Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l4r9xx.h;Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l4xx.h;Drivers/CMSIS/Device/ST/STM32L4xx/Include/system_stm32l4xx.h;Drivers/CMSIS/Device/ST/STM32L4xx/Source/Templates/system_stm32l4xx.c;Drivers/CMSIS/Include/cmsis_armcc.h;Drivers/CMSIS/Include/cmsis_armclang.h;Drivers/CMSIS/Include/cmsis_armclang_ltm.h;Drivers/CMSIS/Include/cmsis_compiler.h;Drivers/CMSIS/Include/cmsis_gcc.h;Drivers/CMSIS/Include/cmsis_iccarm.h;Drivers/CMSIS/Include/cmsis_version.h;Drivers/CMSIS/Include/core_armv81mml.h;Drivers/CMSIS/Include/core_armv8mbl.h;Drivers/CMSIS/Include/core_armv8mml.h;Drivers/CMSIS/Include/core_cm0.h;Drivers/CMSIS/Include/core_cm0plus.h;Drivers/CMSIS/Include/core_cm1.h;Drivers/CMSIS/Include/core_cm23.h;Drivers/CMSIS/Include/core_cm3.h;Drivers/CMSIS/Include/core_cm33.h;Drivers/CMSIS/Include/core_cm35p.h;Drivers/CMSIS/Include/core_cm4.h;Drivers/CMSIS/Include/core_cm7.h;Drivers/CMSIS/Include/core_sc000.h;Drivers/CMSIS/Include/core_sc300.h;Drivers/CMSIS/Include/mpu_armv7.h;Drivers/CMSIS/Include/mpu_armv8.h;Drivers/CMSIS/Include/tz_context.h; + +[PreviousUsedKeilFiles] +SourceFiles=..\Core\Src\main.c;..\Core\Src\gpio.c;..\Core\Src\adc.c;..\Core\Src\dfsdm.c;..\Core\Src\dma.c;..\FATFS\Target\bsp_driver_sd.c;..\FATFS\Target\sd_diskio.c;..\FATFS\App\fatfs.c;..\FATFS\Target\fatfs_platform.c;..\Core\Src\i2c.c;..\Core\Src\rtc.c;..\Core\Src\sdmmc.c;..\Core\Src\spi.c;..\Core\Src\tim.c;..\Core\Src\usart.c;..\USB_DEVICE\App\usb_device.c;..\USB_DEVICE\Target\usbd_conf.c;..\USB_DEVICE\App\usbd_desc.c;..\USB_DEVICE\App\usbd_cdc_if.c;..\Core\Src\stm32l4xx_it.c;..\Core\Src\stm32l4xx_hal_msp.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pcd.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pcd_ex.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_ll_usb.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c_ex.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc_ex.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ex.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ramfunc.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_gpio.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma_ex.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr_ex.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_cortex.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_exti.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_adc.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_adc_ex.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dfsdm.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dfsdm_ex.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rtc.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rtc_ex.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_ll_sdmmc.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_sd.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_sd_ex.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_spi.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_spi_ex.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim_ex.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart_ex.c;..\Middlewares/Third_Party/FatFs/src/diskio.c;..\Middlewares/Third_Party/FatFs/src/ff.c;..\Middlewares/Third_Party/FatFs/src/ff_gen_drv.c;..\Middlewares/Third_Party/FatFs/src/option/syscall.c;..\Middlewares/Third_Party/FatFs/src/option/ccsbcs.c;..\Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c;..\Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c;..\Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c;..\Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c;..\Core\Src/system_stm32l4xx.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pcd.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pcd_ex.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_ll_usb.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c_ex.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc_ex.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ex.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ramfunc.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_gpio.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma_ex.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr_ex.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_cortex.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_exti.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_adc.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_adc_ex.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dfsdm.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dfsdm_ex.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rtc.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rtc_ex.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_ll_sdmmc.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_sd.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_sd_ex.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_spi.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_spi_ex.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim_ex.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c;..\Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart_ex.c;..\Middlewares/Third_Party/FatFs/src/diskio.c;..\Middlewares/Third_Party/FatFs/src/ff.c;..\Middlewares/Third_Party/FatFs/src/ff_gen_drv.c;..\Middlewares/Third_Party/FatFs/src/option/syscall.c;..\Middlewares/Third_Party/FatFs/src/option/ccsbcs.c;..\Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c;..\Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c;..\Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c;..\Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c;..\Core\Src/system_stm32l4xx.c;..\Drivers/CMSIS/Device/ST/STM32L4xx/Source/Templates/system_stm32l4xx.c;;..\Middlewares/Third_Party/FatFs/src/diskio.c;..\Middlewares/Third_Party/FatFs/src/ff.c;..\Middlewares/Third_Party/FatFs/src/ff_gen_drv.c;..\Middlewares/Third_Party/FatFs/src/option/syscall.c;..\Middlewares/Third_Party/FatFs/src/option/ccsbcs.c;..\Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c;..\Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c;..\Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c;..\Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c; +HeaderPath=..\Drivers\STM32L4xx_HAL_Driver\Inc;..\Drivers\STM32L4xx_HAL_Driver\Inc\Legacy;..\Middlewares\Third_Party\FatFs\src;..\Middlewares\ST\STM32_USB_Device_Library\Core\Inc;..\Middlewares\ST\STM32_USB_Device_Library\Class\CDC\Inc;..\Drivers\CMSIS\Device\ST\STM32L4xx\Include;..\Drivers\CMSIS\Include;..\Core\Inc;..\FATFS\Target;..\FATFS\App;..\USB_DEVICE\App;..\USB_DEVICE\Target; +CDefines=USE_HAL_DRIVER;STM32L4R9xx;USE_HAL_DRIVER;USE_HAL_DRIVER; + +[PreviousGenFiles] +AdvancedFolderStructure=true +HeaderFileListSize=22 +HeaderFiles#0=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/Core/Inc/gpio.h +HeaderFiles#1=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/Core/Inc/adc.h +HeaderFiles#2=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/Core/Inc/dfsdm.h +HeaderFiles#3=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/Core/Inc/dma.h +HeaderFiles#4=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/FATFS/Target/ffconf.h +HeaderFiles#5=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/FATFS/Target/bsp_driver_sd.h +HeaderFiles#6=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/FATFS/Target/sd_diskio.h +HeaderFiles#7=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/FATFS/App/fatfs.h +HeaderFiles#8=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/FATFS/Target/fatfs_platform.h +HeaderFiles#9=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/Core/Inc/i2c.h +HeaderFiles#10=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/Core/Inc/rtc.h +HeaderFiles#11=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/Core/Inc/sdmmc.h +HeaderFiles#12=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/Core/Inc/spi.h +HeaderFiles#13=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/Core/Inc/tim.h +HeaderFiles#14=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/Core/Inc/usart.h +HeaderFiles#15=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/USB_DEVICE/App/usb_device.h +HeaderFiles#16=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/USB_DEVICE/Target/usbd_conf.h +HeaderFiles#17=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/USB_DEVICE/App/usbd_desc.h +HeaderFiles#18=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/USB_DEVICE/App/usbd_cdc_if.h +HeaderFiles#19=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/Core/Inc/stm32l4xx_it.h +HeaderFiles#20=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/Core/Inc/stm32l4xx_hal_conf.h +HeaderFiles#21=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/Core/Inc/main.h +HeaderFolderListSize=5 +HeaderPath#0=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/Core/Inc +HeaderPath#1=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/FATFS/Target +HeaderPath#2=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/FATFS/App +HeaderPath#3=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/USB_DEVICE/App +HeaderPath#4=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/USB_DEVICE/Target +HeaderFiles=; +SourceFileListSize=21 +SourceFiles#0=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/Core/Src/gpio.c +SourceFiles#1=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/Core/Src/adc.c +SourceFiles#2=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/Core/Src/dfsdm.c +SourceFiles#3=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/Core/Src/dma.c +SourceFiles#4=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/FATFS/Target/bsp_driver_sd.c +SourceFiles#5=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/FATFS/Target/sd_diskio.c +SourceFiles#6=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/FATFS/App/fatfs.c +SourceFiles#7=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/FATFS/Target/fatfs_platform.c +SourceFiles#8=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/Core/Src/i2c.c +SourceFiles#9=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/Core/Src/rtc.c +SourceFiles#10=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/Core/Src/sdmmc.c +SourceFiles#11=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/Core/Src/spi.c +SourceFiles#12=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/Core/Src/tim.c +SourceFiles#13=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/Core/Src/usart.c +SourceFiles#14=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/USB_DEVICE/App/usb_device.c +SourceFiles#15=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/USB_DEVICE/Target/usbd_conf.c +SourceFiles#16=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/USB_DEVICE/App/usbd_desc.c +SourceFiles#17=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/USB_DEVICE/App/usbd_cdc_if.c +SourceFiles#18=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/Core/Src/stm32l4xx_it.c +SourceFiles#19=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/Core/Src/stm32l4xx_hal_msp.c +SourceFiles#20=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/Core/Src/main.c +SourceFolderListSize=5 +SourcePath#0=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/Core/Src +SourcePath#1=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/FATFS/Target +SourcePath#2=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/FATFS/App +SourcePath#3=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/USB_DEVICE/App +SourcePath#4=F:/04_git_repo/GITEE/rt-thread_github/bsp/stm32/stm32l4r9-st-eval/board/CubeMX_Config/USB_DEVICE/Target +SourceFiles=; + diff --git a/bsp/stm32/stm32l4r9-st-sensortile-box/board/CubeMX_Config/Core/Inc/stm32l4xx_hal_conf.h b/bsp/stm32/stm32l4r9-st-sensortile-box/board/CubeMX_Config/Core/Inc/stm32l4xx_hal_conf.h new file mode 100644 index 0000000000..b925035e23 --- /dev/null +++ b/bsp/stm32/stm32l4r9-st-sensortile-box/board/CubeMX_Config/Core/Inc/stm32l4xx_hal_conf.h @@ -0,0 +1,483 @@ +/** + ****************************************************************************** + * @file stm32l4xx_hal_conf.h + * @author MCD Application Team + * @brief HAL configuration template file. + * This file should be copied to the application folder and renamed + * to stm32l4xx_hal_conf.h. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef STM32L4xx_HAL_CONF_H +#define STM32L4xx_HAL_CONF_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ + +/* ########################## Module Selection ############################## */ +/** + * @brief This is the list of modules to be used in the HAL driver + */ +#define HAL_MODULE_ENABLED +#define HAL_ADC_MODULE_ENABLED +/*#define HAL_CRYP_MODULE_ENABLED */ +/*#define HAL_CAN_MODULE_ENABLED */ +/*#define HAL_COMP_MODULE_ENABLED */ +/*#define HAL_CRC_MODULE_ENABLED */ +/*#define HAL_CRYP_MODULE_ENABLED */ +/*#define HAL_DAC_MODULE_ENABLED */ +/*#define HAL_DCMI_MODULE_ENABLED */ +/*#define HAL_DMA2D_MODULE_ENABLED */ +#define HAL_DFSDM_MODULE_ENABLED +/*#define HAL_DSI_MODULE_ENABLED */ +/*#define HAL_FIREWALL_MODULE_ENABLED */ +/*#define HAL_GFXMMU_MODULE_ENABLED */ +/*#define HAL_HCD_MODULE_ENABLED */ +/*#define HAL_HASH_MODULE_ENABLED */ +/*#define HAL_I2S_MODULE_ENABLED */ +/*#define HAL_IRDA_MODULE_ENABLED */ +/*#define HAL_IWDG_MODULE_ENABLED */ +/*#define HAL_LTDC_MODULE_ENABLED */ +/*#define HAL_LCD_MODULE_ENABLED */ +/*#define HAL_LPTIM_MODULE_ENABLED */ +/*#define HAL_MMC_MODULE_ENABLED */ +/*#define HAL_NAND_MODULE_ENABLED */ +/*#define HAL_NOR_MODULE_ENABLED */ +/*#define HAL_OPAMP_MODULE_ENABLED */ +/*#define HAL_OSPI_MODULE_ENABLED */ +/*#define HAL_OSPI_MODULE_ENABLED */ +#define HAL_PCD_MODULE_ENABLED +/*#define HAL_PKA_MODULE_ENABLED */ +/*#define HAL_QSPI_MODULE_ENABLED */ +/*#define HAL_QSPI_MODULE_ENABLED */ +/*#define HAL_RNG_MODULE_ENABLED */ +#define HAL_RTC_MODULE_ENABLED +/*#define HAL_SAI_MODULE_ENABLED */ +#define HAL_SD_MODULE_ENABLED +/*#define HAL_SMBUS_MODULE_ENABLED */ +/*#define HAL_SMARTCARD_MODULE_ENABLED */ +#define HAL_SPI_MODULE_ENABLED +/*#define HAL_SRAM_MODULE_ENABLED */ +/*#define HAL_SWPMI_MODULE_ENABLED */ +#define HAL_TIM_MODULE_ENABLED +/*#define HAL_TSC_MODULE_ENABLED */ +#define HAL_UART_MODULE_ENABLED +/*#define HAL_USART_MODULE_ENABLED */ +/*#define HAL_WWDG_MODULE_ENABLED */ +/*#define HAL_EXTI_MODULE_ENABLED */ +/*#define HAL_PSSI_MODULE_ENABLED */ +#define HAL_GPIO_MODULE_ENABLED +#define HAL_EXTI_MODULE_ENABLED +#define HAL_I2C_MODULE_ENABLED +#define HAL_DMA_MODULE_ENABLED +#define HAL_RCC_MODULE_ENABLED +#define HAL_FLASH_MODULE_ENABLED +#define HAL_PWR_MODULE_ENABLED +#define HAL_CORTEX_MODULE_ENABLED + +/* ########################## Oscillator Values adaptation ####################*/ +/** + * @brief Adjust the value of External High Speed oscillator (HSE) used in your application. + * This value is used by the RCC HAL module to compute the system frequency + * (when HSE is used as system clock source, directly or through the PLL). + */ +#if !defined (HSE_VALUE) + #define HSE_VALUE ((uint32_t)16000000U) /*!< Value of the External oscillator in Hz */ +#endif /* HSE_VALUE */ + +#if !defined (HSE_STARTUP_TIMEOUT) + #define HSE_STARTUP_TIMEOUT ((uint32_t)100U) /*!< Time out for HSE start up, in ms */ +#endif /* HSE_STARTUP_TIMEOUT */ + +/** + * @brief Internal Multiple Speed oscillator (MSI) default value. + * This value is the default MSI range value after Reset. + */ +#if !defined (MSI_VALUE) + #define MSI_VALUE ((uint32_t)4000000U) /*!< Value of the Internal oscillator in Hz*/ +#endif /* MSI_VALUE */ +/** + * @brief Internal High Speed oscillator (HSI) value. + * This value is used by the RCC HAL module to compute the system frequency + * (when HSI is used as system clock source, directly or through the PLL). + */ +#if !defined (HSI_VALUE) + #define HSI_VALUE ((uint32_t)16000000U) /*!< Value of the Internal oscillator in Hz*/ +#endif /* HSI_VALUE */ + +/** + * @brief Internal High Speed oscillator (HSI48) value for USB FS, SDMMC and RNG. + * This internal oscillator is mainly dedicated to provide a high precision clock to + * the USB peripheral by means of a special Clock Recovery System (CRS) circuitry. + * When the CRS is not used, the HSI48 RC oscillator runs on it default frequency + * which is subject to manufacturing process variations. + */ +#if !defined (HSI48_VALUE) + #define HSI48_VALUE ((uint32_t)48000000U) /*!< Value of the Internal High Speed oscillator for USB FS/SDMMC/RNG in Hz. + The real value my vary depending on manufacturing process variations.*/ +#endif /* HSI48_VALUE */ + +/** + * @brief Internal Low Speed oscillator (LSI) value. + */ +#if !defined (LSI_VALUE) + #define LSI_VALUE 32000U /*!< LSI Typical Value in Hz*/ +#endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz + The real value may vary depending on the variations + in voltage and temperature.*/ + +/** + * @brief External Low Speed oscillator (LSE) value. + * This value is used by the UART, RTC HAL module to compute the system frequency + */ +#if !defined (LSE_VALUE) + #define LSE_VALUE 32768U /*!< Value of the External oscillator in Hz*/ +#endif /* LSE_VALUE */ + +#if !defined (LSE_STARTUP_TIMEOUT) + #define LSE_STARTUP_TIMEOUT 5000U /*!< Time out for LSE start up, in ms */ +#endif /* HSE_STARTUP_TIMEOUT */ + +/** + * @brief External clock source for SAI1 peripheral + * This value is used by the RCC HAL module to compute the SAI1 & SAI2 clock source + * frequency. + */ +#if !defined (EXTERNAL_SAI1_CLOCK_VALUE) + #define EXTERNAL_SAI1_CLOCK_VALUE 2097000U /*!< Value of the SAI1 External clock source in Hz*/ +#endif /* EXTERNAL_SAI1_CLOCK_VALUE */ + +/** + * @brief External clock source for SAI2 peripheral + * This value is used by the RCC HAL module to compute the SAI1 & SAI2 clock source + * frequency. + */ +#if !defined (EXTERNAL_SAI2_CLOCK_VALUE) + #define EXTERNAL_SAI2_CLOCK_VALUE 2097000U /*!< Value of the SAI2 External clock source in Hz*/ +#endif /* EXTERNAL_SAI2_CLOCK_VALUE */ + +/* Tip: To avoid modifying this file each time you need to use different HSE, + === you can define the HSE value in your toolchain compiler preprocessor. */ + +/* ########################### System Configuration ######################### */ +/** + * @brief This is the HAL system configuration section + */ + +#define VDD_VALUE 3300U /*!< Value of VDD in mv */ +#define TICK_INT_PRIORITY 0U /*!< tick interrupt priority */ +#define USE_RTOS 0U +#define PREFETCH_ENABLE 0U +#define INSTRUCTION_CACHE_ENABLE 1U +#define DATA_CACHE_ENABLE 1U + +/* ########################## Assert Selection ############################## */ +/** + * @brief Uncomment the line below to expanse the "assert_param" macro in the + * HAL drivers code + */ +/* #define USE_FULL_ASSERT 1U */ + +/* ################## Register callback feature configuration ############### */ +/** + * @brief Set below the peripheral configuration to "1U" to add the support + * of HAL callback registration/deregistration feature for the HAL + * driver(s). This allows user application to provide specific callback + * functions thanks to HAL_PPP_RegisterCallback() rather than overwriting + * the default weak callback functions (see each stm32l4xx_hal_ppp.h file + * for possible callback identifiers defined in HAL_PPP_CallbackIDTypeDef + * for each PPP peripheral). + */ +#define USE_HAL_ADC_REGISTER_CALLBACKS 0U +#define USE_HAL_CAN_REGISTER_CALLBACKS 0U +#define USE_HAL_COMP_REGISTER_CALLBACKS 0U +#define USE_HAL_CRYP_REGISTER_CALLBACKS 0U +#define USE_HAL_DAC_REGISTER_CALLBACKS 0U +#define USE_HAL_DCMI_REGISTER_CALLBACKS 0U +#define USE_HAL_DFSDM_REGISTER_CALLBACKS 0U +#define USE_HAL_DMA2D_REGISTER_CALLBACKS 0U +#define USE_HAL_DSI_REGISTER_CALLBACKS 0U +#define USE_HAL_GFXMMU_REGISTER_CALLBACKS 0U +#define USE_HAL_HASH_REGISTER_CALLBACKS 0U +#define USE_HAL_HCD_REGISTER_CALLBACKS 0U +#define USE_HAL_I2C_REGISTER_CALLBACKS 0U +#define USE_HAL_IRDA_REGISTER_CALLBACKS 0U +#define USE_HAL_LPTIM_REGISTER_CALLBACKS 0U +#define USE_HAL_LTDC_REGISTER_CALLBACKS 0U +#define USE_HAL_MMC_REGISTER_CALLBACKS 0U +#define USE_HAL_OPAMP_REGISTER_CALLBACKS 0U +#define USE_HAL_OSPI_REGISTER_CALLBACKS 0U +#define USE_HAL_PCD_REGISTER_CALLBACKS 0U +#define USE_HAL_QSPI_REGISTER_CALLBACKS 0U +#define USE_HAL_RNG_REGISTER_CALLBACKS 0U +#define USE_HAL_RTC_REGISTER_CALLBACKS 0U +#define USE_HAL_SAI_REGISTER_CALLBACKS 0U +#define USE_HAL_SD_REGISTER_CALLBACKS 0U +#define USE_HAL_SMARTCARD_REGISTER_CALLBACKS 0U +#define USE_HAL_SMBUS_REGISTER_CALLBACKS 0U +#define USE_HAL_SPI_REGISTER_CALLBACKS 0U +#define USE_HAL_SWPMI_REGISTER_CALLBACKS 0U +#define USE_HAL_TIM_REGISTER_CALLBACKS 0U +#define USE_HAL_TSC_REGISTER_CALLBACKS 0U +#define USE_HAL_UART_REGISTER_CALLBACKS 0U +#define USE_HAL_USART_REGISTER_CALLBACKS 0U +#define USE_HAL_WWDG_REGISTER_CALLBACKS 0U + +/* ################## SPI peripheral configuration ########################## */ + +/* CRC FEATURE: Use to activate CRC feature inside HAL SPI Driver + * Activated: CRC code is present inside driver + * Deactivated: CRC code cleaned from driver + */ + +#define USE_SPI_CRC 0U + +/* Includes ------------------------------------------------------------------*/ +/** + * @brief Include module's header file + */ + +#ifdef HAL_RCC_MODULE_ENABLED + #include "stm32l4xx_hal_rcc.h" +#endif /* HAL_RCC_MODULE_ENABLED */ + +#ifdef HAL_GPIO_MODULE_ENABLED + #include "stm32l4xx_hal_gpio.h" +#endif /* HAL_GPIO_MODULE_ENABLED */ + +#ifdef HAL_DMA_MODULE_ENABLED + #include "stm32l4xx_hal_dma.h" +#endif /* HAL_DMA_MODULE_ENABLED */ + +#ifdef HAL_DFSDM_MODULE_ENABLED + #include "stm32l4xx_hal_dfsdm.h" +#endif /* HAL_DFSDM_MODULE_ENABLED */ + +#ifdef HAL_CORTEX_MODULE_ENABLED + #include "stm32l4xx_hal_cortex.h" +#endif /* HAL_CORTEX_MODULE_ENABLED */ + +#ifdef HAL_ADC_MODULE_ENABLED + #include "stm32l4xx_hal_adc.h" +#endif /* HAL_ADC_MODULE_ENABLED */ + +#ifdef HAL_CAN_MODULE_ENABLED + #include "stm32l4xx_hal_can.h" +#endif /* HAL_CAN_MODULE_ENABLED */ + +#ifdef HAL_CAN_LEGACY_MODULE_ENABLED + #include "Legacy/stm32l4xx_hal_can_legacy.h" +#endif /* HAL_CAN_LEGACY_MODULE_ENABLED */ + +#ifdef HAL_COMP_MODULE_ENABLED + #include "stm32l4xx_hal_comp.h" +#endif /* HAL_COMP_MODULE_ENABLED */ + +#ifdef HAL_CRC_MODULE_ENABLED + #include "stm32l4xx_hal_crc.h" +#endif /* HAL_CRC_MODULE_ENABLED */ + +#ifdef HAL_CRYP_MODULE_ENABLED + #include "stm32l4xx_hal_cryp.h" +#endif /* HAL_CRYP_MODULE_ENABLED */ + +#ifdef HAL_DAC_MODULE_ENABLED + #include "stm32l4xx_hal_dac.h" +#endif /* HAL_DAC_MODULE_ENABLED */ + +#ifdef HAL_DCMI_MODULE_ENABLED + #include "stm32l4xx_hal_dcmi.h" +#endif /* HAL_DCMI_MODULE_ENABLED */ + +#ifdef HAL_DMA2D_MODULE_ENABLED + #include "stm32l4xx_hal_dma2d.h" +#endif /* HAL_DMA2D_MODULE_ENABLED */ + +#ifdef HAL_DSI_MODULE_ENABLED + #include "stm32l4xx_hal_dsi.h" +#endif /* HAL_DSI_MODULE_ENABLED */ + +#ifdef HAL_EXTI_MODULE_ENABLED + #include "stm32l4xx_hal_exti.h" +#endif /* HAL_EXTI_MODULE_ENABLED */ + +#ifdef HAL_GFXMMU_MODULE_ENABLED + #include "stm32l4xx_hal_gfxmmu.h" +#endif /* HAL_GFXMMU_MODULE_ENABLED */ + +#ifdef HAL_FIREWALL_MODULE_ENABLED + #include "stm32l4xx_hal_firewall.h" +#endif /* HAL_FIREWALL_MODULE_ENABLED */ + +#ifdef HAL_FLASH_MODULE_ENABLED + #include "stm32l4xx_hal_flash.h" +#endif /* HAL_FLASH_MODULE_ENABLED */ + +#ifdef HAL_HASH_MODULE_ENABLED + #include "stm32l4xx_hal_hash.h" +#endif /* HAL_HASH_MODULE_ENABLED */ + +#ifdef HAL_HCD_MODULE_ENABLED + #include "stm32l4xx_hal_hcd.h" +#endif /* HAL_HCD_MODULE_ENABLED */ + +#ifdef HAL_I2C_MODULE_ENABLED + #include "stm32l4xx_hal_i2c.h" +#endif /* HAL_I2C_MODULE_ENABLED */ + +#ifdef HAL_IRDA_MODULE_ENABLED + #include "stm32l4xx_hal_irda.h" +#endif /* HAL_IRDA_MODULE_ENABLED */ + +#ifdef HAL_IWDG_MODULE_ENABLED + #include "stm32l4xx_hal_iwdg.h" +#endif /* HAL_IWDG_MODULE_ENABLED */ + +#ifdef HAL_LCD_MODULE_ENABLED + #include "stm32l4xx_hal_lcd.h" +#endif /* HAL_LCD_MODULE_ENABLED */ + +#ifdef HAL_LPTIM_MODULE_ENABLED + #include "stm32l4xx_hal_lptim.h" +#endif /* HAL_LPTIM_MODULE_ENABLED */ + +#ifdef HAL_LTDC_MODULE_ENABLED + #include "stm32l4xx_hal_ltdc.h" +#endif /* HAL_LTDC_MODULE_ENABLED */ + +#ifdef HAL_MMC_MODULE_ENABLED + #include "stm32l4xx_hal_mmc.h" +#endif /* HAL_MMC_MODULE_ENABLED */ + +#ifdef HAL_NAND_MODULE_ENABLED + #include "stm32l4xx_hal_nand.h" +#endif /* HAL_NAND_MODULE_ENABLED */ + +#ifdef HAL_NOR_MODULE_ENABLED + #include "stm32l4xx_hal_nor.h" +#endif /* HAL_NOR_MODULE_ENABLED */ + +#ifdef HAL_OPAMP_MODULE_ENABLED + #include "stm32l4xx_hal_opamp.h" +#endif /* HAL_OPAMP_MODULE_ENABLED */ + +#ifdef HAL_OSPI_MODULE_ENABLED + #include "stm32l4xx_hal_ospi.h" +#endif /* HAL_OSPI_MODULE_ENABLED */ + +#ifdef HAL_PCD_MODULE_ENABLED + #include "stm32l4xx_hal_pcd.h" +#endif /* HAL_PCD_MODULE_ENABLED */ + +#ifdef HAL_PKA_MODULE_ENABLED + #include "stm32l4xx_hal_pka.h" +#endif /* HAL_PKA_MODULE_ENABLED */ + +#ifdef HAL_PSSI_MODULE_ENABLED + #include "stm32l4xx_hal_pssi.h" +#endif /* HAL_PSSI_MODULE_ENABLED */ + +#ifdef HAL_PWR_MODULE_ENABLED + #include "stm32l4xx_hal_pwr.h" +#endif /* HAL_PWR_MODULE_ENABLED */ + +#ifdef HAL_QSPI_MODULE_ENABLED + #include "stm32l4xx_hal_qspi.h" +#endif /* HAL_QSPI_MODULE_ENABLED */ + +#ifdef HAL_RNG_MODULE_ENABLED + #include "stm32l4xx_hal_rng.h" +#endif /* HAL_RNG_MODULE_ENABLED */ + +#ifdef HAL_RTC_MODULE_ENABLED + #include "stm32l4xx_hal_rtc.h" +#endif /* HAL_RTC_MODULE_ENABLED */ + +#ifdef HAL_SAI_MODULE_ENABLED + #include "stm32l4xx_hal_sai.h" +#endif /* HAL_SAI_MODULE_ENABLED */ + +#ifdef HAL_SD_MODULE_ENABLED + #include "stm32l4xx_hal_sd.h" +#endif /* HAL_SD_MODULE_ENABLED */ + +#ifdef HAL_SMARTCARD_MODULE_ENABLED + #include "stm32l4xx_hal_smartcard.h" +#endif /* HAL_SMARTCARD_MODULE_ENABLED */ + +#ifdef HAL_SMBUS_MODULE_ENABLED + #include "stm32l4xx_hal_smbus.h" +#endif /* HAL_SMBUS_MODULE_ENABLED */ + +#ifdef HAL_SPI_MODULE_ENABLED + #include "stm32l4xx_hal_spi.h" +#endif /* HAL_SPI_MODULE_ENABLED */ + +#ifdef HAL_SRAM_MODULE_ENABLED + #include "stm32l4xx_hal_sram.h" +#endif /* HAL_SRAM_MODULE_ENABLED */ + +#ifdef HAL_SWPMI_MODULE_ENABLED + #include "stm32l4xx_hal_swpmi.h" +#endif /* HAL_SWPMI_MODULE_ENABLED */ + +#ifdef HAL_TIM_MODULE_ENABLED + #include "stm32l4xx_hal_tim.h" +#endif /* HAL_TIM_MODULE_ENABLED */ + +#ifdef HAL_TSC_MODULE_ENABLED + #include "stm32l4xx_hal_tsc.h" +#endif /* HAL_TSC_MODULE_ENABLED */ + +#ifdef HAL_UART_MODULE_ENABLED + #include "stm32l4xx_hal_uart.h" +#endif /* HAL_UART_MODULE_ENABLED */ + +#ifdef HAL_USART_MODULE_ENABLED + #include "stm32l4xx_hal_usart.h" +#endif /* HAL_USART_MODULE_ENABLED */ + +#ifdef HAL_WWDG_MODULE_ENABLED + #include "stm32l4xx_hal_wwdg.h" +#endif /* HAL_WWDG_MODULE_ENABLED */ + +/* Exported macro ------------------------------------------------------------*/ +#ifdef USE_FULL_ASSERT +/** + * @brief The assert_param macro is used for function's parameters check. + * @param expr If expr is false, it calls assert_failed function + * which reports the name of the source file and the source + * line number of the call that failed. + * If expr is true, it returns no value. + * @retval None + */ + #define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__)) +/* Exported functions ------------------------------------------------------- */ + void assert_failed(uint8_t *file, uint32_t line); +#else + #define assert_param(expr) ((void)0U) +#endif /* USE_FULL_ASSERT */ + +#ifdef __cplusplus +} +#endif + +#endif /* STM32L4xx_HAL_CONF_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/bsp/stm32/stm32l4r9-st-sensortile-box/board/CubeMX_Config/Core/Src/stm32l4xx_hal_msp.c b/bsp/stm32/stm32l4r9-st-sensortile-box/board/CubeMX_Config/Core/Src/stm32l4xx_hal_msp.c new file mode 100644 index 0000000000..4f7f4205b6 --- /dev/null +++ b/bsp/stm32/stm32l4r9-st-sensortile-box/board/CubeMX_Config/Core/Src/stm32l4xx_hal_msp.c @@ -0,0 +1,161 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file stm32l4xx_hal_msp.c + * @brief This file provides code for the MSP Initialization + * and de-Initialization codes. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2021 STMicroelectronics. + * All rights reserved.

+ * + * This software component is licensed by ST under Ultimate Liberty license + * SLA0044, the "License"; You may not use this file except in compliance with + * the License. You may obtain a copy of the License at: + * www.st.com/SLA0044 + * + ****************************************************************************** + */ +/* USER CODE END Header */ + +/* Includes ------------------------------------------------------------------*/ +#include "board.h" +/* USER CODE BEGIN Includes */ + +/* USER CODE END Includes */ + +/* Private typedef -----------------------------------------------------------*/ +/* USER CODE BEGIN TD */ + +/* USER CODE END TD */ + +/* Private define ------------------------------------------------------------*/ +/* USER CODE BEGIN Define */ + +/* USER CODE END Define */ + +/* Private macro -------------------------------------------------------------*/ +/* USER CODE BEGIN Macro */ + +/* USER CODE END Macro */ + +/* Private variables ---------------------------------------------------------*/ +/* USER CODE BEGIN PV */ + +/* USER CODE END PV */ + +/* Private function prototypes -----------------------------------------------*/ +/* USER CODE BEGIN PFP */ + +/* USER CODE END PFP */ + +/* External functions --------------------------------------------------------*/ +/* USER CODE BEGIN ExternalFunctions */ + +/* USER CODE END ExternalFunctions */ + +/* USER CODE BEGIN 0 */ + +/* USER CODE END 0 */ +/** + * Initializes the Global MSP. + */ +void HAL_MspInit(void) +{ + /* USER CODE BEGIN MspInit 0 */ + + /* USER CODE END MspInit 0 */ + + __HAL_RCC_SYSCFG_CLK_ENABLE(); + __HAL_RCC_PWR_CLK_ENABLE(); + + /* System interrupt init*/ + + /* USER CODE BEGIN MspInit 1 */ + + /* USER CODE END MspInit 1 */ +} + +/* USER CODE BEGIN 1 */ +#ifdef RT_USING_USB_DEVICE +void HAL_PCD_MspInit(PCD_HandleTypeDef* pcdHandle) +{ + GPIO_InitTypeDef GPIO_InitStruct = {0}; + if(pcdHandle->Instance==USB_OTG_FS) + { + /* USER CODE BEGIN USB_OTG_FS_MspInit 0 */ + + /* USER CODE END USB_OTG_FS_MspInit 0 */ + + __HAL_RCC_GPIOA_CLK_ENABLE(); + /**USB_OTG_FS GPIO Configuration + PA12 ------> USB_OTG_FS_DP + PA11 ------> USB_OTG_FS_DM + */ + GPIO_InitStruct.Pin = USB_OTG_DP_Pin|USB_OTG_DM_Pin; + GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; + GPIO_InitStruct.Pull = GPIO_NOPULL; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; + GPIO_InitStruct.Alternate = GPIO_AF10_OTG_FS; + HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); + + /* Peripheral clock enable */ + __HAL_RCC_USB_OTG_FS_CLK_ENABLE(); + + /* Enable VDDUSB */ + if(__HAL_RCC_PWR_IS_CLK_DISABLED()) + { + __HAL_RCC_PWR_CLK_ENABLE(); + HAL_PWREx_EnableVddUSB(); + __HAL_RCC_PWR_CLK_DISABLE(); + } + else + { + HAL_PWREx_EnableVddUSB(); + } + + /* Peripheral interrupt init */ + HAL_NVIC_SetPriority(OTG_FS_IRQn, 0, 0); + HAL_NVIC_EnableIRQ(OTG_FS_IRQn); + /* USER CODE BEGIN USB_OTG_FS_MspInit 1 */ + + /* USER CODE END USB_OTG_FS_MspInit 1 */ + } +} +#endif + +#ifdef BSP_USING_UART +void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle) +{ + + GPIO_InitTypeDef GPIO_InitStruct = {0}; + if(uartHandle->Instance==USART1) + { + /* USER CODE BEGIN USART1_MspInit 0 */ + + /* USER CODE END USART1_MspInit 0 */ + /* USART1 clock enable */ + __HAL_RCC_USART1_CLK_ENABLE(); + + __HAL_RCC_GPIOA_CLK_ENABLE(); + /**USART1 GPIO Configuration + PA10 ------> USART1_RX + PA9 ------> USART1_TX + */ + GPIO_InitStruct.Pin = GPIO_PIN_10|GPIO_PIN_9; + GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; + GPIO_InitStruct.Pull = GPIO_NOPULL; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; + GPIO_InitStruct.Alternate = GPIO_AF7_USART1; + HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); + + /* USER CODE BEGIN USART1_MspInit 1 */ + + /* USER CODE END USART1_MspInit 1 */ + } +} +#endif +/* USER CODE END 1 */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/bsp/stm32/stm32l4r9-st-sensortile-box/board/CubeMX_Config/CubeMX_Config.ioc b/bsp/stm32/stm32l4r9-st-sensortile-box/board/CubeMX_Config/CubeMX_Config.ioc new file mode 100644 index 0000000000..ca1dbcc84b --- /dev/null +++ b/bsp/stm32/stm32l4r9-st-sensortile-box/board/CubeMX_Config/CubeMX_Config.ioc @@ -0,0 +1,644 @@ +#MicroXplorer Configuration settings - do not modify +ADC1.Channel-0\#ChannelRegularConversion=ADC_CHANNEL_8 +ADC1.ContinuousConvMode=ENABLE +ADC1.EnableInjectedConversion=ENABLE +ADC1.IPParameters=Rank-0\#ChannelRegularConversion,Channel-0\#ChannelRegularConversion,SamplingTime-0\#ChannelRegularConversion,OffsetNumber-0\#ChannelRegularConversion,NbrOfConversionFlag,NbrOfConversion,master,ContinuousConvMode,Overrun,OversamplingMode,EnableInjectedConversion +ADC1.NbrOfConversion=1 +ADC1.NbrOfConversionFlag=1 +ADC1.OffsetNumber-0\#ChannelRegularConversion=ADC_OFFSET_NONE +ADC1.Overrun=ADC_OVR_DATA_OVERWRITTEN +ADC1.OversamplingMode=DISABLE +ADC1.Rank-0\#ChannelRegularConversion=1 +ADC1.SamplingTime-0\#ChannelRegularConversion=ADC_SAMPLETIME_12CYCLES_5 +ADC1.master=1 +DFSDM1.DmaMode_reg_FIL0=ENABLE +DFSDM1.FastMode_reg_FIL0=ENABLE +DFSDM1.Filter_injChannel0_FIL0=__NULL +DFSDM1.Filter_regChannel_FIL0=DFSDM_CHANNEL_0 +DFSDM1.Fosr_FIL0=192 +DFSDM1.IPParameters=Filter_injChannel0_FIL0,Filter_regChannel_FIL0,Multiplexer_internal_CH0,FastMode_reg_FIL0,DmaMode_reg_FIL0,Fosr_FIL0,SincOrder_FIL0,RightBitShift_CH0 +DFSDM1.Multiplexer_internal_CH0=DFSDM_CHANNEL_ADC_OUTPUT +DFSDM1.RightBitShift_CH0=7 +DFSDM1.SincOrder_FIL0=DFSDM_FILTER_SINC2_ORDER +Dma.DFSDM1_FLT0.0.Direction=DMA_PERIPH_TO_MEMORY +Dma.DFSDM1_FLT0.0.EventEnable=DISABLE +Dma.DFSDM1_FLT0.0.Instance=DMA1_Channel4 +Dma.DFSDM1_FLT0.0.MemDataAlignment=DMA_MDATAALIGN_WORD +Dma.DFSDM1_FLT0.0.MemInc=DMA_MINC_ENABLE +Dma.DFSDM1_FLT0.0.Mode=DMA_CIRCULAR +Dma.DFSDM1_FLT0.0.PeriphDataAlignment=DMA_PDATAALIGN_WORD +Dma.DFSDM1_FLT0.0.PeriphInc=DMA_PINC_DISABLE +Dma.DFSDM1_FLT0.0.Polarity=HAL_DMAMUX_REQUEST_GEN_RISING +Dma.DFSDM1_FLT0.0.Priority=DMA_PRIORITY_HIGH +Dma.DFSDM1_FLT0.0.RequestNumber=1 +Dma.DFSDM1_FLT0.0.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,SignalID,Polarity,RequestNumber,SyncSignalID,SyncPolarity,SyncEnable,EventEnable,SyncRequestNumber +Dma.DFSDM1_FLT0.0.SignalID=NONE +Dma.DFSDM1_FLT0.0.SyncEnable=DISABLE +Dma.DFSDM1_FLT0.0.SyncPolarity=HAL_DMAMUX_SYNC_NO_EVENT +Dma.DFSDM1_FLT0.0.SyncRequestNumber=1 +Dma.DFSDM1_FLT0.0.SyncSignalID=NONE +Dma.Request0=DFSDM1_FLT0 +Dma.RequestsNb=1 +FATFS.BSP.number=1 +FATFS.IPParameters=_USE_LFN,_FS_NORTC,USE_DMA_CODE_SD +FATFS.USE_DMA_CODE_SD=1 +FATFS._FS_NORTC=0 +FATFS._USE_LFN=3 +FATFS0.BSP.STBoard=false +FATFS0.BSP.api=Unknown +FATFS0.BSP.component= +FATFS0.BSP.condition= +FATFS0.BSP.i2caddr=0 +FATFS0.BSP.i2creg= +FATFS0.BSP.instance=PB12 +FATFS0.BSP.ip=GPIO +FATFS0.BSP.mode=Input +FATFS0.BSP.name=Detect_SDIO +FATFS0.BSP.semaphore= +FATFS0.BSP.solution=PB12 +File.Version=6 +I2C1.I2C_Speed_Mode=I2C_Fast +I2C1.IPParameters=Timing,I2C_Speed_Mode +I2C1.Timing=0x00B03FDB +I2C3.I2C_Speed_Mode=I2C_Fast +I2C3.IPParameters=Timing,I2C_Speed_Mode +I2C3.Timing=0x00B03FDB +KeepUserPlacement=false +Mcu.Family=STM32L4 +Mcu.IP0=ADC1 +Mcu.IP1=DFSDM1 +Mcu.IP10=SPI1 +Mcu.IP11=SPI2 +Mcu.IP12=SPI3 +Mcu.IP13=SYS +Mcu.IP14=TIM2 +Mcu.IP15=TIM6 +Mcu.IP16=TIM7 +Mcu.IP17=USART1 +Mcu.IP18=USB_DEVICE +Mcu.IP19=USB_OTG_FS +Mcu.IP2=DMA +Mcu.IP3=FATFS +Mcu.IP4=I2C1 +Mcu.IP5=I2C3 +Mcu.IP6=NVIC +Mcu.IP7=RCC +Mcu.IP8=RTC +Mcu.IP9=SDMMC1 +Mcu.IPNb=20 +Mcu.Name=STM32L4R9Z(G-I)Jx +Mcu.Package=UFBGA144 +Mcu.Pin0=PB9 +Mcu.Pin1=PB4 (NJTRST) +Mcu.Pin10=PA15 (JTDI) +Mcu.Pin11=PA12 +Mcu.Pin12=PA11 +Mcu.Pin13=PE5 +Mcu.Pin14=PB7 +Mcu.Pin15=PC10 +Mcu.Pin16=PA10 +Mcu.Pin17=PC9 +Mcu.Pin18=PC14-OSC32_IN (PC14) +Mcu.Pin19=PC15-OSC32_OUT (PC15) +Mcu.Pin2=PD3 +Mcu.Pin20=PE4 +Mcu.Pin21=PE6 +Mcu.Pin22=PB6 +Mcu.Pin23=PD5 +Mcu.Pin24=PD2 +Mcu.Pin25=PC12 +Mcu.Pin26=PA9 +Mcu.Pin27=PC6 +Mcu.Pin28=PF2 +Mcu.Pin29=PF0 +Mcu.Pin3=PC11 +Mcu.Pin30=PG10 +Mcu.Pin31=PG8 +Mcu.Pin32=PC7 +Mcu.Pin33=PC8 +Mcu.Pin34=PG7 +Mcu.Pin35=PF7 +Mcu.Pin36=PG3 +Mcu.Pin37=PG4 +Mcu.Pin38=PD15 +Mcu.Pin39=PD14 +Mcu.Pin4=PE3 +Mcu.Pin40=PD13 +Mcu.Pin41=PH0-OSC_IN (PH0) +Mcu.Pin42=PH1-OSC_OUT (PH1) +Mcu.Pin43=PE11 +Mcu.Pin44=PC3 +Mcu.Pin45=PE13 +Mcu.Pin46=PB15 +Mcu.Pin47=PC5 +Mcu.Pin48=PE15 +Mcu.Pin49=PA2 +Mcu.Pin5=PB8 +Mcu.Pin50=PC4 +Mcu.Pin51=PE10 +Mcu.Pin52=PB12 +Mcu.Pin53=PA3 +Mcu.Pin54=PG1 +Mcu.Pin55=PE12 +Mcu.Pin56=PE14 +Mcu.Pin57=VP_DFSDM1_VS_IN0 +Mcu.Pin58=VP_FATFS_VS_SDIO +Mcu.Pin59=VP_RTC_VS_RTC_Activate +Mcu.Pin6=PB5 +Mcu.Pin60=VP_RTC_VS_RTC_Calendar +Mcu.Pin61=VP_SYS_VS_Systick +Mcu.Pin62=VP_TIM2_VS_ClockSourceINT +Mcu.Pin63=VP_TIM6_VS_ClockSourceINT +Mcu.Pin64=VP_TIM7_VS_ClockSourceINT +Mcu.Pin65=VP_USB_DEVICE_VS_USB_DEVICE_CDC_FS +Mcu.Pin7=PB3 (JTDO/TRACESWO) +Mcu.Pin8=PD6 +Mcu.Pin9=PD1 +Mcu.PinsNb=66 +Mcu.ThirdPartyNb=0 +Mcu.UserConstants= +Mcu.UserName=STM32L4R9ZIJx +MxCube.Version=6.1.1 +MxDb.Version=DB.6.0.10 +NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false +NVIC.DMA1_Channel4_IRQn=true\:0\:0\:false\:false\:true\:false\:true +NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false +NVIC.ForceEnableDMAVector=true +NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false +NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false +NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false +NVIC.OTG_FS_IRQn=true\:0\:0\:false\:false\:true\:false\:true +NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false +NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4 +NVIC.SDMMC1_IRQn=true\:0\:0\:false\:false\:true\:true\:true +NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false +NVIC.SysTick_IRQn=true\:0\:0\:false\:false\:true\:false\:true +NVIC.TIM6_DAC_IRQn=true\:0\:0\:false\:false\:true\:true\:true +NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false +PA10.Mode=Asynchronous +PA10.Signal=USART1_RX +PA11.GPIOParameters=GPIO_Label +PA11.GPIO_Label=USB OTG DM +PA11.Locked=true +PA11.Mode=Device_Only +PA11.Signal=USB_OTG_FS_DM +PA12.GPIOParameters=GPIO_Label +PA12.GPIO_Label=USB OTG DP +PA12.Locked=true +PA12.Mode=Device_Only +PA12.Signal=USB_OTG_FS_DP +PA15\ (JTDI).GPIOParameters=GPIO_Speed,PinState,GPIO_Label,GPIO_ModeDefaultOutputPP +PA15\ (JTDI).GPIO_Label=CS_LIS2MDL +PA15\ (JTDI).GPIO_ModeDefaultOutputPP=GPIO_MODE_OUTPUT_OD +PA15\ (JTDI).GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH +PA15\ (JTDI).Locked=true +PA15\ (JTDI).PinState=GPIO_PIN_SET +PA15\ (JTDI).Signal=GPIO_Output +PA2.GPIOParameters=GPIO_Label +PA2.GPIO_Label=INT1_LSM6DSOX +PA2.Locked=true +PA2.Signal=GPXTI2 +PA3.GPIOParameters=GPIO_Label +PA3.GPIO_Label=ADC1_IN8 [MICROPHONE] +PA3.Locked=true +PA3.Signal=ADCx_IN8 +PA9.Mode=Asynchronous +PA9.Signal=USART1_TX +PB12.GPIOParameters=GPIO_Label +PB12.GPIO_Label=SD_DETECT +PB12.Locked=true +PB12.Signal=GPIO_Input +PB15.GPIOParameters=GPIO_Label +PB15.GPIO_Label=CPU_LED +PB15.Locked=true +PB15.Signal=GPIO_Output +PB3\ (JTDO/TRACESWO).GPIOParameters=GPIO_PuPd,GPIO_Label +PB3\ (JTDO/TRACESWO).GPIO_Label=SPI3_SCK [SENSORS] +PB3\ (JTDO/TRACESWO).GPIO_PuPd=GPIO_PULLUP +PB3\ (JTDO/TRACESWO).Locked=true +PB3\ (JTDO/TRACESWO).Mode=Full_Duplex_Master +PB3\ (JTDO/TRACESWO).Signal=SPI3_SCK +PB4\ (NJTRST).GPIOParameters=GPIO_Label +PB4\ (NJTRST).GPIO_Label=SPI3_MISO [SENSORS] +PB4\ (NJTRST).Locked=true +PB4\ (NJTRST).Mode=Full_Duplex_Master +PB4\ (NJTRST).Signal=SPI3_MISO +PB5.GPIOParameters=GPIO_Label +PB5.GPIO_Label=SPI3_MOSI [SENSORS] +PB5.Locked=true +PB5.Mode=Full_Duplex_Master +PB5.Signal=SPI3_MOSI +PB6.GPIOParameters=GPIO_Label +PB6.GPIO_Label=I2C1_SCL [ENV SENSORS] +PB6.Locked=true +PB6.Mode=I2C +PB6.Signal=I2C1_SCL +PB7.GPIOParameters=GPIO_Label +PB7.GPIO_Label=I2C1_SDA [ENV SENSORS] +PB7.Locked=true +PB7.Mode=I2C +PB7.Signal=I2C1_SDA +PB8.GPIOParameters=GPIO_Label +PB8.GPIO_Label=SDMMC1_CKIN +PB8.Locked=true +PB8.Mode=SD_4_bits_Wide_bus_dir_voltage_converter +PB8.Signal=SDMMC1_CKIN +PB9.GPIOParameters=GPIO_Label +PB9.GPIO_Label=SDMMC1_CDIR +PB9.Locked=true +PB9.Mode=SD_4_bits_Wide_bus_dir_voltage_converter +PB9.Signal=SDMMC1_CDIR +PC10.GPIOParameters=GPIO_Label +PC10.GPIO_Label=SDMMC1_D2 +PC10.Locked=true +PC10.Mode=SD_4_bits_Wide_bus_dir_voltage_converter +PC10.Signal=SDMMC1_D2 +PC11.GPIOParameters=GPIO_Label +PC11.GPIO_Label=SDMMC1_D3 +PC11.Locked=true +PC11.Mode=SD_4_bits_Wide_bus_dir_voltage_converter +PC11.Signal=SDMMC1_D3 +PC12.GPIOParameters=GPIO_Label +PC12.GPIO_Label=SDMMC1_CK +PC12.Locked=true +PC12.Mode=SD_4_bits_Wide_bus_dir_voltage_converter +PC12.Signal=SDMMC1_CK +PC14-OSC32_IN\ (PC14).GPIOParameters=GPIO_Label +PC14-OSC32_IN\ (PC14).GPIO_Label=RCC_OSC32_IN +PC14-OSC32_IN\ (PC14).Locked=true +PC14-OSC32_IN\ (PC14).Mode=LSE-External-Oscillator +PC14-OSC32_IN\ (PC14).Signal=RCC_OSC32_IN +PC15-OSC32_OUT\ (PC15).GPIOParameters=GPIO_Label +PC15-OSC32_OUT\ (PC15).GPIO_Label=RCC-OSC32_OUT +PC15-OSC32_OUT\ (PC15).Locked=true +PC15-OSC32_OUT\ (PC15).Mode=LSE-External-Oscillator +PC15-OSC32_OUT\ (PC15).Signal=RCC_OSC32_OUT +PC3.GPIOParameters=GPIO_Label +PC3.GPIO_Label=SPI2_MOSI [BLE] +PC3.Locked=true +PC3.Mode=Full_Duplex_Master +PC3.Signal=SPI2_MOSI +PC4.GPIOParameters=GPIO_Label +PC4.GPIO_Label=AN_VBATT +PC4.Locked=true +PC4.Signal=ADCx_IN13 +PC5.GPIOParameters=GPIO_Label +PC5.GPIO_Label=INT1_LIS2DW12 +PC5.Locked=true +PC5.Signal=GPXTI5 +PC6.GPIOParameters=GPIO_Label +PC6.GPIO_Label=SDMMC1_D0DIR +PC6.Locked=true +PC6.Mode=SD_4_bits_Wide_bus_dir_voltage_converter +PC6.Signal=SDMMC1_D0DIR +PC7.GPIOParameters=GPIO_Label +PC7.GPIO_Label=SDMMC1_D123DIR +PC7.Locked=true +PC7.Mode=SD_4_bits_Wide_bus_dir_voltage_converter +PC7.Signal=SDMMC1_D123DIR +PC8.GPIOParameters=GPIO_Label +PC8.GPIO_Label=SDMMC1_D0 +PC8.Locked=true +PC8.Mode=SD_4_bits_Wide_bus_dir_voltage_converter +PC8.Signal=SDMMC1_D0 +PC9.GPIOParameters=GPIO_Label +PC9.GPIO_Label=SDMMC1_D1 +PC9.Locked=true +PC9.Mode=SD_4_bits_Wide_bus_dir_voltage_converter +PC9.Signal=SDMMC1_D1 +PD1.GPIOParameters=GPIO_Label +PD1.GPIO_Label=SPI2_SCK [BLE] +PD1.Locked=true +PD1.Mode=Full_Duplex_Master +PD1.Signal=SPI2_SCK +PD13.GPIOParameters=GPIO_Label +PD13.GPIO_Label=INT_HTS221 +PD13.Locked=true +PD13.Signal=GPXTI13 +PD14.GPIOParameters=GPIO_Label +PD14.GPIO_Label=INT2_LIS2DW12 +PD14.Locked=true +PD14.Signal=GPXTI14 +PD15.GPIOParameters=GPIO_Label +PD15.GPIO_Label=INT_LPS22HH +PD15.Locked=true +PD15.Signal=GPXTI15 +PD2.GPIOParameters=GPIO_Label +PD2.GPIO_Label=SDMMC1_CMD +PD2.Locked=true +PD2.Mode=SD_4_bits_Wide_bus_dir_voltage_converter +PD2.Signal=SDMMC1_CMD +PD3.GPIOParameters=GPIO_Label +PD3.GPIO_Label=SPI2_MISO [BLE] +PD3.Locked=true +PD3.Mode=Full_Duplex_Master +PD3.Signal=SPI2_MISO +PD5.GPIOParameters=GPIO_Label +PD5.GPIO_Label=USART2_TX [SERIAL PORT] +PD5.Locked=true +PD5.Signal=USART2_TX +PD6.GPIOParameters=GPIO_Label +PD6.GPIO_Label=USART2_RX [SERIAL PORT] +PD6.Locked=true +PD6.Signal=USART2_RX +PE10.GPIOParameters=GPIO_Speed,PinState,GPIO_Label,GPIO_ModeDefaultOutputPP +PE10.GPIO_Label=CS_IIS3DHHC +PE10.GPIO_ModeDefaultOutputPP=GPIO_MODE_OUTPUT_OD +PE10.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH +PE10.Locked=true +PE10.PinState=GPIO_PIN_SET +PE10.Signal=GPIO_Output +PE11.GPIOParameters=GPIO_Speed,PinState,GPIO_Label,GPIO_ModeDefaultOutputPP +PE11.GPIO_Label=CS_LIS2DW12 +PE11.GPIO_ModeDefaultOutputPP=GPIO_MODE_OUTPUT_OD +PE11.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH +PE11.Locked=true +PE11.PinState=GPIO_PIN_SET +PE11.Signal=GPIO_Output +PE12.GPIOParameters=GPIO_Speed,PinState,GPIO_Label,GPIO_ModeDefaultOutputPP +PE12.GPIO_Label=CS_LSM6DSOX +PE12.GPIO_ModeDefaultOutputPP=GPIO_MODE_OUTPUT_OD +PE12.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH +PE12.Locked=true +PE12.PinState=GPIO_PIN_SET +PE12.Signal=GPIO_Output +PE13.GPIOParameters=GPIO_PuPd,GPIO_Label +PE13.GPIO_Label=SPI2_SCK [BLE] +PE13.GPIO_PuPd=GPIO_PULLUP +PE13.Locked=true +PE13.Mode=Full_Duplex_Master +PE13.Signal=SPI1_SCK +PE14.Locked=true +PE14.Mode=Full_Duplex_Master +PE14.Signal=SPI1_MISO +PE15.GPIOParameters=GPIO_Label +PE15.GPIO_Label=SPI1_MOSI [SENSORS] +PE15.Locked=true +PE15.Mode=Full_Duplex_Master +PE15.Signal=SPI1_MOSI +PE3.GPIOParameters=GPIO_Label +PE3.GPIO_Label=INT2_LSM6DSOX +PE3.Locked=true +PE3.Signal=GPXTI3 +PE4.GPIOParameters=PinState,GPIO_Label +PE4.GPIO_Label=SD_EN +PE4.Locked=true +PE4.PinState=GPIO_PIN_SET +PE4.Signal=GPIO_Output +PE5.GPIOParameters=PinState,GPIO_Label +PE5.GPIO_Label=SD_SEL +PE5.Locked=true +PE5.PinState=GPIO_PIN_SET +PE5.Signal=GPIO_Output +PE6.GPIOParameters=GPIO_Label +PE6.GPIO_Label=INT2_IIS3DHHC +PE6.Locked=true +PE6.Signal=GPXTI6 +PF0.GPIOParameters=PinState,GPIO_Label +PF0.GPIO_Label=BB_MODE +PF0.Locked=true +PF0.PinState=GPIO_PIN_RESET +PF0.Signal=GPIO_Output +PF2.GPIOParameters=GPIO_Label,GPIO_ModeDefaultOutputPP +PF2.GPIO_Label=USER_LED +PF2.GPIO_ModeDefaultOutputPP=GPIO_MODE_OUTPUT_PP +PF2.Locked=true +PF2.Signal=GPIO_Output +PF7.GPIOParameters=PinState,GPIO_Label +PF7.GPIO_Label=LDO_2V7_EN +PF7.Locked=true +PF7.PinState=GPIO_PIN_SET +PF7.Signal=GPIO_Output +PG1.GPIOParameters=GPIO_Label,GPIO_ModeDefaultEXTI +PG1.GPIO_Label=USER_PB1 +PG1.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_FALLING +PG1.Locked=true +PG1.Signal=GPXTI1 +PG10.GPIOParameters=PinState,GPIO_Label +PG10.GPIO_Label=CHG_LED2 +PG10.Locked=true +PG10.PinState=GPIO_PIN_SET +PG10.Signal=GPIO_Output +PG3.GPIOParameters=GPIO_Label +PG3.GPIO_Label=CHG_LED +PG3.Locked=true +PG3.Signal=GPIO_Input +PG4.GPIOParameters=GPIO_Label +PG4.GPIO_Label=SW_SEL +PG4.Locked=true +PG4.Signal=GPIO_Output +PG7.GPIOParameters=GPIO_Label +PG7.GPIO_Label=I2C3_SCL [TEMPERATURE] +PG7.Locked=true +PG7.Mode=I2C +PG7.Signal=I2C3_SCL +PG8.GPIOParameters=GPIO_Label +PG8.GPIO_Label=I2C3_SDA [TEMPERATURE] +PG8.Locked=true +PG8.Mode=I2C +PG8.Signal=I2C3_SDA +PH0-OSC_IN\ (PH0).GPIOParameters=GPIO_Label +PH0-OSC_IN\ (PH0).GPIO_Label=RCC_OSC_IN +PH0-OSC_IN\ (PH0).Locked=true +PH0-OSC_IN\ (PH0).Mode=HSE-External-Oscillator +PH0-OSC_IN\ (PH0).Signal=RCC_OSC_IN +PH1-OSC_OUT\ (PH1).GPIOParameters=GPIO_Label +PH1-OSC_OUT\ (PH1).GPIO_Label=RCC_OSC_OUT +PH1-OSC_OUT\ (PH1).Locked=true +PH1-OSC_OUT\ (PH1).Mode=HSE-External-Oscillator +PH1-OSC_OUT\ (PH1).Signal=RCC_OSC_OUT +PinOutPanel.CurrentBGAView=Top +PinOutPanel.RotationAngle=0 +ProjectManager.AskForMigrate=true +ProjectManager.BackupPrevious=false +ProjectManager.CompilerOptimize=6 +ProjectManager.ComputerToolchain=false +ProjectManager.CoupleFile=true +ProjectManager.CustomerFirmwarePackage= +ProjectManager.DefaultFWLocation=true +ProjectManager.DeletePrevious=true +ProjectManager.DeviceId=STM32L4R9ZIJx +ProjectManager.FirmwarePackage=STM32Cube FW_L4 V1.16.0 +ProjectManager.FreePins=false +ProjectManager.HalAssertFull=false +ProjectManager.HeapSize=0x200 +ProjectManager.KeepUserCode=true +ProjectManager.LastFirmware=true +ProjectManager.LibraryCopy=1 +ProjectManager.MainLocation=Core/Src +ProjectManager.NoMain=false +ProjectManager.PreviousToolchain= +ProjectManager.ProjectBuild=false +ProjectManager.ProjectFileName=CubeMX_Config.ioc +ProjectManager.ProjectName=CubeMX_Config +ProjectManager.RegisterCallBack= +ProjectManager.StackSize=0x400 +ProjectManager.TargetToolchain=MDK-ARM V5 +ProjectManager.ToolChainLocation= +ProjectManager.UnderRoot=false +ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-MX_DMA_Init-DMA-false-HAL-true,3-SystemClock_Config-RCC-false-HAL-false,4-MX_ADC1_Init-ADC1-false-HAL-true,5-MX_DFSDM1_Init-DFSDM1-false-HAL-true,6-MX_I2C1_Init-I2C1-false-HAL-true,7-MX_I2C3_Init-I2C3-false-HAL-true,8-MX_RTC_Init-RTC-false-HAL-true,9-MX_SDMMC1_SD_Init-SDMMC1-false-HAL-true,10-MX_SPI1_Init-SPI1-false-HAL-true,11-MX_SPI2_Init-SPI2-false-HAL-true,12-MX_SPI3_Init-SPI3-false-HAL-true,13-MX_TIM2_Init-TIM2-false-HAL-true,14-MX_TIM6_Init-TIM6-false-HAL-true,15-MX_TIM7_Init-TIM7-false-HAL-true,16-MX_FATFS_Init-FATFS-false-HAL-false,17-MX_USB_DEVICE_Init-USB_DEVICE-false-HAL-false,18-MX_USART1_UART_Init-USART1-false-HAL-true +RCC.ADCFreq_Value=76800000 +RCC.AHBFreq_Value=120000000 +RCC.APB1Freq_Value=120000000 +RCC.APB1TimFreq_Value=120000000 +RCC.APB2Freq_Value=120000000 +RCC.APB2TimFreq_Value=120000000 +RCC.CK48CLockSelection=RCC_USBCLKSOURCE_HSI48 +RCC.CRSFreq_Value=48000000 +RCC.CortexFreq_Value=120000000 +RCC.DFSDMFreq_Value=120000000 +RCC.DSIFreq_Value=40000000 +RCC.DSIRXEscFreq_Value=40000000 +RCC.DSITXEscFreq_Value=10000000 +RCC.FCLKCortexFreq_Value=120000000 +RCC.FamilyName=M +RCC.HCLKFreq_Value=120000000 +RCC.HSE_VALUE=16000000 +RCC.HSI48_VALUE=48000000 +RCC.HSI_VALUE=16000000 +RCC.I2C1Freq_Value=120000000 +RCC.I2C2Freq_Value=120000000 +RCC.I2C3Freq_Value=120000000 +RCC.I2C4Freq_Value=120000000 +RCC.IPParameters=ADCFreq_Value,AHBFreq_Value,APB1Freq_Value,APB1TimFreq_Value,APB2Freq_Value,APB2TimFreq_Value,CK48CLockSelection,CRSFreq_Value,CortexFreq_Value,DFSDMFreq_Value,DSIFreq_Value,DSIRXEscFreq_Value,DSITXEscFreq_Value,FCLKCortexFreq_Value,FamilyName,HCLKFreq_Value,HSE_VALUE,HSI48_VALUE,HSI_VALUE,I2C1Freq_Value,I2C2Freq_Value,I2C3Freq_Value,I2C4Freq_Value,LCDTFTFreq_Value,LPTIM1Freq_Value,LPTIM2Freq_Value,LPUART1Freq_Value,LSCOPinFreq_Value,LSI_VALUE,MCO1PinFreq_Value,MSI_VALUE,OCTOSPIMFreq_Value,PLLDSIFreq_Value,PLLDSIVCOFreq_Value,PLLM1,PLLM2,PLLN,PLLP,PLLPoutputFreq_Value,PLLQoutputFreq_Value,PLLRCLKFreq_Value,PLLSAI1N,PLLSAI1PoutputFreq_Value,PLLSAI1Q,PLLSAI1QoutputFreq_Value,PLLSAI1R,PLLSAI1RoutputFreq_Value,PLLSAI2PoutputFreq_Value,PLLSAI2QoutputFreq_Value,PLLSAI2RoutputFreq_Value,PLLSourceVirtual,PWRFreq_Value,RNGFreq_Value,RTCClockSelection,RTCFreq_Value,SAI1Freq_Value,SAI2Freq_Value,SDMMCFreq_Value,SYSCLKFreq_VALUE,SYSCLKSource,UART4Freq_Value,UART5Freq_Value,USART1Freq_Value,USART2Freq_Value,USART3Freq_Value,USBFreq_Value,VCOInput2Freq_Value,VCOInput3Freq_Value,VCOInputFreq_Value,VCOOutputFreq_Value,VCOSAI1OutputFreq_Value,VCOSAI2OutputFreq_Value +RCC.LCDTFTFreq_Value=32000000 +RCC.LPTIM1Freq_Value=120000000 +RCC.LPTIM2Freq_Value=120000000 +RCC.LPUART1Freq_Value=120000000 +RCC.LSCOPinFreq_Value=32000 +RCC.LSI_VALUE=32000 +RCC.MCO1PinFreq_Value=120000000 +RCC.MSI_VALUE=4000000 +RCC.OCTOSPIMFreq_Value=120000000 +RCC.PLLDSIFreq_Value=320000000 +RCC.PLLDSIVCOFreq_Value=640000000 +RCC.PLLM1=4 +RCC.PLLM2=5 +RCC.PLLN=60 +RCC.PLLP=RCC_PLLP_DIV5 +RCC.PLLPoutputFreq_Value=48000000 +RCC.PLLQoutputFreq_Value=120000000 +RCC.PLLRCLKFreq_Value=120000000 +RCC.PLLSAI1N=96 +RCC.PLLSAI1PoutputFreq_Value=153600000 +RCC.PLLSAI1Q=RCC_PLLQ_DIV4 +RCC.PLLSAI1QoutputFreq_Value=76800000 +RCC.PLLSAI1R=RCC_PLLR_DIV4 +RCC.PLLSAI1RoutputFreq_Value=76800000 +RCC.PLLSAI2PoutputFreq_Value=64000000 +RCC.PLLSAI2QoutputFreq_Value=64000000 +RCC.PLLSAI2RoutputFreq_Value=64000000 +RCC.PLLSourceVirtual=RCC_PLLSOURCE_HSE +RCC.PWRFreq_Value=120000000 +RCC.RNGFreq_Value=48000000 +RCC.RTCClockSelection=RCC_RTCCLKSOURCE_LSE +RCC.RTCFreq_Value=32768 +RCC.SAI1Freq_Value=153600000 +RCC.SAI2Freq_Value=153600000 +RCC.SDMMCFreq_Value=48000000 +RCC.SYSCLKFreq_VALUE=120000000 +RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK +RCC.UART4Freq_Value=120000000 +RCC.UART5Freq_Value=120000000 +RCC.USART1Freq_Value=120000000 +RCC.USART2Freq_Value=120000000 +RCC.USART3Freq_Value=120000000 +RCC.USBFreq_Value=48000000 +RCC.VCOInput2Freq_Value=3200000 +RCC.VCOInput3Freq_Value=16000000 +RCC.VCOInputFreq_Value=4000000 +RCC.VCOOutputFreq_Value=240000000 +RCC.VCOSAI1OutputFreq_Value=307200000 +RCC.VCOSAI2OutputFreq_Value=128000000 +RTC.Date=3 +RTC.Format=RTC_FORMAT_BIN +RTC.IPParameters=Format,WeekDay,Month,Date,Year +RTC.IPParametersWithoutCheck=Year +RTC.Month=RTC_MONTH_APRIL +RTC.WeekDay=RTC_WEEKDAY_TUESDAY +RTC.Year=20 +SH.ADCx_IN13.0=ADC1_IN13,IN13-Single-Ended +SH.ADCx_IN13.ConfNb=1 +SH.ADCx_IN8.0=ADC1_IN8,IN8-Single-Ended +SH.ADCx_IN8.ConfNb=1 +SH.GPXTI1.0=GPIO_EXTI1 +SH.GPXTI1.ConfNb=1 +SH.GPXTI13.0=GPIO_EXTI13 +SH.GPXTI13.ConfNb=1 +SH.GPXTI14.0=GPIO_EXTI14 +SH.GPXTI14.ConfNb=1 +SH.GPXTI15.0=GPIO_EXTI15 +SH.GPXTI15.ConfNb=1 +SH.GPXTI2.0=GPIO_EXTI2 +SH.GPXTI2.ConfNb=1 +SH.GPXTI3.0=GPIO_EXTI3 +SH.GPXTI3.ConfNb=1 +SH.GPXTI5.0=GPIO_EXTI5 +SH.GPXTI5.ConfNb=1 +SH.GPXTI6.0=GPIO_EXTI6 +SH.GPXTI6.ConfNb=1 +SPI1.BaudRatePrescaler=SPI_BAUDRATEPRESCALER_16 +SPI1.CLKPhase=SPI_PHASE_2EDGE +SPI1.CLKPolarity=SPI_POLARITY_HIGH +SPI1.CalculateBaudRate=7.5 MBits/s +SPI1.DataSize=SPI_DATASIZE_8BIT +SPI1.Direction=SPI_DIRECTION_2LINES +SPI1.IPParameters=VirtualType,Mode,Direction,BaudRatePrescaler,CalculateBaudRate,DataSize,CLKPolarity,CLKPhase +SPI1.Mode=SPI_MODE_MASTER +SPI1.VirtualType=VM_MASTER +SPI2.BaudRatePrescaler=SPI_BAUDRATEPRESCALER_128 +SPI2.CLKPhase=SPI_PHASE_2EDGE +SPI2.CalculateBaudRate=937.5 KBits/s +SPI2.DataSize=SPI_DATASIZE_8BIT +SPI2.Direction=SPI_DIRECTION_2LINES +SPI2.IPParameters=VirtualType,Mode,Direction,BaudRatePrescaler,CalculateBaudRate,DataSize,CLKPhase +SPI2.Mode=SPI_MODE_MASTER +SPI2.VirtualType=VM_MASTER +SPI3.BaudRatePrescaler=SPI_BAUDRATEPRESCALER_16 +SPI3.CLKPhase=SPI_PHASE_2EDGE +SPI3.CLKPolarity=SPI_POLARITY_HIGH +SPI3.CalculateBaudRate=7.5 MBits/s +SPI3.DataSize=SPI_DATASIZE_8BIT +SPI3.Direction=SPI_DIRECTION_2LINES +SPI3.IPParameters=VirtualType,Mode,Direction,BaudRatePrescaler,CalculateBaudRate,DataSize,CLKPolarity,CLKPhase +SPI3.Mode=SPI_MODE_MASTER +SPI3.VirtualType=VM_MASTER +TIM2.IPParameters=Prescaler,Period +TIM2.Period=0xFFFFFFFF +TIM2.Prescaler=119 +TIM6.IPParameters=Prescaler,Period +TIM6.Period=1000 +TIM6.Prescaler=119 +TIM7.IPParameters=Prescaler,Period +TIM7.Period=0xFFFF +TIM7.Prescaler=119 +USART1.IPParameters=VirtualMode-Asynchronous +USART1.VirtualMode-Asynchronous=VM_ASYNC +USB_DEVICE.CLASS_NAME_FS=CDC +USB_DEVICE.IPParameters=VirtualMode,VirtualModeFS,CLASS_NAME_FS +USB_DEVICE.VirtualMode=Cdc +USB_DEVICE.VirtualModeFS=Cdc_FS +USB_OTG_FS.IPParameters=VirtualMode,battery_charging_enable,use_dedicated_ep1 +USB_OTG_FS.VirtualMode=Device_Only +USB_OTG_FS.battery_charging_enable=ENABLE +USB_OTG_FS.use_dedicated_ep1=DISABLE +VP_DFSDM1_VS_IN0.Mode=Parallel_Input_ch0 +VP_DFSDM1_VS_IN0.Signal=DFSDM1_VS_IN0 +VP_FATFS_VS_SDIO.Mode=SDIO +VP_FATFS_VS_SDIO.Signal=FATFS_VS_SDIO +VP_RTC_VS_RTC_Activate.Mode=RTC_Enabled +VP_RTC_VS_RTC_Activate.Signal=RTC_VS_RTC_Activate +VP_RTC_VS_RTC_Calendar.Mode=RTC_Calendar +VP_RTC_VS_RTC_Calendar.Signal=RTC_VS_RTC_Calendar +VP_SYS_VS_Systick.Mode=SysTick +VP_SYS_VS_Systick.Signal=SYS_VS_Systick +VP_TIM2_VS_ClockSourceINT.Mode=Internal +VP_TIM2_VS_ClockSourceINT.Signal=TIM2_VS_ClockSourceINT +VP_TIM6_VS_ClockSourceINT.Mode=Enable_Timer +VP_TIM6_VS_ClockSourceINT.Signal=TIM6_VS_ClockSourceINT +VP_TIM7_VS_ClockSourceINT.Mode=Enable_Timer +VP_TIM7_VS_ClockSourceINT.Signal=TIM7_VS_ClockSourceINT +VP_USB_DEVICE_VS_USB_DEVICE_CDC_FS.Mode=CDC_FS +VP_USB_DEVICE_VS_USB_DEVICE_CDC_FS.Signal=USB_DEVICE_VS_USB_DEVICE_CDC_FS +board=STEVAL-MKSBOX1V1 +boardIOC=true diff --git a/bsp/stm32/stm32l4r9-st-sensortile-box/board/Kconfig b/bsp/stm32/stm32l4r9-st-sensortile-box/board/Kconfig new file mode 100644 index 0000000000..eedcda70f3 --- /dev/null +++ b/bsp/stm32/stm32l4r9-st-sensortile-box/board/Kconfig @@ -0,0 +1,38 @@ +menu "Hardware Drivers Config" + +config SOC_STM32L4R9ZI + bool + select SOC_SERIES_STM32L4 + select RT_USING_COMPONENTS_INIT + select RT_USING_USER_MAIN + default y + + +menu "On-chip Peripheral Drivers" + + config BSP_USING_GPIO + bool "Enable GPIO" + select RT_USING_PIN + default y + + menuconfig BSP_USING_UART + bool "Enable UART" + default y + select RT_USING_SERIAL + if BSP_USING_UART + config BSP_USING_UART1 + bool "Enable UART1" + default y + endif + + config BSP_USING_USBD + bool "Enable Full-Speed USB Device Controller(USBD)" + select RT_USING_USB_DEVICE + default y + + + source "../libraries/HAL_Drivers/Kconfig" + +endmenu + +endmenu diff --git a/bsp/stm32/stm32l4r9-st-sensortile-box/board/SConscript b/bsp/stm32/stm32l4r9-st-sensortile-box/board/SConscript new file mode 100644 index 0000000000..ef43bfc5c0 --- /dev/null +++ b/bsp/stm32/stm32l4r9-st-sensortile-box/board/SConscript @@ -0,0 +1,41 @@ +import os +import rtconfig +from building import * + +Import('SDK_LIB') + +cwd = GetCurrentDir() + +# add general drivers +src = Split(''' +board.c +CubeMX_Config/Core/Src/stm32l4xx_hal_msp.c +''') + + +path = [cwd] +path += [cwd + '/CubeMX_Config/Core/Inc'] + +startup_path_prefix = SDK_LIB + +if rtconfig.CROSS_TOOL == 'gcc': + src += [startup_path_prefix + '/STM32L4xx_HAL/CMSIS/Device/ST/STM32L4xx/Source/Templates/gcc/startup_stm32l4r9xx.s'] +elif rtconfig.CROSS_TOOL == 'keil': + src += [startup_path_prefix + '/STM32L4xx_HAL/CMSIS/Device/ST/STM32L4xx/Source/Templates/arm/startup_stm32l4r9xx.s'] +elif rtconfig.CROSS_TOOL == 'iar': + src += [startup_path_prefix + '/STM32L4xx_HAL/CMSIS/Device/ST/STM32L4xx/Source/Templates/iar/startup_stm32l4r9xx.s'] + +# STM32L412xx || STM32L422xx || STM32L431xx +# STM32L432xx || STM32L433xx || STM32L442xx +# STM32L443xx || STM32L451xx || STM32L452xx +# STM32L462xx || STM32L471xx || STM32L475xx +# STM32L476xx || STM32L485xx || STM32L486xx +# STM32L496xx || STM32L4A6xx || STM32L4R5xx +# STM32L4R7xx || STM32L4R9xx || STM32L4S5xx +# STM32L4S7xx || STM32L4S9xx +# You can select chips from the list above +CPPDEFINES = ['STM32L4R9xx'] +group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES) + +Return('group') + diff --git a/bsp/stm32/stm32l4r9-st-sensortile-box/board/board.c b/bsp/stm32/stm32l4r9-st-sensortile-box/board/board.c new file mode 100644 index 0000000000..beacd7ac14 --- /dev/null +++ b/bsp/stm32/stm32l4r9-st-sensortile-box/board/board.c @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2021-08-09 supperthomas first version + */ + +#include "board.h" + +void SystemClock_Config(void) +{ + RCC_OscInitTypeDef RCC_OscInitStruct = {0}; + RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; + RCC_PeriphCLKInitTypeDef PeriphClkInit = {0}; + + /** Configure the main internal regulator output voltage + */ + if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1_BOOST) != HAL_OK) + { + Error_Handler(); + } + /** Configure LSE Drive Capability + */ + HAL_PWR_EnableBkUpAccess(); + __HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_LOW); + /** Initializes the RCC Oscillators according to the specified parameters + * in the RCC_OscInitTypeDef structure. + */ + RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI48|RCC_OSCILLATORTYPE_HSE + |RCC_OSCILLATORTYPE_LSE; + RCC_OscInitStruct.HSEState = RCC_HSE_ON; + RCC_OscInitStruct.LSEState = RCC_LSE_ON; + RCC_OscInitStruct.HSI48State = RCC_HSI48_ON; + RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; + RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; + RCC_OscInitStruct.PLL.PLLM = 4; + RCC_OscInitStruct.PLL.PLLN = 60; + RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV5; + RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV2; + RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2; + if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) + { + Error_Handler(); + } + /** Initializes the CPU, AHB and APB buses clocks + */ + RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK + |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; + RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; + RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; + RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1; + RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; + + if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5) != HAL_OK) + { + Error_Handler(); + } + PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_RTC|RCC_PERIPHCLK_USART1 + |RCC_PERIPHCLK_I2C1|RCC_PERIPHCLK_I2C3 + |RCC_PERIPHCLK_DFSDM1|RCC_PERIPHCLK_USB + |RCC_PERIPHCLK_SDMMC1|RCC_PERIPHCLK_ADC; + PeriphClkInit.Usart1ClockSelection = RCC_USART1CLKSOURCE_PCLK2; + PeriphClkInit.I2c1ClockSelection = RCC_I2C1CLKSOURCE_PCLK1; + PeriphClkInit.I2c3ClockSelection = RCC_I2C3CLKSOURCE_PCLK1; + PeriphClkInit.AdcClockSelection = RCC_ADCCLKSOURCE_PLLSAI1; + PeriphClkInit.Dfsdm1ClockSelection = RCC_DFSDM1CLKSOURCE_PCLK; + PeriphClkInit.RTCClockSelection = RCC_RTCCLKSOURCE_LSE; + PeriphClkInit.UsbClockSelection = RCC_USBCLKSOURCE_HSI48; + PeriphClkInit.Sdmmc1ClockSelection = RCC_SDMMC1CLKSOURCE_PLLP; + PeriphClkInit.PLLSAI1.PLLSAI1Source = RCC_PLLSOURCE_HSE; + PeriphClkInit.PLLSAI1.PLLSAI1M = 5; + PeriphClkInit.PLLSAI1.PLLSAI1N = 96; + PeriphClkInit.PLLSAI1.PLLSAI1P = RCC_PLLP_DIV2; + PeriphClkInit.PLLSAI1.PLLSAI1Q = RCC_PLLQ_DIV4; + PeriphClkInit.PLLSAI1.PLLSAI1R = RCC_PLLR_DIV4; + PeriphClkInit.PLLSAI1.PLLSAI1ClockOut = RCC_PLLSAI1_ADC1CLK; + if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) + { + Error_Handler(); + } +} diff --git a/bsp/stm32/stm32l4r9-st-sensortile-box/board/board.h b/bsp/stm32/stm32l4r9-st-sensortile-box/board/board.h new file mode 100644 index 0000000000..049be64f38 --- /dev/null +++ b/bsp/stm32/stm32l4r9-st-sensortile-box/board/board.h @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2021-08-09 supperthomas first version + */ + +#ifndef __BOARD_H__ +#define __BOARD_H__ + +#include +#include +#include "drv_common.h" +#include "drv_gpio.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define STM32_FLASH_START_ADRESS ((uint32_t)0x08000000) +#define STM32_FLASH_SIZE (2048 * 1024) +#define STM32_FLASH_END_ADDRESS ((uint32_t)(STM32_FLASH_START_ADRESS + STM32_FLASH_SIZE)) + +#define STM32_SRAM1_SIZE (640) +#define STM32_SRAM1_START (0x20000000) +#define STM32_SRAM1_END (STM32_SRAM1_START + STM32_SRAM1_SIZE * 1024) + +#if defined(__CC_ARM) || defined(__CLANG_ARM) +extern int Image$$RW_IRAM1$$ZI$$Limit; +#define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) +#elif __ICCARM__ +#pragma section="CSTACK" +#define HEAP_BEGIN (__segment_end("CSTACK")) +#else +extern int __bss_end; +#define HEAP_BEGIN ((void *)&__bss_end) +#endif + +#define HEAP_END STM32_SRAM1_END + +void SystemClock_Config(void); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/bsp/stm32/stm32l4r9-st-sensortile-box/board/linker_scripts/link.icf b/bsp/stm32/stm32l4r9-st-sensortile-box/board/linker_scripts/link.icf new file mode 100644 index 0000000000..838fae1cef --- /dev/null +++ b/bsp/stm32/stm32l4r9-st-sensortile-box/board/linker_scripts/link.icf @@ -0,0 +1,45 @@ +/*###ICF### Section handled by ICF editor, don't touch! ****/ +/*-Editor annotation file-*/ +/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_1.xml" */ +/*-Specials-*/ +define symbol __ICFEDIT_intvec_start__ = 0x08000000; +/*-Memory Regions-*/ +define symbol __ICFEDIT_region_IROM1_start__ = 0x08000000; +define symbol __ICFEDIT_region_IROM1_end__ = 0x081FFFFF; +define symbol __ICFEDIT_region_IRAM1_start__ = 0x20000000; +define symbol __ICFEDIT_region_IRAM1_end__ = 0x2002FFFF; +define symbol __ICFEDIT_region_IRAM2_start__ = 0x20030000; +define symbol __ICFEDIT_region_IRAM2_end__ = 0x2003FFFF; + +/*-Sizes-*/ +define symbol __ICFEDIT_size_cstack__ = 0x2000; +define symbol __ICFEDIT_size_heap__ = 0x2000; +/**** End of ICF editor section. ###ICF###*/ + +define symbol IRAM3_region_start = 0x20040000; +define symbol IRAM3_region_end = 0x2009FFFF; + +define memory mem with size = 4G; +define region IROM_region = mem:[from __ICFEDIT_region_IROM1_start__ to __ICFEDIT_region_IROM1_end__]; + +define region IRAM_region = mem:[from __ICFEDIT_region_IRAM1_start__ to __ICFEDIT_region_IRAM1_end__] + | mem:[from __ICFEDIT_region_IRAM2_start__ to __ICFEDIT_region_IRAM2_end__] + | mem:[from IRAM3_region_start to IRAM3_region_end ]; + + +define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; +define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; + +initialize by copy { readwrite }; + +if (isdefinedsymbol(__USE_DLIB_PERTHREAD)) +{ + // Required in a multi-threaded application + initialize by copy with packing = none { section __DLIB_PERTHREAD }; +} + + +place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; + +place in IROM_region { readonly }; +place in IRAM_region { readwrite, block CSTACK, block HEAP }; \ No newline at end of file diff --git a/bsp/stm32/stm32l4r9-st-sensortile-box/board/linker_scripts/link.lds b/bsp/stm32/stm32l4r9-st-sensortile-box/board/linker_scripts/link.lds new file mode 100644 index 0000000000..d75d77b242 --- /dev/null +++ b/bsp/stm32/stm32l4r9-st-sensortile-box/board/linker_scripts/link.lds @@ -0,0 +1,154 @@ +/* + * linker script for STM32L4XX with GNU ld + */ + +/* Program Entry, set to mark it as "used" and avoid gc */ +MEMORY +{ + ROM (rx) : ORIGIN = 0x08000000, LENGTH = 2048k /* 2048KB flash */ + RAM1 (rw) : ORIGIN = 0x20000000, LENGTH = 256k /* 256k sram */ + RAM2 (rw) : ORIGIN = 0x20040000, LENGTH = 384k /* 384k sram */ +} +ENTRY(Reset_Handler) +_system_stack_size = 0x200; + +SECTIONS +{ + .text : + { + . = ALIGN(4); + _stext = .; + KEEP(*(.isr_vector)) /* Startup code */ + + . = ALIGN(4); + *(.text) /* remaining code */ + *(.text.*) /* remaining code */ + *(.rodata) /* read-only data (constants) */ + *(.rodata*) + *(.glue_7) + *(.glue_7t) + *(.gnu.linkonce.t*) + + /* section information for finsh shell */ + . = ALIGN(4); + __fsymtab_start = .; + KEEP(*(FSymTab)) + __fsymtab_end = .; + + . = ALIGN(4); + __vsymtab_start = .; + KEEP(*(VSymTab)) + __vsymtab_end = .; + + /* section information for initial. */ + . = ALIGN(4); + __rt_init_start = .; + KEEP(*(SORT(.rti_fn*))) + __rt_init_end = .; + + . = ALIGN(4); + PROVIDE(__ctors_start__ = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + PROVIDE(__ctors_end__ = .); + + . = ALIGN(4); + _etext = .; + } > ROM = 0 + + /* .ARM.exidx is sorted, so has to go in its own output section. */ + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + + /* This is used by the startup in order to initialize the .data secion */ + _sidata = .; + } > ROM + __exidx_end = .; + + /* .data section which is used for initialized data */ + + .data : AT (_sidata) + { + . = ALIGN(4); + /* This is used by the startup in order to initialize the .data secion */ + _sdata = . ; + + *(.data) + *(.data.*) + *(.gnu.linkonce.d*) + PROVIDE(__dtors_start__ = .); + KEEP(*(SORT(.dtors.*))) + KEEP(*(.dtors)) + PROVIDE(__dtors_end__ = .); + + . = ALIGN(4); + /* This is used by the startup in order to initialize the .data secion */ + _edata = . ; + } >RAM2 + + .stack : + { + . = ALIGN(4); + _sstack = .; + . = . + _system_stack_size; + . = ALIGN(4); + _estack = .; + } >RAM2 + + __bss_start = .; + .bss : + { + . = ALIGN(4); + /* This is used by the startup in order to initialize the .bss secion */ + _sbss = .; + + *(.bss) + *(.bss.*) + *(COMMON) + + . = ALIGN(4); + /* This is used by the startup in order to initialize the .bss secion */ + _ebss = . ; + + *(.bss.init) + } > RAM2 + __bss_end = .; + + _end = .; + + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* DWARF debug sections. + * Symbols in the DWARF debugging sections are relative to the beginning + * of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } +} diff --git a/bsp/stm32/stm32l4r9-st-sensortile-box/board/linker_scripts/link.sct b/bsp/stm32/stm32l4r9-st-sensortile-box/board/linker_scripts/link.sct new file mode 100644 index 0000000000..1789d52d63 --- /dev/null +++ b/bsp/stm32/stm32l4r9-st-sensortile-box/board/linker_scripts/link.sct @@ -0,0 +1,19 @@ +; ************************************************************* +; *** Scatter-Loading Description File generated by uVision *** +; ************************************************************* + +LR_IROM1 0x08000000 0x00200000 { ; load region size_region + ER_IROM1 0x08000000 0x00200000 { ; load address = execution address + *.o (RESET, +First) + *(InRoot$$Sections) + .ANY (+RO) + } + + RW_IRAM1 0x20000000 0x000A0000 { ; RW data + .ANY (+RW +ZI) + } + + + +} + diff --git a/bsp/stm32/stm32l4r9-st-sensortile-box/figures/board.png b/bsp/stm32/stm32l4r9-st-sensortile-box/figures/board.png new file mode 100644 index 0000000000..f504a13998 Binary files /dev/null and b/bsp/stm32/stm32l4r9-st-sensortile-box/figures/board.png differ diff --git a/bsp/stm32/stm32l4r9-st-sensortile-box/project.ewd b/bsp/stm32/stm32l4r9-st-sensortile-box/project.ewd new file mode 100644 index 0000000000..db81585c48 --- /dev/null +++ b/bsp/stm32/stm32l4r9-st-sensortile-box/project.ewd @@ -0,0 +1,3030 @@ + + + 3 + + rt-thread + + ARM + + 1 + + C-SPY + 2 + + 32 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + CADI_ID + 2 + + 0 + 1 + 1 + + + + + + + + + CMSISDAP_ID + 2 + + 4 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IJET_ID + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + JLINK_ID + 2 + + 16 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + NULINK_ID + 2 + + 0 + 1 + 1 + + + + + + + PEMICRO_ID + 2 + + 3 + 1 + 1 + + + + + + + + STLINK_ID + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + TIFET_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + + + XDS100_ID + 2 + + 8 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\FreeRtos\FreeRtosArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\Mbed\MbedArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\Mbed\MbedArmPlugin2.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\SMX\smxAwareIarArm9.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\SMX\smxAwareIarArm9BE.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\TargetAccessServer\TargetAccessServer.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin + 0 + + + + + Release + + ARM + + 0 + + C-SPY + 2 + + 32 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 0 + + + + + + + + CADI_ID + 2 + + 0 + 1 + 0 + + + + + + + + + CMSISDAP_ID + 2 + + 4 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 0 + + + + + + + + + + + IJET_ID + 2 + + 9 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + JLINK_ID + 2 + + 16 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 2 + 1 + 0 + + + + + + + + + + NULINK_ID + 2 + + 0 + 1 + 0 + + + + + + + PEMICRO_ID + 2 + + 3 + 1 + 0 + + + + + + + + STLINK_ID + 2 + + 7 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 0 + + + + + + + + TIFET_ID + 2 + + 1 + 1 + 0 + + + + + + + + + + + + + + + + + + + XDS100_ID + 2 + + 8 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\FreeRtos\FreeRtosArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\Mbed\MbedArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\Mbed\MbedArmPlugin2.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\SMX\smxAwareIarArm9.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\SMX\smxAwareIarArm9BE.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\TargetAccessServer\TargetAccessServer.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin + 0 + + + + diff --git a/bsp/stm32/stm32l4r9-st-sensortile-box/project.ewp b/bsp/stm32/stm32l4r9-st-sensortile-box/project.ewp new file mode 100644 index 0000000000..a3e3ffe07f --- /dev/null +++ b/bsp/stm32/stm32l4r9-st-sensortile-box/project.ewp @@ -0,0 +1,2328 @@ + + 3 + + rt-thread + + ARM + + 1 + + General + 3 + + 33 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 37 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 11 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + 0 + inputOutputBased + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 25 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + + Release + + ARM + + 0 + + General + 3 + + 33 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 37 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 11 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 0 + + + + + + + + + CUSTOM + 3 + + + + 0 + inputOutputBased + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 25 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 0 + + + + + + + + Applications + + $PROJ_DIR$\applications\main.c + + + + CPU + + $PROJ_DIR$\..\..\..\libcpu\arm\common\backtrace.c + + + $PROJ_DIR$\..\..\..\libcpu\arm\common\showmem.c + + + $PROJ_DIR$\..\..\..\libcpu\arm\common\div0.c + + + $PROJ_DIR$\..\..\..\libcpu\arm\cortex-m4\cpuport.c + + + $PROJ_DIR$\..\..\..\libcpu\arm\cortex-m4\context_iar.S + + + + DeviceDrivers + + $PROJ_DIR$\..\..\..\components\drivers\misc\pin.c + + + $PROJ_DIR$\..\..\..\components\drivers\serial\serial.c + + + $PROJ_DIR$\..\..\..\components\drivers\src\workqueue.c + + + $PROJ_DIR$\..\..\..\components\drivers\src\pipe.c + + + $PROJ_DIR$\..\..\..\components\drivers\src\ringbuffer.c + + + $PROJ_DIR$\..\..\..\components\drivers\src\completion.c + + + $PROJ_DIR$\..\..\..\components\drivers\src\ringblk_buf.c + + + $PROJ_DIR$\..\..\..\components\drivers\src\waitqueue.c + + + $PROJ_DIR$\..\..\..\components\drivers\src\dataqueue.c + + + + Drivers + + $PROJ_DIR$\board\CubeMX_Config\Core\Src\stm32l4xx_hal_msp.c + + + $PROJ_DIR$\..\libraries\STM32L4xx_HAL\CMSIS\Device\ST\STM32L4xx\Source\Templates\iar\startup_stm32l4r9xx.s + + + $PROJ_DIR$\board\board.c + + + $PROJ_DIR$\..\libraries\HAL_Drivers\drv_gpio.c + + + $PROJ_DIR$\..\libraries\HAL_Drivers\drv_usart.c + + + $PROJ_DIR$\..\libraries\HAL_Drivers\drv_common.c + + + + finsh + + $PROJ_DIR$\..\..\..\components\finsh\shell.c + + + $PROJ_DIR$\..\..\..\components\finsh\cmd.c + + + $PROJ_DIR$\..\..\..\components\finsh\msh.c + + + + Kernel + + $PROJ_DIR$\..\..\..\src\components.c + + + $PROJ_DIR$\..\..\..\src\timer.c + + + $PROJ_DIR$\..\..\..\src\clock.c + + + $PROJ_DIR$\..\..\..\src\ipc.c + + + $PROJ_DIR$\..\..\..\src\object.c + + + $PROJ_DIR$\..\..\..\src\memheap.c + + + $PROJ_DIR$\..\..\..\src\mempool.c + + + $PROJ_DIR$\..\..\..\src\device.c + + + $PROJ_DIR$\..\..\..\src\scheduler.c + + + $PROJ_DIR$\..\..\..\src\irq.c + + + $PROJ_DIR$\..\..\..\src\kservice.c + + + $PROJ_DIR$\..\..\..\src\idle.c + + + $PROJ_DIR$\..\..\..\src\thread.c + + + + libc + + + Libraries + + $PROJ_DIR$\..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_cryp.c + + + $PROJ_DIR$\..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_uart.c + + + $PROJ_DIR$\..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_usart.c + + + $PROJ_DIR$\..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_cortex.c + + + $PROJ_DIR$\..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_gpio.c + + + $PROJ_DIR$\..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_dma.c + + + $PROJ_DIR$\..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_pwr.c + + + $PROJ_DIR$\..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_rcc_ex.c + + + $PROJ_DIR$\..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_rcc.c + + + $PROJ_DIR$\..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_dma_ex.c + + + $PROJ_DIR$\..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_exti.c + + + $PROJ_DIR$\..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_crc.c + + + $PROJ_DIR$\..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal.c + + + $PROJ_DIR$\..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_usart_ex.c + + + $PROJ_DIR$\..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_uart_ex.c + + + $PROJ_DIR$\..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_crc_ex.c + + + $PROJ_DIR$\..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_comp.c + + + $PROJ_DIR$\..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_pwr_ex.c + + + $PROJ_DIR$\..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_rng.c + + + $PROJ_DIR$\..\libraries\STM32L4xx_HAL\CMSIS\Device\ST\STM32L4xx\Source\Templates\system_stm32l4xx.c + + + $PROJ_DIR$\..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_cryp_ex.c + + + + utestcases + + diff --git a/bsp/stm32/stm32l4r9-st-sensortile-box/project.eww b/bsp/stm32/stm32l4r9-st-sensortile-box/project.eww new file mode 100644 index 0000000000..c2cb02eb1e --- /dev/null +++ b/bsp/stm32/stm32l4r9-st-sensortile-box/project.eww @@ -0,0 +1,10 @@ + + + + + $WS_DIR$\project.ewp + + + + + diff --git a/bsp/stm32/stm32l4r9-st-sensortile-box/project.uvoptx b/bsp/stm32/stm32l4r9-st-sensortile-box/project.uvoptx new file mode 100644 index 0000000000..9e05242adf --- /dev/null +++ b/bsp/stm32/stm32l4r9-st-sensortile-box/project.uvoptx @@ -0,0 +1,936 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + rt-thread + 0x4 + ARM-ADS + + 12000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\build\keil\List\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 18 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 6 + + + + + + + + + + + STLink\ST-LINKIII-KEIL_SWO.dll + + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 ) -FN1 -FC1000 -FD20000000 -FF0STM32L4Rx_2048_Dual -FL0200000 -FS08000000 -FP0($$Device:STM32L4R9ZIJx$CMSIS\Flash\STM32L4Rx_2048_Dual.FLM) + + + 0 + ST-LINKIII-KEIL_SWO + -U066DFF565251887067022235 -O206 -SF10000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP (ARM Core") -D00(2BA01477) -L00(0) -TO131090 -TC10000000 -TT10000000 -TP21 -TDS8000 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC1000 -FN1 -FF0STM32L4Rx_2048_Dual.FLM -FS08000000 -FL0200000 -FP0($$Device:STM32L4R9ZIJx$CMSIS\Flash\STM32L4Rx_2048_Dual.FLM) + + + + + 0 + + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + 1 + 0 + 0 + 2 + 10000000 + + + + + + Applications + 1 + 0 + 0 + 0 + + 1 + 1 + 1 + 0 + 0 + 0 + applications\main.c + main.c + 0 + 0 + + + + + CPU + 0 + 0 + 0 + 0 + + 2 + 2 + 1 + 0 + 0 + 0 + ..\..\..\libcpu\arm\common\div0.c + div0.c + 0 + 0 + + + 2 + 3 + 1 + 0 + 0 + 0 + ..\..\..\libcpu\arm\common\backtrace.c + backtrace.c + 0 + 0 + + + 2 + 4 + 1 + 0 + 0 + 0 + ..\..\..\libcpu\arm\common\showmem.c + showmem.c + 0 + 0 + + + 2 + 5 + 1 + 0 + 0 + 0 + ..\..\..\libcpu\arm\cortex-m4\cpuport.c + cpuport.c + 0 + 0 + + + 2 + 6 + 2 + 0 + 0 + 0 + ..\..\..\libcpu\arm\cortex-m4\context_rvds.S + context_rvds.S + 0 + 0 + + + + + DeviceDrivers + 0 + 0 + 0 + 0 + + 3 + 7 + 1 + 0 + 0 + 0 + ..\..\..\components\drivers\misc\pin.c + pin.c + 0 + 0 + + + 3 + 8 + 1 + 0 + 0 + 0 + ..\..\..\components\drivers\serial\serial.c + serial.c + 0 + 0 + + + 3 + 9 + 1 + 0 + 0 + 0 + ..\..\..\components\drivers\src\workqueue.c + workqueue.c + 0 + 0 + + + 3 + 10 + 1 + 0 + 0 + 0 + ..\..\..\components\drivers\src\ringblk_buf.c + ringblk_buf.c + 0 + 0 + + + 3 + 11 + 1 + 0 + 0 + 0 + ..\..\..\components\drivers\src\dataqueue.c + dataqueue.c + 0 + 0 + + + 3 + 12 + 1 + 0 + 0 + 0 + ..\..\..\components\drivers\src\ringbuffer.c + ringbuffer.c + 0 + 0 + + + 3 + 13 + 1 + 0 + 0 + 0 + ..\..\..\components\drivers\src\pipe.c + pipe.c + 0 + 0 + + + 3 + 14 + 1 + 0 + 0 + 0 + ..\..\..\components\drivers\src\completion.c + completion.c + 0 + 0 + + + 3 + 15 + 1 + 0 + 0 + 0 + ..\..\..\components\drivers\src\waitqueue.c + waitqueue.c + 0 + 0 + + + + + Drivers + 1 + 0 + 0 + 0 + + 4 + 16 + 1 + 0 + 0 + 0 + board\CubeMX_Config\Core\Src\stm32l4xx_hal_msp.c + stm32l4xx_hal_msp.c + 0 + 0 + + + 4 + 17 + 2 + 0 + 0 + 0 + ..\libraries\STM32L4xx_HAL\CMSIS\Device\ST\STM32L4xx\Source\Templates\arm\startup_stm32l4r9xx.s + startup_stm32l4r9xx.s + 0 + 0 + + + 4 + 18 + 1 + 0 + 0 + 0 + board\board.c + board.c + 0 + 0 + + + 4 + 19 + 1 + 0 + 0 + 0 + ..\libraries\HAL_Drivers\drv_gpio.c + drv_gpio.c + 0 + 0 + + + 4 + 20 + 1 + 0 + 0 + 0 + ..\libraries\HAL_Drivers\drv_usart.c + drv_usart.c + 0 + 0 + + + 4 + 21 + 1 + 0 + 0 + 0 + ..\libraries\HAL_Drivers\drv_common.c + drv_common.c + 0 + 0 + + + + + finsh + 0 + 0 + 0 + 0 + + 5 + 22 + 1 + 0 + 0 + 0 + ..\..\..\components\finsh\shell.c + shell.c + 0 + 0 + + + 5 + 23 + 1 + 0 + 0 + 0 + ..\..\..\components\finsh\cmd.c + cmd.c + 0 + 0 + + + 5 + 24 + 1 + 0 + 0 + 0 + ..\..\..\components\finsh\msh.c + msh.c + 0 + 0 + + + + + Kernel + 0 + 0 + 0 + 0 + + 6 + 25 + 1 + 0 + 0 + 0 + ..\..\..\src\object.c + object.c + 0 + 0 + + + 6 + 26 + 1 + 0 + 0 + 0 + ..\..\..\src\idle.c + idle.c + 0 + 0 + + + 6 + 27 + 1 + 0 + 0 + 0 + ..\..\..\src\irq.c + irq.c + 0 + 0 + + + 6 + 28 + 1 + 0 + 0 + 0 + ..\..\..\src\memheap.c + memheap.c + 0 + 0 + + + 6 + 29 + 1 + 0 + 0 + 0 + ..\..\..\src\thread.c + thread.c + 0 + 0 + + + 6 + 30 + 1 + 0 + 0 + 0 + ..\..\..\src\clock.c + clock.c + 0 + 0 + + + 6 + 31 + 1 + 0 + 0 + 0 + ..\..\..\src\timer.c + timer.c + 0 + 0 + + + 6 + 32 + 1 + 0 + 0 + 0 + ..\..\..\src\scheduler.c + scheduler.c + 0 + 0 + + + 6 + 33 + 1 + 0 + 0 + 0 + ..\..\..\src\kservice.c + kservice.c + 0 + 0 + + + 6 + 34 + 1 + 0 + 0 + 0 + ..\..\..\src\components.c + components.c + 0 + 0 + + + 6 + 35 + 1 + 0 + 0 + 0 + ..\..\..\src\device.c + device.c + 0 + 0 + + + 6 + 36 + 1 + 0 + 0 + 0 + ..\..\..\src\mempool.c + mempool.c + 0 + 0 + + + 6 + 37 + 1 + 0 + 0 + 0 + ..\..\..\src\ipc.c + ipc.c + 0 + 0 + + + + + Libraries + 1 + 0 + 0 + 0 + + 7 + 38 + 1 + 0 + 0 + 0 + ..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_cryp.c + stm32l4xx_hal_cryp.c + 0 + 0 + + + 7 + 39 + 1 + 0 + 0 + 0 + ..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_uart.c + stm32l4xx_hal_uart.c + 0 + 0 + + + 7 + 40 + 1 + 0 + 0 + 0 + ..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_usart.c + stm32l4xx_hal_usart.c + 0 + 0 + + + 7 + 41 + 1 + 0 + 0 + 0 + ..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_cortex.c + stm32l4xx_hal_cortex.c + 0 + 0 + + + 7 + 42 + 1 + 0 + 0 + 0 + ..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_gpio.c + stm32l4xx_hal_gpio.c + 0 + 0 + + + 7 + 43 + 1 + 0 + 0 + 0 + ..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_dma.c + stm32l4xx_hal_dma.c + 0 + 0 + + + 7 + 44 + 1 + 0 + 0 + 0 + ..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_pwr.c + stm32l4xx_hal_pwr.c + 0 + 0 + + + 7 + 45 + 1 + 0 + 0 + 0 + ..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_rcc_ex.c + stm32l4xx_hal_rcc_ex.c + 0 + 0 + + + 7 + 46 + 1 + 0 + 0 + 0 + ..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_rcc.c + stm32l4xx_hal_rcc.c + 0 + 0 + + + 7 + 47 + 1 + 0 + 0 + 0 + ..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_dma_ex.c + stm32l4xx_hal_dma_ex.c + 0 + 0 + + + 7 + 48 + 1 + 0 + 0 + 0 + ..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_exti.c + stm32l4xx_hal_exti.c + 0 + 0 + + + 7 + 49 + 1 + 0 + 0 + 0 + ..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_crc.c + stm32l4xx_hal_crc.c + 0 + 0 + + + 7 + 50 + 1 + 0 + 0 + 0 + ..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal.c + stm32l4xx_hal.c + 0 + 0 + + + 7 + 51 + 1 + 0 + 0 + 0 + ..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_usart_ex.c + stm32l4xx_hal_usart_ex.c + 0 + 0 + + + 7 + 52 + 1 + 0 + 0 + 0 + ..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_uart_ex.c + stm32l4xx_hal_uart_ex.c + 0 + 0 + + + 7 + 53 + 1 + 0 + 0 + 0 + ..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_crc_ex.c + stm32l4xx_hal_crc_ex.c + 0 + 0 + + + 7 + 54 + 1 + 0 + 0 + 0 + ..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_comp.c + stm32l4xx_hal_comp.c + 0 + 0 + + + 7 + 55 + 1 + 0 + 0 + 0 + ..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_pwr_ex.c + stm32l4xx_hal_pwr_ex.c + 0 + 0 + + + 7 + 56 + 1 + 0 + 0 + 0 + ..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_rng.c + stm32l4xx_hal_rng.c + 0 + 0 + + + 7 + 57 + 1 + 0 + 0 + 0 + ..\libraries\STM32L4xx_HAL\CMSIS\Device\ST\STM32L4xx\Source\Templates\system_stm32l4xx.c + system_stm32l4xx.c + 0 + 0 + + + 7 + 58 + 1 + 0 + 0 + 0 + ..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_cryp_ex.c + stm32l4xx_hal_cryp_ex.c + 0 + 0 + + + +
diff --git a/bsp/stm32/stm32l4r9-st-sensortile-box/project.uvprojx b/bsp/stm32/stm32l4r9-st-sensortile-box/project.uvprojx new file mode 100644 index 0000000000..2c2edbe100 --- /dev/null +++ b/bsp/stm32/stm32l4r9-st-sensortile-box/project.uvprojx @@ -0,0 +1,718 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + rt-thread + 0x4 + ARM-ADS + 5060960::V5.06 update 7 (build 960)::ARMCC + 0 + + + STM32L4R9ZIJx + STMicroelectronics + Keil.STM32L4xx_DFP.2.5.0 + http://www.keil.com/pack/ + IRAM(0x20000000,0x000A0000) IROM(0x08000000,0x00200000) CPUTYPE("Cortex-M4") FPU2 DSP CLOCK(12000000) ELITTLE + + + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32L4Rx_2048_Dual -FS08000000 -FL0200000 -FP0($$Device:STM32L4R9ZIJx$CMSIS\Flash\STM32L4Rx_2048_Dual.FLM)) + 0 + $$Device:STM32L4R9ZIJx$Drivers\CMSIS\Device\ST\STM32L4xx\Include\stm32l4xx.h + + + + + + + + + + $$Device:STM32L4R9ZIJx$CMSIS\SVD\STM32L4R9.svd + 0 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\build\keil\Obj\ + rtthread + 1 + 0 + 0 + 1 + 0 + .\build\keil\List\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf --bin !L --output rtthread.bin + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + -REMAP -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M4" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 2 + 0 + 0 + 0 + 0 + 8 + 0 + 0 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0xa0000 + + + 1 + 0x8000000 + 0x200000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x8000000 + 0x200000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0xa0000 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + + + USE_HAL_DRIVER, STM32L4R9xx, __RTTHREAD__, __CLK_TCK=RT_TICK_PER_SECOND + + applications;..\..\..\libcpu\arm\common;..\..\..\libcpu\arm\cortex-m4;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;board;board\CubeMX_Config\Core\Inc;..\libraries\HAL_Drivers;..\libraries\HAL_Drivers\config;..\..\..\components\finsh;.;..\..\..\include;..\..\..\components\libc\compilers\common;..\..\..\components\libc\compilers\common\none-gcc;..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Inc;..\libraries\STM32L4xx_HAL\CMSIS\Device\ST\STM32L4xx\Include;..\libraries\STM32L4xx_HAL\CMSIS\Include;..\..\..\examples\utest\testcases\kernel + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 4 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x08000000 + 0x20000000 + + .\board\linker_scripts\link.sct + + + + + + + + + + + Applications + + + main.c + 1 + applications\main.c + + + + + CPU + + + div0.c + 1 + ..\..\..\libcpu\arm\common\div0.c + + + backtrace.c + 1 + ..\..\..\libcpu\arm\common\backtrace.c + + + showmem.c + 1 + ..\..\..\libcpu\arm\common\showmem.c + + + cpuport.c + 1 + ..\..\..\libcpu\arm\cortex-m4\cpuport.c + + + context_rvds.S + 2 + ..\..\..\libcpu\arm\cortex-m4\context_rvds.S + + + + + DeviceDrivers + + + pin.c + 1 + ..\..\..\components\drivers\misc\pin.c + + + serial.c + 1 + ..\..\..\components\drivers\serial\serial.c + + + workqueue.c + 1 + ..\..\..\components\drivers\src\workqueue.c + + + ringblk_buf.c + 1 + ..\..\..\components\drivers\src\ringblk_buf.c + + + dataqueue.c + 1 + ..\..\..\components\drivers\src\dataqueue.c + + + ringbuffer.c + 1 + ..\..\..\components\drivers\src\ringbuffer.c + + + pipe.c + 1 + ..\..\..\components\drivers\src\pipe.c + + + completion.c + 1 + ..\..\..\components\drivers\src\completion.c + + + waitqueue.c + 1 + ..\..\..\components\drivers\src\waitqueue.c + + + + + Drivers + + + stm32l4xx_hal_msp.c + 1 + board\CubeMX_Config\Core\Src\stm32l4xx_hal_msp.c + + + startup_stm32l4r9xx.s + 2 + ..\libraries\STM32L4xx_HAL\CMSIS\Device\ST\STM32L4xx\Source\Templates\arm\startup_stm32l4r9xx.s + + + board.c + 1 + board\board.c + + + drv_gpio.c + 1 + ..\libraries\HAL_Drivers\drv_gpio.c + + + drv_usart.c + 1 + ..\libraries\HAL_Drivers\drv_usart.c + + + drv_common.c + 1 + ..\libraries\HAL_Drivers\drv_common.c + + + + + finsh + + + shell.c + 1 + ..\..\..\components\finsh\shell.c + + + cmd.c + 1 + ..\..\..\components\finsh\cmd.c + + + msh.c + 1 + ..\..\..\components\finsh\msh.c + + + + + Kernel + + + object.c + 1 + ..\..\..\src\object.c + + + idle.c + 1 + ..\..\..\src\idle.c + + + irq.c + 1 + ..\..\..\src\irq.c + + + memheap.c + 1 + ..\..\..\src\memheap.c + + + thread.c + 1 + ..\..\..\src\thread.c + + + clock.c + 1 + ..\..\..\src\clock.c + + + timer.c + 1 + ..\..\..\src\timer.c + + + scheduler.c + 1 + ..\..\..\src\scheduler.c + + + kservice.c + 1 + ..\..\..\src\kservice.c + + + components.c + 1 + ..\..\..\src\components.c + + + device.c + 1 + ..\..\..\src\device.c + + + mempool.c + 1 + ..\..\..\src\mempool.c + + + ipc.c + 1 + ..\..\..\src\ipc.c + + + + + Libraries + + + stm32l4xx_hal_cryp.c + 1 + ..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_cryp.c + + + stm32l4xx_hal_uart.c + 1 + ..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_uart.c + + + stm32l4xx_hal_usart.c + 1 + ..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_usart.c + + + stm32l4xx_hal_cortex.c + 1 + ..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_cortex.c + + + stm32l4xx_hal_gpio.c + 1 + ..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_gpio.c + + + stm32l4xx_hal_dma.c + 1 + ..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_dma.c + + + stm32l4xx_hal_pwr.c + 1 + ..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_pwr.c + + + stm32l4xx_hal_rcc_ex.c + 1 + ..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_rcc_ex.c + + + stm32l4xx_hal_rcc.c + 1 + ..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_rcc.c + + + stm32l4xx_hal_dma_ex.c + 1 + ..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_dma_ex.c + + + stm32l4xx_hal_exti.c + 1 + ..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_exti.c + + + stm32l4xx_hal_crc.c + 1 + ..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_crc.c + + + stm32l4xx_hal.c + 1 + ..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal.c + + + stm32l4xx_hal_usart_ex.c + 1 + ..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_usart_ex.c + + + stm32l4xx_hal_uart_ex.c + 1 + ..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_uart_ex.c + + + stm32l4xx_hal_crc_ex.c + 1 + ..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_crc_ex.c + + + stm32l4xx_hal_comp.c + 1 + ..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_comp.c + + + stm32l4xx_hal_pwr_ex.c + 1 + ..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_pwr_ex.c + + + stm32l4xx_hal_rng.c + 1 + ..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_rng.c + + + system_stm32l4xx.c + 1 + ..\libraries\STM32L4xx_HAL\CMSIS\Device\ST\STM32L4xx\Source\Templates\system_stm32l4xx.c + + + stm32l4xx_hal_cryp_ex.c + 1 + ..\libraries\STM32L4xx_HAL\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_cryp_ex.c + + + + + + + + + + + + + +
diff --git a/bsp/stm32/stm32l4r9-st-sensortile-box/rtconfig.h b/bsp/stm32/stm32l4r9-st-sensortile-box/rtconfig.h new file mode 100644 index 0000000000..2b1740bc1c --- /dev/null +++ b/bsp/stm32/stm32l4r9-st-sensortile-box/rtconfig.h @@ -0,0 +1,183 @@ +#ifndef RT_CONFIG_H__ +#define RT_CONFIG_H__ + +/* Automatically generated file; DO NOT EDIT. */ +/* RT-Thread Configuration */ + +/* RT-Thread Kernel */ + +#define RT_NAME_MAX 8 +#define RT_ALIGN_SIZE 4 +#define RT_THREAD_PRIORITY_32 +#define RT_THREAD_PRIORITY_MAX 32 +#define RT_TICK_PER_SECOND 1000 +#define RT_USING_OVERFLOW_CHECK +#define RT_USING_HOOK +#define RT_USING_IDLE_HOOK +#define RT_IDLE_HOOK_LIST_SIZE 4 +#define IDLE_THREAD_STACK_SIZE 256 + +/* kservice optimization */ + +#define RT_DEBUG +#define RT_DEBUG_COLOR + +/* Inter-Thread communication */ + +#define RT_USING_SEMAPHORE +#define RT_USING_MUTEX +#define RT_USING_EVENT +#define RT_USING_MAILBOX +#define RT_USING_MESSAGEQUEUE + +/* Memory Management */ + +#define RT_USING_MEMPOOL +#define RT_USING_MEMHEAP +#define RT_USING_MEMHEAP_AS_HEAP +#define RT_USING_HEAP + +/* Kernel Device Object */ + +#define RT_USING_DEVICE +#define RT_USING_CONSOLE +#define RT_CONSOLEBUF_SIZE 256 +#define RT_CONSOLE_DEVICE_NAME "uart1" +#define RT_VER_NUM 0x40004 +#define ARCH_ARM +#define RT_USING_CPU_FFS +#define ARCH_ARM_CORTEX_M +#define ARCH_ARM_CORTEX_M4 + +/* RT-Thread Components */ + +#define RT_USING_COMPONENTS_INIT +#define RT_USING_USER_MAIN +#define RT_MAIN_THREAD_STACK_SIZE 2048 +#define RT_MAIN_THREAD_PRIORITY 10 + +/* C++ features */ + + +/* Command shell */ + +#define RT_USING_FINSH +#define FINSH_THREAD_NAME "tshell" +#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 FINSH_ARG_MAX 10 + +/* Device virtual file system */ + + +/* Device Drivers */ + +#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 + +/* Using USB */ + + +/* POSIX layer and C standard library */ + + +/* Network */ + +/* Socket abstraction layer */ + + +/* Network interface device */ + + +/* light weight TCP/IP stack */ + + +/* AT commands */ + + +/* VBUS(Virtual Software BUS) */ + + +/* Utilities */ + + +/* RT-Thread Utestcases */ + + +/* RT-Thread online packages */ + +/* IoT - internet of things */ + + +/* Wi-Fi */ + +/* Marvell WiFi */ + + +/* Wiced WiFi */ + + +/* IoT Cloud */ + + +/* security packages */ + + +/* language packages */ + + +/* multimedia packages */ + + +/* tools packages */ + + +/* system packages */ + +/* acceleration: Assembly language or algorithmic acceleration packages */ + + +/* Micrium: Micrium software products porting for RT-Thread */ + + +/* peripheral libraries and drivers */ + + +/* AI packages */ + + +/* miscellaneous packages */ + + +/* samples: kernel and components samples */ + + +/* entertainment: terminal games and other interesting software packages */ + +#define SOC_FAMILY_STM32 +#define SOC_SERIES_STM32L4 + +/* Hardware Drivers Config */ + +#define SOC_STM32L4R9ZI + +/* On-chip Peripheral Drivers */ + +#define BSP_USING_GPIO +#define BSP_USING_UART +#define BSP_USING_UART1 + +#endif diff --git a/bsp/stm32/stm32l4r9-st-sensortile-box/rtconfig.py b/bsp/stm32/stm32l4r9-st-sensortile-box/rtconfig.py new file mode 100644 index 0000000000..db96c15631 --- /dev/null +++ b/bsp/stm32/stm32l4r9-st-sensortile-box/rtconfig.py @@ -0,0 +1,150 @@ +import os + +# toolchains options +ARCH='arm' +CPU='cortex-m4' +CROSS_TOOL='gcc' + +# bsp lib config +BSP_LIBRARY_TYPE = None + +if os.getenv('RTT_CC'): + CROSS_TOOL = os.getenv('RTT_CC') +if os.getenv('RTT_ROOT'): + RTT_ROOT = os.getenv('RTT_ROOT') + +# cross_tool provides the cross compiler +# EXEC_PATH is the compiler execute path, for example, CodeSourcery, Keil MDK, IAR +if CROSS_TOOL == 'gcc': + PLATFORM = 'gcc' + EXEC_PATH = r'C:\Users\XXYYZZ' +elif CROSS_TOOL == 'keil': + PLATFORM = 'armcc' + EXEC_PATH = r'C:/Keil_v5' +elif CROSS_TOOL == 'iar': + PLATFORM = 'iar' + EXEC_PATH = r'C:/Program Files (x86)/IAR Systems/Embedded Workbench 8.0' + +if os.getenv('RTT_EXEC_PATH'): + EXEC_PATH = os.getenv('RTT_EXEC_PATH') + +BUILD = 'debug' + +if PLATFORM == 'gcc': + # toolchains + PREFIX = 'arm-none-eabi-' + CC = PREFIX + 'gcc' + AS = PREFIX + 'gcc' + AR = PREFIX + 'ar' + CXX = PREFIX + 'g++' + LINK = PREFIX + 'gcc' + TARGET_EXT = 'elf' + SIZE = PREFIX + 'size' + OBJDUMP = PREFIX + 'objdump' + OBJCPY = PREFIX + 'objcopy' + + DEVICE = ' -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections' + CFLAGS = DEVICE + ' -Dgcc' + AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb ' + LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds' + + CPATH = '' + LPATH = '' + + if BUILD == 'debug': + CFLAGS += ' -O0 -gdwarf-2 -g' + AFLAGS += ' -gdwarf-2' + else: + CFLAGS += ' -O2' + + CXXFLAGS = CFLAGS + + POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' + +elif PLATFORM == 'armcc': + # toolchains + CC = 'armcc' + CXX = 'armcc' + AS = 'armasm' + AR = 'armar' + LINK = 'armlink' + TARGET_EXT = 'axf' + + DEVICE = ' --cpu Cortex-M4.fp ' + CFLAGS = '-c ' + DEVICE + ' --apcs=interwork --c99' + AFLAGS = DEVICE + ' --apcs=interwork ' + LFLAGS = DEVICE + ' --info sizes --info totals --info unused --info veneers --list rtthread.map --strict --scatter "board\linker_scripts\link.sct"' + CFLAGS += ' -I' + EXEC_PATH + '/ARM/ARMCC/include' + LFLAGS += ' --libpath=' + EXEC_PATH + '/ARM/ARMCC/lib' + + CFLAGS += ' -D__MICROLIB ' + AFLAGS += ' --pd "__MICROLIB SETA 1" ' + LFLAGS += ' --library_type=microlib ' + EXEC_PATH += '/ARM/ARMCC/bin/' + + if BUILD == 'debug': + CFLAGS += ' -g -O0' + AFLAGS += ' -g' + else: + CFLAGS += ' -O2' + + CXXFLAGS = CFLAGS + CFLAGS += ' -std=c99' + + POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET' + +elif PLATFORM == 'iar': + # toolchains + CC = 'iccarm' + CXX = 'iccarm' + AS = 'iasmarm' + AR = 'iarchive' + LINK = 'ilinkarm' + TARGET_EXT = 'out' + + DEVICE = '-Dewarm' + + CFLAGS = DEVICE + CFLAGS += ' --diag_suppress Pa050' + CFLAGS += ' --no_cse' + CFLAGS += ' --no_unroll' + CFLAGS += ' --no_inline' + CFLAGS += ' --no_code_motion' + CFLAGS += ' --no_tbaa' + CFLAGS += ' --no_clustering' + CFLAGS += ' --no_scheduling' + CFLAGS += ' --endian=little' + CFLAGS += ' --cpu=Cortex-M4' + CFLAGS += ' -e' + CFLAGS += ' --fpu=VFPv4_sp' + CFLAGS += ' --dlib_config "' + EXEC_PATH + '/arm/INC/c/DLib_Config_Normal.h"' + CFLAGS += ' --silent' + + AFLAGS = DEVICE + AFLAGS += ' -s+' + AFLAGS += ' -w+' + AFLAGS += ' -r' + AFLAGS += ' --cpu Cortex-M4' + AFLAGS += ' --fpu VFPv4_sp' + AFLAGS += ' -S' + + if BUILD == 'debug': + CFLAGS += ' --debug' + CFLAGS += ' -On' + else: + CFLAGS += ' -Oh' + + LFLAGS = ' --config "board/linker_scripts/link.icf"' + LFLAGS += ' --entry __iar_program_start' + + CXXFLAGS = CFLAGS + + EXEC_PATH = EXEC_PATH + '/arm/bin/' + POST_ACTION = 'ielftool --bin $TARGET rtthread.bin' + +def dist_handle(BSP_ROOT, dist_dir): + import sys + cwd_path = os.getcwd() + sys.path.append(os.path.join(os.path.dirname(BSP_ROOT), 'tools')) + from sdk_dist import dist_do_building + dist_do_building(BSP_ROOT, dist_dir) diff --git a/bsp/stm32/stm32l4r9-st-sensortile-box/template.ewd b/bsp/stm32/stm32l4r9-st-sensortile-box/template.ewd new file mode 100644 index 0000000000..d420552e8b --- /dev/null +++ b/bsp/stm32/stm32l4r9-st-sensortile-box/template.ewd @@ -0,0 +1,2966 @@ + + + 3 + + rt-thread + + ARM + + 1 + + C-SPY + 2 + + 30 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + CADI_ID + 2 + + 0 + 1 + 1 + + + + + + + + + CMSISDAP_ID + 2 + + 4 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IJET_ID + 2 + + 8 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + JLINK_ID + 2 + + 16 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + NULINK_ID + 2 + + 0 + 1 + 1 + + + + + + + PEMICRO_ID + 2 + + 3 + 1 + 1 + + + + + + + + STLINK_ID + 2 + + 6 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + TIFET_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + + + XDS100_ID + 2 + + 8 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\FreeRtos\FreeRtosArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\HWRTOSplugin\HWRTOSplugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\Mbed\MbedArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\Mbed\MbedArmPlugin2.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\SMX\smxAwareIarArm8.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\SMX\smxAwareIarArm8BE.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\TargetAccessServer\TargetAccessServer.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin + 0 + + + + + Release + + ARM + + 0 + + C-SPY + 2 + + 30 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 0 + + + + + + + + CADI_ID + 2 + + 0 + 1 + 0 + + + + + + + + + CMSISDAP_ID + 2 + + 4 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 0 + + + + + + + + + + + IJET_ID + 2 + + 8 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + JLINK_ID + 2 + + 16 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 2 + 1 + 0 + + + + + + + + + + NULINK_ID + 2 + + 0 + 1 + 0 + + + + + + + PEMICRO_ID + 2 + + 3 + 1 + 0 + + + + + + + + STLINK_ID + 2 + + 6 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 0 + + + + + + + + TIFET_ID + 2 + + 1 + 1 + 0 + + + + + + + + + + + + + + + + + + + XDS100_ID + 2 + + 8 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\FreeRtos\FreeRtosArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\HWRTOSplugin\HWRTOSplugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\Mbed\MbedArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\Mbed\MbedArmPlugin2.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\SMX\smxAwareIarArm8.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\SMX\smxAwareIarArm8BE.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\TargetAccessServer\TargetAccessServer.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin + 0 + + + + diff --git a/bsp/stm32/stm32l4r9-st-sensortile-box/template.ewp b/bsp/stm32/stm32l4r9-st-sensortile-box/template.ewp new file mode 100644 index 0000000000..011f4cccfb --- /dev/null +++ b/bsp/stm32/stm32l4r9-st-sensortile-box/template.ewp @@ -0,0 +1,2088 @@ + + + 3 + + rt-thread + + ARM + + 1 + + General + 3 + + 33 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 37 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 11 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + 0 + inputOutputBased + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 25 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + + Release + + ARM + + 0 + + General + 3 + + 33 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 37 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 11 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 0 + + + + + + + + + CUSTOM + 3 + + + + 0 + inputOutputBased + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 25 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 0 + + + + + + + diff --git a/bsp/stm32/stm32l4r9-st-sensortile-box/template.eww b/bsp/stm32/stm32l4r9-st-sensortile-box/template.eww new file mode 100644 index 0000000000..bd036bb4c9 --- /dev/null +++ b/bsp/stm32/stm32l4r9-st-sensortile-box/template.eww @@ -0,0 +1,10 @@ + + + + + $WS_DIR$\template.ewp + + + + + diff --git a/bsp/stm32/stm32l4r9-st-sensortile-box/template.uvoptx b/bsp/stm32/stm32l4r9-st-sensortile-box/template.uvoptx new file mode 100644 index 0000000000..8178b6649e --- /dev/null +++ b/bsp/stm32/stm32l4r9-st-sensortile-box/template.uvoptx @@ -0,0 +1,192 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + rt-thread + 0x4 + ARM-ADS + + 12000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\build\keil\List\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 18 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 6 + + + + + + + + + + + STLink\ST-LINKIII-KEIL_SWO.dll + + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 ) -FN1 -FC1000 -FD20000000 -FF0STM32L4Rx_2048_Dual -FL0200000 -FS08000000 -FP0($$Device:STM32L4R9ZIJx$CMSIS\Flash\STM32L4Rx_2048_Dual.FLM) + + + 0 + ST-LINKIII-KEIL_SWO + -U066DFF565251887067022235 -O206 -SF10000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP (ARM Core") -D00(2BA01477) -L00(0) -TO131090 -TC10000000 -TT10000000 -TP21 -TDS8000 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC1000 -FN1 -FF0STM32L4Rx_2048_Dual.FLM -FS08000000 -FL0200000 -FP0($$Device:STM32L4R9ZIJx$CMSIS\Flash\STM32L4Rx_2048_Dual.FLM) + + + + + 0 + + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + 1 + 0 + 0 + 2 + 10000000 + + + + + + Source Group 1 + 0 + 0 + 0 + 0 + + +
diff --git a/bsp/stm32/stm32l4r9-st-sensortile-box/template.uvprojx b/bsp/stm32/stm32l4r9-st-sensortile-box/template.uvprojx new file mode 100644 index 0000000000..d8760f590a --- /dev/null +++ b/bsp/stm32/stm32l4r9-st-sensortile-box/template.uvprojx @@ -0,0 +1,396 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + rt-thread + 0x4 + ARM-ADS + 5060750::V5.06 update 6 (build 750)::ARMCC + 0 + + + STM32L4R9ZIJx + STMicroelectronics + Keil.STM32L4xx_DFP.2.5.0 + http://www.keil.com/pack/ + IRAM(0x20000000,0x000A0000) IROM(0x08000000,0x00200000) CPUTYPE("Cortex-M4") FPU2 DSP CLOCK(12000000) ELITTLE + + + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32L4Rx_2048_Dual -FS08000000 -FL0200000 -FP0($$Device:STM32L4R9ZIJx$CMSIS\Flash\STM32L4Rx_2048_Dual.FLM)) + 0 + $$Device:STM32L4R9ZIJx$Drivers\CMSIS\Device\ST\STM32L4xx\Include\stm32l4xx.h + + + + + + + + + + $$Device:STM32L4R9ZIJx$CMSIS\SVD\STM32L4R9.svd + 0 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\build\keil\Obj\ + rtthread + 1 + 0 + 0 + 1 + 0 + .\build\keil\List\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf --bin !L --output rtthread.bin + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + -REMAP -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M4" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 2 + 0 + 0 + 0 + 0 + 8 + 0 + 0 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0xa0000 + + + 1 + 0x8000000 + 0x200000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x8000000 + 0x200000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0xa0000 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + + + + + + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 4 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x08000000 + 0x20000000 + + .\board\linker_scripts\link.sct + + + + + + + + + + + Source Group 1 + + + + + + + + + + + +
diff --git a/components/libc/compilers/newlib/syscalls.c b/components/libc/compilers/newlib/syscalls.c index e01dc59eb6..aeb4d123e7 100644 --- a/components/libc/compilers/newlib/syscalls.c +++ b/components/libc/compilers/newlib/syscalls.c @@ -210,7 +210,7 @@ int _wait_r(struct _reent *ptr, int *status) _ssize_t _write_r(struct _reent *ptr, int fd, const void *buf, size_t nbytes) { #ifndef RT_USING_DFS -#ifdef RT_USING_DEVICE +#if defined(RT_USING_CONSOLE) && defined(RT_USING_DEVICE) if (fileno(stdout) == fd) { rt_device_t console; diff --git a/components/net/lwip_dhcpd/dhcp_server.c b/components/net/lwip_dhcpd/dhcp_server.c index b37d038b86..0cc08b5a6e 100644 --- a/components/net/lwip_dhcpd/dhcp_server.c +++ b/components/net/lwip_dhcpd/dhcp_server.c @@ -306,7 +306,7 @@ static void dhcpd_thread_entry(void *parameter) while (1) { bytes_read = recvfrom(sock, recv_data, BUFSZ - 1, 0, - (struct sockaddr *)&client_addr, &addr_len); + (struct sockaddr *)&client_addr, (socklen_t *)&addr_len); if (bytes_read <= 0) { closesocket(sock); diff --git a/components/utilities/rt-link/Kconfig b/components/utilities/rt-link/Kconfig index 10ed129e69..d20c2f01d4 100644 --- a/components/utilities/rt-link/Kconfig +++ b/components/utilities/rt-link/Kconfig @@ -14,21 +14,6 @@ if RT_USING_RT_LINK bool "use hardware crc device" endchoice - menu "rt-link hardware device configuration" - config RT_LINK_HW_DEVICE_NAME - string "the name of base actual device" - default "uart2" - - choice - prompt"hardware device is spi, uart or usb" - default RT_LINK_USING_UART - - config RT_LINK_USING_UART - bool "use UART" - endchoice - - endmenu - menu "rt link debug option" config USING_RT_LINK_DEBUG bool "Enable RT-Link debug" diff --git a/components/utilities/rt-link/hw_port/SConscript b/components/utilities/rt-link/hw_port/SConscript deleted file mode 100644 index e34243ebda..0000000000 --- a/components/utilities/rt-link/hw_port/SConscript +++ /dev/null @@ -1,14 +0,0 @@ -import os -from building import * -import rtconfig - -cwd = GetCurrentDir() -src = [] -CPPPATH = [] - -if GetDepend('RT_LINK_USING_UART'): - src += ['uart/rtlink_port_uart.c'] - -group = DefineGroup('rt-link-port', src, depend = ['RT_USING_RT_LINK'], CPPPATH = CPPPATH) - -Return('group') diff --git a/components/utilities/rt-link/hw_port/uart/rtlink_port_uart.c b/components/utilities/rt-link/hw_port/uart/rtlink_port_uart.c deleted file mode 100644 index 48fbb91bc3..0000000000 --- a/components/utilities/rt-link/hw_port/uart/rtlink_port_uart.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2006-2021, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2020-12-09 xiangxistu the first version - */ - -#include -#include - -#include - -#ifndef RT_LINK_HW_DEVICE_NAME - #define RT_LINK_HW_DEVICE_NAME "uart2" -#endif - -#define DBG_TAG "rtlink_port" -#define DBG_LVL DBG_INFO -#include - -static struct rt_device *hw_device = RT_NULL; -rt_err_t rt_link_port_rx_ind(rt_device_t device, rt_size_t size) -{ - RT_ASSERT(device != RT_NULL); - - rt_uint8_t buffer[RT_SERIAL_RB_BUFSZ] = {0}; - rt_size_t length = 0; - length = rt_device_read(device, 0, buffer, sizeof(buffer)); - rt_link_hw_write_cb(&buffer, length); - return RT_EOK; -} - -rt_size_t rt_link_port_send(void *data, rt_size_t length) -{ - rt_size_t size = 0; - size = rt_device_write(hw_device, 0, data, length); - return size; -} - -int rt_link_port_init(void) -{ - hw_device = rt_device_find(RT_LINK_HW_DEVICE_NAME); - if (hw_device) - { - rt_device_open(hw_device, RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_INT_RX); - rt_device_set_rx_indicate(hw_device, rt_link_port_rx_ind); - } - else - { - LOG_E("Not find device %s", RT_LINK_HW_DEVICE_NAME); - return -RT_ERROR; - } - return RT_EOK; -} - -int rt_link_port_deinit(void) -{ - hw_device = rt_device_find(RT_LINK_HW_DEVICE_NAME); - if (hw_device) - { - rt_device_close(hw_device); - rt_device_set_rx_indicate(hw_device, RT_NULL); - } - else - { - LOG_E("Not find device %s", RT_LINK_HW_DEVICE_NAME); - return -RT_ERROR; - } - return RT_EOK; -} diff --git a/components/utilities/rt-link/inc/rtlink.h b/components/utilities/rt-link/inc/rtlink.h index dd98b57c30..941c35a359 100644 --- a/components/utilities/rt-link/inc/rtlink.h +++ b/components/utilities/rt-link/inc/rtlink.h @@ -14,81 +14,102 @@ #include +#define RT_LINK_VER "0.2.0" + #define RT_LINK_AUTO_INIT -#define RT_LINK_FRAME_HEAD 0x15 -#define RT_LINK_FRAME_HEAD_MASK 0x1F -#define RT_LINK_MAX_DATA_LENGTH 2044 /*can exact divide by 4 bytes*/ -#define RT_LINK_FRAMES_MAX 0x03 /* The maximum number of split frames for a long package*/ +#define RT_LINK_FLAG_ACK 0x01 +#define RT_LINK_FLAG_CRC 0x02 -#define RT_LINK_ACK_MAX 0x07 +#define RT_LINK_FRAME_HEAD 0x15 +#define RT_LINK_FRAME_HEAD_MASK 0x1F +/* The maximum number of split frames for a long package */ +#define RT_LINK_FRAMES_MAX 0x03 +/* The length in the rt_link_frame_head structure occupies 11 bits, +so the value range after 4-byte alignment is 0-2044.*/ +#define RT_LINK_MAX_FRAME_LENGTH 1024 + +#define RT_LINK_ACK_MAX 0x07 #define RT_LINK_CRC_LENGTH 4 #define RT_LINK_HEAD_LENGTH 4 -#define RT_LINK_MAX_EXTEND_LENGTH 4 -#define RT_LINK_MAX_FRAME_LENGTH (RT_LINK_HEAD_LENGTH + RT_LINK_MAX_EXTEND_LENGTH + RT_LINK_MAX_DATA_LENGTH + RT_LINK_CRC_LENGTH) -#define RT_LINK_RECEIVE_BUFFER_LENGTH (RT_LINK_MAX_FRAME_LENGTH * RT_LINK_FRAMES_MAX + RT_LINK_HEAD_LENGTH + RT_LINK_MAX_EXTEND_LENGTH) +#define RT_LINK_EXTEND_LENGTH 4 + +#define RT_LINK_MAX_DATA_LENGTH (RT_LINK_MAX_FRAME_LENGTH - \ + RT_LINK_HEAD_LENGTH - \ + RT_LINK_EXTEND_LENGTH - \ + RT_LINK_CRC_LENGTH) +#define RT_LINK_RECEIVE_BUFFER_LENGTH (RT_LINK_MAX_FRAME_LENGTH * \ + RT_LINK_FRAMES_MAX + \ + RT_LINK_HEAD_LENGTH + \ + RT_LINK_EXTEND_LENGTH) typedef enum { - RT_LINK_SERVICE_RTLINK = 0, - RT_LINK_SERVICE_LINK_SOCKET = 1, - RT_LINK_SERVICE_LINK_WIFI = 2, - RT_LINK_SERVICE_LINK_MNGT = 3, - RT_LINK_SERVICE_LINK_MSHTOOLS = 4, + RT_LINK_SERVICE_RTLINK = 0, + RT_LINK_SERVICE_SOCKET = 1, + RT_LINK_SERVICE_WIFI = 2, + RT_LINK_SERVICE_MNGT = 3, + RT_LINK_SERVICE_MSHTOOLS = 4, + + /* Expandable to a maximum of 31 */ RT_LINK_SERVICE_MAX -} rt_link_service_t; - -enum -{ - FRAME_EXTEND = 1 << 0, - FRAME_CRC = 1 << 1, - FRAME_ACK = 1 << 2 -}; +} rt_link_service_e; typedef enum { - RT_LINK_RESERVE_FRAME = 0, + RT_LINK_RESEND_FRAME = 0, + RT_LINK_CONFIRM_FRAME = 1, - RT_LINK_RESEND_FRAME, - RT_LINK_CONFIRM_FRAME, - RT_LINK_SHORT_DATA_FRAME, - RT_LINK_LONG_DATA_FRAME, - RT_LINK_SESSION_END, /* The retring failed to end the session */ + RT_LINK_HANDSHAKE_FRAME = 2, + RT_LINK_DETACH_FRAME = 3, /* service is not online */ + RT_LINK_SESSION_END = 4, /* The retring failed to end the session */ - RT_LINK_HANDSHAKE_FRAME -} rt_link_frame_attribute_t; + RT_LINK_LONG_DATA_FRAME = 5, + RT_LINK_SHORT_DATA_FRAME = 6, + + RT_LINK_RESERVE_FRAME = 7 +} rt_link_frame_attr_e; typedef enum { /* receive event */ - RT_LINK_READ_CHECK_EVENT = 1 << 0, - RT_LINK_RECV_TIMEOUT_FRAME_EVENT = 1 << 1, - RT_LINK_RECV_TIMEOUT_LONG_EVENT = 1 << 2, + RT_LINK_READ_CHECK_EVENT = 1 << 0, + RT_LINK_RECV_TIMEOUT_FRAME_EVENT = 1 << 1, + RT_LINK_RECV_TIMEOUT_LONG_EVENT = 1 << 2, /* send event */ RT_LINK_SEND_READY_EVENT = 1 << 4, RT_LINK_SEND_OK_EVENT = 1 << 5, RT_LINK_SEND_FAILED_EVENT = 1 << 6, RT_LINK_SEND_TIMEOUT_EVENT = 1 << 7 -} rt_link_notice_t; +} rt_link_notice_e; typedef enum { - RT_LINK_ESTABLISHING = 0, - RT_LINK_NO_RESPONSE, - RT_LINK_CONNECT_DONE, -} rt_link_linkstatus_t; + RT_LINK_INIT = 0, + RT_LINK_DISCONN = 1, + RT_LINK_CONNECT = 2, +} rt_link_linkstate_e; typedef enum { - RECVTIMER_NONE = 0, - RECVTIMER_FRAME, - RECVTIMER_LONGFRAME -} rt_link_recvtimer_status_t; + RT_LINK_EOK = 0, + RT_LINK_ERR = 1, + RT_LINK_ETIMEOUT = 2, + RT_LINK_EFULL = 3, + RT_LINK_EEMPTY = 4, + RT_LINK_ENOMEM = 5, + RT_LINK_EIO = 6, + RT_LINK_ESESSION = 7, + RT_LINK_ESERVICE = 8, + + RT_LINK_EMAX +} rt_link_err_e; struct rt_link_receive_buffer { - rt_uint8_t data[RT_LINK_RECEIVE_BUFFER_LENGTH]; /* rt-link receive data buffer */ + /* rt-link receive data buffer */ + rt_uint8_t data[RT_LINK_RECEIVE_BUFFER_LENGTH]; rt_uint8_t *read_point; rt_uint8_t *write_point; rt_uint8_t *end_point; @@ -100,15 +121,16 @@ struct rt_link_frame_head rt_uint8_t extend : 1; rt_uint8_t crc : 1; rt_uint8_t ack : 1; + rt_uint8_t sequence; - rt_uint16_t channel: 5; - rt_uint16_t length : 11; + rt_uint16_t service: 5; + rt_uint16_t length : 11; /* range 0~2047 */ }; /* record frame information that opposite */ struct rt_link_record { - rt_uint8_t rx_seq; /* record the opposite sequence */ + rt_uint8_t rx_seq; /* record the opposite sequence */ rt_uint8_t total; /* the number of long frame number */ rt_uint8_t long_count; /* long packet recv counter */ rt_uint8_t *dataspace; /* the space of long frame */ @@ -116,58 +138,71 @@ struct rt_link_record struct rt_link_extend { - rt_uint16_t attribute; /* rt_link_frame_attribute_t */ + rt_uint16_t attribute; /* rt_link_frame_attr_e */ rt_uint16_t parameter; }; struct rt_link_frame { - struct rt_link_frame_head head; /* frame head */ - struct rt_link_extend extend; /* frame extend data */ - rt_uint8_t *real_data; /* the origin data */ - rt_uint32_t crc; /* CRC result */ + struct rt_link_frame_head head; /* frame head */ + struct rt_link_extend extend; /* frame extend data */ + rt_uint8_t *real_data; /* the origin data */ + rt_uint32_t crc; /* CRC result */ - rt_uint16_t data_len; /* the length of frame length */ - rt_uint16_t attribute; /* this will show frame attribute , rt_link_frame_attribute_t */ + rt_uint16_t data_len; /* the length of frame length */ + rt_uint16_t attribute; /* rt_link_frame_attr_e */ - rt_uint8_t index; /* the index frame for long frame */ - rt_uint8_t total; /* the total frame for long frame */ + rt_uint8_t issent; + rt_uint8_t index; /* the index frame for long frame */ + rt_uint8_t total; /* the total frame for long frame */ - rt_slist_t slist; /* the frame will hang on the send list on session */ + rt_slist_t slist; /* the frame will hang on the send list on session */ }; struct rt_link_service { - rt_err_t (*upload_callback)(void *data, rt_size_t size); + rt_int32_t timeout_tx; + void (*send_cb)(struct rt_link_service *service, void *buffer); + void (*recv_cb)(struct rt_link_service *service, void *data, rt_size_t size); + void *user_data; + + rt_uint8_t flag; /* Whether to use the CRC and ACK */ + rt_link_service_e service; + rt_link_linkstate_e state; /* channel link state */ + rt_link_err_e err; }; struct rt_link_session { - rt_link_linkstatus_t link_status; /* Link connection status*/ - struct rt_event event; /* the event that core logic */ - struct rt_link_service channel[RT_LINK_SERVICE_MAX]; /* thansfer to app layer */ + struct rt_event event; + struct rt_link_service *service[RT_LINK_SERVICE_MAX]; + rt_uint8_t tx_seq; /* Sequence number of the send data frame */ rt_slist_t tx_data_slist; - rt_uint8_t tx_seq; /* sequence for frame */ - struct rt_mutex tx_lock; /* protect send data interface, only one thread can hold it */ - struct rt_timer sendtimer; /* send function timer for rt link */ + rt_uint8_t sendbuffer[RT_LINK_MAX_FRAME_LENGTH]; + struct rt_event sendevent; + struct rt_timer sendtimer; - struct rt_link_record rx_record; /* the memory of receive status */ - struct rt_timer recvtimer; /* receive a frame timer for rt link */ - struct rt_timer longframetimer; /* receive long frame timer for rt link */ + struct rt_link_record rx_record; /* the memory of receive status */ + struct rt_timer recvtimer; /* receive a frame timer for rt link */ + struct rt_timer longframetimer; /* receive long frame timer for rt link */ - struct rt_link_receive_buffer *rx_buffer; /* the buffer will store data */ - rt_uint32_t (*calculate_crc)(rt_uint8_t using_buffer_ring, rt_uint8_t *data, rt_size_t size); /* this function will calculate crc */ + struct rt_link_receive_buffer *rx_buffer; + rt_uint32_t (*calculate_crc)(rt_uint8_t using_buffer_ring, rt_uint8_t *data, rt_size_t size); + rt_link_linkstate_e state; /* Link status */ }; -/* rtlink init and deinit */ +#define SERV_ERR_GET(service) (service->err) + +/* rtlink init and deinit, default is automatic initialization*/ int rt_link_init(void); rt_err_t rt_link_deinit(void); -/* rtlink send data interface */ -rt_size_t rt_link_send(rt_link_service_t service, void *data, rt_size_t size); + +rt_size_t rt_link_send(struct rt_link_service *service, const void *data, rt_size_t size); + /* rtlink service attach and detach */ -rt_err_t rt_link_service_attach(rt_link_service_t service, rt_err_t (*function)(void *data, rt_size_t size)); -rt_err_t rt_link_service_detach(rt_link_service_t service); +rt_err_t rt_link_service_attach(struct rt_link_service *service); +rt_err_t rt_link_service_detach(struct rt_link_service *service); /* Private operator function */ struct rt_link_session *rt_link_get_scb(void); diff --git a/components/utilities/rt-link/inc/rtlink_dev.h b/components/utilities/rt-link/inc/rtlink_dev.h new file mode 100644 index 0000000000..01fd04373c --- /dev/null +++ b/components/utilities/rt-link/inc/rtlink_dev.h @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2021-06-15 Sherman the first version + */ + +#include +#include + +#define RT_LINK_RX_NONBLOCKING 0x1000 +#define RT_LINK_RX_BLOCKING 0x2000 +#define RT_LINK_TX_NONBLOCKING 0x4000 +#define RT_LINK_TX_BLOCKING 0x8000 +#define RT_LINK_DEVICE_MASK 0xf000 + +struct rtlink_recv_list +{ + void *data; + rt_size_t size; + rt_size_t index; + struct rt_slist_node list; +}; + +struct rt_link_device +{ + struct rt_device parent; + struct rt_link_service service; + struct rt_slist_node recv_head; /* recv data list, struct rtlink_recv_list */ +}; + +/* + * rtlink device register + */ +rt_err_t rt_link_dev_register(struct rt_link_device *rtlink, + const char *name, + rt_uint32_t flag, + void *data); diff --git a/components/utilities/rt-link/inc/rtlink_hw.h b/components/utilities/rt-link/inc/rtlink_hw.h index c75609a23a..d0a56fe98c 100644 --- a/components/utilities/rt-link/inc/rtlink_hw.h +++ b/components/utilities/rt-link/inc/rtlink_hw.h @@ -6,6 +6,7 @@ * Change Logs: * Date Author Notes * 2021-02-02 xiangxistu the first version + * 2021-07-13 Sherman add reconnect API * */ #ifndef __RT_LINK_HW_H__ @@ -19,6 +20,7 @@ void rt_link_hw_buffer_point_shift(rt_uint8_t **pointer_address, rt_size_t lengt rt_err_t rt_link_hw_init(void); rt_err_t rt_link_hw_deinit(void); -rt_err_t rt_link_hw_send(void *data, rt_size_t length); +rt_err_t rt_link_hw_reconnect(void); +rt_size_t rt_link_hw_send(void *data, rt_size_t length); #endif /* _RT_LINK_PORT_INTERNAL_H_ */ diff --git a/components/utilities/rt-link/inc/rtlink_port.h b/components/utilities/rt-link/inc/rtlink_port.h index 54a064d117..b22f19072a 100644 --- a/components/utilities/rt-link/inc/rtlink_port.h +++ b/components/utilities/rt-link/inc/rtlink_port.h @@ -7,6 +7,7 @@ * Date Author Notes * 2021-02-02 xiangxistu the first version * 2021-05-15 Sherman function rename + * 2021-07-13 Sherman add reconnect API */ #ifndef __RT_LINK_PORT_H__ #define __RT_LINK_PORT_H__ @@ -14,8 +15,9 @@ #include /* Functions that need to be implemented at the hardware */ -int rt_link_port_init(void); -int rt_link_port_deinit(void); +rt_err_t rt_link_port_init(void); +rt_err_t rt_link_port_deinit(void); +rt_err_t rt_link_port_reconnect(void); rt_size_t rt_link_port_send(void *data, rt_size_t length); #ifdef RT_LINK_USING_HW_CRC diff --git a/components/utilities/rt-link/src/rtlink.c b/components/utilities/rt-link/src/rtlink.c index 37a99538b6..010083aaa5 100644 --- a/components/utilities/rt-link/src/rtlink.c +++ b/components/utilities/rt-link/src/rtlink.c @@ -8,7 +8,11 @@ * 2021-02-02 xiangxistu the first version * 2021-03-19 Sherman Optimize the transfer process * 2021-04-20 Sherman Optimize memory footprint - * 2021-05-10 Sherman Add rtlink_status MSH command; Optimize transmission timer Settings; Fix known bugs + * 2021-05-10 Sherman Add rtlink_status MSH command; + * Optimize transmission timer Settings; + * Fix known bugs + * 2021-08-06 Sherman Add NACK, NCRC, non-blocking transmit mode; + * Add service connection status; */ #include @@ -35,25 +39,28 @@ #define RT_LINK_SENT_FRAME_TIMEOUT 100 #else #define RT_LINK_LONG_FRAME_TIMEOUT 100 - #define RT_LINK_SENT_FRAME_TIMEOUT 200 + #define RT_LINK_SENT_FRAME_TIMEOUT 100 #endif /* RT_LINK_USING_SPI */ #define RT_LINK_RECV_DATA_SEQUENCE 0 #define RT_LINK_INIT_FRAME_SEQENCE 129 -#define RT_LINK_THREAD_NAME "rtlink" -#define RT_LINK_THREAD_TICK 20 -#define RT_LINK_THREAD_PRIORITY 15 -#define RT_LINK_THREAD_STACK_SIZE 832 /* 32 bytes aligned */ +#define RT_LINK_THREAD_NAME "rtlink" +#define RT_LINK_THREAD_TICK 20 +#define RT_LINK_THREAD_PRIORITY 25 +#define RT_LINK_THREAD_STACK_SIZE 1024 /* 32 bytes aligned */ + +#define RT_LINK_FRAME_SENT 1 +#define RT_LINK_FRAME_NOSEND 0 typedef enum { - FIND_FRAME_HEAD = 0, - PARSE_FRAME_HEAD, - PARSE_FRAME_EXTEND, - PARSE_FRAME_SEQ, - CHECK_FRAME_CRC, - HEADLE_FRAME_DATA, + FIND_FRAME_HEAD = 0, + PARSE_FRAME_HEAD = 1, + PARSE_FRAME_EXTEND = 2, + PARSE_FRAME_SEQ = 3, + CHECK_FRAME_CRC = 4, + HEADLE_FRAME_DATA = 5, } rt_link_frame_parse_t; /* rtlink SCB(Session control block) */ @@ -83,11 +90,11 @@ static int rt_link_frame_init(struct rt_link_frame *frame, rt_uint8_t config) /* set frame control information */ rt_memset(&frame->head, 0, sizeof(struct rt_link_frame_head)); - if (config & FRAME_CRC) + if (config & RT_LINK_FLAG_CRC) { frame->head.crc = 1; } - if (config & FRAME_ACK) + if (config & RT_LINK_FLAG_ACK) { frame->head.ack = 1; } @@ -101,37 +108,153 @@ static int rt_link_frame_init(struct rt_link_frame *frame, rt_uint8_t config) frame->index = 0; frame->total = 0; frame->attribute = RT_LINK_RESERVE_FRAME; + frame->issent = RT_LINK_FRAME_NOSEND; rt_slist_init(&frame->slist); return RT_EOK; } -static rt_err_t rt_link_frame_free(struct rt_link_frame *frame) +/* remove the sending list node*/ +static void rt_link_frame_remove(struct rt_link_service *service) { - if (frame == RT_NULL) + RT_ASSERT(service != RT_NULL); + struct rt_link_frame *find_frame = RT_NULL; + rt_uint8_t total = 0; + rt_slist_t *tem_list = rt_slist_first(&rt_link_scb->tx_data_slist); + if (tem_list != RT_NULL) { - return -RT_ERROR; + do + { + find_frame = rt_container_of(tem_list, struct rt_link_frame, slist); + tem_list = rt_slist_next(tem_list); + if (find_frame->head.service == service->service) + { + if (total == 0) + { + total = find_frame->total; + } + /* The data frame order is appended to the list, + with total counting starting at 1 and index counting from 0 */ + LOG_D("remove seq(%d) serv (%d)", find_frame->head.sequence, service->service); + rt_enter_critical(); + rt_slist_remove(&rt_link_scb->tx_data_slist, &find_frame->slist); + rt_exit_critical(); + total--; + rt_memset(find_frame, 0, sizeof(struct rt_link_frame)); + rt_free(find_frame); + } + } while ((total > 0) && (tem_list != RT_NULL)); + } +} + +/* Configure the extended field of the frame */ +static rt_err_t rt_link_frame_extend_config(struct rt_link_frame *frame, rt_link_frame_attr_e attribute, rt_uint16_t parameter) +{ + frame->head.extend = 1; + frame->extend.attribute = attribute; + frame->extend.parameter = parameter; + return RT_EOK; +} + +static int rt_link_command_frame_send(rt_uint8_t serv, rt_uint8_t sequence, rt_link_frame_attr_e attribute, rt_uint16_t parameter) +{ + struct rt_link_frame command_frame = {0}; + rt_uint8_t data[sizeof(command_frame.head) + sizeof(command_frame.extend)] = {0}; + rt_uint8_t data_len = 0; + + /* command frame don't need crc and ack ability */ + rt_link_frame_init(&command_frame, RT_NULL); + data_len += sizeof(command_frame.head); + + rt_link_frame_extend_config(&command_frame, attribute, parameter); + rt_memcpy(data + data_len, &command_frame.extend, sizeof(command_frame.extend)); + data_len += sizeof(command_frame.extend); + + command_frame.head.sequence = sequence; + command_frame.head.service = serv; + rt_memcpy(data, &command_frame.head, sizeof(command_frame.head)); + + rt_link_hw_send(data, data_len); + return RT_EOK; +} + +static void rt_link_service_send_finish(rt_link_err_e err) +{ + struct rt_link_frame *frame = RT_NULL; + rt_uint8_t service = RT_LINK_SERVICE_MAX; + void *buffer = RT_NULL; + rt_slist_t *tem_list = rt_slist_first(&rt_link_scb->tx_data_slist); + if (tem_list == RT_NULL) + { + return ; + } + frame = rt_container_of(tem_list, struct rt_link_frame, slist); + if (frame) + { + service = frame->head.service; + buffer = frame->real_data - (frame->index * RT_LINK_MAX_DATA_LENGTH); + rt_link_scb->service[service]->err = err; + rt_link_scb->sendtimer.parameter = 0; + rt_link_frame_remove(rt_link_scb->service[service]); + if (rt_link_scb->service[service]->timeout_tx != RT_WAITING_NO) + { + rt_event_send(&rt_link_scb->sendevent, (0x01 << service)); + } + else + { + rt_link_scb->service[service]->send_cb(rt_link_scb->service[service], buffer); + } + } +} + +static rt_size_t frame_send(struct rt_link_frame *frame) +{ + rt_size_t length = 0; + rt_uint8_t *data = RT_NULL; + + rt_memset(rt_link_scb->sendbuffer, 0, sizeof(rt_link_scb->sendbuffer)); + data = rt_link_scb->sendbuffer; + length = RT_LINK_HEAD_LENGTH; + if (frame->head.crc) + { + length += RT_LINK_CRC_LENGTH; + } + if (frame->head.extend) + { + length += RT_LINK_EXTEND_LENGTH; } - if (frame->real_data != RT_NULL) + length += frame->data_len; + frame->head.length = frame->data_len; + rt_memcpy(data, &frame->head, RT_LINK_HEAD_LENGTH); + data = data + RT_LINK_HEAD_LENGTH; + if (frame->head.extend) { - rt_free(frame->real_data); - frame->real_data = RT_NULL; + rt_memcpy(data, &frame->extend, RT_LINK_EXTEND_LENGTH); + data = data + RT_LINK_EXTEND_LENGTH; } - rt_memset(frame, 0, sizeof(struct rt_link_frame)); - rt_free(frame); - return RT_EOK; + if (frame->attribute == RT_LINK_SHORT_DATA_FRAME || frame->attribute == RT_LINK_LONG_DATA_FRAME) + { + rt_memcpy(data, frame->real_data, frame->data_len); + data = data + frame->data_len; + } + if (frame->head.crc) + { + frame->crc = rt_link_scb->calculate_crc(RT_FALSE, rt_link_scb->sendbuffer, length - RT_LINK_CRC_LENGTH); + rt_memcpy(data, &frame->crc, RT_LINK_CRC_LENGTH); + } + + LOG_D("frame send seq(%d) len(%d) attr:(%d), crc:(0x%08x).", frame->head.sequence, length, frame->attribute, frame->crc); + return rt_link_hw_send(rt_link_scb->sendbuffer, length); } /* performs data transmission */ static rt_err_t rt_link_frame_send(rt_slist_t *slist) { + rt_uint8_t is_finish = RT_FALSE; struct rt_link_frame *frame = RT_NULL; - rt_uint8_t *origin_data = RT_NULL; - rt_uint8_t *data = RT_NULL; - rt_size_t length = 0; - rt_uint8_t send_max = RT_LINK_ACK_MAX; /* The number of '1' in the binary number */ + rt_uint8_t send_max = RT_LINK_ACK_MAX; /* if slist is tx_data_slist, we should send all data on the slist*/ if (slist == &rt_link_scb->tx_data_slist) @@ -140,16 +263,9 @@ static rt_err_t rt_link_frame_send(rt_slist_t *slist) } if (slist == RT_NULL) { - LOG_W("tx_data_slist NULL"); + LOG_W("send data list NULL"); return -RT_ERROR; } - data = rt_malloc(RT_LINK_MAX_FRAME_LENGTH); - if (data == RT_NULL) - { - LOG_E("rt link alloc memory(%d B) failed, send frame failed.", RT_LINK_MAX_FRAME_LENGTH); - return -RT_ENOMEM; - } - origin_data = data; do { @@ -157,48 +273,42 @@ static rt_err_t rt_link_frame_send(rt_slist_t *slist) frame = rt_container_of(slist, struct rt_link_frame, slist); slist = rt_slist_next(slist); - length = RT_LINK_HEAD_LENGTH; - if (frame->head.crc) + if (frame_send(frame) == 0) { - length += RT_LINK_CRC_LENGTH; + rt_link_scb->service[frame->head.service]->err = RT_LINK_EIO; + goto __err; } - if (frame->head.extend) - { - length += RT_LINK_MAX_EXTEND_LENGTH; - } - - length += frame->data_len; - frame->head.length = frame->data_len; - rt_memcpy(data, &frame->head, RT_LINK_HEAD_LENGTH); - data = data + RT_LINK_HEAD_LENGTH; - if (frame->head.extend) - { - rt_memcpy(data, &frame->extend, RT_LINK_MAX_EXTEND_LENGTH); - data = data + RT_LINK_MAX_EXTEND_LENGTH; - } - if (frame->attribute == RT_LINK_SHORT_DATA_FRAME || frame->attribute == RT_LINK_LONG_DATA_FRAME) - { - rt_memcpy(data, frame->real_data, frame->data_len); - data = data + frame->data_len; - } - if (frame->head.crc) - { - frame->crc = rt_link_scb->calculate_crc(RT_FALSE, origin_data, length - RT_LINK_CRC_LENGTH); - rt_memcpy(data, &frame->crc, RT_LINK_CRC_LENGTH); - } - - LOG_D("frame send(%d) len(%d) attr:(%d), crc:(0x%08x).", frame->head.sequence, length, frame->attribute, frame->crc); - rt_link_hw_send(origin_data, length); - - data = origin_data; - if (slist == RT_NULL) + frame->issent = RT_LINK_FRAME_SENT; + if ((slist == RT_NULL) || (frame->index + 1 >= frame->total)) { send_max = 0; + is_finish = RT_TRUE; + } + else + { + send_max >>= 1; } - send_max >>= 1; }while (send_max); - rt_free(origin_data); + + if ((is_finish) && (frame->head.ack == 0)) + { + /* NACK frame send finish, remove after sending */ + rt_link_service_send_finish(RT_LINK_EOK); + if (slist != RT_NULL) + { + LOG_D("Continue sending"); + rt_event_send(&rt_link_scb->event, RT_LINK_SEND_READY_EVENT); + } + } + else + { + rt_int32_t timeout = RT_LINK_SENT_FRAME_TIMEOUT; + rt_timer_control(&rt_link_scb->sendtimer, RT_TIMER_CTRL_SET_TIME, &timeout); + rt_timer_start(&rt_link_scb->sendtimer); + } return RT_EOK; +__err: + return -RT_ERROR; } static void _stop_recv_long(void) @@ -216,54 +326,16 @@ static void _stop_recv_long(void) static rt_err_t rt_link_frame_stop_receive(struct rt_link_frame *frame) { rt_memset(frame, 0, sizeof(struct rt_link_frame)); - rt_link_hw_buffer_point_shift(&rt_link_scb->rx_buffer->read_point, rt_link_hw_recv_len(rt_link_scb->rx_buffer)); - return RT_EOK; -} - -/* Configure the extended field of the frame */ -static rt_err_t rt_link_frame_extend_config(struct rt_link_frame *frame, rt_link_frame_attribute_t attribute, rt_uint16_t parameter) -{ - frame->head.extend = 1; - frame->extend.attribute = attribute; - frame->extend.parameter = parameter; - return RT_EOK; -} - -static int rt_link_command_frame_send(rt_uint8_t sequence, rt_link_frame_attribute_t attribute, rt_uint16_t parameter) -{ - struct rt_link_frame command_frame = {0}; - rt_uint8_t extend_flag = RT_FALSE; - - /* command frame don't need crc and ack ability */ - rt_link_frame_init(&command_frame, RT_NULL); - command_frame.head.sequence = sequence; - command_frame.head.length = RT_LINK_MAX_EXTEND_LENGTH; - command_frame.attribute = attribute; - switch (attribute) + if (rt_link_scb->rx_record.dataspace) { - case RT_LINK_RESEND_FRAME: - extend_flag = RT_TRUE; - LOG_D("send RESEND_FRAME(%d).", command_frame.head.sequence); - break; - - case RT_LINK_HANDSHAKE_FRAME: - extend_flag = RT_TRUE; - LOG_D("send HANDSHAKE_FRAME(%d).", command_frame.head.sequence); - break; - - case RT_LINK_CONFIRM_FRAME: - LOG_D("send CONFIRM_FRAME(%d).", command_frame.head.sequence); - break; - - default: - break; + rt_free(rt_link_scb->rx_record.dataspace); } + rt_link_scb->rx_record.dataspace = RT_NULL; + rt_link_scb->rx_record.long_count = 0; + rt_link_scb->rx_record.total = 0; - if (extend_flag) - { - rt_link_frame_extend_config(&command_frame, attribute, parameter); - } - rt_link_frame_send(&command_frame.slist); + rt_timer_stop(&rt_link_scb->recvtimer); + rt_link_scb->recvtimer.parameter = 0; return RT_EOK; } @@ -279,7 +351,7 @@ static rt_err_t rt_link_resend_handle(struct rt_link_frame *receive_frame) if (find_frame->head.sequence == receive_frame->head.sequence) { LOG_D("resend frame(%d)", find_frame->head.sequence); - rt_link_frame_send(&find_frame->slist); + frame_send(find_frame); break; } tem_list = tem_list->next; @@ -288,7 +360,9 @@ static rt_err_t rt_link_resend_handle(struct rt_link_frame *receive_frame) if (tem_list == RT_NULL) { LOG_D("frame resent failed, can't find(%d).", receive_frame->head.sequence); - rt_link_command_frame_send(receive_frame->head.sequence, RT_LINK_SESSION_END, RT_NULL); + rt_link_command_frame_send(receive_frame->head.service, + receive_frame->head.sequence, + RT_LINK_SESSION_END, RT_NULL); } return RT_EOK; } @@ -296,16 +370,21 @@ static rt_err_t rt_link_resend_handle(struct rt_link_frame *receive_frame) static rt_err_t rt_link_confirm_handle(struct rt_link_frame *receive_frame) { static struct rt_link_frame *send_frame = RT_NULL; - struct rt_link_frame *find_frame = RT_NULL; rt_slist_t *tem_list = RT_NULL; rt_uint16_t seq_offset = 0; - LOG_D("confirm seq(%d) frame", receive_frame->head.sequence); - if (rt_link_scb->link_status == RT_LINK_NO_RESPONSE) + + rt_timer_stop(&rt_link_scb->sendtimer); + + if (rt_link_scb->service[receive_frame->head.service] != RT_NULL) + { + rt_link_scb->service[receive_frame->head.service]->state = RT_LINK_CONNECT; + } + + if (rt_link_scb->state != RT_LINK_CONNECT) { /* The handshake success and resends the data frame */ - LOG_D("link_status RT_LINK_CONNECT_DONE, resend data"); - rt_link_scb->link_status = RT_LINK_CONNECT_DONE; + rt_link_scb->state = RT_LINK_CONNECT; if (rt_slist_first(&rt_link_scb->tx_data_slist)) { rt_event_send(&rt_link_scb->event, RT_LINK_SEND_READY_EVENT); @@ -319,38 +398,15 @@ static rt_err_t rt_link_confirm_handle(struct rt_link_frame *receive_frame) { return -RT_ERROR; } - send_frame = rt_container_of(tem_list, struct rt_link_frame, slist); - seq_offset = rt_link_check_seq(receive_frame->head.sequence, - rt_link_scb->tx_seq); + seq_offset = rt_link_check_seq(receive_frame->head.sequence, send_frame->head.sequence); if (seq_offset <= send_frame->total) { - LOG_D("confirm frame (%d)", receive_frame->head.sequence); - for (int i = 0; i < seq_offset; i++) - { - find_frame = rt_container_of(tem_list, struct rt_link_frame, slist); - LOG_D("confirm(%d), remove(%d)", receive_frame->head.sequence, find_frame->head.sequence); + rt_link_service_send_finish(RT_LINK_EOK); + rt_link_scb->state = RT_LINK_CONNECT; - rt_enter_critical(); - rt_slist_remove(&rt_link_scb->tx_data_slist, &find_frame->slist); - rt_exit_critical(); - find_frame->real_data = RT_NULL; - rt_link_frame_free(find_frame); - - tem_list = rt_slist_first(&rt_link_scb->tx_data_slist); - if (tem_list == RT_NULL) - { - break; - } - } - rt_link_scb->tx_seq = receive_frame->head.sequence; - rt_link_scb->link_status = RT_LINK_CONNECT_DONE; - if (tem_list == RT_NULL) - { - LOG_D("SEND_OK"); - rt_event_send(&rt_link_scb->event, RT_LINK_SEND_OK_EVENT); - } - else + tem_list = rt_slist_first(&rt_link_scb->tx_data_slist); + if (tem_list != RT_NULL) { LOG_D("Continue sending"); rt_event_send(&rt_link_scb->event, RT_LINK_SEND_READY_EVENT); @@ -359,29 +415,42 @@ static rt_err_t rt_link_confirm_handle(struct rt_link_frame *receive_frame) return RT_EOK; } +/* serv type rt_link_service_e */ +static void rt_link_recv_finish(rt_uint8_t serv, void *data, rt_size_t size) +{ + if (rt_link_scb->service[serv] == RT_NULL) + { + rt_link_command_frame_send(serv, 0, RT_LINK_DETACH_FRAME, RT_NULL); + return; + } + + if (rt_link_scb->service[serv]->recv_cb == RT_NULL) + { + rt_free(data); + LOG_W("service %d haven't been registered.", serv); + } + else + { + rt_link_scb->service[serv]->recv_cb(rt_link_scb->service[serv], data, size); + } +} + static rt_err_t rt_link_short_handle(struct rt_link_frame *receive_frame) { LOG_D("Seq(%d) short data", receive_frame->head.sequence); rt_link_scb->rx_record.dataspace = rt_malloc(receive_frame->data_len); if (rt_link_scb->rx_record.dataspace != RT_NULL) { - rt_link_command_frame_send(receive_frame->head.sequence, RT_LINK_CONFIRM_FRAME, RT_NULL); + if (receive_frame->head.ack) + { + rt_link_command_frame_send(receive_frame->head.service, + receive_frame->head.sequence, + RT_LINK_CONFIRM_FRAME, RT_NULL); + } rt_link_scb->rx_record.rx_seq = receive_frame->head.sequence; - - if (rt_link_scb->channel[receive_frame->head.channel].upload_callback == RT_NULL) - { - rt_free(rt_link_scb->rx_record.dataspace); - LOG_E("Channel %d has not been registered", receive_frame->head.channel); - } - else - { - rt_enter_critical(); - rt_link_hw_copy(rt_link_scb->rx_record.dataspace, receive_frame->real_data, receive_frame->data_len); - rt_exit_critical(); - rt_link_scb->channel[receive_frame->head.channel].upload_callback(rt_link_scb->rx_record.dataspace, receive_frame->data_len); - } + rt_link_hw_copy(rt_link_scb->rx_record.dataspace, receive_frame->real_data, receive_frame->data_len); + rt_link_recv_finish(receive_frame->head.service, rt_link_scb->rx_record.dataspace, receive_frame->data_len); rt_link_scb->rx_record.dataspace = RT_NULL; - rt_link_frame_stop_receive(receive_frame); } else { @@ -391,7 +460,7 @@ static rt_err_t rt_link_short_handle(struct rt_link_frame *receive_frame) return 0; } -static void _long_handle_first(struct rt_link_frame *receive_frame, rt_uint8_t *count_mask) +static void _long_handle_first(struct rt_link_frame *receive_frame) { if (receive_frame->extend.parameter % RT_LINK_MAX_DATA_LENGTH == 0) { @@ -406,22 +475,22 @@ static void _long_handle_first(struct rt_link_frame *receive_frame, rt_uint8_t * rt_link_scb->rx_record.dataspace = rt_malloc(receive_frame->extend.parameter); if (rt_link_scb->rx_record.dataspace == RT_NULL) { - LOG_W("long data %dB alloc failed.", receive_frame->extend.parameter); + LOG_W("long data (%dB) alloc failed.", receive_frame->extend.parameter); } - } -static void _long_handle_second(struct rt_link_frame *receive_frame, rt_uint8_t count_mask) +static void _long_handle_second(struct rt_link_frame *receive_frame) { static rt_uint8_t ack_mask = RT_LINK_ACK_MAX; - - void *data = RT_NULL; - rt_size_t size = 0; - rt_uint16_t serve = 0; rt_size_t offset = 0; /* offset, count from 0 */ receive_frame->index = rt_link_check_seq(receive_frame->head.sequence, rt_link_scb->rx_record.rx_seq) - 1; - LOG_D("index= %d, count= 0x%x, seq(%d), rxseq(%d)", receive_frame->index, rt_link_scb->rx_record.long_count, receive_frame->head.sequence, rt_link_scb->rx_record.rx_seq); + LOG_D("seq(%d), rxseq(%d), index(%d), total(%d), count(0x%x)" + , receive_frame->head.sequence + , rt_link_scb->rx_record.rx_seq + , receive_frame->index + , receive_frame->total + , rt_link_scb->rx_record.long_count); if ((receive_frame->index > RT_LINK_FRAMES_MAX) || (rt_link_scb->rx_record.long_count & (0x01 << receive_frame->index))) { @@ -429,51 +498,41 @@ static void _long_handle_second(struct rt_link_frame *receive_frame, rt_uint8_t } else if (rt_link_scb->rx_record.dataspace != RT_NULL) { - LOG_D("long_count (0x%02x)index(%d)total(%d) seq(%d)", rt_link_scb->rx_record.long_count, receive_frame->index, receive_frame->total, receive_frame->head.sequence); rt_link_scb->rx_record.long_count |= (0x01 << receive_frame->index); offset = RT_LINK_MAX_DATA_LENGTH * receive_frame->index; - - rt_enter_critical(); rt_link_hw_copy(rt_link_scb->rx_record.dataspace + offset, receive_frame->real_data, receive_frame->data_len); - rt_exit_critical(); - if (rt_link_utils_num1(rt_link_scb->rx_record.long_count) == rt_link_scb->rx_record.total) + if (receive_frame->head.ack) { - rt_link_command_frame_send((rt_link_scb->rx_record.rx_seq + rt_link_scb->rx_record.total), RT_LINK_CONFIRM_FRAME, RT_NULL); - } - else if ((rt_link_scb->rx_record.long_count & ack_mask) == ack_mask) - { - rt_link_command_frame_send((rt_link_scb->rx_record.rx_seq + rt_link_utils_num1(ack_mask)), RT_LINK_CONFIRM_FRAME, RT_NULL); - ack_mask |= ack_mask << rt_link_utils_num1(RT_LINK_ACK_MAX); + if (rt_link_utils_num1(rt_link_scb->rx_record.long_count) == rt_link_scb->rx_record.total) + { + rt_link_command_frame_send(receive_frame->head.service, + (rt_link_scb->rx_record.rx_seq + rt_link_scb->rx_record.total), + RT_LINK_CONFIRM_FRAME, RT_NULL); + } + else if ((rt_link_scb->rx_record.long_count & ack_mask) == ack_mask) + { + rt_link_command_frame_send(receive_frame->head.service, + (rt_link_scb->rx_record.rx_seq + rt_link_utils_num1(ack_mask)), + RT_LINK_CONFIRM_FRAME, RT_NULL); + ack_mask |= ack_mask << rt_link_utils_num1(RT_LINK_ACK_MAX); + } } /* receive a complete package */ if (rt_link_utils_num1(rt_link_scb->rx_record.long_count) == rt_link_scb->rx_record.total) { rt_timer_stop(&rt_link_scb->longframetimer); + rt_link_recv_finish(receive_frame->head.service, rt_link_scb->rx_record.dataspace, receive_frame->extend.parameter); rt_enter_critical(); - data = rt_link_scb->rx_record.dataspace; - size = receive_frame->extend.parameter; - serve = receive_frame->head.channel; /* empty rx_record */ rt_link_scb->rx_record.rx_seq += rt_link_scb->rx_record.total; rt_link_scb->rx_record.dataspace = RT_NULL; rt_link_scb->rx_record.long_count = 0; rt_link_scb->rx_record.total = 0; ack_mask = RT_LINK_ACK_MAX; - rt_link_frame_stop_receive(receive_frame); rt_exit_critical(); - - if (rt_link_scb->channel[serve].upload_callback == RT_NULL) - { - rt_free(data); - LOG_E("channel %d haven't been registered.", serve); - } - else - { - rt_link_scb->channel[serve].upload_callback(data, size); - } } else if (rt_link_hw_recv_len(rt_link_scb->rx_buffer) < (receive_frame->data_len % RT_LINK_MAX_DATA_LENGTH)) { @@ -486,20 +545,19 @@ static void _long_handle_second(struct rt_link_frame *receive_frame, rt_uint8_t static rt_err_t rt_link_long_handle(struct rt_link_frame *receive_frame) { - static rt_uint8_t count_mask = 0; if (rt_link_scb->rx_record.long_count == 0) { /* Receive this long package for the first time: * calculates the total number of frames, * requests space, and turns on the receive timer */ - _long_handle_first(receive_frame, &count_mask); + _long_handle_first(receive_frame); } if (rt_link_scb->rx_record.total > 0) { /* Intermediate frame processing: * serial number repeated check, * receive completion check, reply to ACK */ - _long_handle_second(receive_frame, count_mask); + _long_handle_second(receive_frame); } receive_frame->real_data = RT_NULL; return RT_EOK; @@ -507,13 +565,41 @@ static rt_err_t rt_link_long_handle(struct rt_link_frame *receive_frame) static rt_err_t rt_link_handshake_handle(struct rt_link_frame *receive_frame) { - LOG_D("Sequence(%d) is a connect handshake frame.", receive_frame->head.sequence); - rt_link_scb->link_status = RT_LINK_CONNECT_DONE; + LOG_D("HANDSHAKE: seq(%d) param(%d)", receive_frame->head.sequence, receive_frame->extend.parameter); + rt_link_scb->state = RT_LINK_CONNECT; /* sync requester tx seq, responder rx seq = requester tx seq */ rt_link_scb->rx_record.rx_seq = receive_frame->head.sequence; /* sync requester rx seq, responder tx seq = requester rx seq */ rt_link_scb->tx_seq = receive_frame->extend.parameter; - rt_link_command_frame_send(receive_frame->head.sequence, RT_LINK_CONFIRM_FRAME, RT_NULL); + + if (rt_link_scb->service[receive_frame->head.service] != RT_NULL) + { + rt_link_scb->service[receive_frame->head.service]->state = RT_LINK_CONNECT; + rt_link_command_frame_send(receive_frame->head.service, + receive_frame->head.sequence, + RT_LINK_CONFIRM_FRAME, RT_NULL); + } + else + { + rt_link_command_frame_send(receive_frame->head.service, + receive_frame->head.sequence, + RT_LINK_DETACH_FRAME, RT_NULL); + } + return RT_EOK; +} + +static rt_err_t rt_link_detach_handle(struct rt_link_frame *receive_frame) +{ + if (rt_link_scb->service[receive_frame->head.service] != RT_NULL) + { + rt_link_scb->service[receive_frame->head.service]->state = RT_LINK_DISCONN; + } + return RT_EOK; +} + +static rt_err_t rt_link_session_end_handle(struct rt_link_frame *receive_frame) +{ + rt_link_frame_stop_receive(receive_frame); return RT_EOK; } @@ -528,42 +614,29 @@ static rt_err_t rt_link_parse_frame(struct rt_link_frame *receive_frame) case RT_LINK_CONFIRM_FRAME: rt_link_confirm_handle(receive_frame); break; + case RT_LINK_HANDSHAKE_FRAME: + rt_link_handshake_handle(receive_frame); + break; + case RT_LINK_SESSION_END: + rt_link_session_end_handle(receive_frame); + break; + case RT_LINK_DETACH_FRAME: + rt_link_detach_handle(receive_frame); + break; + case RT_LINK_SHORT_DATA_FRAME: rt_link_short_handle(receive_frame); break; case RT_LINK_LONG_DATA_FRAME: rt_link_long_handle(receive_frame); break; - case RT_LINK_HANDSHAKE_FRAME: - rt_link_handshake_handle(receive_frame); - break; - case RT_LINK_SESSION_END: - rt_link_frame_stop_receive(receive_frame); - break; + default: - break; + return -RT_ERROR; } return RT_EOK; } -/* Empty the sending list */ -static void rt_link_datalist_empty(void) -{ - struct rt_link_frame *find_frame = RT_NULL; - rt_slist_t *tem_list = rt_slist_first(&rt_link_scb->tx_data_slist); - while (tem_list != RT_NULL) - { - find_frame = rt_container_of(tem_list, struct rt_link_frame, slist); - tem_list = rt_slist_next(tem_list); - rt_enter_critical(); - rt_slist_remove(&rt_link_scb->tx_data_slist, &find_frame->slist); - rt_exit_critical(); - - find_frame->real_data = RT_NULL; - rt_link_frame_free(find_frame); - } -} - /* RT_LINK_READ_CHECK_EVENT handle */ static void rt_link_frame_check(void) { @@ -574,7 +647,6 @@ static void rt_link_frame_check(void) struct rt_link_frame *send_frame = RT_NULL; rt_tick_t timeout = 0; - rt_uint8_t *real_data = RT_NULL; rt_uint32_t temporary_crc = 0; rt_uint8_t offset = 0; @@ -599,7 +671,7 @@ static void rt_link_frame_check(void) { if (recv_len < buff_len) { - LOG_D("The length is not enough,recv=%d buff=%d", recv_len, buff_len); + LOG_D("HEAD: actual: %d, need: %d.", recv_len, buff_len); return ; } /* Data is an offset address */ @@ -607,16 +679,32 @@ static void rt_link_frame_check(void) rt_link_frame_init(&receive_frame, RT_NULL); rt_link_hw_copy((rt_uint8_t *)&receive_frame.head, data, sizeof(struct rt_link_frame_head)); rt_link_hw_buffer_point_shift(&data, sizeof(struct rt_link_frame_head)); + + LOG_D("HEAD: seq(%d) serv(%d) ack(%d) crc(%d) ext(%d) len(%d) attr(%d)(0x%x)" + , receive_frame.head.sequence + , receive_frame.head.service + , receive_frame.head.ack + , receive_frame.head.crc + , receive_frame.head.extend + , receive_frame.head.length + , receive_frame.extend.attribute + , receive_frame.extend.parameter); + receive_frame.data_len = receive_frame.head.length; - LOG_D("check seq(%d) data len(%d).", receive_frame.head.sequence, receive_frame.data_len); + if (receive_frame.head.service >= RT_LINK_SERVICE_MAX) + { + rt_link_hw_buffer_point_shift(&rt_link_scb->rx_buffer->read_point, 1); + goto __find_head; + } if (receive_frame.head.extend) { - buff_len += RT_LINK_MAX_EXTEND_LENGTH; + buff_len += RT_LINK_EXTEND_LENGTH; analysis_status = PARSE_FRAME_EXTEND; } else { + receive_frame.attribute = RT_LINK_SHORT_DATA_FRAME; analysis_status = PARSE_FRAME_SEQ; } } @@ -627,54 +715,38 @@ static void rt_link_frame_check(void) { if (recv_len < buff_len) { - LOG_D("PARSE_FRAME_EXTEND: actual: %d, need: %d.", recv_len, buff_len); - + LOG_D("EXTEND: actual: %d, need: %d.", recv_len, buff_len); /* should set timer, control receive frame timeout, one shot */ timeout = 50; rt_timer_control(&rt_link_scb->recvtimer, RT_TIMER_CTRL_SET_TIME, &timeout); rt_timer_start(&rt_link_scb->recvtimer); return; } + rt_timer_stop(&rt_link_scb->recvtimer); rt_link_hw_copy((rt_uint8_t *)&receive_frame.extend, data, sizeof(struct rt_link_extend)); rt_link_hw_buffer_point_shift(&data, sizeof(struct rt_link_extend)); - switch (receive_frame.extend.attribute) + if (receive_frame.extend.attribute < RT_LINK_RESERVE_FRAME) { - case RT_LINK_RESEND_FRAME: - case RT_LINK_LONG_DATA_FRAME: - case RT_LINK_HANDSHAKE_FRAME: receive_frame.attribute = receive_frame.extend.attribute; - break; - default: - receive_frame.attribute = RT_LINK_RESERVE_FRAME; - break; - } - } - else - { - if (receive_frame.head.crc) - { - receive_frame.attribute = RT_LINK_SHORT_DATA_FRAME; } else { - receive_frame.attribute = RT_LINK_CONFIRM_FRAME; + LOG_D("EXTEND: attr(%d) err", receive_frame.extend.attribute); + rt_link_hw_buffer_point_shift(&rt_link_scb->rx_buffer->read_point, 1); + goto __find_head; } } - if (receive_frame.attribute == RT_LINK_RESERVE_FRAME) - { - LOG_D("quick filter error frame."); - rt_link_frame_stop_receive(&receive_frame); - buff_len = RT_LINK_HEAD_LENGTH; - analysis_status = FIND_FRAME_HEAD; - break; - } analysis_status = PARSE_FRAME_SEQ; } case PARSE_FRAME_SEQ: { - if ((receive_frame.attribute == RT_LINK_CONFIRM_FRAME) || (receive_frame.attribute == RT_LINK_RESEND_FRAME)) + switch (receive_frame.attribute) { + case RT_LINK_CONFIRM_FRAME: + case RT_LINK_RESEND_FRAME: + { + /* Check the send sequence */ offset = rt_link_check_seq(receive_frame.head.sequence, rt_link_scb->tx_seq); if (rt_slist_first(&rt_link_scb->tx_data_slist) != RT_NULL) { @@ -683,27 +755,36 @@ static void rt_link_frame_check(void) { /* exceptional frame, ignore it */ LOG_D("seq (%d) failed, tx_seq (%d).offset=(%d) total= (%d)", receive_frame.head.sequence, rt_link_scb->tx_seq, offset, send_frame->total); - rt_link_frame_stop_receive(&receive_frame); - buff_len = RT_LINK_HEAD_LENGTH; - analysis_status = FIND_FRAME_HEAD; - break; + rt_link_hw_buffer_point_shift(&rt_link_scb->rx_buffer->read_point, 1); + goto __find_head; } } + break; } - else + case RT_LINK_LONG_DATA_FRAME: + case RT_LINK_SHORT_DATA_FRAME: + case RT_LINK_SESSION_END: { + /* Check the receive sequence */ offset = rt_link_check_seq(receive_frame.head.sequence, rt_link_scb->rx_record.rx_seq) - 1; - if ((offset > RT_LINK_FRAMES_MAX) && (receive_frame.attribute != RT_LINK_HANDSHAKE_FRAME)) + if (offset > RT_LINK_FRAMES_MAX) { /* exceptional frame, ignore it */ - LOG_D("seq (%d) failed, rx_seq (%d) offset=(%d) attr= (%d) status (%d)", receive_frame.head.sequence, rt_link_scb->rx_record.rx_seq, offset, receive_frame.attribute, rt_link_scb->link_status); - rt_link_frame_stop_receive(&receive_frame); - buff_len = RT_LINK_HEAD_LENGTH; - analysis_status = FIND_FRAME_HEAD; - break; + LOG_D("seq (%d) failed, rx_seq (%d) offset=(%d) attr= (%d) status (%d)", receive_frame.head.sequence, rt_link_scb->rx_record.rx_seq, offset, receive_frame.attribute, rt_link_scb->state); + rt_link_hw_buffer_point_shift(&rt_link_scb->rx_buffer->read_point, 1); + goto __find_head; } } + case RT_LINK_HANDSHAKE_FRAME: + case RT_LINK_DETACH_FRAME: + analysis_status = HEADLE_FRAME_DATA; + break; + default: + LOG_D("quick filter error frame."); + rt_link_hw_buffer_point_shift(&rt_link_scb->rx_buffer->read_point, 1); + goto __find_head; + } buff_len += receive_frame.data_len; if (receive_frame.head.crc) { @@ -714,6 +795,8 @@ static void rt_link_frame_check(void) { analysis_status = HEADLE_FRAME_DATA; } + /* fill real data point */ + receive_frame.real_data = data; } case CHECK_FRAME_CRC: @@ -722,6 +805,7 @@ static void rt_link_frame_check(void) { if (recv_len < buff_len) { + LOG_D("CRC: actual: %d, need: %d.", recv_len, buff_len); /* should set timer, control receive frame timeout, one shot */ timeout = 50; rt_timer_control(&rt_link_scb->recvtimer, RT_TIMER_CTRL_SET_TIME, &timeout); @@ -729,7 +813,6 @@ static void rt_link_frame_check(void) return; } - real_data = data; rt_timer_stop(&rt_link_scb->recvtimer); rt_link_hw_buffer_point_shift(&data, receive_frame.data_len); rt_link_hw_copy((rt_uint8_t *)&receive_frame.crc, data, RT_LINK_CRC_LENGTH); @@ -738,25 +821,28 @@ static void rt_link_frame_check(void) { /* check failed. ready resent */ LOG_D("CRC: calc:(0x%08x) ,recv:(0x%08x).", temporary_crc, receive_frame.crc); - /* quick resent, when sequence is right, we can ask for reset this frame */ - rt_link_command_frame_send(receive_frame.head.sequence, RT_LINK_RESEND_FRAME, RT_NULL); - - /* throw the error frame */ - buff_len = RT_LINK_HEAD_LENGTH; - rt_link_frame_stop_receive(&receive_frame); - - /* clear the frame information */ - analysis_status = FIND_FRAME_HEAD; - break; + rt_link_hw_buffer_point_shift(&rt_link_scb->rx_buffer->read_point, 1); + goto __find_head; } - /* fill real data point */ - receive_frame.real_data = real_data; } analysis_status = HEADLE_FRAME_DATA; } case HEADLE_FRAME_DATA: { + if (recv_len < buff_len) + { + LOG_D("PARSE: actual: %d, need: %d.", recv_len, buff_len); + /* should set timer, control receive frame timeout, one shot */ + timeout = 50; + rt_timer_control(&rt_link_scb->recvtimer, RT_TIMER_CTRL_SET_TIME, &timeout); + rt_timer_start(&rt_link_scb->recvtimer); + return; + } + LOG_D("PARSE: buff_len (%d) r (0x%p) w (0x%p)" + , buff_len, rt_link_scb->rx_buffer->read_point + , rt_link_scb->rx_buffer->write_point); + rt_timer_stop(&rt_link_scb->recvtimer); rt_link_hw_buffer_point_shift(&rt_link_scb->rx_buffer->read_point, buff_len); rt_link_parse_frame(&receive_frame); data = RT_NULL; @@ -766,25 +852,47 @@ static void rt_link_frame_check(void) } default: - LOG_E("analysis_status is error."); +__find_head: + LOG_D("to find head (%d)", analysis_status); + rt_link_frame_stop_receive(&receive_frame); + buff_len = RT_LINK_HEAD_LENGTH; + analysis_status = FIND_FRAME_HEAD; break; } + recv_len = rt_link_hw_recv_len(rt_link_scb->rx_buffer); } } static void rt_link_send_ready(void) { - if (rt_link_scb->link_status != RT_LINK_CONNECT_DONE) + struct rt_link_frame *frame = RT_NULL; + rt_uint8_t seq = rt_link_scb->tx_seq; + if (rt_slist_next(&rt_link_scb->tx_data_slist)) { - rt_link_scb->link_status = RT_LINK_NO_RESPONSE; - rt_link_command_frame_send(rt_link_scb->tx_seq, RT_LINK_HANDSHAKE_FRAME, rt_link_scb->rx_record.rx_seq); + frame = rt_container_of(rt_slist_next(&rt_link_scb->tx_data_slist), struct rt_link_frame, slist); + } + + if (rt_link_scb->state != RT_LINK_CONNECT) + { + rt_link_scb->state = RT_LINK_DISCONN; + rt_link_command_frame_send(RT_LINK_SERVICE_RTLINK, seq, + RT_LINK_HANDSHAKE_FRAME, rt_link_scb->rx_record.rx_seq); + + rt_int32_t timeout = 50; + rt_timer_control(&rt_link_scb->sendtimer, RT_TIMER_CTRL_SET_TIME, &timeout); + rt_timer_start(&rt_link_scb->sendtimer); } else { - if (RT_EOK != rt_link_frame_send(&rt_link_scb->tx_data_slist)) + /* Avoid sending the first data frame multiple times */ + if ((frame != RT_NULL) && (frame->issent == RT_LINK_FRAME_NOSEND)) { - rt_event_send(&rt_link_scb->event, RT_LINK_SEND_FAILED_EVENT); + if (RT_EOK != rt_link_frame_send(&rt_link_scb->tx_data_slist)) + { + rt_link_scb->state = RT_LINK_DISCONN; + rt_link_service_send_finish(RT_LINK_EIO); + } } } } @@ -797,41 +905,51 @@ static void rt_link_frame_recv_timeout(void) static void rt_link_send_timeout(void) { - static rt_uint8_t count = 0; - if (count++ > 5) + LOG_D("send count(%d)", (rt_uint32_t)rt_link_scb->sendtimer.parameter); + if ((rt_uint32_t)rt_link_scb->sendtimer.parameter >= 5) { + rt_timer_stop(&rt_link_scb->sendtimer); LOG_W("Send timeout, please check the link status!"); - count = 0; - rt_event_send(&rt_link_scb->event, RT_LINK_SEND_FAILED_EVENT); + rt_link_scb->sendtimer.parameter = 0x00; + rt_link_service_send_finish(RT_LINK_ETIMEOUT); } else { - rt_timer_start(&rt_link_scb->sendtimer); - rt_link_command_frame_send(rt_link_scb->tx_seq, RT_LINK_HANDSHAKE_FRAME, rt_link_scb->rx_record.rx_seq); + if (rt_slist_next(&rt_link_scb->tx_data_slist)) + { + struct rt_link_frame *frame = rt_container_of(rt_slist_next(&rt_link_scb->tx_data_slist), struct rt_link_frame, slist); + frame->issent = RT_LINK_FRAME_NOSEND; + rt_link_command_frame_send(RT_LINK_SERVICE_RTLINK, + frame->head.sequence, + RT_LINK_HANDSHAKE_FRAME, + rt_link_scb->rx_record.rx_seq); + } } } -static int rt_link_long_recv_timeout(void) +static void rt_link_long_recv_timeout(void) { - static rt_uint8_t count = 0; - if (count++ > 5) + if ((rt_uint32_t)rt_link_scb->longframetimer.parameter >= 5) { LOG_W("long package receive timeout"); - count = 0; + rt_link_scb->longframetimer.parameter = 0x00; _stop_recv_long(); + rt_timer_stop(&rt_link_scb->longframetimer); } else { - for (rt_uint8_t total = rt_link_scb->rx_record.total; total > 0; total--) + rt_uint8_t total = rt_link_scb->rx_record.total; + for (; total > 0; total--) { if (((rt_link_scb->rx_record.long_count >> (total - 1)) & 0x01) == 0x00) { /* resend command */ - rt_link_command_frame_send((rt_link_scb->rx_record.rx_seq + total), RT_LINK_RESEND_FRAME, RT_NULL); + rt_link_command_frame_send(RT_LINK_SERVICE_RTLINK, + (rt_link_scb->rx_record.rx_seq + total), + RT_LINK_RESEND_FRAME, RT_NULL); } } } - return RT_EOK; } void rt_link_thread(void *parameter) @@ -839,7 +957,8 @@ void rt_link_thread(void *parameter) rt_uint32_t recved = 0; while (1) { - rt_event_recv(&rt_link_scb->event, RT_LINK_READ_CHECK_EVENT | + rt_event_recv(&rt_link_scb->event, + RT_LINK_READ_CHECK_EVENT | RT_LINK_SEND_READY_EVENT | RT_LINK_SEND_TIMEOUT_EVENT | RT_LINK_RECV_TIMEOUT_FRAME_EVENT | @@ -877,6 +996,8 @@ void rt_link_thread(void *parameter) static void rt_link_sendtimer_callback(void *parameter) { + rt_uint32_t count = (rt_uint32_t)rt_link_scb->sendtimer.parameter + 1; + rt_link_scb->sendtimer.parameter = (void *)count; rt_event_send(&rt_link_scb->event, RT_LINK_SEND_TIMEOUT_EVENT); } @@ -887,34 +1008,38 @@ static void rt_link_recvtimer_callback(void *parameter) static void rt_link_receive_long_frame_callback(void *parameter) { + rt_uint32_t count = (rt_uint32_t)rt_link_scb->longframetimer.parameter + 1; + rt_link_scb->longframetimer.parameter = (void *)count; rt_event_send(&rt_link_scb->event, RT_LINK_RECV_TIMEOUT_LONG_EVENT); } /** * rtlink send data interface - * @param service Registered service channel, choose enum rt_link_service_t + * @param service Registered service channel, struct rt_link_service * @param data send data * @param size send data size * @return The actual size of the data sent * */ -rt_size_t rt_link_send(rt_link_service_t service, void *data, rt_size_t size) +rt_size_t rt_link_send(struct rt_link_service *service, const void *data, rt_size_t size) { - if ((size == 0) || (data == RT_NULL) || (service >= RT_LINK_SERVICE_MAX)) - { - return 0; - } - rt_mutex_take(&rt_link_scb->tx_lock, RT_WAITING_FOREVER); + RT_ASSERT(service != RT_NULL); rt_uint32_t recved = 0; - rt_err_t result = RT_EOK; - rt_uint32_t timeout = 0; - rt_uint8_t total = 0; /* The total number of frames to send */ rt_uint8_t index = 0; /* The index of the split packet */ rt_size_t offset = 0; /* The offset of the send data */ + rt_size_t send_len = 0; struct rt_link_frame *send_frame = RT_NULL; - rt_link_frame_attribute_t attribute; + rt_link_frame_attr_e attribute = RT_LINK_SHORT_DATA_FRAME; + + if ((size == 0) || (data == RT_NULL)) + { + service->err = RT_LINK_ERR; + goto __exit; + } + + service->err = RT_LINK_EOK; if (size % RT_LINK_MAX_DATA_LENGTH == 0) { total = size / RT_LINK_MAX_DATA_LENGTH; @@ -926,24 +1051,25 @@ rt_size_t rt_link_send(rt_link_service_t service, void *data, rt_size_t size) if (total > RT_LINK_FRAMES_MAX) { - result = -RT_ENOMEM; + service->err = RT_LINK_ENOMEM; goto __exit; } else if (total > 1) { attribute = RT_LINK_LONG_DATA_FRAME; } - else - { - attribute = RT_LINK_SHORT_DATA_FRAME; - } do { send_frame = rt_malloc(sizeof(struct rt_link_frame)); - rt_link_frame_init(send_frame, FRAME_CRC | FRAME_ACK); - send_frame->head.sequence = rt_link_scb->tx_seq + 1 + index; - send_frame->head.channel = service; + if (send_frame == RT_NULL) + { + service->err = RT_LINK_ENOMEM; + goto __exit; + } + rt_link_frame_init(send_frame, service->flag); + send_frame->head.sequence = ++rt_link_scb->tx_seq; + send_frame->head.service = service->service; send_frame->real_data = (rt_uint8_t *)data + offset; send_frame->index = index; send_frame->total = total; @@ -970,53 +1096,39 @@ rt_size_t rt_link_send(rt_link_service_t service, void *data, rt_size_t size) } /* append the frame on the tail of list */ - LOG_D("new data append on the send slist, seq(%d), len(%d).", send_frame->head.sequence, send_frame->data_len); + LOG_D("append send slist, seq(%d), len(%d)", send_frame->head.sequence, send_frame->data_len); rt_slist_append(&rt_link_scb->tx_data_slist, &send_frame->slist); index++; + send_len += send_frame->data_len; }while(total > index); - timeout = RT_LINK_SENT_FRAME_TIMEOUT * total; - rt_timer_control(&rt_link_scb->sendtimer, RT_TIMER_CTRL_SET_TIME, &timeout); - rt_timer_start(&rt_link_scb->sendtimer); /* Notify the core thread to send packet */ rt_event_send(&rt_link_scb->event, RT_LINK_SEND_READY_EVENT); - /* Wait for the packet to be sent successfully */ - rt_event_recv(&rt_link_scb->event, RT_LINK_SEND_OK_EVENT | RT_LINK_SEND_FAILED_EVENT, RT_EVENT_FLAG_OR | RT_EVENT_FLAG_CLEAR, RT_WAITING_FOREVER, &recved); + if (service->timeout_tx != RT_WAITING_NO) + { + /* Wait for the packet to send the result */ + rt_err_t ret = rt_event_recv(&rt_link_scb->sendevent, (0x01 << service->service), + RT_EVENT_FLAG_OR | RT_EVENT_FLAG_CLEAR, + service->timeout_tx, &recved); + if (ret == -RT_ETIMEOUT) + { + service->err = RT_LINK_ETIMEOUT; + send_len = 0; + } + } - if (recved & RT_LINK_SEND_OK_EVENT) - { - result = RT_EOK; - } - else if (recved & RT_LINK_SEND_FAILED_EVENT) - { - LOG_E("the data (%dB) send failed", size); - result = -RT_ERROR; - } - else - { - LOG_E("unexpected event."); - result = -RT_ERROR; - } __exit: - rt_timer_stop(&rt_link_scb->sendtimer); - /* Empty the sending list */ - rt_link_datalist_empty(); - rt_mutex_release(&rt_link_scb->tx_lock); - if (result == RT_EOK) - { - return size; - } - return result; + return send_len; } void rtlink_status(void) { - rt_kprintf("rtlink status:\n"); + rt_kprintf("rtlink(v%s) status:\n", RT_LINK_VER); if (rt_link_scb != RT_NULL) { - rt_kprintf("\tlink status=%d\n", rt_link_scb->link_status); + rt_kprintf("\tlink status=%d\n", rt_link_scb->state); rt_kprintf("\trx seq=%d\n", rt_link_scb->rx_record.rx_seq); rt_kprintf("\ttx seq=%d\n", rt_link_scb->tx_seq); @@ -1034,7 +1146,7 @@ void rtlink_status(void) rt_slist_t *data = RT_NULL; rt_slist_for_each(data, &rt_link_scb->tx_data_slist) { - rt_kprintf("\tsend data list: serv %u\t", ((struct rt_link_frame_head *)data)->channel); + rt_kprintf("\tsend data list: serv %u\t", ((struct rt_link_frame_head *)data)->service); rt_kprintf(" seq %u\t", ((struct rt_link_frame_head *)data)->sequence); rt_kprintf(" len %u\n", ((struct rt_link_frame_head *)data)->length); } @@ -1044,10 +1156,10 @@ void rtlink_status(void) rt_kprintf("\tsend data list: NULL\n"); } - rt_uint8_t serv = sizeof(rt_link_scb->channel) / sizeof(struct rt_link_service); + rt_uint8_t serv = RT_LINK_SERVICE_MAX - 1; while (serv--) { - rt_kprintf("\tservices [%d](0x%p)\n", serv, rt_link_scb->channel[serv]); + rt_kprintf("\tservices [%d](0x%p)\n", serv, rt_link_scb->service[serv]); } } else @@ -1069,7 +1181,6 @@ rt_err_t rt_link_deinit(void) rt_timer_detach(&rt_link_scb->longframetimer); rt_timer_detach(&rt_link_scb->sendtimer); rt_timer_detach(&rt_link_scb->recvtimer); - rt_mutex_detach(&rt_link_scb->tx_lock); rt_event_detach(&rt_link_scb->event); rt_free(rt_link_scb); rt_link_scb = RT_NULL; @@ -1106,10 +1217,12 @@ int rt_link_init(void) } rt_memset(rt_link_scb, 0, sizeof(struct rt_link_session)); - rt_event_init(&rt_link_scb->event, "lny_event", RT_IPC_FLAG_FIFO); + rt_event_init(&rt_link_scb->event, "rtlink", RT_IPC_FLAG_FIFO); rt_event_control(&rt_link_scb->event, RT_IPC_CMD_RESET, RT_NULL); - rt_mutex_init(&rt_link_scb->tx_lock, "tx_lock", RT_IPC_FLAG_FIFO); + rt_event_init(&rt_link_scb->sendevent, "send_rtlink", RT_IPC_FLAG_FIFO); + rt_event_control(&rt_link_scb->sendevent, RT_IPC_CMD_RESET, RT_NULL); + rt_timer_init(&rt_link_scb->sendtimer, "tx_time", rt_link_sendtimer_callback, RT_NULL, 0, RT_TIMER_FLAG_SOFT_TIMER | RT_TIMER_FLAG_PERIODIC); rt_timer_init(&rt_link_scb->recvtimer, "rx_time", rt_link_recvtimer_callback, @@ -1117,8 +1230,6 @@ int rt_link_init(void) rt_timer_init(&rt_link_scb->longframetimer, "rxl_time", rt_link_receive_long_frame_callback, RT_NULL, 0, RT_TIMER_FLAG_SOFT_TIMER | RT_TIMER_FLAG_PERIODIC); - rt_link_scb->link_status = RT_LINK_ESTABLISHING; - rt_link_scb->rx_record.rx_seq = 255; rt_slist_init(&rt_link_scb->tx_data_slist); @@ -1137,8 +1248,8 @@ int rt_link_init(void) goto __exit; } rt_thread_startup(thread); - result = rt_link_hw_init(); + rt_link_scb->state = RT_LINK_INIT; __exit: if (result != RT_EOK) { @@ -1147,7 +1258,7 @@ __exit: } else { - LOG_I("rtlink init success."); + LOG_I("rtlink init success(VER:%s).", RT_LINK_VER); } return result; } @@ -1158,35 +1269,52 @@ MSH_CMD_EXPORT(rt_link_init, rt link init); /** * rtlink service attach - * @param service Registered service channel, choose enum rt_link_service_t - * @param function receive callback function + * @param service Registered service channel, struct rt_link_service * @return Function Execution Result * */ -rt_err_t rt_link_service_attach(rt_link_service_t service, rt_err_t (*function)(void *data, rt_size_t size)) +rt_err_t rt_link_service_attach(struct rt_link_service *serv) { - if (service >= RT_LINK_SERVICE_MAX) + RT_ASSERT(serv != RT_NULL); + if (serv->service >= RT_LINK_SERVICE_MAX) { LOG_W("Invalid parameter."); - return -RT_ERROR; + return -RT_EINVAL; } - rt_link_scb->channel[service].upload_callback = function; - LOG_I("rt link attach service[%02d].", service); + rt_uint8_t seq = rt_link_scb->tx_seq; + rt_link_hw_init(); + rt_link_scb->service[serv->service] = serv; + serv->state = RT_LINK_INIT; + LOG_I("rt link attach service[%02d].", serv->service); + + if (rt_slist_next(&rt_link_scb->tx_data_slist)) + { + struct rt_link_frame *frame = rt_container_of(rt_slist_next(&rt_link_scb->tx_data_slist), struct rt_link_frame, slist); + seq = frame->head.sequence; + } + rt_link_command_frame_send(serv->service, seq, RT_LINK_HANDSHAKE_FRAME, rt_link_scb->rx_record.rx_seq); return RT_EOK; } /** * rtlink service detach - * @param service Registered service channel, choose enum rt_link_service_t + * @param service Registered service channel, struct rt_link_service * @return rt_err_t Function Execution Result * */ -rt_err_t rt_link_service_detach(rt_link_service_t service) +rt_err_t rt_link_service_detach(struct rt_link_service *serv) { - if (service >= RT_LINK_SERVICE_MAX) + RT_ASSERT(serv != RT_NULL); + if (serv->service >= RT_LINK_SERVICE_MAX) { LOG_W("Invalid parameter."); - return -RT_ERROR; + return -RT_EINVAL; } - rt_link_scb->channel[service].upload_callback = RT_NULL; - LOG_I("rt link detach service[%02d].", service); + rt_link_command_frame_send(serv->service, + rt_link_scb->tx_seq, + RT_LINK_DETACH_FRAME, + rt_link_scb->rx_record.rx_seq); + + serv->state = RT_LINK_DISCONN; + rt_link_scb->service[serv->service] = RT_NULL; + LOG_I("rt link detach service[%02d].", serv->service); return RT_EOK; } diff --git a/components/utilities/rt-link/src/rtlink_dev.c b/components/utilities/rt-link/src/rtlink_dev.c new file mode 100644 index 0000000000..5eff1f9782 --- /dev/null +++ b/components/utilities/rt-link/src/rtlink_dev.c @@ -0,0 +1,396 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2021-06-15 Sherman the first version + */ + +#define DBG_TAG "RTLINK_DEV" +#define DBG_LVL DBG_LOG +#include + +#include +#include +#include +#include + +#define RTLINK_SERV(dev) (((struct rt_link_device*)dev)->service) + +#ifdef RT_USING_POSIX +#include +#include + +int rtlink_fops_open(struct dfs_fd *fd) +{ + rt_uint16_t flags = 0; + rt_device_t device; + + switch (fd->flags & O_ACCMODE) + { + case O_RDONLY: + LOG_D("fops open: O_RDONLY!"); + flags = RT_DEVICE_FLAG_RDONLY; + break; + case O_WRONLY: + LOG_D("fops open: O_WRONLY!"); + flags = RT_DEVICE_FLAG_WRONLY; + break; + case O_RDWR: + LOG_D("fops open: O_RDWR!"); + flags = RT_DEVICE_FLAG_RDWR; + break; + default: + LOG_E("fops open: unknown mode - %d!", fd->flags & O_ACCMODE); + break; + } + + device = (rt_device_t)fd->data; + if (fd->flags & O_NONBLOCK) + { + rt_device_control(device, RT_LINK_TX_NONBLOCKING | RT_LINK_RX_NONBLOCKING, RT_NULL); + } + + return rt_device_open(device, flags); +} + +int rtlink_fops_close(struct dfs_fd *fd) +{ + rt_device_t device; + device = (rt_device_t)fd->data; + + rt_device_set_rx_indicate(device, RT_NULL); + return rt_device_close(device); +} + +int rtlink_fops_ioctl(struct dfs_fd *fd, int cmd, void *args) +{ + rt_device_t device; + device = (rt_device_t)fd->data; + + if (cmd == O_NONBLOCK) + { + return rt_device_control(device, RT_LINK_TX_NONBLOCKING | RT_LINK_RX_NONBLOCKING, RT_NULL); + } + else + { + return rt_device_control(device, cmd, args); + } +} + +int rtlink_fops_read(struct dfs_fd *fd, void *buf, size_t count) +{ + int size = 0; + rt_device_t device; + device = (rt_device_t)fd->data; + + size = rt_device_read(device, -1, buf, count); + if (size <= 0) + { + size = -EAGAIN; + } + return size; +} + +int rtlink_fops_write(struct dfs_fd *fd, const void *buf, size_t count) +{ + int size = 0; + rt_device_t device; + device = (rt_device_t)fd->data; + + size = rt_device_write(device, -1, buf, count); + if (size <= 0) + { + size = -EAGAIN; + } + return size; +} + +int rtlink_fops_poll(struct dfs_fd *fd, struct rt_pollreq *req) +{ + int mask = 0; + int flags = 0; + rt_device_t device; + struct rt_link_device *rtlink_dev; + + device = (rt_device_t)fd->data; + RT_ASSERT(device != RT_NULL); + + rtlink_dev = (struct rt_link_device *)device; + + flags = fd->flags & O_ACCMODE; + if (flags == O_RDONLY || flags == O_RDWR) + { + rt_base_t level; + rt_poll_add(&(device->wait_queue), req); + + level = rt_hw_interrupt_disable(); + if (RT_NULL != rt_slist_first(&rtlink_dev->recv_head)) + mask |= POLLIN; + rt_hw_interrupt_enable(level); + } + mask |= POLLOUT; + + return mask; +} + +const static struct dfs_file_ops _rtlink_fops = +{ + rtlink_fops_open, + rtlink_fops_close, + rtlink_fops_ioctl, + rtlink_fops_read, + rtlink_fops_write, + RT_NULL, /* flush */ + RT_NULL, /* lseek */ + RT_NULL, /* getdents */ + rtlink_fops_poll, +}; +#endif /* RT_USING_POSIX */ + +/* The event type for the service channel number, + * which is used to wake up the service thread in blocking receive mode */ +struct rt_event recv_event; + +static rt_err_t rt_link_event_send(struct rt_link_service *serv) +{ + RT_ASSERT(serv != RT_NULL); + RT_ASSERT(serv->service < RT_LINK_SERVICE_MAX); + rt_uint32_t set = 0x01 << serv->service; + return rt_event_send(&recv_event, set); +} + +static rt_err_t rt_link_event_recv(struct rt_link_service *service) +{ + RT_ASSERT(service != RT_NULL); + RT_ASSERT(service->service < RT_LINK_SERVICE_MAX); + + rt_uint32_t set = 0x01 << service->service; + rt_uint32_t recved = 0; + rt_err_t ret = rt_event_recv(&recv_event, + set, + RT_EVENT_FLAG_AND | RT_EVENT_FLAG_CLEAR, + RT_WAITING_FOREVER, + &recved); + if (recved & set) + { + return ret; + } + return RT_ERROR; +} + +static void send_cb(struct rt_link_service *service, void *buffer) +{ + RT_ASSERT(service != RT_NULL); + RT_ASSERT(buffer != RT_NULL); + struct rt_link_device *rtlink = (struct rt_link_device *)service->user_data; + + if (rtlink && rtlink->parent.tx_complete) + { + rtlink->parent.tx_complete(&rtlink->parent, buffer); + } +} + +static void recv_cb(struct rt_link_service *service, void *data, rt_size_t size) +{ + RT_ASSERT(service != RT_NULL); + struct rt_link_device *rtlink = (struct rt_link_device *)service->user_data; + + if (rtlink) + { + struct rtlink_recv_list *node = rt_malloc(sizeof(struct rtlink_recv_list)); + node->data = data; + node->size = size; + node->index = 0; + rt_slist_append(&rtlink->recv_head, &node->list); + rt_link_event_send(service); + + if (rtlink->parent.rx_indicate) + { + rtlink->parent.rx_indicate(&rtlink->parent, size); + } + } + else + { + rt_free(data); + } +} + +rt_err_t rt_link_dev_init(rt_device_t dev) +{ + RT_ASSERT(dev != RT_NULL); + + dev->rx_indicate = RT_NULL; + dev->tx_complete = RT_NULL; + + struct rt_link_device *rtlink = (struct rt_link_device *)dev; + rtlink->service.service = RT_LINK_SERVICE_MAX; + rtlink->service.recv_cb = RT_NULL; + rtlink->service.send_cb = RT_NULL; + rtlink->service.timeout_tx = RT_WAITING_NO; + rtlink->service.user_data = (void *)dev; + + rt_slist_init(&rtlink->recv_head); + return RT_EOK; +} + +rt_err_t rt_link_dev_open(rt_device_t dev, rt_uint16_t oflag) +{ + RT_ASSERT(dev != RT_NULL); + struct rt_link_device *rtlink = (struct rt_link_device *)dev; + + rtlink->service.recv_cb = recv_cb; + rtlink->service.send_cb = send_cb; + + dev->open_flag = oflag & RT_DEVICE_OFLAG_MASK; + if (dev->open_flag == RT_DEVICE_OFLAG_RDONLY) + { + rtlink->service.send_cb = RT_NULL; + } + else if (dev->open_flag == RT_DEVICE_OFLAG_WRONLY) + { + rtlink->service.recv_cb = RT_NULL; + } + return rt_link_service_attach(&rtlink->service); +} + +rt_err_t rt_link_dev_close(rt_device_t dev) +{ + RT_ASSERT(dev != RT_NULL); + struct rt_link_device *rtlink = (struct rt_link_device *)dev; + return rt_link_service_detach(&rtlink->service); +} + +rt_size_t rt_link_dev_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size) +{ + RT_ASSERT(dev != RT_NULL); + RT_ASSERT(buffer != RT_NULL); + RT_ASSERT(size != 0); + + struct rt_link_device *rtlink = (struct rt_link_device *)dev; + struct rtlink_recv_list *node; + rt_size_t read_len = 0; + rt_size_t unread_len = 0; + + if (dev->rx_indicate == RT_NULL) + { + /* RT_LINK_RX_BLOCKING, wait service receive data event */ + rt_link_event_recv(&rtlink->service); + } + + if (rt_slist_first(&rtlink->recv_head) != RT_NULL) + { + node = rt_container_of(rt_slist_next(&rtlink->recv_head), struct rtlink_recv_list, list); + unread_len = (node->size) - (node->index); + read_len = (size > unread_len) ? unread_len : size; + rt_memcpy(buffer, (rt_uint8_t *)node->data + node->index, read_len); + node->index += read_len; + + if (node->index >= node->size) + { + rt_slist_remove(&rtlink->recv_head, &node->list); + node->index = 0; + rt_free(node->data); + rt_free(node); + } + if (rt_slist_first(&rtlink->recv_head) != RT_NULL) + { + rt_link_event_send(&rtlink->service); + } + } + return read_len; +} + +rt_size_t rt_link_dev_write(rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size) +{ + RT_ASSERT(dev != RT_NULL); + RT_ASSERT(buffer != RT_NULL); + RT_ASSERT(size != 0); + + return rt_link_send(&RTLINK_SERV(dev), buffer, size); +} + +rt_err_t rt_link_dev_control(rt_device_t dev, int cmd, void *args) +{ + RT_ASSERT(dev != RT_NULL); + + if (cmd & RT_DEVICE_CTRL_CONFIG) + { + if (args == RT_NULL) + return RT_EINVAL; + RTLINK_SERV(dev).service = ((struct rt_link_service *)args)->service; + RTLINK_SERV(dev).timeout_tx = ((struct rt_link_service *)args)->timeout_tx; + RTLINK_SERV(dev).flag = ((struct rt_link_service *)args)->flag; + } + + if (cmd & RT_LINK_RX_BLOCKING) + { + dev->rx_indicate = RT_NULL; + } + if (cmd & RT_LINK_TX_BLOCKING) + { + RTLINK_SERV(dev).timeout_tx = RT_WAITING_FOREVER; + dev->tx_complete = RT_NULL; + } + if (cmd & RT_LINK_TX_NONBLOCKING) + { + RTLINK_SERV(dev).timeout_tx = RT_WAITING_NO; + } + + return RT_EOK; +} + +#ifdef RT_USING_DEVICE_OPS +const static struct rt_device_ops rtlink_ops = +{ + rt_link_dev_init, + rt_link_dev_open, + rt_link_dev_close, + rt_link_dev_read, + rt_link_dev_write, + rt_link_dev_control +}; +#endif /* RT_USING_DEVICE_OPS */ + +/* + * rtlink device register + */ +rt_err_t rt_link_dev_register(struct rt_link_device *rtlink, + const char *name, + rt_uint32_t flag, + void *data) +{ + rt_err_t ret; + struct rt_device *device; + RT_ASSERT(rtlink != RT_NULL); + + device = (struct rt_device *)rtlink; + device->type = RT_Device_Class_Char; + device->rx_indicate = RT_NULL; + device->tx_complete = RT_NULL; + +#ifdef RT_USING_DEVICE_OPS + device->ops = &rtlink_ops; +#else + device->init = rt_link_dev_init; + device->open = rt_link_dev_open; + device->close = rt_link_dev_close; + device->read = rt_link_dev_read; + device->write = rt_link_dev_write; + device->control = rt_link_dev_control; +#endif + device->user_data = data; + + /* register a character device */ + ret = rt_device_register(device, name, flag); + +#if defined(RT_USING_POSIX) + /* set fops */ + device->fops = &_rtlink_fops; +#endif + + rt_event_init(&recv_event, "rtlink_dev", RT_IPC_FLAG_FIFO); + return ret; +} diff --git a/components/utilities/rt-link/src/rtlink_hw.c b/components/utilities/rt-link/src/rtlink_hw.c index 9c4567ab63..696ab5b78a 100644 --- a/components/utilities/rt-link/src/rtlink_hw.c +++ b/components/utilities/rt-link/src/rtlink_hw.c @@ -85,18 +85,39 @@ static rt_size_t rt_link_hw_buffer_write(void *data, rt_size_t count) /* increases buffer pointer by one and circle around if necessary */ void rt_link_hw_buffer_point_shift(rt_uint8_t **pointer_address, rt_size_t length) { - rt_uint8_t *pointer = RT_NULL; + rt_uint8_t *pointer = *pointer_address + length; - pointer = *pointer_address + length; - if (pointer >= rx_buffer->end_point) + if (rx_buffer->write_point >= rx_buffer->read_point) { - rt_size_t offset = 0; - offset = pointer - rx_buffer->end_point; - *pointer_address = rx_buffer->data + offset; + if (pointer >= rx_buffer->write_point) + { + *pointer_address = rx_buffer->write_point; + } + else + { + *pointer_address = pointer; + } } else { - *pointer_address = *pointer_address + length; + if (pointer >= rx_buffer->end_point) + { + *pointer_address = rx_buffer->data; + pointer = pointer - rx_buffer->end_point + rx_buffer->data; + + if (pointer >= rx_buffer->write_point) + { + *pointer_address = rx_buffer->write_point; + } + else + { + *pointer_address = pointer; + } + } + else + { + *pointer_address = pointer; + } } } @@ -119,9 +140,13 @@ void rt_link_hw_copy(rt_uint8_t *dst, rt_uint8_t *src, rt_size_t count) } } -/* Tells, how many chars are saved into the buffer */ +/* Length of data received */ rt_size_t rt_link_hw_recv_len(struct rt_link_receive_buffer *buffer) { + if (buffer == RT_NULL) + { + return 0; + } if (buffer->write_point >= buffer->read_point) { return (buffer->write_point - buffer->read_point); @@ -183,15 +208,18 @@ rt_uint32_t rt_link_get_crc(rt_uint8_t using_buffer_ring, rt_uint8_t *data, rt_s return crc32; } -rt_err_t rt_link_hw_send(void *data, rt_size_t length) +rt_size_t rt_link_hw_send(void *data, rt_size_t length) { rt_size_t send_len = 0; send_len = rt_link_port_send(data, length); - LOG_D("hw_send len= %d", send_len); + if (send_len <= 0) + { + rt_link_port_reconnect(); + send_len = rt_link_port_send(data, length); + } return send_len; } -/* provide this function to hardware spi/uart/usb to store data */ rt_size_t rt_link_hw_write_cb(void *data, rt_size_t length) { /* write real data into rtlink receive buffer */ @@ -220,11 +248,17 @@ rt_err_t rt_link_hw_init(void) scb->rx_buffer = rx_buffer; scb->calculate_crc = rt_link_get_crc; - rt_link_port_init(); + if (RT_EOK != rt_link_port_init()) + { + return -RT_ERROR; + } #ifdef LINK_LAYER_USING_HW_CRC /* crc hardware device for mcu and node */ - rt_link_hw_crc32_init(); + if (RT_EOK != rt_link_hw_crc32_init()) + { + return -RT_ERROR; + } #endif LOG_I("link layer hardware environment init successful."); @@ -244,11 +278,17 @@ rt_err_t rt_link_hw_deinit(void) scb->rx_buffer = rx_buffer; scb->calculate_crc = RT_NULL; } - rt_link_port_deinit(); + if (RT_EOK != rt_link_port_deinit()) + { + return -RT_ERROR; + } #ifdef LINK_LAYER_USING_HW_CRC /* crc hardware device for mcu and node */ - rt_link_hw_crc32_deinit(); + if (RT_EOK != rt_link_hw_crc32_deinit()) + { + return -RT_ERROR; + } #endif LOG_I("rtlink hardware deinit successful."); diff --git a/examples/rt-link/rtlink_dev_example.c b/examples/rt-link/rtlink_dev_example.c new file mode 100644 index 0000000000..0a026bcb3d --- /dev/null +++ b/examples/rt-link/rtlink_dev_example.c @@ -0,0 +1,395 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2021-06-19 Sherman the first version + */ + +#include +#include + +#define DBG_TAG "example" +#define DBG_LVL DBG_LOG +#include +#include + +enum +{ + NONE_TEST = 0, + SHORT_FRAME_TEST, + LONG_FRAME_TEST +}; +static rt_uint8_t speed_test_type = NONE_TEST; + +static struct rt_link_device rtlink_dev = {0}; +#define RTLINK01 "rtlink01" +#define TEST_CONTEXT "This message is sent by RT-Link" +rt_uint8_t test_buff[1024] = {0}; + +static rt_err_t rtlink_dev_rx_ind(rt_device_t dev, rt_size_t size) +{ + RT_ASSERT(dev != RT_NULL); + LOG_I("rx_ind: dev name %s, rx size %d", dev->parent.name, size); + return RT_EOK; +} + +static rt_err_t rtlink_dev_tx_done(rt_device_t dev, void *buffer) +{ + RT_ASSERT(dev != RT_NULL); + struct rt_link_device *rtlink_dev = (struct rt_link_device *)dev; + LOG_I("tx_done: dev name %s, buffer 0x%p errno %d", dev->parent.name, buffer, rtlink_dev->service.err); + rt_free(buffer); + return RT_EOK; +} + +#ifdef RT_USING_POSIX +#include +#include +#include + +#define RTLINK01_PATH "/dev/rtlink01" +int fd = -1; + +static void rtlink_fopen(int argc, char *argv[]) +{ + fd = open(RTLINK01_PATH, O_RDWR | O_NONBLOCK); + + if (fd < 0) + { + LOG_E("open rt_link failed!"); + } +} +MSH_CMD_EXPORT(rtlink_fopen, rtlink posix interface example); + +static void rtlink_fclose(int argc, char *argv[]) +{ + LOG_D("colse %d", fd); + close(fd); + fd = -1; +} +MSH_CMD_EXPORT(rtlink_fclose, rtlink posix interface example); + +static void rtlink_fread(int argc, char *argv[]) +{ + int read_len; + read_len = read(fd, test_buff, sizeof(test_buff)); + LOG_D("read len %d", read_len); + LOG_HEX("read", 8, test_buff, 32); +} +MSH_CMD_EXPORT(rtlink_fread, rtlink posix interface example); + +static void rtlink_fwrite(int argc, char *argv[]) +{ + char *data = RT_NULL; + rt_size_t length = 0; + rt_uint16_t count = 0; + rt_size_t ret = 0; + + if (argc == 1) + { + data = rt_malloc(sizeof(TEST_CONTEXT)); + if (data) + { + length = sizeof(TEST_CONTEXT) - 1; + rt_memcpy(data, TEST_CONTEXT, sizeof(TEST_CONTEXT) - 1); + ret = write(fd, data, length); + } + LOG_I("write data(0x%p) result: %d.", data, ret); + } + else if (argc >= 3) + { + if (strcmp(argv[1], "-l") == 0) + { + data = rt_malloc(atoi((const char *)argv[2])); + if (data) + { + for (count = 0; count < atoi((const char *)argv[2]); count++) + { + data[count] = (count % 93 + 33); + } + length = atoi((const char *)argv[2]); + ret = write(fd, data, length); + } + LOG_I("write data(0x%p) result: %d.", data, ret); + } + else + { + LOG_E("Invalid parameter."); + } + } +} +MSH_CMD_EXPORT(rtlink_fwrite, rtlink posix interface example); + +#define RTLINK02 "rtlink02" +#define RTLINK02_PATH "/dev/rtlink02" +static struct rt_link_device rtlink_fd = {0}; +rt_uint8_t fd_buff[1024] = {0}; + +static void listen_thread(void *param) +{ + int fd = open(RTLINK02_PATH, O_RDWR | O_NONBLOCK); + if (fd < 0) + { + LOG_E("open (%s) failed", RTLINK02); + return; + } + while (1) + { + rt_uint8_t *write_buf = RT_NULL; + int write_len = 0; + fd_set readfds, writefds; + FD_ZERO(&readfds); + FD_ZERO(&writefds); + FD_SET(fd, &readfds); + FD_SET(fd, &writefds); + + int ret = select(fd + 1, &readfds, &writefds, RT_NULL, RT_NULL); + LOG_D("select ret(%d), read (%d), write (%d)", ret, readfds, writefds); + if (FD_ISSET(fd, &readfds)) + { + LOG_I("POLLIN"); + int read_len = read(fd, fd_buff, sizeof(test_buff)); + LOG_D("read len %d", read_len); + LOG_HEX("read", 8, test_buff, 32); + } + + if (FD_ISSET(fd, &writefds)) + { + LOG_I("POLLOUT"); + write_buf = rt_malloc(1024); + if (write_buf) + { + write_len = write(fd, write_buf, 1024); + LOG_D("write %d", write_len); + } + } + + rt_thread_delay(500); + } + LOG_I("fd (%s) listen thread exit", RTLINK02); +} + +static void rtlink_fselect() +{ + /* step1: register rtlink to to the device framework */ + rt_link_dev_register(&rtlink_fd, RTLINK02, + RT_DEVICE_FLAG_RDWR | + RT_DEVICE_FLAG_REMOVABLE | + RT_DEVICE_FLAG_STANDALONE, + RT_NULL); + + /* step2: Initialize the rlink device as the default configuration, */ + rt_device_t device = rt_device_find(RTLINK02); + if (device == RT_NULL) + { + LOG_E("device not find!"); + return ; + } + rt_device_init(device); + + /* step3: config rtlink device rx/tx callback, channel, send timeout */ + rt_device_set_rx_indicate(device, rtlink_dev_rx_ind); + rt_device_set_tx_complete(device, rtlink_dev_tx_done); + struct rt_link_service service; + service.service = RT_LINK_SERVICE_MNGT; + service.timeout_tx = RT_WAITING_NO; + rt_device_control(device, RT_DEVICE_CTRL_CONFIG, &service); + + rt_thread_t tid = rt_thread_create(RTLINK02, listen_thread, RT_NULL, 1024, 21, 20); + if (tid) + { + rt_thread_startup(tid); + } +} +MSH_CMD_EXPORT(rtlink_fselect, rtlink posix interface example); +#endif /* RT_USING_POSIX */ + +static void rtlink_dread(void) +{ + rt_size_t read_len = 0; + rt_device_t dev = rt_device_find(RTLINK01); + if (dev == RT_NULL) + { + LOG_E("dev %s not find ", RTLINK01); + return; + } + + read_len = rt_device_read(dev, 0, test_buff, sizeof(test_buff)); + + LOG_D("read len %d", read_len); + LOG_HEX("read", 8, test_buff, 32); +} +MSH_CMD_EXPORT(rtlink_dread, rtlink device interface example); + +void rt_link_speed_test(void *paremeter) +{ + int ret; + rt_uint8_t *send_buf, *data; + rt_size_t bufflen = 0; + rt_size_t sentlen = 0; + rt_size_t count = 0; + rt_tick_t tick1, tick2; + rt_size_t total = 0; + rt_uint32_t integer, decimal; + rt_device_t dev = rt_device_find(RTLINK01); + if (dev == RT_NULL) + { + LOG_E("dev %s not find!", RTLINK01); + return ; + } + + if (speed_test_type == SHORT_FRAME_TEST) + { + bufflen = 988; + } + else + { + bufflen = 3036; + } + + send_buf = rt_malloc(bufflen); + if (send_buf != RT_NULL) + { + data = send_buf; + for (count = 0; count < bufflen; count++) + { + *data++ = (count % 93 + 33); + } + } + else + { + rt_kprintf("speed of send buffer malloc failed."); + return; + } + + tick1 = rt_tick_get(); + while (speed_test_type) + { + ret = rt_device_write(dev, 0, send_buf, bufflen); + + if (ret == RT_EOK) + { + sentlen += bufflen; + } + + tick2 = rt_tick_get(); + if (tick2 - tick1 >= RT_TICK_PER_SECOND) + { + total = sentlen * RT_TICK_PER_SECOND / 125 / (tick2 - tick1); + integer = total / 1000; + decimal = total % 1000; + LOG_I("%d.%03d0 Mbps!", integer, decimal); + sentlen = 0; + tick1 = tick2; + } + } + rt_free(send_buf); + LOG_W("speed test end, type %d", speed_test_type); +} + +void create_thead_to_test_speed(rt_uint8_t mutil_num) +{ + rt_uint8_t i = 0; + + LOG_D("Speed test type [%02d], mutil [%02d]", speed_test_type, mutil_num); + for (i = 0; i < mutil_num; i++) + { + rt_thread_t tid; + char tid_name[RT_NAME_MAX + 1] = {0}; + + rt_snprintf(tid_name, sizeof(tid_name), "lny_s%03d", i + 1); + tid = rt_thread_create(tid_name, rt_link_speed_test, RT_NULL, 1024, 20, 10); + rt_thread_startup(tid); + LOG_I("Speed test thread[%s] startup", tid_name); + } +} + +static void rtlink_dwrite(int argc, char *argv[]) +{ + char *data = RT_NULL; + rt_size_t length = 0; + rt_uint16_t count = 0; + rt_size_t ret = RT_ERROR; + + rt_device_t dev = rt_device_find(RTLINK01); + if (dev == RT_NULL) + { + LOG_E("device not find!"); + return ; + } + + if (argc == 1) + { + data = rt_malloc(sizeof(TEST_CONTEXT)); + length = sizeof(TEST_CONTEXT) - 1; + rt_memcpy(data, TEST_CONTEXT, sizeof(TEST_CONTEXT) - 1); + + ret = rt_device_write(dev, 0, data, length); + LOG_I("write data(0x%p) result: %d.", data, ret); + } + else if (argc >= 3) + { + if (strcmp(argv[1], "-l") == 0) + { + data = rt_malloc(atoi((const char *)argv[2])); + for (count = 0; count < atoi((const char *)argv[2]); count++) + { + data[count] = (count % 93 + 33); + } + length = atoi((const char *)argv[2]); + ret = rt_device_write(dev, 0, data, length); + LOG_I("write data(0x%p) result: %d.", data, ret); + } + else + { + LOG_E("Invalid parameter."); + } + } +} +MSH_CMD_EXPORT(rtlink_dwrite, rtlink device interface example); + +static void rtlink_dinit(void) +{ + /* step1: register rtlink to to the device framework */ + rt_link_dev_register(&rtlink_dev, RTLINK01, + RT_DEVICE_FLAG_RDWR | + RT_DEVICE_FLAG_REMOVABLE | + RT_DEVICE_FLAG_STANDALONE, + RT_NULL); + + /* step2: Initialize the rlink device as the default configuration, */ + rt_device_t device = rt_device_find(RTLINK01); + if (device == RT_NULL) + { + LOG_E("device not find!"); + return ; + } + rt_device_init(device); + + /* step3: config rtlink device rx/tx callback, channel, send timeout */ + rt_device_set_rx_indicate(device, rtlink_dev_rx_ind); + rt_device_set_tx_complete(device, rtlink_dev_tx_done); + struct rt_link_service service; + service.service = RT_LINK_SERVICE_SOCKET; + service.timeout_tx = RT_WAITING_FOREVER; + service.flag = RT_LINK_FLAG_ACK | RT_LINK_FLAG_CRC; + rt_device_control(device, RT_DEVICE_CTRL_CONFIG, &service); +} +MSH_CMD_EXPORT(rtlink_dinit, rtlink device interface example); + +static void rtlink_dopen() +{ + /* step4: open rtlink device, attach the service channel */ + rt_device_t device = rt_device_find(RTLINK01); + if (device == RT_NULL) + { + LOG_E("device not find!"); + return ; + } + rt_err_t ret = rt_device_open(device, RT_DEVICE_OFLAG_RDWR); + LOG_I("dev open ret %d", ret); +} +MSH_CMD_EXPORT(rtlink_dopen, rtlink device interface example); diff --git a/examples/rt-link/rtlink_example.c b/examples/rt-link/rtlink_example.c index 841e56b17e..4c9b9c54fb 100644 --- a/examples/rt-link/rtlink_example.c +++ b/examples/rt-link/rtlink_example.c @@ -1,4 +1,3 @@ - /* * Copyright (c) 2006-2021, RT-Thread Development Team * @@ -7,6 +6,7 @@ * Change Logs: * Date Author Notes * 2021-05-15 Sherman the first version + * 2021-08-04 Sherman Adapted to new version of rt-link API */ #include @@ -30,33 +30,25 @@ enum void rt_link_speed_test(void *paremeter); static rt_uint8_t speed_test_type = NONE_TEST; +static struct rt_link_service serv_socket; +static struct rt_link_service serv_wifi; -rt_err_t rt_link_receive_example_callback(void *data, rt_size_t length) +static void send_cb(struct rt_link_service *service, void *buffer) { - LOG_I("recv data %d",length); - LOG_HEX("example",8,data,length); - rt_free(data); - return RT_EOK; + LOG_I("send_cb: service (%d) buffer (0x%p) err(%d)", service->service, buffer, service->err); } -void create_thead_to_test_speed(rt_uint8_t mutil_num) +static void recv_cb(struct rt_link_service *service, void *data, rt_size_t size) { - rt_uint8_t i = 0; + LOG_I("service (%d) size (%d) data(0x%p)", service->service, size, data); - LOG_D("Speed test type [%02d], mutil [%02d]", speed_test_type, mutil_num); - for(i = 0; i< mutil_num; i++) + if (size) { - rt_thread_t tid; - char tid_name[RT_NAME_MAX + 1] = {0}; - - rt_snprintf(tid_name, sizeof(tid_name), "lny_s%03d", i + 1); - tid = rt_thread_create(tid_name, rt_link_speed_test, RT_NULL, 1024, 20, 10); - rt_thread_startup(tid); - LOG_I("Speed test thread[%s] startup", tid_name); + rt_free(data); } } -void rt_link_speed_test(void *paremeter) +static void rt_link_speed_test(void *paremeter) { int ret; rt_uint8_t *send_buf, *data; @@ -67,20 +59,20 @@ void rt_link_speed_test(void *paremeter) rt_size_t total = 0; rt_uint32_t integer, decimal; - if(speed_test_type == SHORT_FRAME_TEST) + if (speed_test_type == SHORT_FRAME_TEST) { - bufflen = 2044; + bufflen = RT_LINK_MAX_DATA_LENGTH; } else { - bufflen = 6132; + bufflen = RT_LINK_MAX_DATA_LENGTH * RT_LINK_FRAMES_MAX; } send_buf = rt_malloc(bufflen); - if(send_buf != RT_NULL) + if (send_buf != RT_NULL) { data = send_buf; - for(count = 0;count < bufflen; count++) + for (count = 0; count < bufflen; count++) { *data++ = (count % 93 + 33); } @@ -94,70 +86,94 @@ void rt_link_speed_test(void *paremeter) tick1 = rt_tick_get(); while (speed_test_type) { - ret = rt_link_send(RT_LINK_SERVICE_RTLINK, send_buf, bufflen); - if(ret > 0) + ret = rt_link_send(&serv_socket, send_buf, bufflen); + if (ret > 0) { sentlen += ret; } + else + { + log_w("send err %d", ret); + } tick2 = rt_tick_get(); - if (tick2 - tick1 >= RT_TICK_PER_SECOND)//* 10 + if (tick2 - tick1 >= RT_TICK_PER_SECOND) { total = sentlen * RT_TICK_PER_SECOND / 125 / (tick2 - tick1); - integer = total/1000; - decimal = total%1000; + integer = total / 1000; + decimal = total % 1000; LOG_I("%d.%03d0 Mbps!", integer, decimal); sentlen = 0; tick1 = tick2; } } rt_free(send_buf); - LOG_W("speed test end, type %d",speed_test_type); + LOG_W("speed test end, type %d", speed_test_type); } -int rt_link_example_send(int argc, char **argv) +static void create_thead_to_test_speed(rt_uint8_t mutil_num) +{ + rt_uint8_t i = 0; + + LOG_D("Speed test type [%02d], mutil [%02d]", speed_test_type, mutil_num); + for (i = 0; i < mutil_num; i++) + { + rt_thread_t tid; + char tid_name[RT_NAME_MAX + 1] = {0}; + + rt_snprintf(tid_name, sizeof(tid_name), "lny_s%03d", i + 1); + tid = rt_thread_create(tid_name, rt_link_speed_test, RT_NULL, 1024, 20, 10); + if (tid) + { + rt_thread_startup(tid); + LOG_I("Speed test thread[%s] startup", tid_name); + } + } +} + +static int rtlink_exsend(int argc, char **argv) { char *receive = RT_NULL; rt_size_t length = 0; rt_uint16_t count = 0; - if(argc == 1) + if (argc == 1) { receive = rt_malloc(sizeof(TEST_CONTEXT)); rt_memcpy(receive, TEST_CONTEXT, sizeof(TEST_CONTEXT) - 1); - length = rt_link_send(RT_LINK_SERVICE_RTLINK, receive, sizeof(TEST_CONTEXT) - 1); + length = rt_link_send(&serv_socket, receive, sizeof(TEST_CONTEXT) - 1); LOG_I("send data length: %d.", length); rt_free(receive); } - else if(argc >= 3) + else if (argc >= 3) { - if(strcmp(argv[1], "-l") == 0) + if (strcmp(argv[1], "-l") == 0) { receive = rt_malloc(atoi((const char *)argv[2])); - for(count = 0;count < atoi((const char *)argv[2]); count++) + for (count = 0; count < atoi((const char *)argv[2]); count++) { *receive++ = (count % 93 + 33); } - length = rt_link_send(RT_LINK_SERVICE_RTLINK, receive - atoi((const char *)argv[2]), atoi((const char *)argv[2])); + length = rt_link_send(&serv_socket, receive - atoi((const char *)argv[2]), atoi((const char *)argv[2])); rt_free(receive - atoi((const char *)argv[2])); LOG_I("send data length: %d.", length); } - else if(strcmp(argv[1], "-s") == 0) + else if (strcmp(argv[1], "-s") == 0) { - if(speed_test_type == NONE_TEST) + if (speed_test_type == NONE_TEST) { rt_uint8_t mutil_num = 1; - if(argc > 3) + if (argc > 3) { mutil_num = atoi((const char *)argv[3]); } - if(strncmp(argv[2], "-s", rt_strlen(argv[2])) == 0) + if (strncmp(argv[2], "-s", rt_strlen(argv[2])) == 0) { speed_test_type = SHORT_FRAME_TEST; } - else if(strncmp(argv[2], "-l", rt_strlen(argv[2])) == 0) + else if (strncmp(argv[2], "-l", rt_strlen(argv[2])) == 0) { speed_test_type = LONG_FRAME_TEST; } @@ -176,12 +192,23 @@ int rt_link_example_send(int argc, char **argv) } return 0; } -MSH_CMD_EXPORT(rt_link_example_send, rt link layer send test); +MSH_CMD_EXPORT(rtlink_exsend, rt link layer send test); -int rt_link_example_init(void) +int rtlink_exinit(void) { + serv_socket.service = RT_LINK_SERVICE_SOCKET; + serv_socket.timeout_tx = RT_WAITING_FOREVER; + serv_socket.flag = RT_LINK_FLAG_ACK | RT_LINK_FLAG_CRC; + serv_socket.recv_cb = recv_cb; + serv_socket.send_cb = send_cb; + rt_link_service_attach(&serv_socket); - rt_link_service_attach(RT_LINK_SERVICE_RTLINK, rt_link_receive_example_callback); + serv_wifi.service = RT_LINK_SERVICE_WIFI; + serv_wifi.timeout_tx = RT_WAITING_FOREVER; + serv_wifi.flag = RT_NULL; + serv_wifi.recv_cb = recv_cb; + serv_wifi.send_cb = send_cb; + rt_link_service_attach(&serv_wifi); return RT_EOK; } -MSH_CMD_EXPORT(rt_link_example_init, rt link layer example init); +MSH_CMD_EXPORT(rtlink_exinit, rt link example init); diff --git a/include/rtdef.h b/include/rtdef.h index 62d0a53685..dac345f26d 100644 --- a/include/rtdef.h +++ b/include/rtdef.h @@ -908,6 +908,7 @@ enum rt_device_class_type RT_Device_Class_I2CBUS, /**< I2C bus device */ RT_Device_Class_USBDevice, /**< USB slave device */ RT_Device_Class_USBHost, /**< USB host bus */ + RT_Device_Class_USBOTG, /**< USB OTG bus */ RT_Device_Class_SPIBUS, /**< SPI bus device */ RT_Device_Class_SPIDevice, /**< SPI device */ RT_Device_Class_SDIO, /**< SDIO bus device */