Other Parts Discussed in Thread: AM62P, UNIFLASH
部件号: AM62P
Thread 中讨论的其他器件: UNIFLASH
默认 MCU+SDK SBL 示例仅支持从单个引导介质 (SBL OSPI/SBL EMMC) 进行引导、本常见问题解答演示了如何修改 SBL 示例、以支持针对某些应用程序映像(对于 A53、使用 Linux 从 eMMC 引导、而对于 OSPI NOR 引导的其余映像)从不同的引导介质进行引导。
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
常见问题解答使用 sbl_OSPI_Linux stage-2 作为 AM62P 的参考、但这可应用于任何其他 AM62XX SoC、以下示例使用以下引导配置:
SBL stage-1 和 2、MCU R5、HSM 应用程序映像+来自 OSPI NOR 的 u-boot.img
EMMC 的 A53 Linux 应用映像
请在 SBL OSPI Stage 2 示例中进行以下更改:
将 Linux SBL 实例的引导介质 (config_bootloader_flash_linux) 更改为 EMMC、您可以根据要求配置引导映像偏移量、但确保以相同的配置偏移量刷写 Linux 应用映像。
将引导介质更改为 eMMC 还将在 syscfg 中添加一个 MMCSD 实例、您需要将该实例 的名称更改为 CONFIG_MMCSD_SBL、以下补丁包括 example.syscfg 所需的所有更改:
diff --git a/examples/drivers/boot/sbl_ospi_linux_multistage/sbl_ospi_linux_stage2/am62px-sk/wkup-r5fss0-0_freertos/example.syscfg b/examples/driv
ers/boot/sbl_ospi_linux_multistage/sbl_ospi_linux_stage2/am62px-sk/wkup-r5fss0-0_freertos/example.syscfg
index f3b7b5f..efce82a 100644
--- a/examples/drivers/boot/sbl_ospi_linux_multistage/sbl_ospi_linux_stage2/am62px-sk/wkup-r5fss0-0_freertos/example.syscfg
+++ b/examples/drivers/boot/sbl_ospi_linux_multistage/sbl_ospi_linux_stage2/am62px-sk/wkup-r5fss0-0_freertos/example.syscfg
@@ -16,6 +16,8 @@ const bootloader1 = bootloader.addInstance();
const bootloader2 = bootloader.addInstance();
const bootloader3 = bootloader.addInstance();
const gtc = scripting.addModule("/drivers/gtc/gtc");
+const mmcsd = scripting.addModule("/drivers/mmcsd/mmcsd", {}, false);
+const mmcsd1 = mmcsd.addInstance();
const uart = scripting.addModule("/drivers/uart/uart", {}, false);
const uart1 = uart.addInstance();
const clock = scripting.addModule("/kernel/dpl/clock");
@@ -40,12 +42,8 @@ bootloader1.appImageOffset = "0x240000";
bootloader2.$name = "CONFIG_BOOTLOADER_FLASH_MCU";
bootloader2.appImageOffset = "0x800000";
-bootloader3.$name = "CONFIG_BOOTLOADER_FLASH_LINUX";
-bootloader3.appImageOffset = "0x1200000";
-
bootloader1.flashDriver = flash1;
bootloader2.flashDriver = flash1;
-bootloader3.flashDriver = flash1;
flash1.$name = "CONFIG_FLASH_SBL";
flash1.serialFlashDriver.$name = "board_flash_serialFlash_serialflash0";
flash1.serialFlashDriver.peripheralDriver.$name = "CONFIG_OSPI_SBL";
@@ -53,6 +51,13 @@ flash1.serialFlashDriver.peripheralDriver.dmaEnable = true;
flash1.serialFlashDriver.peripheralDriver.phyEnable = true;
flash1.serialFlashDriver.peripheralDriver.phySkipTuning = true;
+bootloader3.$name = "CONFIG_BOOTLOADER_FLASH_LINUX";
+bootloader3.appImageOffset = "0x1200000";
+bootloader3.bootMedia = "EMMC";
+
+bootloader3.MMCSDDriver = mmcsd1;
+mmcsd1.$name = "CONFIG_MMCSD_SBL";
+
uart1.$name = "CONFIG_UART_SBL";
uart1.useWakeupDomainPeripherals = false;
uart1.addedByBootloader = true;
@@ -142,6 +147,7 @@ flash1.serialFlashDriver.peripheralDriver.OSPI.D3.$suggestSolution = "OSPI0_D3
flash1.serialFlashDriver.peripheralDriver.OSPI.D2.$suggestSolution = "OSPI0_D2";
flash1.serialFlashDriver.peripheralDriver.OSPI.D1.$suggestSolution = "OSPI0_D1";
flash1.serialFlashDriver.peripheralDriver.OSPI.D0.$suggestSolution = "OSPI0_D0";
+mmcsd1.MMC0.$suggestSolution = "MMC0";
uart1.UART.$suggestSolution = "USART0";
uart1.UART.RXD.$suggestSolution = "UART0_RXD";
uart1.UART.TXD.$suggestSolution = "UART0_TXD";
将此补丁应用于 sbl_ospi_linux_stage2.c、以从 eMMC 引导 Linux appimage:
diff --git a/examples/drivers/boot/common/soc/am62px/sbl_ospi_linux_stage2.c b/examples/drivers/boot/common/soc/am62px/sbl_ospi_linux_stage2.c
index d6df824..3785ddb 100644
--- a/examples/drivers/boot/common/soc/am62px/sbl_ospi_linux_stage2.c
+++ b/examples/drivers/boot/common/soc/am62px/sbl_ospi_linux_stage2.c
@@ -109,6 +109,14 @@ void App_driversOpen()
DebugP_logError("OSPI open failed for instance %d !!!\r\n", CONFIG_OSPI_SBL);
}
+ gMmcsdHandle[CONFIG_MMCSD_SBL] = NULL;
+
+ gMmcsdHandle[CONFIG_MMCSD_SBL] = MMCSD_open(CONFIG_MMCSD_SBL, &gMmcsdParams[CONFIG_MMCSD_SBL]);
+ if(NULL == gMmcsdHandle[CONFIG_MMCSD_SBL])
+ {
+ DebugP_logError("MMCSD open failed for instance %d !!!\r\n", CONFIG_MMCSD_SBL);
+ }
+
gUartHandle[CONFIG_UART_SBL] = NULL;
gUartHandle[CONFIG_UART_SBL] = UART_open(CONFIG_UART_SBL, &gUartParams[CONFIG_UART_SBL]);
@@ -129,6 +137,9 @@ void App_driversClose()
OSPI_close(gOspiHandle[CONFIG_OSPI_SBL]);
gOspiHandle[CONFIG_OSPI_SBL] = NULL;
+ MMCSD_close(gMmcsdHandle[CONFIG_MMCSD_SBL]);
+ gMmcsdHandle[CONFIG_MMCSD_SBL] = NULL;
+
UART_close(gUartHandle[CONFIG_UART_SBL]);
gUartHandle[CONFIG_UART_SBL] = NULL;
}
@@ -232,6 +243,7 @@ void App_loadAndRunImages(Bootloader_LoadImageParams *bootLoadParams)
gImageSize += Bootloader_getMulticoreImageSize(bootLoadParams->bootHandle);
App_printBootloaderLogs();
+ SOC_moduleClockEnable(TISCI_DEV_MMCSD0, 0);
/* Unlock all the control MMRs. Linux/U-boot expects all the MMRs to be unlocked */
SOC_unlockAllMMR();
请确保在进行这些更改后重新编译 stage-2 示例。
确保根据引导加载程序配置将应用程序映像刷写到正确的引导介质并具有适当的偏移量、在使用 UART UNIFLASH 时、可以使用以下配置文件作为刷写的参考: sbl_ospi_emmc_linux_hs_fs.cfg
请注意、对于正常的 Linux 引导、u-boot.img 仍从 OSPI NOR 中加载、因此您需要在 OSPI 中的 0x280000 偏移处刷写 u-boot、但使用 falcon 引导时会跳过 u-boot、因此不需要刷写 u-boot.img 、您只需要在 eMMC 中配置的偏移处刷写 linux.falcon.appimage.hs_fs。