diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index 4f9491a2a5..09d39f2b62 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -69,8 +69,10 @@ jobs: - "hc32l196" #- "tae32f5300" - "mm32/mm32f3270-100ask-pitaya" - - "sam7x" + - "sam7x" - "hk32/hk32f030c8-mini" + - "acm32/acm32f0x0-nucleo" + - "acm32/acm32f4xx-nucleo" - RTT_BSP: "stm32l4_f0_f1" RTT_TOOL_CHAIN: "sourcery-arm" SUB_RTT_BSP: @@ -187,7 +189,9 @@ jobs: #- "lpc43xx/M4" - "renesas/ra6m3-ek" - "renesas/ra6m4-cpk" - - "renesas/ra6m3-hmi-board" + - "renesas/ra6m3-hmi-board" + - "renesas/ra4m2-eco" + - "renesas/ra2l1-cpk" - RTT_BSP: "gd32_n32_apm32" RTT_TOOL_CHAIN: "sourcery-arm" SUB_RTT_BSP: diff --git a/bsp/acm32/acm32f4xx-nucleo/libraries/Device/libSystem_Accelerate.a b/bsp/acm32/acm32f4xx-nucleo/libraries/Device/libSystem_Accelerate.a new file mode 100644 index 0000000000..285624ad35 Binary files /dev/null and b/bsp/acm32/acm32f4xx-nucleo/libraries/Device/libSystem_Accelerate.a differ diff --git a/bsp/acm32/acm32f4xx-nucleo/libraries/HAL_Driver/Src/libHAL_EFlash_EX.a b/bsp/acm32/acm32f4xx-nucleo/libraries/HAL_Driver/Src/libHAL_EFlash_EX.a new file mode 100644 index 0000000000..06a361cabe Binary files /dev/null and b/bsp/acm32/acm32f4xx-nucleo/libraries/HAL_Driver/Src/libHAL_EFlash_EX.a differ diff --git a/bsp/acm32/acm32f4xx-nucleo/libraries/SConscript b/bsp/acm32/acm32f4xx-nucleo/libraries/SConscript index 88a351515d..812c529fde 100644 --- a/bsp/acm32/acm32f4xx-nucleo/libraries/SConscript +++ b/bsp/acm32/acm32f4xx-nucleo/libraries/SConscript @@ -19,7 +19,7 @@ libpath = ['.', cwd + '/Device', cwd + '/HAL_Driver/Src'] libs = ['System_Accelerate', 'HAL_EFlash_EX'] if rtconfig.PLATFORM in ['gcc']: - src += ['Device/Startup_ACM32F4_gcc.s'] + src += ['Device/startup_ACM32F4_gcc.s'] elif rtconfig.PLATFORM in ['armcc', 'armclang']: src += ['Device/Startup_ACM32F4.s'] elif rtconfig.PLATFORM in ['iccarm']: diff --git a/bsp/mm32f103x/drivers/board.h b/bsp/mm32f103x/drivers/board.h index 60c0f4ff66..af1bb6fd37 100644 --- a/bsp/mm32f103x/drivers/board.h +++ b/bsp/mm32f103x/drivers/board.h @@ -11,7 +11,7 @@ #ifndef BOARD_H__ #define BOARD_H__ #include -#include +#include #define SRAM_SIZE 0x5000 diff --git a/bsp/mm32f327x/Libraries/SConscript b/bsp/mm32f327x/Libraries/SConscript index 34781346d8..d09c142467 100644 --- a/bsp/mm32f327x/Libraries/SConscript +++ b/bsp/mm32f327x/Libraries/SConscript @@ -2,7 +2,7 @@ from building import * import rtconfig cwd = GetCurrentDir() src = ['MM32F327x/Source/system_mm32f327x.c'] -CPPPATH = [cwd + '/CMSIS/KEIL_CORE', cwd + '/MM32F327x/Include', cwd + '/MM32F327x/Source', cwd + '/MM32F327x/HAL_lib/Inc'] +CPPPATH = [cwd + '/CMSIS/KEIL_CORE', cwd + '/MM32F327x/Include', cwd + '/MM32F327x/Source', cwd + '/MM32F327x/HAL_Lib/Inc'] src += Glob('MM32F327x/HAL_lib/src/*.c') CPPDEFINES = ['USE_STDPERIPH_DRIVER'] diff --git a/bsp/mm32f327x/applications/main.c b/bsp/mm32f327x/applications/main.c index 8f91379865..09c50c4038 100644 --- a/bsp/mm32f327x/applications/main.c +++ b/bsp/mm32f327x/applications/main.c @@ -10,7 +10,7 @@ #include #include -#include "HAL_device.h" +#include "hal_device.h" /* defined the LED pin: PA15 */ #define LED_PIN 38 int main(void) diff --git a/bsp/mm32f327x/drivers/drv_uart.c b/bsp/mm32f327x/drivers/drv_uart.c index 7445ce798b..44c4a17619 100644 --- a/bsp/mm32f327x/drivers/drv_uart.c +++ b/bsp/mm32f327x/drivers/drv_uart.c @@ -7,7 +7,7 @@ * Date Author Notes * 2021-08-05 mazhiyuan first version */ -#include +#include #include #include "drv_uart.h" #include diff --git a/bsp/mm32l07x/drivers/board.h b/bsp/mm32l07x/drivers/board.h index fc2da93b0e..6f076216bf 100644 --- a/bsp/mm32l07x/drivers/board.h +++ b/bsp/mm32l07x/drivers/board.h @@ -11,7 +11,7 @@ #ifndef BOARD_H__ #define BOARD_H__ #include -#include +#include #define SRAM_SIZE 0x2000 diff --git a/bsp/mm32l07x/rtconfig.py b/bsp/mm32l07x/rtconfig.py index 2194a68adf..b308dd9a30 100644 --- a/bsp/mm32l07x/rtconfig.py +++ b/bsp/mm32l07x/rtconfig.py @@ -42,7 +42,7 @@ if PLATFORM == 'gcc': OBJDUMP = PREFIX + 'objdump' OBJCPY = PREFIX + 'objcopy' - DEVICE = ' -mcpu=' + CPU + '-mthumb -ffunction-sections -fdata-sections -Wall' + DEVICE = ' -mcpu=' + CPU + ' -mthumb -ffunction-sections -fdata-sections -Wall' CFLAGS = DEVICE + ' -std=c99' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb ' LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,Reset_Handler -T drivers/linker_scripts/link.lds' diff --git a/bsp/mm32l3xx/drivers/board.h b/bsp/mm32l3xx/drivers/board.h index 60c0f4ff66..af1bb6fd37 100644 --- a/bsp/mm32l3xx/drivers/board.h +++ b/bsp/mm32l3xx/drivers/board.h @@ -11,7 +11,7 @@ #ifndef BOARD_H__ #define BOARD_H__ #include -#include +#include #define SRAM_SIZE 0x5000 diff --git a/bsp/qemu-virt64-aarch64/.config b/bsp/qemu-virt64-aarch64/.config index 86d73fe1c0..c6de1d3c7a 100644 --- a/bsp/qemu-virt64-aarch64/.config +++ b/bsp/qemu-virt64-aarch64/.config @@ -9,6 +9,7 @@ CONFIG_RT_NAME_MAX=16 # CONFIG_RT_USING_ARCH_DATA_TYPE is not set # CONFIG_RT_USING_SMART is not set +# CONFIG_RT_USING_AMP is not set CONFIG_RT_USING_SMP=y CONFIG_RT_CPUS_NR=4 CONFIG_RT_ALIGN_SIZE=8 @@ -47,6 +48,7 @@ CONFIG_RT_DEBUG_COLOR=y # 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_PAGE_LEAK is not set # CONFIG_RT_DEBUG_MODULE_CONFIG is not set # @@ -57,6 +59,7 @@ CONFIG_RT_USING_MUTEX=y CONFIG_RT_USING_EVENT=y CONFIG_RT_USING_MAILBOX=y CONFIG_RT_USING_MESSAGEQUEUE=y +# CONFIG_RT_USING_MESSAGEQUEUE_PRIORITY is not set # CONFIG_RT_USING_SIGNALS is not set # @@ -89,11 +92,11 @@ CONFIG_RT_USING_INTERRUPT_INFO=y CONFIG_RT_USING_CONSOLE=y CONFIG_RT_CONSOLEBUF_SIZE=256 CONFIG_RT_CONSOLE_DEVICE_NAME="uart0" -CONFIG_RT_VER_NUM=0x50000 -# CONFIG_RT_USING_STDC_ATOMIC is not set +CONFIG_RT_VER_NUM=0x50001 +CONFIG_RT_USING_STDC_ATOMIC=y CONFIG_ARCH_CPU_64BIT=y CONFIG_RT_USING_CACHE=y -CONFIG_RT_USING_HW_ATOMIC=y +# CONFIG_RT_USING_HW_ATOMIC is not set # CONFIG_ARCH_ARM_BOOTWITH_FLUSH_CACHE is not set # CONFIG_ARCH_CPU_STACK_GROWS_UPWARD is not set # CONFIG_RT_USING_CPU_FFS is not set @@ -125,13 +128,19 @@ CONFIG_FINSH_USING_DESCRIPTION=y # CONFIG_FINSH_ECHO_DISABLE_DEFAULT is not set # CONFIG_FINSH_USING_AUTH is not set CONFIG_FINSH_ARG_MAX=10 + +# +# DFS: device virtual file system +# CONFIG_RT_USING_DFS=y CONFIG_DFS_USING_POSIX=y CONFIG_DFS_USING_WORKDIR=y +# CONFIG_RT_USING_DFS_MNTTABLE is not set +CONFIG_DFS_FD_MAX=32 +CONFIG_RT_USING_DFS_V1=y +# CONFIG_RT_USING_DFS_V2 is not set CONFIG_DFS_FILESYSTEMS_MAX=4 CONFIG_DFS_FILESYSTEM_TYPES_MAX=8 -CONFIG_DFS_FD_MAX=32 -# CONFIG_RT_USING_DFS_MNTTABLE is not set CONFIG_RT_USING_DFS_ELMFAT=y # @@ -278,6 +287,7 @@ CONFIG_RT_USING_POSIX_PIPE_SIZE=512 # CONFIG_RT_USING_VAR_EXPORT is not set CONFIG_RT_USING_ADT=y CONFIG_RT_USING_ADT_AVL=y +CONFIG_RT_USING_RESOURCE_ID=y # CONFIG_RT_USING_RT_LINK is not set # CONFIG_RT_USING_VBUS is not set @@ -372,8 +382,6 @@ CONFIG_RT_USING_ADT_AVL=y # CONFIG_PKG_USING_AGILE_FTP is not set # CONFIG_PKG_USING_EMBEDDEDPROTO is not set # CONFIG_PKG_USING_RT_LINK_HW is not set -# CONFIG_PKG_USING_RYANMQTT is not set -# CONFIG_PKG_USING_RYANW5500 is not set # CONFIG_PKG_USING_LORA_PKT_FWD is not set # CONFIG_PKG_USING_LORA_GW_DRIVER_LIB is not set # CONFIG_PKG_USING_LORA_PKT_SNIFFER is not set @@ -381,8 +389,6 @@ CONFIG_RT_USING_ADT_AVL=y # CONFIG_PKG_USING_SMALL_MODBUS is not set # CONFIG_PKG_USING_NET_SERVER is not set # CONFIG_PKG_USING_ZFTP is not set -# CONFIG_PKG_USING_WOL is not set -# CONFIG_PKG_USING_ZEPHYR_POLLING is not set # # security packages @@ -451,12 +457,17 @@ CONFIG_RT_USING_ADT_AVL=y # CONFIG_PKG_USING_MP3PLAYER is not set # CONFIG_PKG_USING_TINYJPEG is not set # CONFIG_PKG_USING_UGUI is not set + +# +# PainterEngine: A cross-platform graphics application framework written in C language +# +# CONFIG_PKG_USING_PAINTERENGINE is not set +# CONFIG_PKG_USING_PAINTERENGINE_AUX is not set # CONFIG_PKG_USING_MCURSES is not set # CONFIG_PKG_USING_TERMBOX is not set # CONFIG_PKG_USING_VT100 is not set # CONFIG_PKG_USING_QRCODE is not set # CONFIG_PKG_USING_GUIENGINE is not set -# CONFIG_PKG_USING_3GPP_AMRNB is not set # # tools packages @@ -466,9 +477,9 @@ CONFIG_RT_USING_ADT_AVL=y # 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_RTT_AUTO_EXE_CMD is not set # CONFIG_PKG_USING_RDB 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 @@ -502,6 +513,7 @@ CONFIG_RT_USING_ADT_AVL=y # CONFIG_PKG_USING_CBOX is not set # CONFIG_PKG_USING_SNOWFLAKE is not set # CONFIG_PKG_USING_HASH_MATCH is not set +# CONFIG_PKG_USING_FIRE_PID_CURVE is not set # CONFIG_PKG_USING_ARMV7M_DWT_TOOL is not set # CONFIG_PKG_USING_VOFA_PLUS is not set @@ -574,94 +586,19 @@ CONFIG_RT_USING_ADT_AVL=y # CONFIG_PKG_USING_TFDB is not set # CONFIG_PKG_USING_QPC is not set # CONFIG_PKG_USING_AGILE_UPGRADE is not set -# CONFIG_PKG_USING_FLASH_BLOB is not set # # peripheral libraries and drivers # - -# -# sensors drivers -# -# CONFIG_PKG_USING_LSM6DSM is not set -# CONFIG_PKG_USING_LSM6DSL is not set -# CONFIG_PKG_USING_LPS22HB is not set -# CONFIG_PKG_USING_HTS221 is not set -# CONFIG_PKG_USING_LSM303AGR is not set -# CONFIG_PKG_USING_BME280 is not set -# CONFIG_PKG_USING_BME680 is not set -# CONFIG_PKG_USING_BMA400 is not set -# CONFIG_PKG_USING_BMI160_BMX160 is not set -# CONFIG_PKG_USING_SPL0601 is not set -# CONFIG_PKG_USING_MS5805 is not set -# CONFIG_PKG_USING_DA270 is not set -# CONFIG_PKG_USING_DF220 is not set -# CONFIG_PKG_USING_HSHCAL001 is not set -# CONFIG_PKG_USING_BH1750 is not set -# CONFIG_PKG_USING_MPU6XXX is not set -# CONFIG_PKG_USING_AHT10 is not set -# CONFIG_PKG_USING_AP3216C is not set -# CONFIG_PKG_USING_TSL4531 is not set -# CONFIG_PKG_USING_DS18B20 is not set -# CONFIG_PKG_USING_DHT11 is not set -# CONFIG_PKG_USING_DHTXX is not set -# CONFIG_PKG_USING_GY271 is not set -# CONFIG_PKG_USING_GP2Y10 is not set -# CONFIG_PKG_USING_SGP30 is not set -# CONFIG_PKG_USING_HDC1000 is not set -# CONFIG_PKG_USING_BMP180 is not set -# CONFIG_PKG_USING_BMP280 is not set -# CONFIG_PKG_USING_SHTC1 is not set -# CONFIG_PKG_USING_BMI088 is not set -# CONFIG_PKG_USING_HMC5883 is not set -# CONFIG_PKG_USING_MAX6675 is not set -# CONFIG_PKG_USING_TMP1075 is not set -# CONFIG_PKG_USING_SR04 is not set -# CONFIG_PKG_USING_CCS811 is not set -# CONFIG_PKG_USING_PMSXX is not set -# CONFIG_PKG_USING_RT3020 is not set -# CONFIG_PKG_USING_MLX90632 is not set -# CONFIG_PKG_USING_MLX90393 is not set -# CONFIG_PKG_USING_MLX90392 is not set -# CONFIG_PKG_USING_MLX90397 is not set -# CONFIG_PKG_USING_MS5611 is not set -# CONFIG_PKG_USING_MAX31865 is not set -# CONFIG_PKG_USING_VL53L0X is not set -# CONFIG_PKG_USING_INA260 is not set -# CONFIG_PKG_USING_MAX30102 is not set -# CONFIG_PKG_USING_INA226 is not set -# CONFIG_PKG_USING_LIS2DH12 is not set -# CONFIG_PKG_USING_HS300X is not set -# CONFIG_PKG_USING_ZMOD4410 is not set -# CONFIG_PKG_USING_ISL29035 is not set -# CONFIG_PKG_USING_MMC3680KJ is not set -# CONFIG_PKG_USING_QMP6989 is not set -# CONFIG_PKG_USING_BALANCE is not set +# 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_AD7746 is not set # CONFIG_PKG_USING_ADT74XX is not set -# CONFIG_PKG_USING_MAX17048 is not set # CONFIG_PKG_USING_AS7341 is not set -# CONFIG_PKG_USING_CW2015 is not set -# CONFIG_PKG_USING_ICM20608 is not set -# CONFIG_PKG_USING_PAJ7620 is not set -# CONFIG_PKG_USING_STHS34PF80 is not set - -# -# touch drivers -# -# CONFIG_PKG_USING_GT9147 is not set -# CONFIG_PKG_USING_GT1151 is not set -# CONFIG_PKG_USING_GT917S is not set -# CONFIG_PKG_USING_GT911 is not set -# CONFIG_PKG_USING_FT6206 is not set -# CONFIG_PKG_USING_FT5426 is not set -# CONFIG_PKG_USING_FT6236 is not set -# CONFIG_PKG_USING_XPT2046_TOUCH is not set -# CONFIG_PKG_USING_REALTEK_AMEBA is not set # CONFIG_PKG_USING_STM32_SDIO is not set # CONFIG_PKG_USING_ESP_IDF is not set +# CONFIG_PKG_USING_ICM20608 is not set # CONFIG_PKG_USING_BUTTON is not set # CONFIG_PKG_USING_PCF8574 is not set # CONFIG_PKG_USING_SX12XX is not set @@ -684,10 +621,12 @@ CONFIG_RT_USING_ADT_AVL=y # 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_ILI9341 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 @@ -702,6 +641,7 @@ CONFIG_RT_USING_ADT_AVL=y # 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 @@ -732,11 +672,10 @@ CONFIG_RT_USING_ADT_AVL=y # CONFIG_PKG_USING_BL_MCU_SDK is not set # CONFIG_PKG_USING_SOFT_SERIAL is not set # CONFIG_PKG_USING_MB85RS16 is not set +# CONFIG_PKG_USING_CW2015 is not set # CONFIG_PKG_USING_RFM300 is not set # CONFIG_PKG_USING_IO_INPUT_FILTER is not set # CONFIG_PKG_USING_RASPBERRYPI_PICO_SDK is not set -# CONFIG_PKG_USING_LRF_NV7LIDAR is not set -# CONFIG_PKG_USING_FINGERPRINT is not set # # AI packages @@ -751,12 +690,6 @@ CONFIG_RT_USING_ADT_AVL=y # CONFIG_PKG_USING_QUEST is not set # CONFIG_PKG_USING_NAXOS is not set -# -# Signal Processing and Control Algorithm Packages -# -# CONFIG_PKG_USING_FIRE_PID_CURVE is not set -# CONFIG_PKG_USING_UKAL is not set - # # miscellaneous packages # @@ -786,7 +719,6 @@ CONFIG_RT_USING_ADT_AVL=y # CONFIG_PKG_USING_TETRIS is not set # CONFIG_PKG_USING_DONUT is not set # CONFIG_PKG_USING_COWSAY is not set -# CONFIG_PKG_USING_MORSE is not set # CONFIG_PKG_USING_LIBCSV is not set # CONFIG_PKG_USING_OPTPARSE is not set # CONFIG_PKG_USING_FASTLZ is not set @@ -809,6 +741,7 @@ CONFIG_RT_USING_ADT_AVL=y # 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_UKAL is not set # CONFIG_PKG_USING_CRCLIB is not set # CONFIG_PKG_USING_LWGPS is not set # CONFIG_PKG_USING_STATE_MACHINE is not set @@ -819,7 +752,6 @@ CONFIG_RT_USING_ADT_AVL=y # CONFIG_PKG_USING_SLCAN2RTT is not set # CONFIG_PKG_USING_SOEM is not set # CONFIG_PKG_USING_QPARAM is not set -# CONFIG_PKG_USING_CorevMCU_CLI is not set # # Arduino libraries @@ -836,17 +768,16 @@ CONFIG_RT_USING_ADT_AVL=y # # Sensors # -# CONFIG_PKG_USING_ARDUINO_SENSOR_DEVICE_DRIVERS is not set -# CONFIG_PKG_USING_ARDUINO_CAPACITIVESENSOR is not set +# CONFIG_PKG_USING_ARDUINO_SEEED_BMP280 is not set # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_ADXL375 is not set # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_VL53L0X is not set -# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_VL53L1X is not set +# CONFIG_PKG_USING_ARDUINO_SEEED_LIS3DHTR is not set +# CONFIG_PKG_USING_ARDUINO_SEEED_DHT is not set +# CONFIG_PKG_USING_ARDUINO_CAPACITIVESENSOR is not set # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_SENSOR is not set -# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_VL6180X is not set # CONFIG_PKG_USING_ADAFRUIT_MAX31855 is not set # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_MAX31865 is not set # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_MAX31856 is not set -# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_MAX6675 is not set # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_MLX90614 is not set # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_LSM9DS1 is not set # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_AHTX0 is not set @@ -927,7 +858,6 @@ CONFIG_RT_USING_ADT_AVL=y # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_HTU21DF is not set # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_AS7341 is not set # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_HTU31D is not set -# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_SENSORLAB is not set # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_INA260 is not set # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_TMP007_LIBRARY is not set # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_L3GD20 is not set @@ -939,45 +869,11 @@ CONFIG_RT_USING_ADT_AVL=y # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_VEML6070 is not set # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_VEML6075 is not set # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_VEML7700 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_LIS3DHTR is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_DHT is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_ADXL335 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_ADXL345 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_BME280 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_BMP280 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_H3LIS331DL is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_MMA7660 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_TSL2561 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_PAJ7620 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_VL53L0X is not set -# CONFIG_PKG_USING_SEEED_ITG3200 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_SHT31 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_HP20X is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_DRV2605L is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_BBM150 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_HMC5883L is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_LSM303DLH is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_TCS3414CS is not set -# CONFIG_PKG_USING_SEEED_MP503 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_BMP085 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_HIGHTEMP is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_VEML6070 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_SI1145 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_SHT35 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_AT42QT1070 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_LSM6DS3 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_HDC1000 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_HM3301 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_MCP9600 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_LTC2941 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_LDC1612 is not set # # Display # # CONFIG_PKG_USING_ARDUINO_U8G2 is not set -# CONFIG_PKG_USING_ARDUINO_U8GLIB_ARDUINO is not set -# CONFIG_PKG_USING_SEEED_TM1637 is not set # # Timing @@ -1005,18 +901,10 @@ CONFIG_RT_USING_ADT_AVL=y # # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_PCF8574 is not set # CONFIG_PKG_USING_ARDUINO_ADAFRUIT_PCA9685 is not set -# CONFIG_PKG_USING_ARDUINO_SEEED_PCF85063TP is not set -# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_TPA2016 is not set -# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_DRV2605 is not set -# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_DS1841 is not set -# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_DS3502 is not set # # Other # -# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_MFRC630 is not set -# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_SI5351 is not set -# CONFIG_PKG_USING_ARDUINO_RTCLIB is not set # # Signal IO diff --git a/bsp/qemu-virt64-aarch64/rtconfig.h b/bsp/qemu-virt64-aarch64/rtconfig.h index 3bdf25b998..32757a23cc 100644 --- a/bsp/qemu-virt64-aarch64/rtconfig.h +++ b/bsp/qemu-virt64-aarch64/rtconfig.h @@ -59,10 +59,10 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 256 #define RT_CONSOLE_DEVICE_NAME "uart0" -#define RT_VER_NUM 0x50000 +#define RT_VER_NUM 0x50001 +#define RT_USING_STDC_ATOMIC #define ARCH_CPU_64BIT #define RT_USING_CACHE -#define RT_USING_HW_ATOMIC #define ARCH_MM_MMU #define ARCH_ARM #define ARCH_ARM_MMU @@ -87,12 +87,16 @@ #define MSH_USING_BUILT_IN_COMMANDS #define FINSH_USING_DESCRIPTION #define FINSH_ARG_MAX 10 + +/* DFS: device virtual file system */ + #define RT_USING_DFS #define DFS_USING_POSIX #define DFS_USING_WORKDIR +#define DFS_FD_MAX 32 +#define RT_USING_DFS_V1 #define DFS_FILESYSTEMS_MAX 4 #define DFS_FILESYSTEM_TYPES_MAX 8 -#define DFS_FD_MAX 32 #define RT_USING_DFS_ELMFAT /* elm-chan's FatFs, Generic FAT Filesystem Module */ @@ -172,6 +176,7 @@ #define RT_USING_ADT #define RT_USING_ADT_AVL +#define RT_USING_RESOURCE_ID /* RT-Thread Utestcases */ @@ -211,6 +216,9 @@ /* u8g2: a monochrome graphic library */ +/* PainterEngine: A cross-platform graphics application framework written in C language */ + + /* tools packages */ @@ -230,11 +238,6 @@ /* peripheral libraries and drivers */ -/* sensors drivers */ - - -/* touch drivers */ - /* Kendryte SDK */ @@ -242,9 +245,6 @@ /* AI packages */ -/* Signal Processing and Control Algorithm Packages */ - - /* miscellaneous packages */ /* project laboratory */ @@ -283,7 +283,6 @@ /* Other */ - /* Signal IO */ diff --git a/bsp/renesas/ra2l1-cpk/.config b/bsp/renesas/ra2l1-cpk/.config index 922e4c0824..58814a1f3b 100644 --- a/bsp/renesas/ra2l1-cpk/.config +++ b/bsp/renesas/ra2l1-cpk/.config @@ -8,6 +8,7 @@ # CONFIG_RT_NAME_MAX=8 # CONFIG_RT_USING_ARCH_DATA_TYPE is not set +# CONFIG_RT_USING_AMP is not set # CONFIG_RT_USING_SMP is not set CONFIG_RT_ALIGN_SIZE=8 # CONFIG_RT_THREAD_PRIORITY_8 is not set @@ -35,16 +36,16 @@ CONFIG_RT_KSERVICE_USING_STDLIB=y # CONFIG_RT_KPRINTF_USING_LONGLONG is not set CONFIG_RT_DEBUG=y # CONFIG_RT_DEBUG_COLOR is not set -# 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 +# CONFIG_RT_DEBUG_INIT is not set +# CONFIG_RT_DEBUG_THREAD is not set +# CONFIG_RT_DEBUG_SCHEDULER is not set +# CONFIG_RT_DEBUG_IPC is not set +# CONFIG_RT_DEBUG_TIMER is not set +# CONFIG_RT_DEBUG_IRQ is not set +# CONFIG_RT_DEBUG_MEM is not set +# CONFIG_RT_DEBUG_SLAB is not set +# CONFIG_RT_DEBUG_MEMHEAP is not set +# CONFIG_RT_DEBUG_MODULE is not set # # Inter-Thread communication @@ -54,12 +55,12 @@ CONFIG_RT_USING_MUTEX=y CONFIG_RT_USING_EVENT=y CONFIG_RT_USING_MAILBOX=y CONFIG_RT_USING_MESSAGEQUEUE=y +# CONFIG_RT_USING_MESSAGEQUEUE_PRIORITY is not set # CONFIG_RT_USING_SIGNALS is not set # # Memory Management # -CONFIG_RT_PAGE_MAX_ORDER=11 CONFIG_RT_USING_MEMPOOL=y CONFIG_RT_USING_SMALL_MEM=y # CONFIG_RT_USING_SLAB is not set @@ -82,8 +83,8 @@ CONFIG_RT_USING_DEVICE=y # CONFIG_RT_USING_INTERRUPT_INFO is not set CONFIG_RT_USING_CONSOLE=y CONFIG_RT_CONSOLEBUF_SIZE=128 -CONFIG_RT_CONSOLE_DEVICE_NAME="uart" -CONFIG_RT_VER_NUM=0x50000 +CONFIG_RT_CONSOLE_DEVICE_NAME="uart9" +CONFIG_RT_VER_NUM=0x50001 # CONFIG_RT_USING_STDC_ATOMIC is not set # CONFIG_RT_USING_CACHE is not set # CONFIG_RT_USING_HW_ATOMIC is not set @@ -114,13 +115,19 @@ CONFIG_FINSH_USING_DESCRIPTION=y # CONFIG_FINSH_ECHO_DISABLE_DEFAULT is not set # CONFIG_FINSH_USING_AUTH is not set CONFIG_FINSH_ARG_MAX=10 + +# +# DFS: device virtual file system +# CONFIG_RT_USING_DFS=y CONFIG_DFS_USING_POSIX=y CONFIG_DFS_USING_WORKDIR=y +# CONFIG_RT_USING_DFS_MNTTABLE is not set +CONFIG_DFS_FD_MAX=16 +CONFIG_RT_USING_DFS_V1=y +# CONFIG_RT_USING_DFS_V2 is not set CONFIG_DFS_FILESYSTEMS_MAX=4 CONFIG_DFS_FILESYSTEM_TYPES_MAX=4 -CONFIG_DFS_FD_MAX=16 -# CONFIG_RT_USING_DFS_MNTTABLE is not set # CONFIG_RT_USING_DFS_ELMFAT is not set # CONFIG_RT_USING_DFS_DEVFS is not set # CONFIG_RT_USING_DFS_ROMFS is not set @@ -136,10 +143,9 @@ CONFIG_RT_USING_DEVICE_IPC=y CONFIG_RT_UNAMED_PIPE_NUMBER=64 # 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_USING_SERIAL_V1 is not set +CONFIG_RT_USING_SERIAL_V2=y 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 @@ -221,6 +227,7 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8 # CONFIG_RT_USING_UTEST is not set # CONFIG_RT_USING_VAR_EXPORT is not set # CONFIG_RT_USING_ADT is not set +# CONFIG_RT_USING_RESOURCE_ID is not set # CONFIG_RT_USING_RT_LINK is not set # CONFIG_RT_USING_VBUS is not set @@ -247,7 +254,6 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8 # 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_LIBMODBUS is not set # CONFIG_PKG_USING_FREEMODBUS is not set # CONFIG_PKG_USING_NANOPB is not set @@ -518,6 +524,7 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8 # CONFIG_PKG_USING_QPC is not set # CONFIG_PKG_USING_AGILE_UPGRADE is not set # CONFIG_PKG_USING_FLASH_BLOB is not set +# CONFIG_PKG_USING_MLIBC is not set # # peripheral libraries and drivers @@ -602,6 +609,7 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8 # CONFIG_PKG_USING_FT5426 is not set # CONFIG_PKG_USING_FT6236 is not set # CONFIG_PKG_USING_XPT2046_TOUCH is not set +# CONFIG_PKG_USING_CST816X is not set # CONFIG_PKG_USING_REALTEK_AMEBA is not set # CONFIG_PKG_USING_STM32_SDIO is not set # CONFIG_PKG_USING_ESP_IDF is not set @@ -614,7 +622,6 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8 # 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 # # Kendryte SDK @@ -672,14 +679,17 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8 # CONFIG_PKG_USING_MISAKA_AT24CXX is not set # CONFIG_PKG_USING_MISAKA_RGB_BLING is not set # CONFIG_PKG_USING_LORA_MODEM_DRIVER is not set -# CONFIG_PKG_USING_BL_MCU_SDK is not set # CONFIG_PKG_USING_SOFT_SERIAL is not set # CONFIG_PKG_USING_MB85RS16 is not set # CONFIG_PKG_USING_RFM300 is not set # CONFIG_PKG_USING_IO_INPUT_FILTER is not set # CONFIG_PKG_USING_RASPBERRYPI_PICO_SDK is not set # CONFIG_PKG_USING_LRF_NV7LIDAR is not set +# CONFIG_PKG_USING_AIP650 is not set # CONFIG_PKG_USING_FINGERPRINT is not set +# CONFIG_PKG_USING_BT_ECB02C is not set +# CONFIG_PKG_USING_UAT is not set +# CONFIG_PKG_USING_SPI_TOOLS is not set # # AI packages @@ -698,7 +708,10 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8 # Signal Processing and Control Algorithm Packages # # CONFIG_PKG_USING_FIRE_PID_CURVE is not set +# CONFIG_PKG_USING_QPID is not set # CONFIG_PKG_USING_UKAL is not set +# CONFIG_PKG_USING_DIGITALCTRL is not set +# CONFIG_PKG_USING_KISSFFT is not set # # miscellaneous packages @@ -745,7 +758,6 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8 # 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 # CONFIG_PKG_USING_HELLO is not set @@ -770,8 +782,9 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8 # CONFIG_PKG_USING_RTDUINO is not set # -# Projects +# Projects and Demos # +# CONFIG_PKG_USING_ARDUINO_MSGQ_C_CPP_DEMO is not set # CONFIG_PKG_USING_ARDUINO_ULTRASOUND_RADAR is not set # CONFIG_PKG_USING_ARDUINO_SENSOR_KIT is not set # CONFIG_PKG_USING_ARDUINO_MATLAB_SUPPORT is not set @@ -918,14 +931,19 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8 # # Display # +# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_GFX_LIBRARY is not set # CONFIG_PKG_USING_ARDUINO_U8G2 is not set -# CONFIG_PKG_USING_ARDUINO_U8GLIB_ARDUINO is not set +# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_ST7735 is not set +# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_SSD1306 is not set +# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_ILI9341 is not set # CONFIG_PKG_USING_SEEED_TM1637 is not set # # Timing # # CONFIG_PKG_USING_ARDUINO_MSTIMER2 is not set +# CONFIG_PKG_USING_ARDUINO_TICKER is not set +# CONFIG_PKG_USING_ARDUINO_TASKSCHEDULER is not set # # Data Processing @@ -1005,7 +1023,11 @@ CONFIG_BSP_USING_UART=y # CONFIG_BSP_USING_UART1 is not set # CONFIG_BSP_USING_UART2 is not set # CONFIG_BSP_USING_UART3 is not set -# CONFIG_BSP_USING_UART9 is not set +CONFIG_BSP_USING_UART9=y +# CONFIG_BSP_UART9_RX_USING_DMA is not set +# CONFIG_BSP_UART9_TX_USING_DMA is not set +CONFIG_BSP_UART9_RX_BUFSIZE=256 +CONFIG_BSP_UART9_TX_BUFSIZE=0 # CONFIG_BSP_USING_I2C is not set # CONFIG_BSP_USING_SPI is not set # CONFIG_BSP_USING_ADC is not set diff --git a/bsp/renesas/ra2l1-cpk/ra_cfg/fsp_cfg/r_icu_cfg.h b/bsp/renesas/ra2l1-cpk/ra_cfg/fsp_cfg/r_icu_cfg.h new file mode 100644 index 0000000000..5e77b6980f --- /dev/null +++ b/bsp/renesas/ra2l1-cpk/ra_cfg/fsp_cfg/r_icu_cfg.h @@ -0,0 +1,5 @@ +/* generated configuration header file - do not edit */ +#ifndef R_ICU_CFG_H_ +#define R_ICU_CFG_H_ +#define ICU_CFG_PARAM_CHECKING_ENABLE (BSP_CFG_PARAM_CHECKING_ENABLE) +#endif /* R_ICU_CFG_H_ */ diff --git a/bsp/renesas/ra2l1-cpk/rtconfig.h b/bsp/renesas/ra2l1-cpk/rtconfig.h index 2fef56b2f8..0e69af8396 100644 --- a/bsp/renesas/ra2l1-cpk/rtconfig.h +++ b/bsp/renesas/ra2l1-cpk/rtconfig.h @@ -36,7 +36,6 @@ /* Memory Management */ -#define RT_PAGE_MAX_ORDER 11 #define RT_USING_MEMPOOL #define RT_USING_SMALL_MEM #define RT_USING_SMALL_MEM_AS_HEAP @@ -47,8 +46,8 @@ #define RT_USING_DEVICE #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 -#define RT_CONSOLE_DEVICE_NAME "uart" -#define RT_VER_NUM 0x50000 +#define RT_CONSOLE_DEVICE_NAME "uart9" +#define RT_VER_NUM 0x50001 /* RT-Thread Components */ @@ -69,21 +68,24 @@ #define MSH_USING_BUILT_IN_COMMANDS #define FINSH_USING_DESCRIPTION #define FINSH_ARG_MAX 10 + +/* DFS: device virtual file system */ + #define RT_USING_DFS #define DFS_USING_POSIX #define DFS_USING_WORKDIR +#define DFS_FD_MAX 16 +#define RT_USING_DFS_V1 #define DFS_FILESYSTEMS_MAX 4 #define DFS_FILESYSTEM_TYPES_MAX 4 -#define DFS_FD_MAX 16 /* Device Drivers */ #define RT_USING_DEVICE_IPC #define RT_UNAMED_PIPE_NUMBER 64 #define RT_USING_SERIAL -#define RT_USING_SERIAL_V1 +#define RT_USING_SERIAL_V2 #define RT_SERIAL_USING_DMA -#define RT_SERIAL_RB_BUFSZ 64 #define RT_USING_PIN /* Using USB */ @@ -193,7 +195,7 @@ /* Arduino libraries */ -/* Projects */ +/* Projects and Demos */ /* Sensors */ @@ -238,6 +240,9 @@ #define BSP_USING_GPIO #define BSP_USING_UART +#define BSP_USING_UART9 +#define BSP_UART9_RX_BUFSIZE 256 +#define BSP_UART9_TX_BUFSIZE 0 /* Board extended module Drivers */ diff --git a/bsp/renesas/ra2l1-cpk/rtconfig.py b/bsp/renesas/ra2l1-cpk/rtconfig.py index 8656096f71..3ce1475bc3 100644 --- a/bsp/renesas/ra2l1-cpk/rtconfig.py +++ b/bsp/renesas/ra2l1-cpk/rtconfig.py @@ -15,7 +15,7 @@ if os.getenv('RTT_ROOT'): # EXEC_PATH is the compiler execute path, for example, CodeSourcery, Keil MDK, IAR if CROSS_TOOL == 'gcc': PLATFORM = 'gcc' - EXEC_PATH = 'C:\Users\XXYYZZ' + EXEC_PATH = '' elif CROSS_TOOL == 'keil': PLATFORM = 'armclang' EXEC_PATH = 'C:/Keil_v5' diff --git a/bsp/renesas/ra4m2-eco/board/SConscript b/bsp/renesas/ra4m2-eco/board/SConscript index ca95be14e2..036c56c281 100644 --- a/bsp/renesas/ra4m2-eco/board/SConscript +++ b/bsp/renesas/ra4m2-eco/board/SConscript @@ -4,6 +4,10 @@ from building import * objs = [] cwd = GetCurrentDir() list = os.listdir(cwd) +CPPPATH = [cwd] +src = [] + +objs = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH) for item in list: if os.path.isfile(os.path.join(cwd, item, 'SConscript')): diff --git a/bsp/renesas/ra4m2-eco/script/fsp.ld b/bsp/renesas/ra4m2-eco/script/fsp.ld new file mode 100644 index 0000000000..e28bce5dc4 --- /dev/null +++ b/bsp/renesas/ra4m2-eco/script/fsp.ld @@ -0,0 +1,591 @@ +/* + Linker File for Renesas FSP +*/ + +INCLUDE memory_regions.ld + +QSPI_FLASH_PRV_LENGTH = DEFINED(QSPI_FLASH_SIZE) ? ABSOLUTE(QSPI_FLASH_SIZE) : ABSOLUTE(QSPI_FLASH_LENGTH); +OSPI_DEVICE_0_PRV_LENGTH = DEFINED(OSPI_DEVICE_0_SIZE) ? ABSOLUTE(OSPI_DEVICE_0_SIZE) : ABSOLUTE(OSPI_DEVICE_0_LENGTH); +OSPI_DEVICE_1_PRV_LENGTH = DEFINED(OSPI_DEVICE_1_SIZE) ? ABSOLUTE(OSPI_DEVICE_1_SIZE) : ABSOLUTE(OSPI_DEVICE_1_LENGTH); + +/* If a flat (secure) project has DEFINED RAM_NS_BUFFER_LENGTH, then emit IDAU symbols to allocate non-secure RAM. */ +__RESERVE_NS_RAM = !DEFINED(PROJECT_NONSECURE) && DEFINED(RAM_NS_BUFFER_LENGTH) && (OPTION_SETTING_S_LENGTH != 0); + +RAM_NS_BUFFER_BLOCK_LENGTH = DEFINED(RAM_NS_BUFFER_LENGTH) ? ALIGN(RAM_NS_BUFFER_LENGTH, 8192) : 0; +RAM_NS_BUFFER_LENGTH = DEFINED(RAM_NS_BUFFER_LENGTH) ? RAM_NS_BUFFER_LENGTH : 0; +RAM_NS_BUFFER_START = RAM_START + RAM_LENGTH - RAM_NS_BUFFER_LENGTH; +RAM_NS_BUFFER_BLOCK_START = RAM_START + RAM_LENGTH - RAM_NS_BUFFER_BLOCK_LENGTH; + +OPTION_SETTING_START_NS = 0x0100A180; + +/* This definition is used to avoid moving the counter in OPTION_SETTING regions for projects that should not configure option settings. + * Bootloader images do not configure option settings because they are owned by the bootloader. + * FSP_BOOTABLE_IMAGE is only defined in bootloader images. */ +__bl_FSP_BOOTABLE_IMAGE = 1; +__bln_FSP_BOOTABLE_IMAGE = 1; +PROJECT_SECURE_OR_FLAT = !DEFINED(PROJECT_NONSECURE) && OPTION_SETTING_LENGTH && !DEFINED(FSP_BOOTABLE_IMAGE); +USE_OPTION_SETTING_NS = DEFINED(PROJECT_NONSECURE) && !DEFINED(FSP_BOOTABLE_IMAGE); + +__bl_FLASH_IMAGE_START = !DEFINED(FLASH_BOOTLOADER_LENGTH) ? 0 : + FLASH_APPLICATION_IMAGE_NUMBER == 1 ? FLASH_BOOTLOADER_LENGTH + FLASH_BOOTLOADER_HEADER_LENGTH : + FLASH_BOOTLOADER_LENGTH + FLASH_BOOTLOADER_SCRATCH_LENGTH + FLASH_APPLICATION_S_LENGTH + FLASH_BOOTLOADER_HEADER_LENGTH; +__bl_FLASH_IMAGE_LENGTH = !DEFINED(FLASH_BOOTLOADER_LENGTH) ? 0 : + FLASH_APPLICATION_S_LENGTH - FLASH_BOOTLOADER_HEADER_LENGTH; +__bl_FLASH_IMAGE_END = __bl_FLASH_IMAGE_START + __bl_FLASH_IMAGE_LENGTH; +__bl_FLASH_NS_START = !DEFINED(FLASH_BOOTLOADER_LENGTH) ? 0 : + FLASH_APPLICATION_NS_LENGTH == 0 ? __bl_FLASH_IMAGE_END : + __bl_FLASH_IMAGE_START - FLASH_BOOTLOADER_HEADER_LENGTH + FLASH_APPLICATION_S_LENGTH; +__bl_FLASH_NSC_START = !DEFINED(FLASH_BOOTLOADER_LENGTH) ? 0 : + FLASH_APPLICATION_NS_LENGTH == 0 ? __bl_FLASH_IMAGE_END : + __bl_FLASH_NS_START - FLASH_APPLICATION_NSC_LENGTH; +__bl_RAM_NS_START = !DEFINED(FLASH_BOOTLOADER_LENGTH) ? 0 : + FLASH_APPLICATION_NS_LENGTH == 0 ? RAM_START + RAM_LENGTH : + RAM_START + RAM_LENGTH - RAM_APPLICATION_NS_LENGTH; +__bl_RAM_NSC_START = !DEFINED(FLASH_BOOTLOADER_LENGTH) ? 0 : + FLASH_APPLICATION_NS_LENGTH == 0 ? RAM_START + RAM_LENGTH : + __bl_RAM_NS_START - RAM_APPLICATION_NSC_LENGTH; +__bl_FLASH_NS_IMAGE_START = !DEFINED(FLASH_BOOTLOADER_LENGTH) ? 0 : + FLASH_APPLICATION_NS_LENGTH == 0 ? __bl_FLASH_IMAGE_END : + __bl_FLASH_NS_START + FLASH_BOOTLOADER_HEADER_LENGTH_2; +__bln_FLASH_IMAGE_START = __bl_FLASH_NS_IMAGE_START; +__bln_FLASH_IMAGE_LENGTH = !DEFINED(FLASH_BOOTLOADER_LENGTH) ? 0 : + FLASH_APPLICATION_NS_LENGTH == 0 ? __bl_FLASH_IMAGE_END : + FLASH_APPLICATION_NS_LENGTH - FLASH_BOOTLOADER_HEADER_LENGTH_2; + +FLASH_ORIGIN = DEFINED(FLASH_IMAGE_START) ? FLASH_IMAGE_START : FLASH_START; +LIMITED_FLASH_LENGTH = DEFINED(FLASH_IMAGE_LENGTH) ? FLASH_IMAGE_LENGTH : + DEFINED(FLASH_BOOTLOADER_LENGTH) ? FLASH_BOOTLOADER_LENGTH : + FLASH_LENGTH; + +/* Define memory regions. */ +MEMORY +{ + FLASH (rx) : ORIGIN = FLASH_ORIGIN, LENGTH = LIMITED_FLASH_LENGTH + RAM (rwx) : ORIGIN = RAM_START, LENGTH = RAM_LENGTH + DATA_FLASH (rx) : ORIGIN = DATA_FLASH_START, LENGTH = DATA_FLASH_LENGTH + QSPI_FLASH (rx) : ORIGIN = QSPI_FLASH_START, LENGTH = QSPI_FLASH_PRV_LENGTH + OSPI_DEVICE_0 (rx) : ORIGIN = OSPI_DEVICE_0_START, LENGTH = OSPI_DEVICE_0_PRV_LENGTH + OSPI_DEVICE_1 (rx) : ORIGIN = OSPI_DEVICE_1_START, LENGTH = OSPI_DEVICE_1_PRV_LENGTH + SDRAM (rwx) : ORIGIN = SDRAM_START, LENGTH = SDRAM_LENGTH + OPTION_SETTING (r): ORIGIN = OPTION_SETTING_START, LENGTH = OPTION_SETTING_LENGTH + OPTION_SETTING_S (r): ORIGIN = OPTION_SETTING_S_START, LENGTH = OPTION_SETTING_S_LENGTH + ID_CODE (rx) : ORIGIN = ID_CODE_START, LENGTH = ID_CODE_LENGTH +} + +/* Library configurations */ +GROUP(libgcc.a libc.a libm.a libnosys.a) + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be DEFINED in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + * __Vectors_End + * __Vectors_Size + * __qspi_flash_start__ + * __qspi_flash_end__ + * __qspi_flash_code_size__ + * __qspi_region_max_size__ + * __qspi_region_start_address__ + * __qspi_region_end_address__ + * __ospi_device_0_start__ + * __ospi_device_0_end__ + * __ospi_device_0_code_size__ + * __ospi_device_0_region_max_size__ + * __ospi_device_0_region_start_address__ + * __ospi_device_0_region_end_address__ + * __ospi_device_1_start__ + * __ospi_device_1_end__ + * __ospi_device_1_code_size__ + * __ospi_device_1_region_max_size__ + * __ospi_device_1_region_start_address__ + * __ospi_device_1_region_end_address__ + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + __tz_FLASH_S = ABSOLUTE(FLASH_START); + __ROM_Start = .; + + /* Even though the vector table is not 256 entries (1KB) long, we still allocate that much + * space because ROM registers are at address 0x400 and there is very little space + * in between. */ + KEEP(*(.fixed_vectors*)) + KEEP(*(.application_vectors*)) + __Vectors_End = .; + + /* ROM Registers start at address 0x00000400 for devices that do not have the OPTION_SETTING region. */ + . = OPTION_SETTING_LENGTH > 0 ? . : __ROM_Start + 0x400; + KEEP(*(.rom_registers*)) + + /* Reserving 0x100 bytes of space for ROM registers. */ + . = OPTION_SETTING_LENGTH > 0 ? . : __ROM_Start + 0x500; + + /* Allocate flash write-boundary-aligned + * space for sce9 wrapped public keys for mcuboot if the module is used. + */ + . = ALIGN(128); + KEEP(*(.mcuboot_sce9_key*)) + + *(.text*) + + KEEP(*(.version)) + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + __usb_dev_descriptor_start_fs = .; + KEEP(*(.usb_device_desc_fs*)) + __usb_cfg_descriptor_start_fs = .; + KEEP(*(.usb_config_desc_fs*)) + __usb_interface_descriptor_start_fs = .; + KEEP(*(.usb_interface_desc_fs*)) + __usb_descriptor_end_fs = .; + __usb_dev_descriptor_start_hs = .; + KEEP(*(.usb_device_desc_hs*)) + __usb_cfg_descriptor_start_hs = .; + KEEP(*(.usb_config_desc_hs*)) + __usb_interface_descriptor_start_hs = .; + KEEP(*(.usb_interface_desc_hs*)) + __usb_descriptor_end_hs = .; + + KEEP(*(.eh_frame*)) + + __ROM_End = .; + } > FLASH = 0xFF + + __Vectors_Size = __Vectors_End - __Vectors; + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + __tz_RAM_S = ORIGIN(RAM); + + /* If DTC is used, put the DTC vector table at the start of SRAM. + This avoids memory holes due to 1K alignment required by it. */ + .fsp_dtc_vector_table (NOLOAD) : + { + . = ORIGIN(RAM); + *(.fsp_dtc_vector_table) + } > RAM + + /* Initialized data section. */ + .data : + { + __data_start__ = .; + . = ALIGN(4); + + __Code_In_RAM_Start = .; + + KEEP(*(.code_in_ram*)) + __Code_In_RAM_End = .; + + *(vtable) + /* Don't use *(.data*) because it will place data meant for .data_flash in this section. */ + *(.data.*) + *(.data) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + + . = ALIGN(4); + + /* All data end */ + __data_end__ = .; + + } > RAM AT > FLASH + + + /* TrustZone Secure Gateway Stubs Section. */ + .gnu.sgstubs : ALIGN (1024) + { + . = (DEFINED(PROJECT_SECURE) && DEFINED(FLASH_NSC_START)) ? ABSOLUTE(FLASH_NSC_START) : ALIGN(1024); + __tz_FLASH_C = DEFINED(FLASH_NSC_START) ? ABSOLUTE(FLASH_NSC_START) : __RESERVE_NS_RAM ? ABSOLUTE(FLASH_START + FLASH_LENGTH) : ALIGN(1024); + _start_sg = .; + *(.gnu.sgstubs*) + . = ALIGN(32); + _end_sg = .; + } > FLASH + + __tz_FLASH_N = DEFINED(FLASH_NS_START) ? ABSOLUTE(FLASH_NS_START) : __RESERVE_NS_RAM ? ABSOLUTE(FLASH_START + FLASH_LENGTH) : ALIGN(32768); + FLASH_NS_IMAGE_START = DEFINED(FLASH_NS_IMAGE_START) ? FLASH_NS_IMAGE_START : __tz_FLASH_N; + + /* Note: There are no secure/non-secure boundaries for QSPI. These symbols are provided for the RA configuration tool. */ + __tz_QSPI_FLASH_S = ORIGIN(QSPI_FLASH); + + /* QSPI_FLASH section to be downloaded via debugger */ + .qspi_flash : + { + __qspi_flash_start__ = .; + KEEP(*(.qspi_flash*)) + KEEP(*(.code_in_qspi*)) + __qspi_flash_end__ = .; + } > QSPI_FLASH + __qspi_flash_code_size__ = __qspi_flash_end__ - __qspi_flash_start__; + + /* QSPI_FLASH non-retentive section, creates a copy in internal flash that can be copied to QSPI */ + __qspi_flash_code_addr__ = __etext + (__data_end__ - __data_start__); + .qspi_non_retentive : AT (__qspi_flash_code_addr__) + { + __qspi_non_retentive_start__ = .; + KEEP(*(.qspi_non_retentive*)) + __qspi_non_retentive_end__ = .; + } > QSPI_FLASH + __qspi_non_retentive_size__ = __qspi_non_retentive_end__ - __qspi_non_retentive_start__; + + __qspi_region_max_size__ = 0x4000000; /* Must be the same as defined in MEMORY above */ + __qspi_region_start_address__ = __qspi_flash_start__; + __qspi_region_end_address__ = __qspi_flash_start__ + __qspi_region_max_size__; + + /* Note: There are no secure/non-secure boundaries for QSPI. These symbols are provided for the RA configuration tool. */ + __tz_QSPI_FLASH_N = __qspi_non_retentive_end__; + + /* Note: There are no secure/non-secure boundaries for QSPI. These symbols are provided for the RA configuration tool. */ + __tz_OSPI_DEVICE_0_S = ORIGIN(OSPI_DEVICE_0); + + /* OSPI_DEVICE_0 section to be downloaded via debugger */ + .OSPI_DEVICE_0 : + { + __ospi_device_0_start__ = .; + KEEP(*(.ospi_device_0*)) + KEEP(*(.code_in_ospi_device_0*)) + __ospi_device_0_end__ = .; + } > OSPI_DEVICE_0 + __ospi_device_0_code_size__ = __ospi_device_0_end__ - __ospi_device_0_start__; + + /* OSPI_DEVICE_0 non-retentive section, creates a copy in internal flash that can be copied to OSPI */ + __ospi_device_0_code_addr__ = __etext + (__data_end__ - __data_start__); + .ospi_device_0_non_retentive : AT (__ospi_device_0_code_addr__) + { + __ospi_device_0_non_retentive_start__ = .; + KEEP(*(.ospi_device_0_non_retentive*)) + __ospi_device_0_non_retentive_end__ = .; + } > OSPI_DEVICE_0 + __ospi_device_0_non_retentive_size__ = __ospi_device_0_non_retentive_end__ - __ospi_device_0_non_retentive_start__; + + __ospi_device_0_region_max_size__ = 0x8000000; /* Must be the same as defined in MEMORY above */ + __ospi_device_0_region_start_address__ = __ospi_device_0_start__; + __ospi_device_0_region_end_address__ = __ospi_device_0_start__ + __ospi_device_0_region_max_size__; + + /* Note: There are no secure/non-secure boundaries for OSPI. These symbols are provided for the RA configuration tool. */ + __tz_OSPI_DEVICE_0_N = __ospi_device_0_non_retentive_end__; + + /* Note: There are no secure/non-secure boundaries for OSPI. These symbols are provided for the RA configuration tool. */ + __tz_OSPI_DEVICE_1_S = ORIGIN(OSPI_DEVICE_1); + + /* OSPI_DEVICE_1 section to be downloaded via debugger */ + .OSPI_DEVICE_1 : + { + __ospi_device_1_start__ = .; + KEEP(*(.ospi_device_1*)) + KEEP(*(.code_in_ospi_device_1*)) + __ospi_device_1_end__ = .; + } > OSPI_DEVICE_1 + __ospi_device_1_code_size__ = __ospi_device_1_end__ - __ospi_device_1_start__; + + /* OSPI_DEVICE_1 non-retentive section, creates a copy in internal flash that can be copied to OSPI */ + __ospi_device_1_code_addr__ = __etext + (__data_end__ - __data_start__); + .ospi_device_1_non_retentive : AT (__ospi_device_1_code_addr__) + { + __ospi_device_1_non_retentive_start__ = .; + KEEP(*(.ospi_device_1_non_retentive*)) + __ospi_device_1_non_retentive_end__ = .; + } > OSPI_DEVICE_1 + __ospi_device_1_non_retentive_size__ = __ospi_device_1_non_retentive_end__ - __ospi_device_1_non_retentive_start__; + + __ospi_device_1_region_max_size__ = 0x10000000; /* Must be the same as defined in MEMORY above */ + __ospi_device_1_region_start_address__ = __ospi_device_1_start__; + __ospi_device_1_region_end_address__ = __ospi_device_1_start__ + __ospi_device_1_region_max_size__; + + /* Note: There are no secure/non-secure boundaries for OSPI. These symbols are provided for the RA configuration tool. */ + __tz_OSPI_DEVICE_1_N = __ospi_device_1_non_retentive_end__; + + .noinit (NOLOAD): + { + . = ALIGN(4); + __noinit_start = .; + KEEP(*(.noinit*)) + . = ALIGN(8); + /* Place the FreeRTOS heap here so that the __HeapLimit calculation does not include the freertos heap. */ + KEEP(*(.heap.*)) + __noinit_end = .; + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (NOLOAD): + { + . = ALIGN(8); + __HeapBase = .; + /* Place the STD heap here. */ + KEEP(*(.heap)) + __HeapLimit = .; + } > RAM + + /* Stacks are stored in this section. */ + .stack_dummy (NOLOAD): + { + . = ALIGN(8); + __StackLimit = .; + /* Main stack */ + KEEP(*(.stack)) + __StackTop = .; + /* Thread stacks */ + KEEP(*(.stack*)) + __StackTopAll = .; + } > RAM + + PROVIDE(__stack = __StackTopAll); + + /* This symbol represents the end of user allocated RAM. The RAM after this symbol can be used + at run time for things such as ThreadX memory pool allocations. */ + __RAM_segment_used_end__ = ALIGN(__StackTopAll , 4); + + /* RAM_NSC_START can be used to set a fixed address for non-secure callable RAM in secure projects. + * If it is not specified, the address for NSC RAM is the end of RAM aligned to a 1K boundary. + * In flat projects that require non-secure RAM, this variable is set to the start of non-secure RAM. */ + __tz_RAM_C = DEFINED(RAM_NSC_START) ? ABSOLUTE(RAM_NSC_START) : __RESERVE_NS_RAM ? ABSOLUTE(RAM_NS_BUFFER_BLOCK_START) : ALIGN(__RAM_segment_used_end__, 1024); + + /* RAM_NS_START can be used to set a fixed address for non-secure RAM in secure projects or flat projects. + * RAM_NS_BUFFER_BLOCK_LENGTH is used to allocate non-secure buffers in a flat project. If it is not + * specified, the address for NSC RAM is the end of RAM aligned to an 8K boundary. + * In flat projects that require non-secure RAM, this variable is set to the start of non-secure RAM. */ + __tz_RAM_N = DEFINED(RAM_NS_START) ? ABSOLUTE(RAM_NS_START) : __RESERVE_NS_RAM ? ABSOLUTE(RAM_NS_BUFFER_BLOCK_START) : ALIGN(__tz_RAM_C, 8192); + + /* Non-secure buffers must be in non-secure RAM. This is primarily used for the EDMAC in flat projects. + * The EDMAC is a non-secure bus master and can only access non-secure RAM. */ + .ns_buffer (NOLOAD): + { + /* Allocate RAM on a 32-byte boundary to help with placement of Ethernet buffers. */ + . = __RESERVE_NS_RAM ? ABSOLUTE(RAM_NS_BUFFER_START & 0xFFFFFFE0) : .; + + KEEP(*(.ns_buffer*)) + } > RAM + + /* Data flash. */ + .data_flash : + { + . = ORIGIN(DATA_FLASH); + __tz_DATA_FLASH_S = .; + __Data_Flash_Start = .; + KEEP(*(.data_flash*)) + __Data_Flash_End = .; + + __tz_DATA_FLASH_N = DEFINED(DATA_FLASH_NS_START) ? ABSOLUTE(DATA_FLASH_NS_START) : __RESERVE_NS_RAM ? ABSOLUTE(DATA_FLASH_START + DATA_FLASH_LENGTH) : ALIGN(1024); + } > DATA_FLASH + + /* Note: There are no secure/non-secure boundaries for SDRAM. These symbols are provided for the RA configuration tool. */ + __tz_SDRAM_S = ORIGIN(SDRAM); + + /* SDRAM */ + .sdram (NOLOAD): + { + __SDRAM_Start = .; + KEEP(*(.sdram*)) + KEEP(*(.frame*)) + __SDRAM_End = .; + } > SDRAM + + /* Note: There are no secure/non-secure boundaries for SDRAM. These symbols are provided for the RA configuration tool. */ + __tz_SDRAM_N = __SDRAM_End; + + /* Note: There are no secure/non-secure boundaries for ID_CODE. These symbols are provided for the RA configuration tool. */ + __tz_ID_CODE_S = ORIGIN(ID_CODE); + + .id_code : + { + __ID_Code_Start = .; + KEEP(*(.id_code*)) + __ID_Code_End = .; + } > ID_CODE + + /* Note: There are no secure/non-secure boundaries for ID_CODE. These symbols are provided for the RA configuration tool. */ + __tz_ID_CODE_N = __ID_Code_End; + + /* Symbol required for RA Configuration tool. */ + __tz_OPTION_SETTING_S = ORIGIN(OPTION_SETTING); + + .option_setting : + { + __OPTION_SETTING_Start = .; + KEEP(*(.option_setting_ofs0)) + . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_Start + 0x10 : __OPTION_SETTING_Start; + KEEP(*(.option_setting_dualsel)) + . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_Start + 0x34 : __OPTION_SETTING_Start; + KEEP(*(.option_setting_sas)) + __OPTION_SETTING_End = .; + } > OPTION_SETTING = 0xFF + + /* Symbol required for RA Configuration tool. */ + __tz_OPTION_SETTING_N = OPTION_SETTING_START_NS; + + .option_setting_ns : + { + __OPTION_SETTING_NS_Start = .; + KEEP(*(.option_setting_ofs1)) + . = USE_OPTION_SETTING_NS ? __OPTION_SETTING_NS_Start + 0x10 : __OPTION_SETTING_NS_Start; + KEEP(*(.option_setting_banksel)) + . = USE_OPTION_SETTING_NS ? __OPTION_SETTING_NS_Start + 0x40 : __OPTION_SETTING_NS_Start; + KEEP(*(.option_setting_bps0)) + . = USE_OPTION_SETTING_NS ? __OPTION_SETTING_NS_Start + 0x44 : __OPTION_SETTING_NS_Start; + KEEP(*(.option_setting_bps1)) + . = USE_OPTION_SETTING_NS ? __OPTION_SETTING_NS_Start + 0x48 : __OPTION_SETTING_NS_Start; + KEEP(*(.option_setting_bps2)) + . = USE_OPTION_SETTING_NS ? __OPTION_SETTING_NS_Start + 0x60 : __OPTION_SETTING_NS_Start; + KEEP(*(.option_setting_pbps0)) + . = USE_OPTION_SETTING_NS ? __OPTION_SETTING_NS_Start + 0x64 : __OPTION_SETTING_NS_Start; + KEEP(*(.option_setting_pbps1)) + . = USE_OPTION_SETTING_NS ? __OPTION_SETTING_NS_Start + 0x68 : __OPTION_SETTING_NS_Start; + KEEP(*(.option_setting_pbps2)) + __OPTION_SETTING_NS_End = .; + } > OPTION_SETTING = 0xFF + + /* Symbol required for RA Configuration tool. */ + __tz_OPTION_SETTING_S_S = ORIGIN(OPTION_SETTING_S); + + .option_setting_s : + { + __OPTION_SETTING_S_Start = .; + KEEP(*(.option_setting_ofs1_sec)) + . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0x10 : __OPTION_SETTING_S_Start; + KEEP(*(.option_setting_banksel_sec)) + . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0x40 : __OPTION_SETTING_S_Start; + KEEP(*(.option_setting_bps_sec0)) + . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0x44 : __OPTION_SETTING_S_Start; + KEEP(*(.option_setting_bps_sec1)) + . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0x48 : __OPTION_SETTING_S_Start; + KEEP(*(.option_setting_bps_sec2)) + . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0x60 : __OPTION_SETTING_S_Start; + KEEP(*(.option_setting_pbps_sec0)) + . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0x64 : __OPTION_SETTING_S_Start; + KEEP(*(.option_setting_pbps_sec1)) + . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0x68 : __OPTION_SETTING_S_Start; + KEEP(*(.option_setting_pbps_sec2)) + . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0x80 : __OPTION_SETTING_S_Start; + KEEP(*(.option_setting_ofs1_sel)) + . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0x90 : __OPTION_SETTING_S_Start; + KEEP(*(.option_setting_banksel_sel)) + . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0xC0 : __OPTION_SETTING_S_Start; + KEEP(*(.option_setting_bps_sel0)) + . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0xC4 : __OPTION_SETTING_S_Start; + KEEP(*(.option_setting_bps_sel1)) + . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0xC8 : __OPTION_SETTING_S_Start; + KEEP(*(.option_setting_bps_sel2)) + __OPTION_SETTING_S_End = .; + } > OPTION_SETTING_S = 0xFF + + /* Symbol required for RA Configuration tool. */ + __tz_OPTION_SETTING_S_N = __OPTION_SETTING_S_End; +} diff --git a/bsp/renesas/ra4m2-eco/script/memory_regions.ld b/bsp/renesas/ra4m2-eco/script/memory_regions.ld new file mode 100644 index 0000000000..36196b1854 --- /dev/null +++ b/bsp/renesas/ra4m2-eco/script/memory_regions.ld @@ -0,0 +1,21 @@ +/* generated memory regions file - do not edit */ +RAM_START = 0x20000000; +RAM_LENGTH = 0x20000; +FLASH_START = 0x00000000; +FLASH_LENGTH = 0x80000; +DATA_FLASH_START = 0x08000000; +DATA_FLASH_LENGTH = 0x2000; +OPTION_SETTING_START = 0x0100A100; +OPTION_SETTING_LENGTH = 0x100; +OPTION_SETTING_S_START = 0x0100A200; +OPTION_SETTING_S_LENGTH = 0x100; +ID_CODE_START = 0x00000000; +ID_CODE_LENGTH = 0x0; +SDRAM_START = 0x90000000; +SDRAM_LENGTH = 0x0; +QSPI_FLASH_START = 0x60000000; +QSPI_FLASH_LENGTH = 0x4000000; +OSPI_DEVICE_0_START = 0x68000000; +OSPI_DEVICE_0_LENGTH = 0x0; +OSPI_DEVICE_1_START = 0x70000000; +OSPI_DEVICE_1_LENGTH = 0x0; diff --git a/bsp/renesas/ra4m2-eco/src/hal_entry.cpp b/bsp/renesas/ra4m2-eco/src/hal_entry.c similarity index 100% rename from bsp/renesas/ra4m2-eco/src/hal_entry.cpp rename to bsp/renesas/ra4m2-eco/src/hal_entry.c diff --git a/components/dfs/Kconfig b/components/dfs/Kconfig index f7b386c8f5..c39502774b 100644 --- a/components/dfs/Kconfig +++ b/components/dfs/Kconfig @@ -173,6 +173,11 @@ endif bool "Enable TMP file system" default n + config RT_USING_DFS_MQUEUE + bool "Enable MQUEUE file system" + select RT_USING_DEV_BUS + default n + if RT_USING_DFS_V1 config RT_USING_DFS_NFS bool "Using NFS v3 client file system" diff --git a/components/dfs/dfs_v1/filesystems/mqueue/SConscript b/components/dfs/dfs_v1/filesystems/mqueue/SConscript new file mode 100644 index 0000000000..17567e1280 --- /dev/null +++ b/components/dfs/dfs_v1/filesystems/mqueue/SConscript @@ -0,0 +1,11 @@ +# RT-Thread building script for component + +from building import * + +cwd = GetCurrentDir() +src = Glob('*.c') +CPPPATH = [cwd] + +group = DefineGroup('Filesystem', src, depend = ['RT_USING_DFS', 'RT_USING_DFS_MQUEUE'], CPPPATH = CPPPATH) + +Return('group') diff --git a/components/dfs/dfs_v1/filesystems/mqueue/dfs_mqueue.c b/components/dfs/dfs_v1/filesystems/mqueue/dfs_mqueue.c new file mode 100644 index 0000000000..6c4b870d87 --- /dev/null +++ b/components/dfs/dfs_v1/filesystems/mqueue/dfs_mqueue.c @@ -0,0 +1,165 @@ +/* + * Copyright (c) 2006-2023, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2023-07-04 zhkag first Version + */ + +#include +#include +#include +#include "dfs_mqueue.h" + +static rt_list_t _mqueue_file_list = RT_LIST_OBJECT_INIT(_mqueue_file_list); +struct rt_spinlock mqueue_lock; + +void dfs_mqueue_insert_after(rt_list_t *n) { + rt_spin_lock(&mqueue_lock); + rt_list_insert_after(&(_mqueue_file_list), n); + rt_spin_unlock(&mqueue_lock); +} + +struct mqueue_file *dfs_mqueue_lookup(const char *path, rt_size_t *size) { + struct mqueue_file *file; + rt_list_t *node; + rt_spin_lock(&mqueue_lock); + rt_list_for_each(node, &_mqueue_file_list) { + file = rt_list_entry(node, struct mqueue_file, list); + + if (rt_strncmp(file->name, path, RT_NAME_MAX) == 0) { + *size = file->size; + rt_spin_unlock(&mqueue_lock); + return file; + } + } + rt_spin_unlock(&mqueue_lock); + return RT_NULL; +} + +int dfs_mqueue_mount(struct dfs_filesystem *fs, unsigned long rwflag, const void *data) { + return RT_EOK; +} + +int dfs_mqueue_unmount(struct dfs_filesystem *fs) { return RT_EOK; } + +int dfs_mqueue_statfs(struct dfs_filesystem *fs, struct statfs *buf) { return RT_EOK; } + +int dfs_mqueue_close(struct dfs_file *file) { return RT_EOK; } + +int dfs_mqueue_open(struct dfs_file *file) { + rt_size_t size; + if ((file->vnode->path[0] == '/') && (file->vnode->path[1] == '\0')) + return 0; + + if (file->flags & O_DIRECTORY) + return -ENOENT; + + struct mqueue_file *mq_file; + + mq_file = dfs_mqueue_lookup(file->vnode->path + 1, &size); + if (mq_file == RT_NULL && !(file->flags & O_CREAT)) + return -ENOENT; + if (mq_file == RT_NULL) { + mq_file = (struct mqueue_file *)rt_malloc(sizeof(struct mqueue_file)); + if (mq_file == RT_NULL) { + return -ENFILE; + } + mq_file->msg_size = 8192; + mq_file->max_msgs = 10; + strncpy(mq_file->name, file->vnode->path + 1, RT_NAME_MAX); + dfs_mqueue_insert_after(&(mq_file->list)); + } + + if (file->flags & O_CREAT) { + rt_mq_t mq = rt_mq_create(file->vnode->path + 1, mq_file->msg_size, mq_file->max_msgs, + RT_IPC_FLAG_FIFO); + mq_file->data = (void *)mq; + file->vnode->data = mq_file; + file->vnode->size = 0; + } + + return 0; +} + +int dfs_mqueue_stat(struct dfs_filesystem *fs, const char *path, struct stat *st) { + st->st_dev = 0; + st->st_mode = S_IFREG | S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR | S_IWGRP | S_IWOTH; + st->st_size = 0; + st->st_mtime = 0; + return RT_EOK; +} + +int dfs_mqueue_getdents(struct dfs_file *file, struct dirent *dirp, uint32_t count) { + rt_size_t index, end; + struct dirent *d; + count = (count / sizeof(struct dirent)); + end = file->pos + count; + index = 0; + count = 0; + struct mqueue_file *mq_file; + rt_list_t *node; + rt_spin_lock(&mqueue_lock); + rt_list_for_each(node, &_mqueue_file_list) { + if (index >= (rt_size_t)file->pos) { + mq_file = rt_list_entry(node, struct mqueue_file, list); + d = dirp + count; + d->d_namlen = RT_NAME_MAX; + d->d_reclen = (rt_uint16_t)sizeof(struct dirent); + rt_strncpy(d->d_name, mq_file->name, RT_NAME_MAX); + count += 1; + file->pos += 1; + } + index += 1; + if (index >= end) { + break; + } + } + rt_spin_unlock(&mqueue_lock); + return count * sizeof(struct dirent); +} + +int dfs_mqueue_unlink(struct dfs_filesystem *fs, const char *path) { + rt_size_t size; + struct mqueue_file *mq_file; + mq_file = dfs_mqueue_lookup(path + 1, &size); + if (mq_file == RT_NULL) + return -ENOENT; + rt_list_remove(&(mq_file->list)); + if (mq_file->data != RT_NULL) + rt_mq_delete((rt_mq_t)mq_file->data); + rt_free(mq_file); + return RT_EOK; +} + +static const struct dfs_file_ops _mqueue_fops = { + .open = dfs_mqueue_open, + .close = dfs_mqueue_close, + .getdents = dfs_mqueue_getdents, +}; + +static const struct dfs_filesystem_ops _mqueue = { + .name = "mqueue", + .flags = DFS_FS_FLAG_DEFAULT, + .fops = &_mqueue_fops, + + .mount = dfs_mqueue_mount, + .unmount = dfs_mqueue_unmount, + .statfs = dfs_mqueue_statfs, + + .unlink = dfs_mqueue_unlink, + .stat = dfs_mqueue_stat, +}; + +int dfs_mqueue_init(void) { + /* register mqueue file system */ + dfs_register(&_mqueue); + mkdir("/dev/mqueue", 0x777); + if (dfs_mount(RT_NULL, "/dev/mqueue", "mqueue", 0, 0) != 0) { + rt_kprintf("Dir /dev/mqueue mount failed!\n"); + } + return 0; +} +INIT_COMPONENT_EXPORT(dfs_mqueue_init); diff --git a/components/dfs/dfs_v1/filesystems/mqueue/dfs_mqueue.h b/components/dfs/dfs_v1/filesystems/mqueue/dfs_mqueue.h new file mode 100644 index 0000000000..a2e1f71bc2 --- /dev/null +++ b/components/dfs/dfs_v1/filesystems/mqueue/dfs_mqueue.h @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2006-2023, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2023-07-04 zhkag first Version + */ + +#ifndef __DFS_MQUEUE_H__ +#define __DFS_MQUEUE_H__ + +#include + +struct mqueue_file { + char name[RT_NAME_MAX]; /* file name */ + rt_uint16_t msg_size; /**< message size of each message */ + rt_uint16_t max_msgs; /**< max number of messages */ + rt_list_t list; + rt_uint8_t *data; /* file date ptr */ + rt_size_t size; /* file size */ +}; + +struct mqueue_file *dfs_mqueue_lookup(const char *path, rt_size_t *size); +void dfs_mqueue_insert_after(rt_list_t *n); + +#endif diff --git a/components/dfs/dfs_v2/filesystems/elmfat/dfs_elm.c b/components/dfs/dfs_v2/filesystems/elmfat/dfs_elm.c index 589bf22f62..f4f27bd273 100644 --- a/components/dfs/dfs_v2/filesystems/elmfat/dfs_elm.c +++ b/components/dfs/dfs_v2/filesystems/elmfat/dfs_elm.c @@ -829,7 +829,7 @@ int dfs_elm_stat(struct dfs_dentry *dentry, struct stat *st) st->st_blksize = fat->csize * SS(fat); if (file_info.fattrib & AM_ARC) { - st->st_blocks = file_info.fsize ? ((file_info.fsize - 1) / SS(f) / fat->csize + 1) : 0; + st->st_blocks = file_info.fsize ? ((file_info.fsize - 1) / SS(fat) / fat->csize + 1) : 0; st->st_blocks *= (st->st_blksize / 512); // man say st_blocks is number of 512B blocks allocated } else diff --git a/components/dfs/dfs_v2/filesystems/mqueue/SConscript b/components/dfs/dfs_v2/filesystems/mqueue/SConscript new file mode 100644 index 0000000000..17567e1280 --- /dev/null +++ b/components/dfs/dfs_v2/filesystems/mqueue/SConscript @@ -0,0 +1,11 @@ +# RT-Thread building script for component + +from building import * + +cwd = GetCurrentDir() +src = Glob('*.c') +CPPPATH = [cwd] + +group = DefineGroup('Filesystem', src, depend = ['RT_USING_DFS', 'RT_USING_DFS_MQUEUE'], CPPPATH = CPPPATH) + +Return('group') diff --git a/components/dfs/dfs_v2/filesystems/mqueue/dfs_mqueue.c b/components/dfs/dfs_v2/filesystems/mqueue/dfs_mqueue.c new file mode 100644 index 0000000000..2325758dad --- /dev/null +++ b/components/dfs/dfs_v2/filesystems/mqueue/dfs_mqueue.c @@ -0,0 +1,240 @@ +/* + * Copyright (c) 2006-2023, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2023-07-04 zhkag first Version + */ + +#include +#include +#include +#include +#include +#include +#include +#include "dfs_mqueue.h" + +static rt_list_t _mqueue_file_list = RT_LIST_OBJECT_INIT(_mqueue_file_list); +struct rt_spinlock mqueue_lock; + +void dfs_mqueue_insert_after(rt_list_t *n) { + rt_spin_lock(&mqueue_lock); + rt_list_insert_after(&(_mqueue_file_list), n); + rt_spin_unlock(&mqueue_lock); +} + +struct mqueue_file *dfs_mqueue_lookup(const char *path, rt_size_t *size) { + struct mqueue_file *file; + rt_list_t *node; + rt_spin_lock(&mqueue_lock); + rt_list_for_each(node, &_mqueue_file_list) { + file = rt_list_entry(node, struct mqueue_file, list); + + if (rt_strncmp(file->name, path, RT_NAME_MAX) == 0) { + *size = file->size; + rt_spin_unlock(&mqueue_lock); + return file; + } + } + rt_spin_unlock(&mqueue_lock); + return RT_NULL; +} + +int dfs_mqueue_mount(struct dfs_filesystem *fs, unsigned long rwflag, const void *data) { + return RT_EOK; +} + +int dfs_mqueue_umount(struct dfs_filesystem *fs) { return RT_EOK; } + +int dfs_mqueue_statfs(struct dfs_filesystem *fs, struct statfs *buf) { return RT_EOK; } + +int dfs_mqueue_close(struct dfs_file *file) { return RT_EOK; } + +int dfs_mqueue_open(struct dfs_file *file) { + rt_size_t size; + if ((file->dentry->pathname[0] == '/') && (file->dentry->pathname[1] == '\0')) + return 0; + +} + +int dfs_mqueue_stat(struct dfs_dentry *dentry, struct stat *st) { + const char *path = RT_NULL; + struct dfs_vnode *vnode = RT_NULL; + if (dentry && dentry->vnode) { + path = dentry->pathname; + vnode = dentry->vnode; + st->st_dev = 0; + st->st_gid = vnode->gid; + st->st_uid = vnode->uid; + st->st_ino = 0; + st->st_mode = vnode->mode; + st->st_nlink = vnode->nlink; + st->st_size = vnode->size; + st->st_mtim.tv_nsec = vnode->mtime.tv_nsec; + st->st_mtim.tv_sec = vnode->mtime.tv_sec; + st->st_ctim.tv_nsec = vnode->ctime.tv_nsec; + st->st_ctim.tv_sec = vnode->ctime.tv_sec; + st->st_atim.tv_nsec = vnode->atime.tv_nsec; + st->st_atim.tv_sec = vnode->atime.tv_sec; + } + return RT_EOK; +} + +int dfs_mqueue_getdents(struct dfs_file *file, struct dirent *dirp, uint32_t count) { + rt_size_t index, end; + struct dirent *d; + count = (count / sizeof(struct dirent)); + end = file->fpos + count; + index = 0; + count = 0; + struct mqueue_file *mq_file; + rt_list_t *node; + rt_spin_lock(&mqueue_lock); + rt_list_for_each(node, &_mqueue_file_list) { + if (index >= (rt_size_t)file->fpos) { + mq_file = rt_list_entry(node, struct mqueue_file, list); + d = dirp + count; + d->d_namlen = RT_NAME_MAX; + d->d_reclen = (rt_uint16_t)sizeof(struct dirent); + rt_strncpy(d->d_name, mq_file->name, RT_NAME_MAX); + count += 1; + file->fpos += 1; + } + index += 1; + if (index >= end) { + break; + } + } + rt_spin_unlock(&mqueue_lock); + return count * sizeof(struct dirent); +} + +int dfs_mqueue_unlink(struct dfs_dentry *dentry) { + rt_size_t size; + struct mqueue_file *mq_file; + mq_file = dfs_mqueue_lookup(dentry->pathname + 1, &size); + if (mq_file == RT_NULL) + return -ENOENT; + rt_list_remove(&(mq_file->list)); + if (mq_file->data != RT_NULL) + rt_mq_delete((rt_mq_t)mq_file->data); + rt_free(mq_file); + return RT_EOK; +} + +static struct dfs_vnode *dfs_mqueue_create_vnode(struct dfs_dentry *dentry, int type, mode_t mode) { + struct dfs_vnode *vnode = RT_NULL; + rt_size_t size; + struct mqueue_file *mq_file; + + if (dentry == NULL || dentry->mnt == NULL) { + return NULL; + } + + vnode = dfs_vnode_create(); + if (vnode) { + mq_file = dfs_mqueue_lookup(dentry->pathname + 1, &size); + if (mq_file == RT_NULL) { + mq_file = (struct mqueue_file *)rt_malloc(sizeof(struct mqueue_file)); + if (mq_file == RT_NULL) { + return -ENFILE; + } + mq_file->msg_size = 8192; + mq_file->max_msgs = 10; + strncpy(mq_file->name, dentry->pathname + 1, RT_NAME_MAX); + dfs_mqueue_insert_after(&(mq_file->list)); + } + + vnode->mode = S_IFREG | mode; + vnode->type = FT_REGULAR; + rt_mq_t mq = rt_mq_create(dentry->pathname + 1, mq_file->msg_size, mq_file->max_msgs, + RT_IPC_FLAG_FIFO); + mq_file->data = (void *)mq; + vnode->data = mq_file; + vnode->size = 0; + } + + return vnode; +} + +static int dfs_mqueue_free_vnode(struct dfs_vnode *vnode) { + /* nothing to be freed */ + if (vnode && vnode->ref_count <= 1) { + vnode->data = NULL; + } + return 0; +} + +static const struct dfs_file_ops _mqueue_fops = { + .open = dfs_mqueue_open, + .close = dfs_mqueue_close, + .getdents = dfs_mqueue_getdents, +}; + +struct dfs_vnode *_dfs_mqueue_lookup(struct dfs_dentry *dentry) { + struct dfs_vnode *vnode = RT_NULL; + rt_size_t size; + // struct tmpfs_sb *superblock; + struct mqueue_file *mq_file; + + if (dentry == NULL || dentry->mnt == NULL) { + return NULL; + } + + if (dentry->pathname[0] == '/' && dentry->pathname[1] == '\0') { + } + + mq_file = dfs_mqueue_lookup(dentry->pathname + 1, &size); + + vnode = dfs_vnode_create(); + if (mq_file && mq_file->data) { + vnode->mode = S_IFREG | S_IRUSR | S_IWUSR | S_IXUSR; + vnode->type = FT_REGULAR; + vnode->mnt = dentry->mnt; + vnode->data = mq_file; + vnode->size = mq_file->size; + } else { + vnode->size = 0; + vnode->nlink = 1; + vnode->fops = &_mqueue_fops; + vnode->mnt = dentry->mnt; + vnode->type = FT_DIRECTORY; + vnode->mode = S_IFDIR | S_IRUSR | S_IWUSR | S_IXUSR; + } + return vnode; +} + +static const struct dfs_filesystem_ops _mqueue_ops = { + .name = "mqueue", + .flags = DFS_FS_FLAG_DEFAULT, + .default_fops = &_mqueue_fops, + + .mount = dfs_mqueue_mount, + .umount = dfs_mqueue_umount, + .statfs = dfs_mqueue_statfs, + + .unlink = dfs_mqueue_unlink, + .stat = dfs_mqueue_stat, + + .lookup = _dfs_mqueue_lookup, + .create_vnode = dfs_mqueue_create_vnode, + .free_vnode = dfs_mqueue_free_vnode +}; + +static struct dfs_filesystem_type _mqueue = { + .fs_ops = &_mqueue_ops, +}; + +int dfs_mqueue_init(void) { + /* register mqueue file system */ + dfs_register(&_mqueue); + mkdir("/dev/mqueue", 0x777); + if (dfs_mount(RT_NULL, "/dev/mqueue", "mqueue", 0, 0) != 0) { + rt_kprintf("Dir /dev/mqueue mount failed!\n"); + } + return 0; +} +INIT_COMPONENT_EXPORT(dfs_mqueue_init); diff --git a/components/dfs/dfs_v2/filesystems/mqueue/dfs_mqueue.h b/components/dfs/dfs_v2/filesystems/mqueue/dfs_mqueue.h new file mode 100644 index 0000000000..a2e1f71bc2 --- /dev/null +++ b/components/dfs/dfs_v2/filesystems/mqueue/dfs_mqueue.h @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2006-2023, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2023-07-04 zhkag first Version + */ + +#ifndef __DFS_MQUEUE_H__ +#define __DFS_MQUEUE_H__ + +#include + +struct mqueue_file { + char name[RT_NAME_MAX]; /* file name */ + rt_uint16_t msg_size; /**< message size of each message */ + rt_uint16_t max_msgs; /**< max number of messages */ + rt_list_t list; + rt_uint8_t *data; /* file date ptr */ + rt_size_t size; /* file size */ +}; + +struct mqueue_file *dfs_mqueue_lookup(const char *path, rt_size_t *size); +void dfs_mqueue_insert_after(rt_list_t *n); + +#endif diff --git a/components/libc/posix/ipc/Kconfig b/components/libc/posix/ipc/Kconfig index deaab1b3e3..2bec207754 100644 --- a/components/libc/posix/ipc/Kconfig +++ b/components/libc/posix/ipc/Kconfig @@ -26,6 +26,7 @@ config RT_USING_POSIX_MESSAGE_QUEUE bool "Enable posix message queue " select RT_USING_POSIX_CLOCK select RT_USING_MESSAGEQUEUE_PRIORITY + select RT_USING_DFS_MQUEUE default n config RT_USING_POSIX_MESSAGE_SEMAPHORE diff --git a/components/libc/posix/ipc/SConscript b/components/libc/posix/ipc/SConscript index 5ea9dea355..bee46adf19 100644 --- a/components/libc/posix/ipc/SConscript +++ b/components/libc/posix/ipc/SConscript @@ -9,7 +9,7 @@ inc = [cwd] # src += Glob('system-v/*.c') # inc += [cwd + '/system-v'] -if GetDepend('RT_USING_POSIX_MESSAGE_QUEUE'): +if GetDepend(['RT_USING_POSIX_MESSAGE_QUEUE', 'RT_USING_DFS_MQUEUE']): src += ['mqueue.c'] if GetDepend('RT_USING_POSIX_MESSAGE_SEMAPHORE'): diff --git a/components/libc/posix/ipc/mqueue.c b/components/libc/posix/ipc/mqueue.c index 49ce6bf98d..72b6c5b8f7 100644 --- a/components/libc/posix/ipc/mqueue.c +++ b/components/libc/posix/ipc/mqueue.c @@ -7,93 +7,10 @@ * Date Author Notes */ -#include -#include -#include -#include -#include -#include -#include +#include +#include #include "mqueue.h" -static mqdes_t posix_mq_list = RT_NULL; -static struct rt_semaphore posix_mq_lock; - -/* initialize posix mqueue */ -static int posix_mq_system_init(void) -{ - rt_sem_init(&posix_mq_lock, "pmq", 1, RT_IPC_FLAG_FIFO); - return 0; -} -INIT_COMPONENT_EXPORT(posix_mq_system_init); - -rt_inline void posix_mq_insert(mqdes_t pmq) -{ - if (posix_mq_list == RT_NULL) - pmq->mq_id = 1; - else - pmq->mq_id = posix_mq_list->mq_id + 1; - pmq->next = posix_mq_list; - posix_mq_list = pmq; -} - -static void posix_mq_delete(mqdes_t pmq) -{ - mqdes_t iter; - if (posix_mq_list == pmq) - { - posix_mq_list = pmq->next; - - rt_mq_delete(pmq->mq); - rt_free(pmq); - - return; - } - for (iter = posix_mq_list; iter->next != RT_NULL; iter = iter->next) - { - if (iter->next == pmq) - { - /* delete this mq */ - if (pmq->next != RT_NULL) - iter->next = pmq->next; - else - iter->next = RT_NULL; - - /* delete RT-Thread mqueue */ - rt_mq_delete(pmq->mq); - rt_free(pmq); - - return ; - } - } -} - -static mqdes_t posix_mq_find(const char *name) -{ - mqdes_t iter; - rt_object_t object; - - for (iter = posix_mq_list; iter != RT_NULL; iter = iter->next) - { - object = (rt_object_t)(iter->mq); - - if (strncmp(object->name, name, RT_NAME_MAX) == 0) - { - return iter; - } - } - - return RT_NULL; -} - -static mqdes_t posix_mq_id_find(mqd_t id) -{ - for (mqdes_t iter = posix_mq_list; iter != RT_NULL; iter = iter->next) - if (iter->mq_id == id) - return iter; - return RT_NULL; -} - int mq_setattr(mqd_t id, const struct mq_attr *mqstat, struct mq_attr *omqstat) @@ -109,18 +26,18 @@ RTM_EXPORT(mq_setattr); int mq_getattr(mqd_t id, struct mq_attr *mqstat) { - rt_sem_take(&posix_mq_lock, RT_WAITING_FOREVER); - mqdes_t mqdes = posix_mq_id_find(id); - rt_sem_release(&posix_mq_lock); - if ((mqdes == RT_NULL) || mqstat == RT_NULL) + rt_mq_t mq; + struct mqueue_file *mq_file; + mq_file = fd_get(id)->vnode->data; + mq = (rt_mq_t)mq_file->data; + if ((mq == RT_NULL) || mqstat == RT_NULL) { rt_set_errno(EBADF); - return -1; } - mqstat->mq_maxmsg = mqdes->mq->max_msgs; - mqstat->mq_msgsize = mqdes->mq->msg_size; + mqstat->mq_maxmsg = mq->max_msgs; + mqstat->mq_msgsize = mq->msg_size; mqstat->mq_curmsgs = 0; mqstat->mq_flags = 0; @@ -130,109 +47,88 @@ RTM_EXPORT(mq_getattr); mqd_t mq_open(const char *name, int oflag, ...) { + int mq_fd; va_list arg; mode_t mode; - mqdes_t mqdes = RT_NULL; struct mq_attr *attr = RT_NULL; + va_start(arg, oflag); + mode = (mode_t)va_arg(arg, unsigned int); + mode = (mode_t)mode; /* self-assignment avoids compiler optimization */ + attr = (struct mq_attr *)va_arg(arg, struct mq_attr *); + attr = (struct mq_attr *)attr; /* self-assignment avoids compiler optimization */ + va_end(arg); + if(*name == '/') + { + name++; + } - /* lock posix mqueue list */ - rt_sem_take(&posix_mq_lock, RT_WAITING_FOREVER); int len = rt_strlen(name); if (len > RT_NAME_MAX) { rt_set_errno(ENAMETOOLONG); - goto __return; + return (mqd_t)(-1); } - - mqdes = posix_mq_find(name); - if (mqdes != RT_NULL) + rt_size_t size; + struct mqueue_file *mq_file; + mq_file = dfs_mqueue_lookup(name, &size); + if(mq_file != RT_NULL) { if (oflag & O_CREAT && oflag & O_EXCL) { rt_set_errno(EEXIST); - rt_sem_release(&posix_mq_lock); return (mqd_t)(-1); } - mqdes->refcount++; /* increase reference count */ } else if (oflag & O_CREAT) { - va_start(arg, oflag); - mode = (mode_t)va_arg(arg, unsigned int); - mode = (mode_t)mode; /* self-assignment avoids compiler optimization */ - attr = (struct mq_attr *)va_arg(arg, struct mq_attr *); - attr = (struct mq_attr *)attr; /* self-assignment avoids compiler optimization */ - va_end(arg); - if (attr->mq_maxmsg <= 0) { rt_set_errno(EINVAL); - goto __return; + return (mqd_t)(-1); } + struct mqueue_file *mq_file; + mq_file = (struct mqueue_file *) rt_malloc (sizeof(struct mqueue_file)); - mqdes = (mqdes_t) rt_malloc (sizeof(struct mqdes)); - if (mqdes == RT_NULL) + if (mq_file == RT_NULL) { rt_set_errno(ENFILE); - goto __return; + return (mqd_t)(-1); } - - /* create RT-Thread message queue */ - mqdes->mq = rt_mq_create(name, attr->mq_msgsize, attr->mq_maxmsg, RT_IPC_FLAG_FIFO); - if (mqdes->mq == RT_NULL) /* create failed */ - { - rt_set_errno(ENFILE); - goto __return; - } - /* initialize reference count */ - mqdes->refcount = 1; - mqdes->unlinked = 0; - - /* insert mq to posix mq list */ - posix_mq_insert(mqdes); + mq_file->msg_size = attr->mq_msgsize; + mq_file->max_msgs = attr->mq_maxmsg; + mq_file->data = RT_NULL; + strncpy(mq_file->name, name, RT_NAME_MAX); + dfs_mqueue_insert_after(&(mq_file->list)); } else { rt_set_errno(ENOENT); - goto __return; + return (mqd_t)(-1); } - rt_sem_release(&posix_mq_lock); - return (mqd_t)(mqdes->mq_id); + const char* mq_path = "/dev/mqueue/"; + char mq_name[RT_NAME_MAX + 12] = {0}; + rt_sprintf(mq_name, "%s%s", mq_path, name); + mq_fd = open(mq_name, oflag); -__return: - /* release lock */ - rt_sem_release(&posix_mq_lock); - - /* release allocated memory */ - if (mqdes != RT_NULL) - { - if (mqdes->mq != RT_NULL) - { - /* delete RT-Thread message queue */ - rt_mq_delete(mqdes->mq); - } - rt_free(mqdes); - } - return (mqd_t)(-1); + return (mqd_t)(mq_fd); } RTM_EXPORT(mq_open); ssize_t mq_receive(mqd_t id, char *msg_ptr, size_t msg_len, unsigned *msg_prio) { - rt_sem_take(&posix_mq_lock, RT_WAITING_FOREVER); - mqdes_t mqdes = posix_mq_id_find(id); - rt_sem_release(&posix_mq_lock); + rt_mq_t mq; rt_err_t result; - - if ((mqdes == RT_NULL) || (msg_ptr == RT_NULL)) + struct mqueue_file *mq_file; + mq_file = fd_get(id)->vnode->data; + mq = (rt_mq_t)mq_file->data; + if ((mq == RT_NULL) || (msg_ptr == RT_NULL)) { rt_set_errno(EINVAL); - return -1; } - result = rt_mq_recv_prio(mqdes->mq, msg_ptr, msg_len, (rt_int32_t *)msg_prio, RT_WAITING_FOREVER, RT_UNINTERRUPTIBLE); + result = rt_mq_recv_prio(mq, msg_ptr, msg_len, (rt_int32_t *)msg_prio, RT_WAITING_FOREVER, RT_UNINTERRUPTIBLE); if (result >= 0) return rt_strlen(msg_ptr); @@ -243,19 +139,18 @@ RTM_EXPORT(mq_receive); int mq_send(mqd_t id, const char *msg_ptr, size_t msg_len, unsigned msg_prio) { - rt_sem_take(&posix_mq_lock, RT_WAITING_FOREVER); - mqdes_t mqdes = posix_mq_id_find(id); - rt_sem_release(&posix_mq_lock); + rt_mq_t mq; rt_err_t result; + struct mqueue_file *mq_file; + mq_file = fd_get(id)->vnode->data; + mq = (rt_mq_t)mq_file->data; - if ((mqdes == RT_NULL) || (msg_ptr == RT_NULL)) + if ((mq == RT_NULL) || (msg_ptr == RT_NULL)) { rt_set_errno(EINVAL); - return -1; } - - result = rt_mq_send_wait_prio(mqdes->mq, (void *)msg_ptr, msg_len, msg_prio, 0, RT_UNINTERRUPTIBLE); + result = rt_mq_send_wait_prio(mq, (void *)msg_ptr, msg_len, msg_prio, 0, RT_UNINTERRUPTIBLE); if (result == RT_EOK) return 0; @@ -271,23 +166,22 @@ ssize_t mq_timedreceive(mqd_t id, unsigned *msg_prio, const struct timespec *abs_timeout) { - rt_sem_take(&posix_mq_lock, RT_WAITING_FOREVER); - mqdes_t mqdes = posix_mq_id_find(id); - rt_sem_release(&posix_mq_lock); - int tick = 0; + rt_mq_t mq; rt_err_t result; - + int tick = 0; + struct mqueue_file *mq_file; + mq_file = fd_get(id)->vnode->data; + mq = (rt_mq_t)mq_file->data; /* parameters check */ - if ((mqdes == RT_NULL) || (msg_ptr == RT_NULL)) + if ((mq == RT_NULL) || (msg_ptr == RT_NULL)) { rt_set_errno(EINVAL); - return -1; } if (abs_timeout != RT_NULL) tick = rt_timespec_to_tick(abs_timeout); - result = rt_mq_recv_prio(mqdes->mq, msg_ptr, msg_len, (rt_int32_t *)msg_prio, tick, RT_UNINTERRUPTIBLE); + result = rt_mq_recv_prio(mq, msg_ptr, msg_len, (rt_int32_t *)msg_prio, tick, RT_UNINTERRUPTIBLE); if (result >= 0) return rt_strlen(msg_ptr); @@ -316,10 +210,11 @@ RTM_EXPORT(mq_timedsend); int mq_notify(mqd_t id, const struct sigevent *notification) { - rt_sem_take(&posix_mq_lock, RT_WAITING_FOREVER); - mqdes_t mqdes = posix_mq_id_find(id); - rt_sem_release(&posix_mq_lock); - if (mqdes == RT_NULL || mqdes->refcount == 0) + rt_mq_t mq; + struct mqueue_file *mq_file; + mq_file = fd_get(id)->vnode->data; + mq = (rt_mq_t)mq_file->data; + if (mq == RT_NULL) { rt_set_errno(EBADF); return -1; @@ -332,27 +227,7 @@ RTM_EXPORT(mq_notify); int mq_close(mqd_t id) { - rt_sem_take(&posix_mq_lock, RT_WAITING_FOREVER); - mqdes_t mqdes = posix_mq_id_find(id); - rt_sem_release(&posix_mq_lock); - if (mqdes == RT_NULL) - { - rt_set_errno(EBADF); - return -1; - } - - /* lock posix mqueue list */ - rt_sem_take(&posix_mq_lock, RT_WAITING_FOREVER); - mqdes->refcount --; - if (mqdes->refcount == 0) - { - /* delete from posix mqueue list */ - if (mqdes->unlinked) - posix_mq_delete(mqdes); - } - rt_sem_release(&posix_mq_lock); - - return 0; + return close(id); } RTM_EXPORT(mq_close); @@ -392,28 +267,13 @@ RTM_EXPORT(mq_close); */ int mq_unlink(const char *name) { - mqdes_t pmq; - - /* lock posix mqueue list */ - rt_sem_take(&posix_mq_lock, RT_WAITING_FOREVER); - pmq = posix_mq_find(name); - if (pmq != RT_NULL) + if(*name == '/') { - pmq->unlinked = 1; - if (pmq->refcount == 0) - { - /* remove this mqueue */ - posix_mq_delete(pmq); - } - rt_sem_release(&posix_mq_lock); - - return 0; + name++; } - rt_sem_release(&posix_mq_lock); - - /* no this entry */ - rt_set_errno(ENOENT); - - return -1; + const char *mq_path = "/dev/mqueue/"; + char mq_name[RT_NAME_MAX + 12] = {0}; + rt_sprintf(mq_name, "%s%s", mq_path, name); + return unlink(mq_name); } RTM_EXPORT(mq_unlink); diff --git a/components/libc/posix/ipc/mqueue.h b/components/libc/posix/ipc/mqueue.h index 665ebb20e7..154fbd17e4 100644 --- a/components/libc/posix/ipc/mqueue.h +++ b/components/libc/posix/ipc/mqueue.h @@ -10,24 +10,12 @@ #ifndef __MQUEUE_H__ #define __MQUEUE_H__ +#include #include -#include -#include -struct mqdes -{ - /* reference count and unlinked */ - rt_uint16_t refcount; - rt_uint16_t unlinked; - - /* RT-Thread message queue */ - rt_mq_t mq; - - int mq_id; - /* next posix mqueue */ - struct mqdes* next; -}; -typedef struct mqdes* mqdes_t; +#ifdef RT_USING_DFS_MQUEUE +#include "dfs_mqueue.h" +#endif typedef int mqd_t; diff --git a/components/mm/mm_page.c b/components/mm/mm_page.c index f72083a9d3..53df6a4e28 100644 --- a/components/mm/mm_page.c +++ b/components/mm/mm_page.c @@ -597,46 +597,42 @@ int rt_pages_free(void *addr, rt_uint32_t size_bits) void rt_page_list(void) __attribute__((alias("list_page"))); -#warning TODO: improve list page +#define PGNR2SIZE(nr) ((nr) * ARCH_PAGE_SIZE / 1024) + void list_page(void) { int i; - rt_size_t total = 0; + rt_size_t free = 0; + rt_size_t installed = page_nr + _high_pages_nr; rt_base_t level; level = rt_hw_interrupt_disable(); for (i = 0; i < RT_PAGE_MAX_ORDER; i++) { - struct rt_page *p = page_list_low[i]; + struct rt_page *lp = page_list_low[i]; + struct rt_page *hp = page_list_high[i]; rt_kprintf("level %d ", i); - while (p) + while (lp) { - total += (1UL << i); - rt_kprintf("[0x%08p]", rt_page_page2addr(p)); - p = p->next; + free += (1UL << i); + rt_kprintf("[0x%08p]", rt_page_page2addr(lp)); + lp = lp->next; } - rt_kprintf("\n"); - } - for (i = 0; i < RT_PAGE_MAX_ORDER; i++) - { - struct rt_page *p = page_list_high[i]; - - rt_kprintf("level %d ", i); - - while (p) + while (hp) { - total += (1UL << i); - rt_kprintf("[0x%08p]", rt_page_page2addr(p)); - p = p->next; + free += (1UL << i); + rt_kprintf("[0x%08p]", rt_page_page2addr(hp)); + hp = hp->next; } rt_kprintf("\n"); } rt_hw_interrupt_enable(level); - rt_kprintf("free pages is 0x%08lx (%ld KB)\n", total, total * ARCH_PAGE_SIZE / 1024); + rt_kprintf("-------------------------------\n"); + rt_kprintf("Page Summary:\n => free/installed: 0x%lx/0x%lx (%ld/%ld KB)\n", free, installed, PGNR2SIZE(free), PGNR2SIZE(installed)); rt_kprintf("-------------------------------\n"); } MSH_CMD_EXPORT(list_page, show page info); diff --git a/components/utilities/ulog/ulog.c b/components/utilities/ulog/ulog.c index c83d40dbfe..359677d333 100644 --- a/components/utilities/ulog/ulog.c +++ b/components/utilities/ulog/ulog.c @@ -559,49 +559,53 @@ static void do_output(rt_uint32_t level, const char *tag, rt_bool_t is_raw, cons { #ifdef ULOG_USING_ASYNC_OUTPUT rt_size_t log_buf_size = log_len + sizeof((char)'\0'); - - if (is_raw == RT_FALSE) + if (ulog.async_enabled) { - rt_rbb_blk_t log_blk; - ulog_frame_t log_frame; - - /* allocate log frame */ - log_blk = rt_rbb_blk_alloc(ulog.async_rbb, RT_ALIGN(sizeof(struct ulog_frame) + log_buf_size, RT_ALIGN_SIZE)); - if (log_blk) + if (is_raw == RT_FALSE) { - /* package the log frame */ - log_frame = (ulog_frame_t) log_blk->buf; - log_frame->magic = ULOG_FRAME_MAGIC; - log_frame->is_raw = is_raw; - log_frame->level = level; - log_frame->log_len = log_len; - log_frame->tag = tag; - log_frame->log = (const char *)log_blk->buf + sizeof(struct ulog_frame); - /* copy log data */ - rt_strncpy((char *)(log_blk->buf + sizeof(struct ulog_frame)), log_buf, log_buf_size); - /* put the block */ - rt_rbb_blk_put(log_blk); + rt_rbb_blk_t log_blk; + ulog_frame_t log_frame; + + /* allocate log frame */ + log_blk = rt_rbb_blk_alloc(ulog.async_rbb, RT_ALIGN(sizeof(struct ulog_frame) + log_buf_size, RT_ALIGN_SIZE)); + if (log_blk) + { + /* package the log frame */ + log_frame = (ulog_frame_t) log_blk->buf; + log_frame->magic = ULOG_FRAME_MAGIC; + log_frame->is_raw = is_raw; + log_frame->level = level; + log_frame->log_len = log_len; + log_frame->tag = tag; + log_frame->log = (const char *)log_blk->buf + sizeof(struct ulog_frame); + /* copy log data */ + rt_strncpy((char *)(log_blk->buf + sizeof(struct ulog_frame)), log_buf, log_buf_size); + /* put the block */ + rt_rbb_blk_put(log_blk); + /* send a notice */ + rt_sem_release(&ulog.async_notice); + } + else + { + static rt_bool_t already_output = RT_FALSE; + if (already_output == RT_FALSE) + { + rt_kprintf("Warning: There is no enough buffer for saving async log," + " please increase the ULOG_ASYNC_OUTPUT_BUF_SIZE option.\n"); + already_output = RT_TRUE; + } + } + } + else if (ulog.async_rb) + { + rt_ringbuffer_put(ulog.async_rb, (const rt_uint8_t *)log_buf, (rt_uint16_t)log_buf_size); /* send a notice */ rt_sem_release(&ulog.async_notice); } - else - { - static rt_bool_t already_output = RT_FALSE; - if (already_output == RT_FALSE) - { - rt_kprintf("Warning: There is no enough buffer for saving async log," - " please increase the ULOG_ASYNC_OUTPUT_BUF_SIZE option.\n"); - already_output = RT_TRUE; - } - } + + return; } - else if (ulog.async_rb) - { - rt_ringbuffer_put(ulog.async_rb, (const rt_uint8_t *)log_buf, (rt_uint16_t)log_buf_size); - /* send a notice */ - rt_sem_release(&ulog.async_notice); - } -#else +#endif /* ULOG_USING_ASYNC_OUTPUT */ /* is in thread context */ if (rt_interrupt_get_nest() == 0) { @@ -618,7 +622,6 @@ static void do_output(rt_uint32_t level, const char *tag, rt_bool_t is_raw, cons ulog_console_backend_output(RT_NULL, level, tag, is_raw, log_buf, log_len); #endif /* ULOG_BACKEND_USING_CONSOLE */ } -#endif /* ULOG_USING_ASYNC_OUTPUT */ } /**