diff --git a/bsp/ra6m4-cpk/.config b/bsp/ra6m4-cpk/.config index cac101664f..3b36572e22 100644 --- a/bsp/ra6m4-cpk/.config +++ b/bsp/ra6m4-cpk/.config @@ -574,6 +574,8 @@ CONFIG_SOC_SERIES_R7FA6M4AF=y # On-chip Peripheral Drivers # CONFIG_BSP_USING_GPIO=y +# CONFIG_BSP_USING_ONCHIP_FLASH is not set +# CONFIG_BSP_USING_WDT is not set CONFIG_BSP_USING_UART=y CONFIG_BSP_USING_UART7=y # CONFIG_BSP_UART7_RX_USING_DMA is not set @@ -581,11 +583,11 @@ CONFIG_BSP_USING_UART7=y CONFIG_BSP_UART7_RX_BUFSIZE=256 CONFIG_BSP_UART7_TX_BUFSIZE=0 # CONFIG_BSP_USING_I2C is not set -# CONFIG_BSP_USING_WDT is not set # CONFIG_BSP_USING_ONCHIP_RTC is not set # CONFIG_BSP_USING_SPI is not set # CONFIG_BSP_USING_ADC is not set # CONFIG_BSP_USING_DAC is not set +# CONFIG_BSP_USING_PWM is not set # # Board extended module Drivers diff --git a/bsp/ra6m4-cpk/.settings/standalone.prefs b/bsp/ra6m4-cpk/.settings/standalone.prefs index ee88b72efb..99ce253417 100644 --- a/bsp/ra6m4-cpk/.settings/standalone.prefs +++ b/bsp/ra6m4-cpk/.settings/standalone.prefs @@ -1,19 +1,21 @@ -#Tue Oct 26 21:18:08 CST 2021 +#Wed Nov 03 20:31:16 CST 2021 com.renesas.cdt.ddsc.content/com.renesas.cdt.ddsc.content.defaultlinkerscript=script/fsp.scat com.renesas.cdt.ddsc.packs.componentfiles/Renesas\#\#BSP\#\#ra6m4\#\#device\#\#\#\#3.1.0/libraries= -com.renesas.cdt.ddsc.packs.componentfiles/Renesas\#\#HAL\ Drivers\#\#all\#\#r_ioport\#\#\#\#3.1.0/all=1957950123,ra/fsp/inc/api/r_ioport_api.h|1390983687,ra/fsp/inc/instances/r_ioport.h|3204787724,ra/fsp/src/r_ioport/r_ioport.c +com.renesas.cdt.ddsc.packs.componentfiles/Renesas\#\#HAL\ Drivers\#\#all\#\#r_ioport\#\#\#\#3.1.0/all=1390983687,ra/fsp/inc/instances/r_ioport.h|3204787724,ra/fsp/src/r_ioport/r_ioport.c|1957950123,ra/fsp/inc/api/r_ioport_api.h com.renesas.cdt.ddsc.packs.componentfiles/Renesas\#\#HAL\ Drivers\#\#all\#\#r_sci_uart\#\#\#\#3.1.0/libraries= +com.renesas.cdt.ddsc.packs.componentfiles/Renesas\#\#HAL\ Drivers\#\#all\#\#r_icu\#\#\#\#3.1.0/all=2545672180,ra/fsp/inc/instances/r_icu.h|3018483678,ra/fsp/src/r_icu/r_icu.c|1906465970,ra/fsp/inc/api/r_external_irq_api.h com.renesas.cdt.ddsc.packs.componentfiles/Renesas\#\#BSP\#\#Board\#\#ra6m4_cpk\#\#\#\#3.1.0/libraries= com.renesas.cdt.ddsc.packs.componentfiles/Renesas\#\#BSP\#\#ra6m4\#\#device\#\#\#\#3.1.0/all=2308894280,ra/fsp/src/bsp/cmsis/Device/RENESAS/Include/system.h -com.renesas.cdt.ddsc.packs.componentfiles/Renesas\#\#Common\#\#all\#\#fsp_common\#\#\#\#3.1.0/all=3581546608,ra/fsp/inc/fsp_common_api.h|2247478812,ra/fsp/src/bsp/mcu/all/bsp_module_stop.h|3983299396,ra/fsp/src/bsp/mcu/all/bsp_delay.h|2308894280,ra/fsp/src/bsp/cmsis/Device/RENESAS/Include/system.h|1222394411,ra/fsp/src/bsp/mcu/all/bsp_io.c|731782070,ra/fsp/src/bsp/mcu/all/bsp_irq.h|568600546,ra/fsp/src/bsp/cmsis/Device/RENESAS/Source/startup.c|1390983687,ra/fsp/inc/instances/r_ioport.h|496115995,ra/fsp/src/bsp/mcu/all/bsp_register_protection.c|1552630912,ra/fsp/src/bsp/mcu/all/bsp_guard.h|3590501432,ra/fsp/src/bsp/mcu/all/bsp_io.h|521902797,ra/fsp/src/bsp/mcu/all/bsp_security.h|1630997354,ra/fsp/src/bsp/mcu/all/bsp_irq.c|2920829723,ra/fsp/src/bsp/mcu/all/bsp_guard.c|400573940,ra/fsp/src/bsp/mcu/all/bsp_register_protection.h|905231975,ra/fsp/src/bsp/mcu/all/bsp_clocks.c|1992062042,ra/fsp/src/bsp/mcu/all/bsp_compiler_support.h|1868795951,ra/fsp/inc/fsp_features.h|3984836408,ra/fsp/src/bsp/mcu/all/bsp_group_irq.h|2966752275,ra/fsp/src/bsp/mcu/all/bsp_delay.c|3098075304,ra/fsp/src/bsp/mcu/all/bsp_clocks.h|2556589544,ra/fsp/src/bsp/mcu/all/bsp_group_irq.c|2812024316,ra/fsp/src/bsp/mcu/all/bsp_common.h|1957950123,ra/fsp/inc/api/r_ioport_api.h|2906400,ra/fsp/src/bsp/mcu/all/bsp_common.c|3520119047,ra/fsp/src/bsp/cmsis/Device/RENESAS/Include/base_addresses.h|2977689308,ra/fsp/src/bsp/mcu/all/bsp_mcu_api.h|2006974055,ra/fsp/inc/api/bsp_api.h|3819230577,ra/fsp/src/bsp/cmsis/Device/RENESAS/Source/system.c|3131094294,ra/fsp/src/bsp/mcu/all/bsp_rom_registers.c|1982083345,ra/fsp/src/bsp/mcu/all/bsp_security.c|1615019982,ra/fsp/src/bsp/mcu/all/bsp_sbrk.c|3366593968,ra/fsp/src/bsp/cmsis/Device/RENESAS/Include/renesas.h|4191472725,ra/fsp/inc/fsp_version.h +com.renesas.cdt.ddsc.packs.componentfiles/Renesas\#\#Common\#\#all\#\#fsp_common\#\#\#\#3.1.0/all=568600546,ra/fsp/src/bsp/cmsis/Device/RENESAS/Source/startup.c|2977689308,ra/fsp/src/bsp/mcu/all/bsp_mcu_api.h|1222394411,ra/fsp/src/bsp/mcu/all/bsp_io.c|3098075304,ra/fsp/src/bsp/mcu/all/bsp_clocks.h|905231975,ra/fsp/src/bsp/mcu/all/bsp_clocks.c|3590501432,ra/fsp/src/bsp/mcu/all/bsp_io.h|1868795951,ra/fsp/inc/fsp_features.h|2556589544,ra/fsp/src/bsp/mcu/all/bsp_group_irq.c|3581546608,ra/fsp/inc/fsp_common_api.h|3984836408,ra/fsp/src/bsp/mcu/all/bsp_group_irq.h|496115995,ra/fsp/src/bsp/mcu/all/bsp_register_protection.c|2812024316,ra/fsp/src/bsp/mcu/all/bsp_common.h|1390983687,ra/fsp/inc/instances/r_ioport.h|521902797,ra/fsp/src/bsp/mcu/all/bsp_security.h|4191472725,ra/fsp/inc/fsp_version.h|2247478812,ra/fsp/src/bsp/mcu/all/bsp_module_stop.h|3131094294,ra/fsp/src/bsp/mcu/all/bsp_rom_registers.c|400573940,ra/fsp/src/bsp/mcu/all/bsp_register_protection.h|2906400,ra/fsp/src/bsp/mcu/all/bsp_common.c|2308894280,ra/fsp/src/bsp/cmsis/Device/RENESAS/Include/system.h|3366593968,ra/fsp/src/bsp/cmsis/Device/RENESAS/Include/renesas.h|3520119047,ra/fsp/src/bsp/cmsis/Device/RENESAS/Include/base_addresses.h|2920829723,ra/fsp/src/bsp/mcu/all/bsp_guard.c|1982083345,ra/fsp/src/bsp/mcu/all/bsp_security.c|1552630912,ra/fsp/src/bsp/mcu/all/bsp_guard.h|1992062042,ra/fsp/src/bsp/mcu/all/bsp_compiler_support.h|3819230577,ra/fsp/src/bsp/cmsis/Device/RENESAS/Source/system.c|3983299396,ra/fsp/src/bsp/mcu/all/bsp_delay.h|2966752275,ra/fsp/src/bsp/mcu/all/bsp_delay.c|731782070,ra/fsp/src/bsp/mcu/all/bsp_irq.h|1615019982,ra/fsp/src/bsp/mcu/all/bsp_sbrk.c|1630997354,ra/fsp/src/bsp/mcu/all/bsp_irq.c|2006974055,ra/fsp/inc/api/bsp_api.h|1957950123,ra/fsp/inc/api/r_ioport_api.h com.renesas.cdt.ddsc.packs.componentfiles/Arm\#\#CMSIS\#\#CMSIS5\#\#CoreM\#\#\#\#5.7.0+fsp.3.1.0/libraries= -com.renesas.cdt.ddsc.settingseditor/com.renesas.cdt.ddsc.settingseditor.active_page=PinConfiguration +com.renesas.cdt.ddsc.settingseditor/com.renesas.cdt.ddsc.settingseditor.active_page=SWPConfigurator +com.renesas.cdt.ddsc.packs.componentfiles/Renesas\#\#HAL\ Drivers\#\#all\#\#r_icu\#\#\#\#3.1.0/libraries= com.renesas.cdt.ddsc.packs.componentfiles/Renesas\#\#HAL\ Drivers\#\#all\#\#r_ioport\#\#\#\#3.1.0/libraries= com.renesas.cdt.ddsc.packs.componentfiles/Renesas\#\#BSP\#\#ra6m4\#\#device\#\#R7FA6M4AF3CFB\#\#3.1.0/libraries= -com.renesas.cdt.ddsc.packs.componentfiles/Arm\#\#CMSIS\#\#CMSIS5\#\#CoreM\#\#\#\#5.7.0+fsp.3.1.0/all=546157604,ra/arm/CMSIS_5/CMSIS/Core/Include/core_armv8mml.h|1372010515,ra/arm/CMSIS_5/CMSIS/Core/Include/core_cm23.h|1078551279,ra/arm/CMSIS_5/CMSIS/Core/Include/core_sc300.h|2333906976,ra/arm/CMSIS_5/CMSIS/Core/Include/cmsis_version.h|1536854638,ra/arm/CMSIS_5/CMSIS/Core/Include/mpu_armv8.h|206980015,ra/arm/CMSIS_5/CMSIS/Core/Include/mpu_armv7.h|3007265674,ra/arm/CMSIS_5/CMSIS/Core/Include/core_armv8mbl.h|2024281644,ra/arm/CMSIS_5/CMSIS/Core/Include/cmsis_armclang_ltm.h|1017116116,ra/arm/CMSIS_5/CMSIS/Core/Include/cmsis_compiler.h|4231934849,ra/arm/CMSIS_5/CMSIS/Core/Include/cmsis_iccarm.h|2748964184,ra/arm/CMSIS_5/CMSIS/Core/Include/cachel1_armv7.h|377628369,ra/arm/CMSIS_5/CMSIS/Core/Include/core_cm55.h|637879414,ra/arm/CMSIS_5/CMSIS/Core/Include/core_cm33.h|4005730526,ra/arm/CMSIS_5/CMSIS/Core/Include/pmu_armv8.h|2327633156,ra/arm/CMSIS_5/CMSIS/Core/Include/core_sc000.h|2635219934,ra/arm/CMSIS_5/CMSIS/Core/Include/tz_context.h|3589068132,ra/arm/CMSIS_5/CMSIS/Core/Include/cmsis_armcc.h|2851112248,ra/arm/CMSIS_5/CMSIS/Core/Include/core_cm1.h|3021372151,ra/arm/CMSIS_5/CMSIS/Core/Include/cmsis_gcc.h|1562896660,ra/arm/CMSIS_5/CMSIS/Core/Include/core_cm35p.h|1745843273,ra/arm/CMSIS_5/CMSIS/Core/Include/core_cm0.h|2491522803,ra/arm/CMSIS_5/CMSIS/Core/Include/cmsis_armclang.h|1441545198,ra/arm/CMSIS_5/LICENSE.txt|3602366610,ra/arm/CMSIS_5/CMSIS/Core/Include/core_cm3.h|3779323067,ra/arm/CMSIS_5/CMSIS/Core/Include/core_cm4.h|3442821435,ra/arm/CMSIS_5/CMSIS/Core/Include/core_cm7.h|4290386133,ra/arm/CMSIS_5/CMSIS/Core/Include/core_cm0plus.h|2686445441,ra/arm/CMSIS_5/CMSIS/Core/Include/core_armv81mml.h -com.renesas.cdt.ddsc.packs.componentfiles/Renesas\#\#HAL\ Drivers\#\#all\#\#r_sci_uart\#\#\#\#3.1.0/all=2349328507,ra/fsp/src/r_sci_uart/r_sci_uart.c|853178775,ra/fsp/inc/api/r_uart_api.h|1610456547,ra/fsp/inc/api/r_transfer_api.h|1672784957,ra/fsp/inc/instances/r_sci_uart.h -com.renesas.cdt.ddsc.packs.componentfiles/Renesas\#\#BSP\#\#ra6m4\#\#fsp\#\#\#\#3.1.0/all=3571093944,ra/fsp/src/bsp/mcu/ra6m4/bsp_elc.h|2347061782,ra/fsp/src/bsp/mcu/ra6m4/bsp_mcu_info.h|3852442662,ra/fsp/src/bsp/mcu/ra6m4/bsp_feature.h +com.renesas.cdt.ddsc.packs.componentfiles/Arm\#\#CMSIS\#\#CMSIS5\#\#CoreM\#\#\#\#5.7.0+fsp.3.1.0/all=2686445441,ra/arm/CMSIS_5/CMSIS/Core/Include/core_armv81mml.h|2491522803,ra/arm/CMSIS_5/CMSIS/Core/Include/cmsis_armclang.h|2748964184,ra/arm/CMSIS_5/CMSIS/Core/Include/cachel1_armv7.h|1017116116,ra/arm/CMSIS_5/CMSIS/Core/Include/cmsis_compiler.h|3007265674,ra/arm/CMSIS_5/CMSIS/Core/Include/core_armv8mbl.h|3589068132,ra/arm/CMSIS_5/CMSIS/Core/Include/cmsis_armcc.h|1536854638,ra/arm/CMSIS_5/CMSIS/Core/Include/mpu_armv8.h|206980015,ra/arm/CMSIS_5/CMSIS/Core/Include/mpu_armv7.h|4005730526,ra/arm/CMSIS_5/CMSIS/Core/Include/pmu_armv8.h|1372010515,ra/arm/CMSIS_5/CMSIS/Core/Include/core_cm23.h|1078551279,ra/arm/CMSIS_5/CMSIS/Core/Include/core_sc300.h|546157604,ra/arm/CMSIS_5/CMSIS/Core/Include/core_armv8mml.h|2333906976,ra/arm/CMSIS_5/CMSIS/Core/Include/cmsis_version.h|1441545198,ra/arm/CMSIS_5/LICENSE.txt|1562896660,ra/arm/CMSIS_5/CMSIS/Core/Include/core_cm35p.h|2327633156,ra/arm/CMSIS_5/CMSIS/Core/Include/core_sc000.h|2635219934,ra/arm/CMSIS_5/CMSIS/Core/Include/tz_context.h|3021372151,ra/arm/CMSIS_5/CMSIS/Core/Include/cmsis_gcc.h|3602366610,ra/arm/CMSIS_5/CMSIS/Core/Include/core_cm3.h|4290386133,ra/arm/CMSIS_5/CMSIS/Core/Include/core_cm0plus.h|2851112248,ra/arm/CMSIS_5/CMSIS/Core/Include/core_cm1.h|1745843273,ra/arm/CMSIS_5/CMSIS/Core/Include/core_cm0.h|2024281644,ra/arm/CMSIS_5/CMSIS/Core/Include/cmsis_armclang_ltm.h|4231934849,ra/arm/CMSIS_5/CMSIS/Core/Include/cmsis_iccarm.h|3442821435,ra/arm/CMSIS_5/CMSIS/Core/Include/core_cm7.h|637879414,ra/arm/CMSIS_5/CMSIS/Core/Include/core_cm33.h|377628369,ra/arm/CMSIS_5/CMSIS/Core/Include/core_cm55.h|3779323067,ra/arm/CMSIS_5/CMSIS/Core/Include/core_cm4.h +com.renesas.cdt.ddsc.packs.componentfiles/Renesas\#\#HAL\ Drivers\#\#all\#\#r_sci_uart\#\#\#\#3.1.0/all=2349328507,ra/fsp/src/r_sci_uart/r_sci_uart.c|1672784957,ra/fsp/inc/instances/r_sci_uart.h|1610456547,ra/fsp/inc/api/r_transfer_api.h|853178775,ra/fsp/inc/api/r_uart_api.h +com.renesas.cdt.ddsc.packs.componentfiles/Renesas\#\#BSP\#\#ra6m4\#\#fsp\#\#\#\#3.1.0/all=2347061782,ra/fsp/src/bsp/mcu/ra6m4/bsp_mcu_info.h|3852442662,ra/fsp/src/bsp/mcu/ra6m4/bsp_feature.h|3571093944,ra/fsp/src/bsp/mcu/ra6m4/bsp_elc.h com.renesas.cdt.ddsc.packs.componentfiles/Renesas\#\#Common\#\#all\#\#fsp_common\#\#\#\#3.1.0/libraries= com.renesas.cdt.ddsc.threads.configurator/collapse/module.driver.uart_on_sci_uart.813326093=false -com.renesas.cdt.ddsc.packs.componentfiles/Renesas\#\#BSP\#\#Board\#\#ra6m4_cpk\#\#\#\#3.1.0/all=3938710240,ra/board/ra6m4_cpk/board_leds.c|3343992478,ra/board/ra6m4_cpk/board.h|2525887392,ra/board/ra6m4_cpk/board_ethernet_phy.h|3559227370,ra/board/ra6m4_cpk/board_init.c|3843040667,ra/board/ra6m4_cpk/board_leds.h|2967196421,ra/board/ra6m4_cpk/board_init.h +com.renesas.cdt.ddsc.packs.componentfiles/Renesas\#\#BSP\#\#Board\#\#ra6m4_cpk\#\#\#\#3.1.0/all=3843040667,ra/board/ra6m4_cpk/board_leds.h|2525887392,ra/board/ra6m4_cpk/board_ethernet_phy.h|3559227370,ra/board/ra6m4_cpk/board_init.c|2967196421,ra/board/ra6m4_cpk/board_init.h|3343992478,ra/board/ra6m4_cpk/board.h|3938710240,ra/board/ra6m4_cpk/board_leds.c com.renesas.cdt.ddsc.packs.componentfiles/Renesas\#\#BSP\#\#ra6m4\#\#fsp\#\#\#\#3.1.0/libraries= diff --git a/bsp/ra6m4-cpk/README.md b/bsp/ra6m4-cpk/README.md index fdb3a742b8..a58570c97f 100644 --- a/bsp/ra6m4-cpk/README.md +++ b/bsp/ra6m4-cpk/README.md @@ -25,20 +25,23 @@ **更多详细资料及工具** - ## 外设支持 本 BSP 目前对外设的支持情况如下: -| **片上外设** | **支持情况** | **备注** | -| :----------- | :---------- | :------------------------ | -| UART | 支持 | UART7 | -| GPIO | 支持 | | -| IIC | 支持 | 软件 | -| WDT | 支持 | | -| RTC | 支持 | | -| 持续更新中... | | | - +| **片上外设** | **支持情况** | **备注** | +| :----------------- | :----------------- | :------------- | +| UART | 支持 | UART7 | +| GPIO | 支持 | | +| IIC | 支持 | 软件 | +| WDT | 支持 | | +| RTC | 支持 | | +| ADC | 支持 | | +| DAC | 支持 | | +| SPI | 支持 | | +| FLASH | 支持 | | +| PWM | 支持 | | +| 持续更新中... | | | ## 使用说明 @@ -46,16 +49,14 @@ - 快速上手 - 本章节是为刚接触 RT-Thread 的新手准备的使用说明,遵循简单的步骤即可将 RT-Thread 操作系统运行在该开发板上,看到实验效果 。 - + 本章节是为刚接触 RT-Thread 的新手准备的使用说明,遵循简单的步骤即可将 RT-Thread 操作系统运行在该开发板上,看到实验效果 。 - 进阶使用 - 本章节是为需要在 RT-Thread 操作系统上使用更多开发板资源的开发者准备的。通过使用 ENV 工具对 BSP 进行配置,可以开启更多板载资源,实现更多高级功能。 - + 本章节是为需要在 RT-Thread 操作系统上使用更多开发板资源的开发者准备的。通过使用 ENV 工具对 BSP 进行配置,可以开启更多板载资源,实现更多高级功能。 ### 快速上手 -本 BSP 为目前仅为开发者提供 MDK5 工程。下面以 MDK5 开发环境为例,介绍如何将系统运行起来。 +本 BSP 目前仅提供 MDK5 工程。下面以 MDK5 开发环境为例,介绍如何将系统运行起来。 **硬件连接** @@ -134,47 +135,40 @@ void hal_entry(void) ### 进阶使用 +**资料及文档** + +- [开发板官网主页](https://www2.renesas.cn/cn/zh/products/microcontrollers-microprocessors/ra-cortex-m-mcus/cpk-ra6m4-evaluation-board) +- [开发板用户手册](https://www2.renesas.cn/cn/zh/document/mah/1527156?language=zh&r=1527191) +- [瑞萨RA MCU 基础知识](https://www2.renesas.cn/cn/zh/document/gde/1520091) +- [RA6 MCU 快速设计指南](https://www2.renesas.cn/cn/zh/document/apn/ra6-quick-design-guide) +- [RA6M4_datasheet](https://www2.renesas.cn/cn/zh/document/dst/ra6m4-group-datasheet) +- [RA6M4 Group User’s Manual: Hardware](https://www2.renesas.cn/cn/zh/document/man/ra6m4-group-user-s-manual-hardware) + +**FSP 配置** + +需要修改瑞萨的 BSP 外设配置或添加新的外设端口,需要用到瑞萨的 [FSP](https://www2.renesas.cn/jp/zh/software-tool/flexible-software-package-fsp#document) 配置工具。请务必按照如下步骤完成配置。配置中有任何问题可到[RT-Thread 社区论坛](https://club.rt-thread.org/)中提问。 + +1. [下载灵活配置软件包 (FSP) | Renesas](https://www.renesas.com/cn/zh/software-tool/flexible-software-package-fsp) +2. 下载安装完成后,需要添加 CPK-RA6M4 开发板的[官方板级支持包](https://www2.renesas.cn/document/sws/1527176?language=zh&r=1527191) +3. 如何将 BSP 配置包添加到 FSP 中,请参考文档[如何导入板级支持包](https://www2.renesas.cn/document/ppt/1527171?language=zh&r=1527191) +4. 请查看文档:[使用瑞萨 FSP 配置工具](./docs/使用瑞萨FSP配置工具.md)。在 MDK 中通过添加自定义命名来打开当前工程的 FSP 配置, + **ENV 配置** - 如何使用 ENV 工具:[RT-Thread env 工具用户手册](https://www.rt-thread.org/document/site/#/development-tools/env/env) -此 BSP 默认只开启了 串口7 的功能,如果需使用更多高级功能例如组件、软件包等,需要利用 ENV 工具进行配置。步骤如下: +此 BSP 默认只开启了 串口7 的功能,如果需使用更多高级功能例如组件、软件包等,需要利用 ENV 工具进行配置。 +步骤如下: 1. 在 bsp 下打开 env 工具。 - 2. 输入`menuconfig`命令配置工程,配置好之后保存退出。 - 3. 输入`pkgs --update`命令更新软件包。 - 4. 输入`scons --target=mdk5` 命令重新生成工程。 -**FSP 配置** - -如果需要修改瑞萨的 BSP 外设配置或者需要添加新的外设端口,需要用到瑞萨的 FSP 配置工具。 - -1. [下载灵活配置软件包 (FSP) | Renesas](https://www.renesas.com/cn/zh/software-tool/flexible-software-package-fsp) -2. 下载安装完成后,需要添加这款开发板的官方[CPK-RA6M4板级支持包](https://www2.renesas.cn/document/sws/1527176?language=zh&r=1527191) -3. 如何将BSP配置包添加到 FSP 中,请参考文档[如何导入板级支持包](https://www2.renesas.cn/document/ppt/1527171?language=zh&r=1527191) -4. 在 MDK 中添加自定义命名来打开当前工程的配置详细步骤,请查看文档: [使用瑞萨 FSP 配置工具](./docs/使用瑞萨FSP配置工具.md) - -## 更多资料及文档 - -- [开发板官网主页](https://www2.renesas.cn/cn/zh/products/microcontrollers-microprocessors/ra-cortex-m-mcus/cpk-ra6m4-evaluation-board) - -- [开发板用户手册](https://www2.renesas.cn/cn/zh/document/mah/1527156?language=zh&r=1527191) - -- [瑞萨RA MCU 基础知识](https://www2.renesas.cn/cn/zh/document/gde/1520091) - -- [RA6 MCU 快速设计指南](https://www2.renesas.cn/cn/zh/document/apn/ra6-quick-design-guide) - -- [RA6M4_datasheet](https://www2.renesas.cn/cn/zh/document/dst/ra6m4-group-datasheet) - -- [RA6M4 Group User’s Manual: Hardware](https://www2.renesas.cn/cn/zh/document/man/ra6m4-group-user-s-manual-hardware) - ## 联系人信息 在使用过程中若您有任何的想法和建议,建议您通过以下方式来联系到我们 [RT-Thread 社区论坛](https://club.rt-thread.org/) ## 贡献代码 -如果您对 CPK-RA6M4 感兴趣,并且有一些好玩的项目愿意与大家分享的话欢迎给我们贡献代码,您可以参考 [向 RT-Thread 代码贡献](https://www.rt-thread.org/document/site/#/rt-thread-version/rt-thread-standard/development-guide/github/github) 。 \ No newline at end of file +如果您对 CPK-RA6M4 感兴趣,并且有一些好玩的项目愿意与大家分享的话欢迎给我们贡献代码,您可以参考 [向 RT-Thread 代码贡献](https://www.rt-thread.org/document/site/#/rt-thread-version/rt-thread-standard/development-guide/github/github) 。 diff --git a/bsp/ra6m4-cpk/buildinfo.gpdsc b/bsp/ra6m4-cpk/buildinfo.gpdsc index 24f3ff4bda..d70f167058 100644 --- a/bsp/ra6m4-cpk/buildinfo.gpdsc +++ b/bsp/ra6m4-cpk/buildinfo.gpdsc @@ -58,62 +58,50 @@ + + - - - - - - - - - - - - - + - - @@ -127,6 +115,7 @@ + diff --git a/bsp/ra6m4-cpk/configuration.xml b/bsp/ra6m4-cpk/configuration.xml index 577e43299b..a20ca08969 100644 --- a/bsp/ra6m4-cpk/configuration.xml +++ b/bsp/ra6m4-cpk/configuration.xml @@ -163,6 +163,10 @@ SCI UART Renesas.RA.3.1.0.pack + + External Interrupt + Renesas.RA.3.1.0.pack + @@ -196,13 +200,26 @@ + + + + + + + + + + + + + @@ -331,6 +348,8 @@ + + @@ -362,8 +381,8 @@ - - + + diff --git a/bsp/ra6m4-cpk/docs/picture/1635909864954.png b/bsp/ra6m4-cpk/docs/picture/1635909864954.png new file mode 100644 index 0000000000..f8a1333083 Binary files /dev/null and b/bsp/ra6m4-cpk/docs/picture/1635909864954.png differ diff --git a/bsp/ra6m4-cpk/docs/picture/1635929089445.png b/bsp/ra6m4-cpk/docs/picture/1635929089445.png new file mode 100644 index 0000000000..3574c5c491 Binary files /dev/null and b/bsp/ra6m4-cpk/docs/picture/1635929089445.png differ diff --git a/bsp/ra6m4-cpk/docs/picture/import_changes.png b/bsp/ra6m4-cpk/docs/picture/import_changes.png new file mode 100644 index 0000000000..ed6794cd1f Binary files /dev/null and b/bsp/ra6m4-cpk/docs/picture/import_changes.png differ diff --git a/bsp/ra6m4-cpk/docs/picture/irq0.png b/bsp/ra6m4-cpk/docs/picture/irq0.png new file mode 100644 index 0000000000..46a3d04b50 Binary files /dev/null and b/bsp/ra6m4-cpk/docs/picture/irq0.png differ diff --git a/bsp/ra6m4-cpk/docs/picture/irq1.png b/bsp/ra6m4-cpk/docs/picture/irq1.png new file mode 100644 index 0000000000..9a2032978f Binary files /dev/null and b/bsp/ra6m4-cpk/docs/picture/irq1.png differ diff --git a/bsp/ra6m4-cpk/docs/picture/p105.png b/bsp/ra6m4-cpk/docs/picture/p105.png new file mode 100644 index 0000000000..1eccce075c Binary files /dev/null and b/bsp/ra6m4-cpk/docs/picture/p105.png differ diff --git a/bsp/ra6m4-cpk/docs/picture/pwm_env.png b/bsp/ra6m4-cpk/docs/picture/pwm_env.png new file mode 100644 index 0000000000..65319f4312 Binary files /dev/null and b/bsp/ra6m4-cpk/docs/picture/pwm_env.png differ diff --git a/bsp/ra6m4-cpk/docs/picture/rtc_env.png b/bsp/ra6m4-cpk/docs/picture/rtc_env.png index efc3aae4cb..b58d1a283d 100644 Binary files a/bsp/ra6m4-cpk/docs/picture/rtc_env.png and b/bsp/ra6m4-cpk/docs/picture/rtc_env.png differ diff --git a/bsp/ra6m4-cpk/docs/使用瑞萨FSP配置工具.md b/bsp/ra6m4-cpk/docs/使用瑞萨FSP配置工具.md index 24832213b5..6ad2b5ab71 100644 --- a/bsp/ra6m4-cpk/docs/使用瑞萨FSP配置工具.md +++ b/bsp/ra6m4-cpk/docs/使用瑞萨FSP配置工具.md @@ -1,5 +1,7 @@ ## 在 MDK 中使用 FSP +- 添加RA Smart Config + 1. 打开 MDK,选择 “Tools -> Customize Tools Menu…” 2. 点击 “new” 图标,添加一条自定义命令: RA Smart Configurator 3. Command 输入工具的安装路径, 点击“…”找到安装路径下的“rasc.exe”文件并选中 (setup_fsp_v3_1_0_rasc_ 安装目录下) @@ -13,6 +15,26 @@ ![image.png](picture/openrasc.png) +- 添加 Device Partition Manager,添加步骤同上。 + +1. 输入命令名称: `Device Partition Manager` +2. Command: 在安装路径选中 `rasc.exe` +3. Initial Folder : `$P` +4. Arguments: `-application com.renesas.cdt.ddsc.dpm.ui.dpmapplication configuration.xml "SL%L"` + +> PS:以上相关操作也可以在 FSP 的说明文档中找到。 +> +> 文档路径(本地):在 FSP 的安装目录下 .\fsp_documentation\v3.1.0\fsp_user_manual_v3.1.0\index.html +> +> 文档路径(官网):https://www2.renesas.cn/jp/zh/software-tool/flexible-software-package-fsp#document + +## 更新工程配置 + +使用 FSP 配置完成后如果有新的文件添加进工程中,不会马上添加进去。需要先编译一次,如果弹出如下提醒,选择 “是” 然后再次编译即可。 + +![img](picture/import_changes.png) + + ## UART 如何添加一个 UART 端口外设配置? @@ -21,40 +43,39 @@ ![image.png](picture/rascuart.png) -2. 配置 UART 参数,因为需要适配 RT-Thread 驱动中使用的命名,所以需要修改命名,设置 **name** 、**channel** 、**callback** 是一致的标号。 -![image.png](picture/rascuart1.png) - - +2. 配置 UART 参数,因为需要适配 RT-Thread 驱动中使用的命名,所以需要修改命名,设置**name** 、**channel** 、**callback** 是一致的标号。![image.png](picture/rascuart1.png) ## GPIO 中断 如何添加一个 IO 中断? -1. 选择引脚编号,进入配置,比如选择 P402 做为中断引脚。 +1. 选择引脚编号,进入配置,比如选择 P105 做为中断引脚。可先找到引脚查看可配置成的 IRQx 通道号。 -![image-20211019142514276](picture/gpio.png) - 2. 打开 ICU 中断通道 IRQ4 +![image-20211103200949759](picture/p105.png) -![image-20211019142801323](picture/gpio_irq.png) - 3. 创建 stack 并进入配置。因为需要适配 RT-Thread 驱动中使用的命名,所以需要修改命名,设置 **name** 、**channel** 、**callback** 是一致的标号。选择你希望的触发方式。最后保存配置,生成配置代码。 +2. 打开 ICU 中断通道 IRQ00 -![image-20211019142910292](picture/icu_stack.png) +![image-20211103200813467](picture/irq0.png) -![image-20211019143151891](picture/config_irq4.png) +3. 创建 stack 并进入配置。因为需要适配 RT-Thread 驱动中使用的命名,所以需要修改命名,设置**name** 、**channel** 、**callback** 是一致的标号。选择你希望的触发方式,最后保存配置,生成配置代码。 -4. 测试中断是否能够成功开启 +![](picture/1635929089445.png) + +![image-20211103201047103](picture/irq1.png) + +4. 测试中断是否成功开启 ```c - + #define IRQ_TEST_PIN "p104" void irq_callback_test(void *args) { - rt_kprintf("\n Irq4 triggered \n"); + rt_kprintf("\n IRQ01 triggered \n"); } - + void icu_sample(void) { - /* 初始化P*/ - rt_uint32_t pin = rt_pin_get("P402"); + /* init P104 */ + rt_uint32_t pin = rt_pin_get(IRQ_TEST_PIN); rt_kprintf("\n pin number : 0x%04X \n", pin); rt_err_t err = rt_pin_attach_irq(pin, PIN_IRQ_MODE_RISING, irq_callback_test, RT_NULL); if(RT_EOK != err) @@ -72,15 +93,15 @@ ## WDT -1. 创建 WDT +1. 创建 WDT ![image-20211019152302939](picture/wdt.png) -2. 配置 WDT,需要注意在 RT-Thread 中只是用了一个 WDT 设备,所以没有对其进行编号,如果是新创建的 WDT 设备需要注意 name 字段,在驱动中默认使用的是 `g_wdt` 。 +2. 配置 WDT,需要注意在 RT-Thread 中只使用了一个 WDT 设备,所以没有对其进行编号,如果是新创建的 WDT 设备需要注意 name 字段,在驱动中默认使用的是`g_wdt` 。 ![image-20211019152407572](picture/wdt_config.png) -3. 如何在 ENV 中打开 WDT 以及 [WDT 接口使用说明](https://www.rt-thread.org/document/site/#/rt-thread-version/rt-thread-standard/programming-manual/device/watchdog/watchdog) +3. 如何在 ENV 中打开 WDT 以及[WDT 接口使用说明](https://www.rt-thread.org/document/site/#/rt-thread-version/rt-thread-standard/programming-manual/device/watchdog/watchdog) ![image-20211027183406251](picture/wdt_env.png) @@ -90,22 +111,21 @@ ![image-20211019152536749](picture/rtc.png) -2. 配置 RTC,需要注意在 RT-Thread 中只是用了一个 RTC 设备,所以没有对其进行编号,如果是新创建的 RTC 设备需要注意 name 字段,在驱动中默认使用的是 `g_rtc` 。 +2. 配置 RTC,需要注意在 RT-Thread 中只是用了一个 RTC 设备,所以没有对其进行编号,如果是新创建的 RTC 设备需要注意 name 字段,在驱动中默认使用的是`g_rtc` 。修改 Callback 为 rtc_callback ![image-20211019152627412](picture/rtc_config.png) -3. 如何在 ENV 中打开 RTC 以及[ RTC 接口使用说明](https://www.rt-thread.org/document/site/#/rt-thread-version/rt-thread-standard/programming-manual/device/rtc/rtc) +3. 如何在 ENV 中打开 RTC 以及[ RTC 接口使用说明](https://www.rt-thread.org/document/site/#/rt-thread-version/rt-thread-standard/programming-manual/device/rtc/rtc) ![image-20211027181550233](picture/rtc_env.png) - ## Flash 1. 创建 Flash ![image-20211026105031200](picture/add_flash.png) -2. 配置 Flash,需要注意在 RT-Thread 中只使用了一个 flash 设备,所以没有对其进行编号,如果是新创建的 flash 设备需要注意 name 字段,在驱动中默认使用的是 `g_flash` 。 +2. 配置 Flash,需要注意在 RT-Thread 中只使用了一个 flash 设备,所以没有对其进行编号,如果是新创建的 flash 设备需要注意 name 字段,在驱动中默认使用的是`g_flash` 。 ![image-20211026105628706](picture/config_flash.png) @@ -113,7 +133,6 @@ ![image-20211026123252310](picture/flash_menuconfig.png) - ## SPI 1. 添加一个 SPI 外设端口 @@ -128,15 +147,13 @@ ![image-20211027181444023](picture/spi_env.png) - - ## ADC/DAC 创建 ADC/DAC ![img](picture/adc_dac.png) -- ADC +- **ADC** 1. 配置 name、unit、mode,选择扫描的通道编号 @@ -146,7 +163,9 @@ ![img](picture/adc_config1.png) -- DAC +3. 在 menuconfig 中打开对应的通道 + +- **DAC** 1. 需要先关闭 P014 的默认 mode @@ -160,6 +179,7 @@ ![img](picture/dac_config2.png) +4. 在 menuconfig 中打开对应的通道 ## 通用 PWM 定时器(GPT) @@ -168,21 +188,25 @@ GPT 定时器在该芯片中可作为通用定时器,也可以用于产生 PWM 1. 添加 GPT 设备 ![img](./picture/add_gpt1.png) - + 2. 配置通道 ![img](./picture/add_gpt2.png) 对 GPT 较为关键的配置如图所示,具体解释如下: - 1. 将 ```Common``` -> ```Pin Output Support``` 设置为 Enable ,以开启 PWM 波形的输出。 - 2. 指定 GPT 通道,并根据通道数指定 GPT 的名称,例如此处指定 GPT 通道 3 ,所以 GPT 的名称必须为 ```g_timer3```。并且将定时器模式设置为 PWM ,并指定每个 PWM 周期的计数值。 + 1. 将``Common`` ->``Pin Output Support`` 设置为 Enable ,以开启 PWM 波形的输出。 + 2. 指定 GPT 通道,并根据通道数指定 GPT 的名称,例如此处指定 GPT 通道 3 ,所以 GPT 的名称必须为``g_timer3``。并且将定时器模式设置为 PWM ,并指定每个 PWM 周期的计数值。 3. 设定 PWM 通道默认输出的占空比,这里为 50% 。 4. 设定 GPT 通道下两个输出端口的使能状态。 5. 此处设置 GPT 通道下两个输出端口各自对应的引脚。 - + 3. 配置输出引脚 ![img](./picture/add_gpt3.png) - 在完成上一步对 GPT 定时器的设置后,根据图示找到对应 GPT 通道输出引脚设置的界面(这里是 GPT3),将图中标号 **1** 处设置为 ```GTIOCA or GTIOCB``` ,并根据需要在图中标号 **2** 处设置 GPT 通道下两个输出端口各自对应的输出引脚。 \ No newline at end of file + 在完成上一步对 GPT 定时器的设置后,根据图示找到对应 GPT 通道输出引脚设置的界面(这里是 GPT3),将图中标号 **1** 处设置为 ``GTIOCA or GTIOCB`` ,并根据需要在图中标号 **2** 处设置 GPT 通道下两个输出端口各自对应的输出引脚。 + + 4. 在 menuconfig 中打开对应的通道,[RT-Thread 的 pwm 框架介绍](https://www.rt-thread.org/document/site/#/rt-thread-version/rt-thread-standard/programming-manual/device/pwm/pwm) + + ![image-20211103202216381](picture/pwm_env.png) diff --git a/bsp/ra6m4-cpk/drivers/Kconfig b/bsp/ra6m4-cpk/drivers/Kconfig index 56e2cbc325..78029ac720 100644 --- a/bsp/ra6m4-cpk/drivers/Kconfig +++ b/bsp/ra6m4-cpk/drivers/Kconfig @@ -87,16 +87,6 @@ menu "Hardware Drivers Config" select RT_USING_RTC default n if BSP_USING_ONCHIP_RTC - choice - prompt "Select clock source" - default BSP_RTC_USING_LSE - - config BSP_RTC_USING_LSE - bool "RTC USING LSE" - - config BSP_RTC_USING_LSI - bool "RTC USING LSI" - endchoice endif menuconfig BSP_USING_SPI diff --git a/bsp/ra6m4-cpk/drivers/config/ra6m4/dac_config.h b/bsp/ra6m4-cpk/drivers/config/ra6m4/dac_config.h index 12284c449a..0765a8c228 100644 --- a/bsp/ra6m4-cpk/drivers/config/ra6m4/dac_config.h +++ b/bsp/ra6m4-cpk/drivers/config/ra6m4/dac_config.h @@ -18,7 +18,7 @@ extern "C" { #endif -#if defined(BSP_USING_DAC0) && defined(BSP_USING_DAC1) +#ifdef BSP_USING_DAC struct ra_dac_map { char name; diff --git a/bsp/ra6m4-cpk/drivers/drv_gpio.c b/bsp/ra6m4-cpk/drivers/drv_gpio.c index fa2a2f2151..0f180cd2a2 100644 --- a/bsp/ra6m4-cpk/drivers/drv_gpio.c +++ b/bsp/ra6m4-cpk/drivers/drv_gpio.c @@ -383,7 +383,7 @@ static rt_base_t ra_pin_get(const char *name) int pin_number = -1, port = -1, pin = -1; if (rt_strlen(name) != 4) return -1; - if (name[0] == 'P') + if ((name[0] == 'P')||(name[0] == 'p')) { if ('0' <= (int)name[1] && (int)name[1] <= '9') { diff --git a/bsp/ra6m4-cpk/drivers/drv_rtc.c b/bsp/ra6m4-cpk/drivers/drv_rtc.c index 342d598587..dc49462241 100644 --- a/bsp/ra6m4-cpk/drivers/drv_rtc.c +++ b/bsp/ra6m4-cpk/drivers/drv_rtc.c @@ -111,6 +111,7 @@ static rt_err_t ra_set_secs(void *args) return result; } +#ifdef RT_USING_ALARM static rt_err_t ra_get_alarm(void *arg) { rt_err_t result = RT_EOK; @@ -179,15 +180,17 @@ static rt_err_t ra_set_alarm(void *arg) } return result; } - -static rt_device_t ra_device; +#endif /* RT_USING_ALARM */ void rtc_callback(rtc_callback_args_t *p_args) { +#ifdef RT_USING_ALARM + static rt_device_t ra_device; if (RTC_EVENT_ALARM_IRQ == p_args->event) { rt_alarm_update(ra_device, 1); } +#endif } static const struct rt_rtc_ops ra_rtc_ops = @@ -195,8 +198,10 @@ static const struct rt_rtc_ops ra_rtc_ops = .init = ra_rtc_init, .get_secs = ra_get_secs, .set_secs = ra_set_secs, +#ifdef RT_USING_ALARM .set_alarm = ra_set_alarm, .get_alarm = ra_get_alarm, +#endif }; static rt_rtc_dev_t ra_rtc_dev; diff --git a/bsp/ra6m4-cpk/project.uvoptx b/bsp/ra6m4-cpk/project.uvoptx index a345fd8d5d..f8db0ba535 100644 --- a/bsp/ra6m4-cpk/project.uvoptx +++ b/bsp/ra6m4-cpk/project.uvoptx @@ -170,79 +170,79 @@ - Source Group 1 - 0 - 0 - 0 - 0 - - - - :Renesas RA Smart Configurator:Common Sources + CPU 0 0 0 0 - 2 + 1 1 1 0 0 0 - .\src\hal_entry.c - hal_entry.c + ..\..\libcpu\arm\common\backtrace.c + backtrace.c 0 0 - 2 + 1 2 - 5 + 1 0 0 0 - .\src\SConscript - SConscript + ..\..\libcpu\arm\common\div0.c + div0.c 0 0 - 2 + 1 3 1 0 0 0 - .\src\adc_sample.c - adc_sample.c + ..\..\libcpu\arm\common\showmem.c + showmem.c 0 0 - 2 + 1 4 - 1 + 2 0 0 0 - .\src\alarm_sample.c - alarm_sample.c + ..\..\libcpu\arm\cortex-m4\context_rvds.S + context_rvds.S 0 0 - 2 + 1 5 1 0 0 0 - .\src\dac_sample.c - dac_sample.c + ..\..\libcpu\arm\cortex-m4\cpuport.c + cpuport.c 0 0 + + + + DeviceDrivers + 0 + 0 + 0 + 0 2 6 @@ -250,8 +250,8 @@ 0 0 0 - .\src\icu_sample.c - icu_sample.c + ..\..\components\drivers\misc\pin.c + pin.c 0 0 @@ -262,8 +262,8 @@ 0 0 0 - .\src\rtc_sample.c - rtc_sample.c + ..\..\components\drivers\serial\serial_v2.c + serial_v2.c 0 0 @@ -274,8 +274,8 @@ 0 0 0 - .\src\spi_sample.c - spi_sample.c + ..\..\components\drivers\src\pipe.c + pipe.c 0 0 @@ -286,8 +286,360 @@ 0 0 0 - .\src\wdt_sample.c - wdt_sample.c + ..\..\components\drivers\src\ringblk_buf.c + ringblk_buf.c + 0 + 0 + + + 2 + 10 + 1 + 0 + 0 + 0 + ..\..\components\drivers\src\dataqueue.c + dataqueue.c + 0 + 0 + + + 2 + 11 + 1 + 0 + 0 + 0 + ..\..\components\drivers\src\workqueue.c + workqueue.c + 0 + 0 + + + 2 + 12 + 1 + 0 + 0 + 0 + ..\..\components\drivers\src\ringbuffer.c + ringbuffer.c + 0 + 0 + + + 2 + 13 + 1 + 0 + 0 + 0 + ..\..\components\drivers\src\completion.c + completion.c + 0 + 0 + + + 2 + 14 + 1 + 0 + 0 + 0 + ..\..\components\drivers\src\waitqueue.c + waitqueue.c + 0 + 0 + + + + + Drivers + 1 + 0 + 0 + 0 + + 3 + 15 + 1 + 0 + 0 + 0 + drivers\drv_gpio.c + drv_gpio.c + 0 + 0 + + + 3 + 16 + 1 + 0 + 0 + 0 + drivers\drv_usart_v2.c + drv_usart_v2.c + 0 + 0 + + + 3 + 17 + 1 + 0 + 0 + 0 + drivers\drv_common.c + drv_common.c + 0 + 0 + + + + + Finsh + 0 + 0 + 0 + 0 + + 4 + 18 + 1 + 0 + 0 + 0 + ..\..\components\finsh\shell.c + shell.c + 0 + 0 + + + 4 + 19 + 1 + 0 + 0 + 0 + ..\..\components\finsh\msh.c + msh.c + 0 + 0 + + + 4 + 20 + 1 + 0 + 0 + 0 + ..\..\components\finsh\cmd.c + cmd.c + 0 + 0 + + + + + Kernel + 0 + 0 + 0 + 0 + + 5 + 21 + 1 + 0 + 0 + 0 + ..\..\src\ipc.c + ipc.c + 0 + 0 + + + 5 + 22 + 1 + 0 + 0 + 0 + ..\..\src\thread.c + thread.c + 0 + 0 + + + 5 + 23 + 1 + 0 + 0 + 0 + ..\..\src\device.c + device.c + 0 + 0 + + + 5 + 24 + 1 + 0 + 0 + 0 + ..\..\src\kservice.c + kservice.c + 0 + 0 + + + 5 + 25 + 1 + 0 + 0 + 0 + ..\..\src\components.c + components.c + 0 + 0 + + + 5 + 26 + 1 + 0 + 0 + 0 + ..\..\src\clock.c + clock.c + 0 + 0 + + + 5 + 27 + 1 + 0 + 0 + 0 + ..\..\src\timer.c + timer.c + 0 + 0 + + + 5 + 28 + 1 + 0 + 0 + 0 + ..\..\src\mem.c + mem.c + 0 + 0 + + + 5 + 29 + 1 + 0 + 0 + 0 + ..\..\src\object.c + object.c + 0 + 0 + + + 5 + 30 + 1 + 0 + 0 + 0 + ..\..\src\scheduler.c + scheduler.c + 0 + 0 + + + 5 + 31 + 1 + 0 + 0 + 0 + ..\..\src\irq.c + irq.c + 0 + 0 + + + 5 + 32 + 1 + 0 + 0 + 0 + ..\..\src\idle.c + idle.c + 0 + 0 + + + + + libc + 0 + 0 + 0 + 0 + + 6 + 33 + 1 + 0 + 0 + 0 + ..\..\components\libc\compilers\common\time.c + time.c + 0 + 0 + + + + + :Renesas RA Smart Configurator:Common Sources + 0 + 0 + 0 + 0 + + 7 + 34 + 1 + 0 + 0 + 0 + .\src\hal_entry.c + hal_entry.c + 0 + 0 + + + 7 + 35 + 5 + 0 + 0 + 0 + .\src\SConscript + SConscript 0 0 diff --git a/bsp/ra6m4-cpk/project.uvprojx b/bsp/ra6m4-cpk/project.uvprojx index 1a05a1a505..969b850402 100644 --- a/bsp/ra6m4-cpk/project.uvprojx +++ b/bsp/ra6m4-cpk/project.uvprojx @@ -1,7 +1,10 @@ + 2.1 +
### uVision Project, (C) Keil Software
+ Target 1 @@ -15,28 +18,28 @@ Renesas.RA_DFP.3.1.0 https://www2.renesas.eu/Keil_MDK_Packs/ CPUTYPE("Cortex-M33") FPU2 CLOCK(12000000) ELITTLE - - - + + + 0 - - - - - - - - - - + + + + + + + + + + $$Device:R7FA6M4AF$SVD\R7FA6M4AF.svd 0 0 - - - - - + + + + + 0 0 @@ -58,8 +61,8 @@ 0 0 - - + + 0 0 0 @@ -68,8 +71,8 @@ 0 0 - - + + 0 0 0 @@ -78,15 +81,15 @@ 0 0 - - + + 0 0 0 0 0 - + 0 @@ -100,8 +103,8 @@ 0 0 3 - - + + 1 @@ -133,12 +136,12 @@ -1 1 - + "" () - - - - + + + + 0 @@ -171,7 +174,7 @@ 0 0 "Cortex-M33" - + 0 0 0 @@ -305,7 +308,7 @@ 0x0 - + 1 @@ -334,7 +337,7 @@ -Wno-license-management -Wuninitialized -Wall -Wmissing-declarations -Wpointer-arith -Waggregate-return -Wfloat-equal SOC_R7FA6M4AF, __RTTHREAD__, __CLK_TCK=RT_TICK_PER_SECOND - + ..\..\libcpu\arm\common;..\..\libcpu\arm\cortex-m4;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\include;drivers;drivers\config;..\..\components\finsh;.;..\..\include;..\..\components\libc\compilers\common;..\..\components\libc\compilers\common\none-gcc;..\..\examples\utest\testcases\kernel @@ -350,10 +353,10 @@ 0 4 - - - - + + + + @@ -363,14 +366,14 @@ 0 0 0 - - - + + + .\script\fsp.scat - - - - + + + + 6319,6314 @@ -380,33 +383,25 @@ CPU - showmem.c + backtrace.c 1 - ..\..\libcpu\arm\common\showmem.c + ..\..\libcpu\arm\common\backtrace.c - - div0.c 1 ..\..\libcpu\arm\common\div0.c - - - backtrace.c + showmem.c 1 - ..\..\libcpu\arm\common\backtrace.c + ..\..\libcpu\arm\common\showmem.c - - context_rvds.S 2 ..\..\libcpu\arm\cortex-m4\context_rvds.S - - cpuport.c 1 @@ -422,63 +417,47 @@ 1 ..\..\components\drivers\misc\pin.c - - serial_v2.c 1 ..\..\components\drivers\serial\serial_v2.c - - pipe.c 1 ..\..\components\drivers\src\pipe.c - - - - completion.c - 1 - ..\..\components\drivers\src\completion.c - - - ringblk_buf.c 1 ..\..\components\drivers\src\ringblk_buf.c - - + + dataqueue.c + 1 + ..\..\components\drivers\src\dataqueue.c + workqueue.c 1 ..\..\components\drivers\src\workqueue.c - - ringbuffer.c 1 ..\..\components\drivers\src\ringbuffer.c - - + + completion.c + 1 + ..\..\components\drivers\src\completion.c + waitqueue.c 1 ..\..\components\drivers\src\waitqueue.c - - - dataqueue.c - 1 - ..\..\components\drivers\src\dataqueue.c - -
Drivers @@ -488,15 +467,11 @@ 1 drivers\drv_gpio.c
- - drv_usart_v2.c 1 drivers\drv_usart_v2.c - - drv_common.c 1 @@ -512,15 +487,11 @@ 1 ..\..\components\finsh\shell.c - - msh.c 1 ..\..\components\finsh\msh.c - - cmd.c 1 @@ -530,84 +501,62 @@ Kernel - - - timer.c - 1 - ..\..\src\timer.c - - - - - object.c - 1 - ..\..\src\object.c - - - - - irq.c - 1 - ..\..\src\irq.c - - - - - kservice.c - 1 - ..\..\src\kservice.c - - ipc.c 1 ..\..\src\ipc.c - - - - components.c - 1 - ..\..\src\components.c - - - - - mem.c - 1 - ..\..\src\mem.c - - - - - device.c - 1 - ..\..\src\device.c - - - - - clock.c - 1 - ..\..\src\clock.c - - - thread.c 1 ..\..\src\thread.c - - + + device.c + 1 + ..\..\src\device.c + + + kservice.c + 1 + ..\..\src\kservice.c + + + components.c + 1 + ..\..\src\components.c + + + clock.c + 1 + ..\..\src\clock.c + + + timer.c + 1 + ..\..\src\timer.c + + + mem.c + 1 + ..\..\src\mem.c + + + object.c + 1 + ..\..\src\object.c + scheduler.c 1 ..\..\src\scheduler.c - - + + irq.c + 1 + ..\..\src\irq.c + idle.c 1 @@ -625,26 +574,46 @@ + + :Renesas RA Smart Configurator:Common Sources + + + hal_entry.c + 1 + .\src\hal_entry.c + + + SConscript + 5 + .\src\SConscript + + + + + ::Flex Software + + - + - + - + - + - + + diff --git a/bsp/ra6m4-cpk/ra_cfg/fsp_cfg/bsp/bsp_mcu_family_cfg.h b/bsp/ra6m4-cpk/ra_cfg/fsp_cfg/bsp/bsp_mcu_family_cfg.h index 46477a5ed6..8943340af5 100644 --- a/bsp/ra6m4-cpk/ra_cfg/fsp_cfg/bsp/bsp_mcu_family_cfg.h +++ b/bsp/ra6m4-cpk/ra_cfg/fsp_cfg/bsp/bsp_mcu_family_cfg.h @@ -190,7 +190,7 @@ /* Security attribution for registers for IRQ channels. */ #ifndef BSP_TZ_CFG_ICUSARA #define BSP_TZ_CFG_ICUSARA (\ - (((RA_NOT_DEFINED > 0) ? 0U : 1U) << 0U) /* External IRQ0 */ | \ + (((1 > 0) ? 0U : 1U) << 0U) /* External IRQ0 */ | \ (((RA_NOT_DEFINED > 0) ? 0U : 1U) << 1U) /* External IRQ1 */ | \ (((RA_NOT_DEFINED > 0) ? 0U : 1U) << 2U) /* External IRQ2 */ | \ (((RA_NOT_DEFINED > 0) ? 0U : 1U) << 3U) /* External IRQ3 */ | \ diff --git a/bsp/ra6m4-cpk/ra_gen/hal_data.c b/bsp/ra6m4-cpk/ra_gen/hal_data.c index 34a14e4d6c..1727d2e918 100644 --- a/bsp/ra6m4-cpk/ra_gen/hal_data.c +++ b/bsp/ra6m4-cpk/ra_gen/hal_data.c @@ -1,5 +1,29 @@ /* generated HAL source file - do not edit */ #include "hal_data.h" +icu_instance_ctrl_t g_external_irq0_ctrl; +const external_irq_cfg_t g_external_irq0_cfg = +{ + .channel = 0, + .trigger = EXTERNAL_IRQ_TRIG_RISING, + .filter_enable = false, + .pclk_div = EXTERNAL_IRQ_PCLK_DIV_BY_64, + .p_callback = irq0_callback, + .p_context = NULL, + .p_extend = NULL, + .ipl = (12), +#if defined(VECTOR_NUMBER_ICU_IRQ0) + .irq = VECTOR_NUMBER_ICU_IRQ0, +#else + .irq = FSP_INVALID_VECTOR, +#endif +}; +/* Instance structure to use this module. */ +const external_irq_instance_t g_external_irq0 = +{ + .p_ctrl = &g_external_irq0_ctrl, + .p_cfg = &g_external_irq0_cfg, + .p_api = &g_external_irq_on_icu +}; sci_uart_instance_ctrl_t g_uart7_ctrl; baud_setting_t g_uart7_baud_setting = diff --git a/bsp/ra6m4-cpk/ra_gen/hal_data.h b/bsp/ra6m4-cpk/ra_gen/hal_data.h index 310230edd5..eedf16b98d 100644 --- a/bsp/ra6m4-cpk/ra_gen/hal_data.h +++ b/bsp/ra6m4-cpk/ra_gen/hal_data.h @@ -4,9 +4,21 @@ #include #include "bsp_api.h" #include "common_data.h" +#include "r_icu.h" +#include "r_external_irq_api.h" #include "r_sci_uart.h" #include "r_uart_api.h" FSP_HEADER +/** External IRQ on ICU Instance. */ +extern const external_irq_instance_t g_external_irq0; + +/** Access the ICU instance using these structures when calling API functions directly (::p_api is not used). */ +extern icu_instance_ctrl_t g_external_irq0_ctrl; +extern const external_irq_cfg_t g_external_irq0_cfg; + +#ifndef irq0_callback +void irq0_callback(external_irq_callback_args_t * p_args); +#endif /** UART on SCI Instance. */ extern const uart_instance_t g_uart7; diff --git a/bsp/ra6m4-cpk/ra_gen/pin_data.c b/bsp/ra6m4-cpk/ra_gen/pin_data.c index c173e439ed..448eee5d8e 100644 --- a/bsp/ra6m4-cpk/ra_gen/pin_data.c +++ b/bsp/ra6m4-cpk/ra_gen/pin_data.c @@ -38,7 +38,7 @@ const ioport_pin_cfg_t g_bsp_pin_cfg_data[] = { }, { .pin = BSP_IO_PORT_00_PIN_14, - .pin_cfg = ((uint32_t) IOPORT_CFG_PORT_DIRECTION_OUTPUT | (uint32_t) IOPORT_CFG_PORT_OUTPUT_LOW) + .pin_cfg = ((uint32_t) IOPORT_CFG_ANALOG_ENABLE) }, { .pin = BSP_IO_PORT_00_PIN_15, diff --git a/bsp/ra6m4-cpk/ra_gen/vector_data.c b/bsp/ra6m4-cpk/ra_gen/vector_data.c index dbf7d108f7..5bbc494618 100644 --- a/bsp/ra6m4-cpk/ra_gen/vector_data.c +++ b/bsp/ra6m4-cpk/ra_gen/vector_data.c @@ -8,6 +8,7 @@ [1] = sci_uart_txi_isr, /* SCI7 TXI (Transmit data empty) */ [2] = sci_uart_tei_isr, /* SCI7 TEI (Transmit end) */ [3] = sci_uart_eri_isr, /* SCI7 ERI (Receive error) */ + [4] = r_icu_isr, /* ICU IRQ0 (External pin interrupt 0) */ }; const bsp_interrupt_event_t g_interrupt_event_link_select[BSP_ICU_VECTOR_MAX_ENTRIES] = { @@ -15,5 +16,6 @@ [1] = BSP_PRV_IELS_ENUM(EVENT_SCI7_TXI), /* SCI7 TXI (Transmit data empty) */ [2] = BSP_PRV_IELS_ENUM(EVENT_SCI7_TEI), /* SCI7 TEI (Transmit end) */ [3] = BSP_PRV_IELS_ENUM(EVENT_SCI7_ERI), /* SCI7 ERI (Receive error) */ + [4] = BSP_PRV_IELS_ENUM(EVENT_ICU_IRQ0), /* ICU IRQ0 (External pin interrupt 0) */ }; #endif \ No newline at end of file diff --git a/bsp/ra6m4-cpk/ra_gen/vector_data.h b/bsp/ra6m4-cpk/ra_gen/vector_data.h index 4beef7fd21..fd6cf29e21 100644 --- a/bsp/ra6m4-cpk/ra_gen/vector_data.h +++ b/bsp/ra6m4-cpk/ra_gen/vector_data.h @@ -3,19 +3,21 @@ #define VECTOR_DATA_H /* Number of interrupts allocated */ #ifndef VECTOR_DATA_IRQ_COUNT - #define VECTOR_DATA_IRQ_COUNT (4) + #define VECTOR_DATA_IRQ_COUNT (5) #endif /* ISR prototypes */ void sci_uart_rxi_isr(void); void sci_uart_txi_isr(void); void sci_uart_tei_isr(void); void sci_uart_eri_isr(void); + void r_icu_isr(void); /* Vector table allocations */ #define VECTOR_NUMBER_SCI7_RXI ((IRQn_Type) 0) /* SCI7 RXI (Received data full) */ #define VECTOR_NUMBER_SCI7_TXI ((IRQn_Type) 1) /* SCI7 TXI (Transmit data empty) */ #define VECTOR_NUMBER_SCI7_TEI ((IRQn_Type) 2) /* SCI7 TEI (Transmit end) */ #define VECTOR_NUMBER_SCI7_ERI ((IRQn_Type) 3) /* SCI7 ERI (Receive error) */ + #define VECTOR_NUMBER_ICU_IRQ0 ((IRQn_Type) 4) /* ICU IRQ0 (External pin interrupt 0) */ typedef enum IRQn { Reset_IRQn = -15, NonMaskableInt_IRQn = -14, @@ -32,5 +34,6 @@ SCI7_TXI_IRQn = 1, /* SCI7 TXI (Transmit data empty) */ SCI7_TEI_IRQn = 2, /* SCI7 TEI (Transmit end) */ SCI7_ERI_IRQn = 3, /* SCI7 ERI (Receive error) */ + ICU_IRQ0_IRQn = 4, /* ICU IRQ0 (External pin interrupt 0) */ } IRQn_Type; #endif /* VECTOR_DATA_H */ \ No newline at end of file diff --git a/bsp/ra6m4-cpk/src/hal_entry.c b/bsp/ra6m4-cpk/src/hal_entry.c index 35ec1110d4..acac8a8442 100644 --- a/bsp/ra6m4-cpk/src/hal_entry.c +++ b/bsp/ra6m4-cpk/src/hal_entry.c @@ -6,6 +6,7 @@ * Change Logs: * Date Author Notes * 2021-10-10 Sherman first version + * 2021-11-03 Sherman Add icu_sample */ #include @@ -13,6 +14,7 @@ #include #define LED3_PIN BSP_IO_PORT_01_PIN_06 +#define USER_INPUT "P105" void hal_entry(void) { @@ -26,3 +28,26 @@ void hal_entry(void) rt_thread_mdelay(500); } } + +void irq_callback_test(void *args) +{ + rt_kprintf("\n IRQ00 triggered \n"); +} + +void icu_sample(void) +{ + /* init */ + rt_uint32_t pin = rt_pin_get(USER_INPUT); + rt_kprintf("\n pin number : 0x%04X \n", pin); + rt_err_t err = rt_pin_attach_irq(pin, PIN_IRQ_MODE_RISING, irq_callback_test, RT_NULL); + if(RT_EOK != err) + { + rt_kprintf("\n attach irq failed. \n"); + } + err = rt_pin_irq_enable(pin, PIN_IRQ_ENABLE); + if(RT_EOK != err) + { + rt_kprintf("\n enable irq failed. \n"); + } +} +MSH_CMD_EXPORT(icu_sample, icu sample);