Skip to content

Commit 6ea6827

Browse files
authored
[BSP][NXP] Add new features of I2C DMA, CAN, SPI, DWT and SDIO for RT1180 (#11715)
* updated template files, conifg files and script files to support hypperram, multicore kickoff, rpmsg-lite, netc, cherryusb and ethercat. * updated different link files of GCC, IAR and KEIL, for supporting multicore kick-off and different loading methods * Updated .ini files to support debugging in keil. And updeated .mac files to support deugging in iar. * Updated template files, conifg files and script files of CM7 to support hypperram, multicore kickoff, rpmsg-lite, netc, cherryusb and ethercat. * Updated different link files of GCC, IAR and KEIL of CM7 project, for supporting multicore kick-off and different loading methods. * Modify LittleFS to use the last 1 MB of flash and update CM7 support for LittleFS on QSPI flash. * Updated different link files of loading to hyperram. * Updated .ini files of CM7 to support debugging in keil. And updeated .mac files of CM7 to support deugging in iar. * Remove Keil projects and keep templates only. * Remove RAMFUNC due to IAR compilation issues, and use linker configuration to place all flash operation code in RAM. * Add related code to support kick-offing CM7 and rpmsg-lite. * Add codes to support cherryUSB for CM33 and CM7. * Add mnt.c to support littleFS for CM7. * Add codes to support etherCAT for CM7. * Add codes to support USART12 for RT1180. * Modify the drv_uart_v2.c to fix some bug to make it can work in CM33, but still cannot work in CM7. Will continue to update in next version. * Updated README with both Chinese and English versions. * Move the EtherCAT code into the packages\nxp-imxrt-sdk-latest. * Remove EtherCAT-related sources, keep only SConscript. * updated ci.attachconfig.yml for cm33 and cm7 projects. * Fixed BSP_ROOT path error in rtconfig.py. * Added drv_netc.c and updated SConscript for netc. * Updated cherryusb_port.c to avoid worning. * Updated sconscript to locate multicore directory in packages for header inclusion. * Updated cm33/board/board.c to avoid worning when enable cm33_kickoff_cm7. * Deleted peripheral.ethercat, because the related protocol stack has not been uploaded. And added CONFIG_BSP_USING_GPIO=y for Peripheral.netc.: * Removed the SConscript of multicore and ethercat to packages. * Added CONFIG_BSP_USING_GPIO=y to Peripheral.hyperflash_dma. * Added CONFIG_BSP_USING_GPIO=y for Peripheral.hyperflash. * Reformat code according to coding standards. * Reformat code according to coding standards. * Added features of RTC, CAN, I2C DMA, SPI and SDIO for CM33. * Updated flexspi_port.h to support using flexspi api only. * Added ci.attachconfig of UART, RTC, CAN, I2C DMA, SPI, DWT and SDIO for CM33. * Added features of RTC, CAN, I2C DMA, SPI and SDIO for CM7. * Added ci.attachconfig of UART, RTC, CAN, I2C DMA, SPI, DWT and SDIO for CM7. * Added driver of DWT. * Added driver of flexCAN for RT1180. * Added driver of i2c dma for RT1180. * Added driver of lpspi and dma for RT1180. * Added driver of sdio for RT1180. * Added driver of RTC for RT1180. * Updated driver of drv_uart.c and fixed some bugs in drv_uart_v2.c. * Updated README of imxrt1180-nxp-evk. * Reformat codes according to tools/ci/clang_format_check.py * fix: use unsigned shift to avoid UB in drv_can.c * Removed unnecessary build artifacts and test files. * bsp/nxp/imxrt: fix CI build errors for non-RT1180 BSPs * bsp/nxp/imxrt: clang-format drv_lpadc.c to fix CI format check * Fixed standalone driver compilation errors and code formatting issues. * Fixed CI attach failures by updating the default linker script for CM7-only ITCM builds with large .text sections. * [bsp][imxrt] fix BBNSM GPR epoch truncation by storing epoch in two 32-bit GPRs * [bsp][imxrt] define DBG_TAG/DBG_LVL before rtdbg.h in cm7 mnt.c * [bsp][imxrt1180] fix(sdcard): add timeout to sd0 wait loop in mnt.c
1 parent ba79f69 commit 6ea6827

46 files changed

Lines changed: 3579 additions & 769 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

bsp/nxp/imx/imxrt/imxrt1180-nxp-evk/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ This BSP currently provides peripheral support:
3434
| Rpmsg-lite | Supported | |
3535
| GPIO | supported | |
3636
| UART | Supported | |
37-
| SPI | Not yet supported | |
37+
| SPI | supported | |
3838
| I2C | supported | |
3939
| ADC | supported | |
4040
| Timer | supported | |
41-
| SDIO | Not yet supported | |
42-
| RTC | Not yet supported | |
41+
| SDIO | supported | |
42+
| RTC | supported | |
4343
| PWM | Not yet supported | |
44-
| CAN | Not yet supported | |
44+
| CAN | supported | |
4545

4646
## Usage Instructions
4747

bsp/nxp/imx/imxrt/imxrt1180-nxp-evk/README_zh.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ CM33对CM7的kick off将在后续版本中支持。
3636
| Rpmsg-lite | 支持 | |
3737
| GPIO | 支持 | |
3838
| UART | 支持 | |
39-
| SPI | 暂不支持 | |
39+
| SPI | 支持 | |
4040
| I2C | 支持 | |
4141
| ADC | 支持 | |
4242
| Timer | 支持 | |
43-
| SDIO | 暂不支持 | |
44-
| RTC | 暂不支持 | |
43+
| SDIO | 支持 | |
44+
| RTC | 支持 | |
4545
| PWM | 暂不支持 | |
46-
| CAN | 暂不支持 | |
46+
| CAN | 支持 | |
4747

4848

4949
## 使用说明

bsp/nxp/imx/imxrt/imxrt1180-nxp-evk/cm33/.ci/attachconfig/ci.attachconfig.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,37 @@ Peripheral.lpadc1:
2323
- CONFIG_RT_USING_ADC=y
2424
- CONFIG_BSP_USING_LPADC=y
2525
- CONFIG_BSP_USING_LPADC1=y
26+
Peripheral.lpuart_device:
27+
<<: *scons
28+
kconfig:
29+
- CONFIG_BSP_USING_LPUART=y
30+
- CONFIG_BSP_USING_DMA=y
31+
Peripheral.i2c_device:
32+
<<: *scons
33+
kconfig:
34+
- CONFIG_BSP_USING_I2C=y
35+
- CONFIG_BSP_USING_DMA=y
36+
Peripheral.spi_device:
37+
<<: *scons
38+
kconfig:
39+
- CONFIG_BSP_USING_SPI=y
40+
- CONFIG_BSP_USING_DMA=y
41+
Peripheral.can_device:
42+
<<: *scons
43+
kconfig:
44+
- CONFIG_BSP_USING_CAN=y
45+
Peripheral.rtc_device:
46+
<<: *scons
47+
kconfig:
48+
- CONFIG_BSP_USING_RTC=y
49+
Peripheral.dwt_device:
50+
<<: *scons
51+
kconfig:
52+
- CONFIG_BSP_USING_DWT=y
53+
Peripheral.sdio_device:
54+
<<: *scons
55+
kconfig:
56+
- CONFIG_BSP_USING_SDCARD_FATFS=y
2657
Peripheral.usb_device:
2758
<<: *scons
2859
kconfig:

bsp/nxp/imx/imxrt/imxrt1180-nxp-evk/cm33/.config

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ CONFIG_RT_USING_SERIAL=y
244244
CONFIG_RT_USING_SERIAL_V2=y
245245
# CONFIG_RT_SERIAL_BUF_STRATEGY_DROP is not set
246246
CONFIG_RT_SERIAL_BUF_STRATEGY_OVERWRITE=y
247-
# CONFIG_RT_SERIAL_USING_DMA is not set
247+
CONFIG_RT_SERIAL_USING_DMA=y
248248
# CONFIG_RT_USING_SERIAL_BYPASS is not set
249249
# CONFIG_RT_USING_CAN is not set
250250
# CONFIG_RT_USING_ADC is not set
@@ -1445,15 +1445,18 @@ CONFIG_SOC_MIMXRT1189CVM8C_CM33=y
14451445
#
14461446
# On-chip Peripheral Drivers
14471447
#
1448-
# CONFIG_BSP_USING_DMA is not set
1448+
# CONFIG_BSP_USING_DWT is not set
1449+
CONFIG_BSP_USING_DMA=y
14491450
CONFIG_BSP_USING_GPIO=y
14501451
# CONFIG_BSP_USING_RTC is not set
14511452
# CONFIG_BSP_USING_USB is not set
14521453
# CONFIG_BSP_USING_SDIO is not set
14531454
CONFIG_BSP_USING_LPUART=y
14541455
CONFIG_BSP_USING_LPUART1=y
1455-
# CONFIG_BSP_LPUART1_RX_USING_DMA is not set
1456-
# CONFIG_BSP_LPUART1_TX_USING_DMA is not set
1456+
CONFIG_BSP_LPUART1_RX_USING_DMA=y
1457+
CONFIG_BSP_LPUART1_RX_DMA_CHANNEL=0
1458+
CONFIG_BSP_LPUART1_TX_USING_DMA=y
1459+
CONFIG_BSP_LPUART1_TX_DMA_CHANNEL=1
14571460
# CONFIG_BSP_USING_LPUART2 is not set
14581461
# CONFIG_BSP_USING_LPUART3 is not set
14591462
# CONFIG_BSP_USING_LPUART4 is not set
@@ -1465,6 +1468,8 @@ CONFIG_BSP_USING_LPUART1=y
14651468
# CONFIG_BSP_USING_LPUART10 is not set
14661469
# CONFIG_BSP_USING_LPUART11 is not set
14671470
# CONFIG_BSP_USING_LPUART12 is not set
1471+
# CONFIG_BSP_USING_SPI is not set
1472+
# CONFIG_BSP_USING_I2C is not set
14681473
# CONFIG_BSP_USING_CAN is not set
14691474
# CONFIG_BSP_USING_FLEXSPI is not set
14701475
# end of On-chip Peripheral Drivers
@@ -1476,6 +1481,7 @@ CONFIG_BSP_USING_LPUART1=y
14761481
# CONFIG_BSP_USE_MULTICORE is not set
14771482
# CONFIG_BSP_USING_ETH is not set
14781483
# CONFIG_BSP_USING_FS is not set
1484+
# CONFIG_BSP_USING_QSPI_FLASH is not set
14791485
# end of Onboard Peripheral Drivers
14801486

14811487
#

bsp/nxp/imx/imxrt/imxrt1180-nxp-evk/cm33/applications/mnt.c

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
#include <dfs_fs.h>
3232
#include <fal.h>
3333

34-
#define FS_PARTITION_NAME "filesystem"
35-
#define FS_TYPE_NAME "lfs"
36-
#define FS_MOUNT_POINT "/"
34+
#define FS_PARTITION_NAME "filesystem"
35+
#define FS_TYPE_NAME "lfs"
36+
#define FS_MOUNT_POINT "/"
3737

3838
static int _qspi_flash_fs_mount(void)
3939
{
@@ -97,4 +97,48 @@ INIT_APP_EXPORT(_qspi_flash_fs_mount);
9797
*/
9898
INIT_COMPONENT_EXPORT(fal_init);
9999

100-
#endif /* BSP_USING_QSPI_FLASH_FS */
100+
#endif /* BSP_USING_QSPI_FLASH_FS */
101+
102+
/* ====================================================================
103+
* SD card FAT filesystem (controlled by BSP_USING_SDCARD_FATFS)
104+
*
105+
* Dependencies:
106+
* - drv_sdio.c / sdio_port.c (USDHC1 driver + board init)
107+
* - RT-Thread MMCSD / elmfat component
108+
*
109+
* The driver registers the block device as "sd0" asynchronously, so
110+
* this function polls until the device appears before mounting.
111+
* ==================================================================== */
112+
#ifdef BSP_USING_SDCARD_FATFS
113+
#include <dfs_fs.h>
114+
#include <dfs_file.h>
115+
#define DBG_TAG "app.sdcard"
116+
#define DBG_LVL DBG_INFO
117+
#include <rtdbg.h>
118+
119+
static int _sdcard_fs_mount(void)
120+
{
121+
rt_tick_t start = rt_tick_get();
122+
while (rt_device_find("sd0") == RT_NULL)
123+
{
124+
if ((rt_tick_get() - start) > (5 * RT_TICK_PER_SECOND))
125+
{
126+
LOG_E("wait for 'sd0' timeout");
127+
return -RT_ETIMEOUT;
128+
}
129+
rt_thread_mdelay(10);
130+
}
131+
132+
int ret = dfs_mount("sd0", "/", "elm", 0, 0);
133+
if (ret != 0)
134+
{
135+
LOG_E("sd0 mount to '/' failed! (ret=%d)", ret);
136+
return ret;
137+
}
138+
139+
LOG_I("sd0 mounted at '/'");
140+
return RT_EOK;
141+
}
142+
INIT_ENV_EXPORT(_sdcard_fs_mount);
143+
144+
#endif /* BSP_USING_SDCARD_FATFS */

0 commit comments

Comments
 (0)