From 493c3338697d175a8618365596f33b428d9b7bad Mon Sep 17 00:00:00 2001 From: xiao xie <335266746@qq.com> Date: Tue, 8 Nov 2022 13:49:39 +0800 Subject: [PATCH] =?UTF-8?q?[imxrt1170]=E4=BF=AE=E5=A4=8DSD=E5=8D=A1?= =?UTF-8?q?=E4=BD=9C=E4=B8=BA=E5=BC=95=E5=AF=BC=E5=99=A8=E5=90=8E=EF=BC=8C?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E6=97=A0=E6=B3=95=E6=8C=82=E8=BD=BDSD?= =?UTF-8?q?=E5=8D=A1=E7=9A=84=E9=97=AE=E9=A2=98=20(#6600)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 修复SD卡作为引导器后,系统无法挂载SD卡的问题 * Update Kconfig Co-authored-by: Man, Jianting (Meco) <920369182@qq.com> --- bsp/imxrt/imxrt1170-nxp-evk/m7/applications/mnt.c | 4 ++-- bsp/imxrt/imxrt1170-nxp-evk/m7/board/Kconfig | 8 ++++++++ bsp/imxrt/libraries/drivers/drv_sdio.c | 7 +++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/bsp/imxrt/imxrt1170-nxp-evk/m7/applications/mnt.c b/bsp/imxrt/imxrt1170-nxp-evk/m7/applications/mnt.c index 3b89810de7..bb7a940650 100644 --- a/bsp/imxrt/imxrt1170-nxp-evk/m7/applications/mnt.c +++ b/bsp/imxrt/imxrt1170-nxp-evk/m7/applications/mnt.c @@ -51,11 +51,11 @@ static int filesystem_mount(void) if (ret != 0) { rt_kprintf("ret: %d\n",ret); - LOG_E("sd0p0 mount to '/' failed!"); + LOG_E("sd0 mount to '/' failed!"); return ret; } return RT_EOK; } -INIT_APP_EXPORT(filesystem_mount); +INIT_ENV_EXPORT(filesystem_mount); #endif diff --git a/bsp/imxrt/imxrt1170-nxp-evk/m7/board/Kconfig b/bsp/imxrt/imxrt1170-nxp-evk/m7/board/Kconfig index 8a4c96034c..83baa59582 100644 --- a/bsp/imxrt/imxrt1170-nxp-evk/m7/board/Kconfig +++ b/bsp/imxrt/imxrt1170-nxp-evk/m7/board/Kconfig @@ -34,6 +34,14 @@ menu "On-chip Peripheral Drivers" select RT_USING_DFS default n + if BSP_USING_SDIO + config CODE_STORED_ON_SDCARD + bool "Enable Code STORED On SDCARD" + default n + help + "SD CARD work as boot devive" + endif + menuconfig BSP_USING_LPUART bool "Enable UART" select RT_USING_SERIAL diff --git a/bsp/imxrt/libraries/drivers/drv_sdio.c b/bsp/imxrt/libraries/drivers/drv_sdio.c index a38bdd30a3..3fc8b23a5b 100644 --- a/bsp/imxrt/libraries/drivers/drv_sdio.c +++ b/bsp/imxrt/libraries/drivers/drv_sdio.c @@ -91,11 +91,14 @@ struct imxrt_mmcsd uint32_t *usdhc_adma2_table; }; +#ifndef CODE_STORED_ON_SDCARD static void _mmcsd_gpio_init(struct imxrt_mmcsd *mmcsd) { // CLOCK_EnableClock(kCLOCK_Iomuxc); /* iomuxc clock (iomuxc_clk_enable): 0x03u */ } +#endif + static void SDMMCHOST_ErrorRecovery(USDHC_Type *base) { uint32_t status = 0U; @@ -115,6 +118,7 @@ static void SDMMCHOST_ErrorRecovery(USDHC_Type *base) } } +#ifndef CODE_STORED_ON_SDCARD static void _mmcsd_host_init(struct imxrt_mmcsd *mmcsd) { usdhc_host_t *usdhc_host = &mmcsd->usdhc_host; @@ -143,6 +147,7 @@ static void _mmcsd_isr_init(struct imxrt_mmcsd *mmcsd) { //NVIC_SetPriority(USDHC1_IRQn, 5U); } +#endif static void _mmc_request(struct rt_mmcsd_host *host, struct rt_mmcsd_req *req) { @@ -449,10 +454,12 @@ rt_int32_t _imxrt_mci_init(void) #endif mmcsd->host = host; +#ifndef CODE_STORED_ON_SDCARD _mmcsd_clk_init(mmcsd); _mmcsd_isr_init(mmcsd); _mmcsd_gpio_init(mmcsd); _mmcsd_host_init(mmcsd); +#endif host->private_data = mmcsd;