[imxrt1170]修复SD卡作为引导器后,系统无法挂载SD卡的问题 (#6600)

* 修复SD卡作为引导器后,系统无法挂载SD卡的问题

* Update Kconfig

Co-authored-by: Man, Jianting (Meco) <920369182@qq.com>
This commit is contained in:
xiao xie 2022-11-08 13:49:39 +08:00 committed by GitHub
parent 1755750b2a
commit 493c333869
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 2 deletions

View File

@ -51,11 +51,11 @@ static int filesystem_mount(void)
if (ret != 0) if (ret != 0)
{ {
rt_kprintf("ret: %d\n",ret); rt_kprintf("ret: %d\n",ret);
LOG_E("sd0p0 mount to '/' failed!"); LOG_E("sd0 mount to '/' failed!");
return ret; return ret;
} }
return RT_EOK; return RT_EOK;
} }
INIT_APP_EXPORT(filesystem_mount); INIT_ENV_EXPORT(filesystem_mount);
#endif #endif

View File

@ -34,6 +34,14 @@ menu "On-chip Peripheral Drivers"
select RT_USING_DFS select RT_USING_DFS
default n 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 menuconfig BSP_USING_LPUART
bool "Enable UART" bool "Enable UART"
select RT_USING_SERIAL select RT_USING_SERIAL

View File

@ -91,11 +91,14 @@ struct imxrt_mmcsd
uint32_t *usdhc_adma2_table; uint32_t *usdhc_adma2_table;
}; };
#ifndef CODE_STORED_ON_SDCARD
static void _mmcsd_gpio_init(struct imxrt_mmcsd *mmcsd) static void _mmcsd_gpio_init(struct imxrt_mmcsd *mmcsd)
{ {
// CLOCK_EnableClock(kCLOCK_Iomuxc); /* iomuxc clock (iomuxc_clk_enable): 0x03u */ // CLOCK_EnableClock(kCLOCK_Iomuxc); /* iomuxc clock (iomuxc_clk_enable): 0x03u */
} }
#endif
static void SDMMCHOST_ErrorRecovery(USDHC_Type *base) static void SDMMCHOST_ErrorRecovery(USDHC_Type *base)
{ {
uint32_t status = 0U; 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) static void _mmcsd_host_init(struct imxrt_mmcsd *mmcsd)
{ {
usdhc_host_t *usdhc_host = &mmcsd->usdhc_host; 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); //NVIC_SetPriority(USDHC1_IRQn, 5U);
} }
#endif
static void _mmc_request(struct rt_mmcsd_host *host, struct rt_mmcsd_req *req) 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 #endif
mmcsd->host = host; mmcsd->host = host;
#ifndef CODE_STORED_ON_SDCARD
_mmcsd_clk_init(mmcsd); _mmcsd_clk_init(mmcsd);
_mmcsd_isr_init(mmcsd); _mmcsd_isr_init(mmcsd);
_mmcsd_gpio_init(mmcsd); _mmcsd_gpio_init(mmcsd);
_mmcsd_host_init(mmcsd); _mmcsd_host_init(mmcsd);
#endif
host->private_data = mmcsd; host->private_data = mmcsd;