Other Parts Discussed in Thread: UNIFLASH, AM62P
器件型号: AM62x
Thread 中讨论的其他器件: UNIFLASH、 AM62P
MCU+SDK 中提供的 UART UNIFLASH 工具仅适用于开箱即用的 TI EVM、因为它是根据特定 EVM 中使用的闪存和 DDR 器件进行配置的、此常见问题解答提供了有关如何将此工具移植到定制电路板中的步骤。
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.
对于 AM464/AM243 器件和其他 AM62XX 器件 (AM62x、AM62P、AM62D、AM62A)、此工具的移植过程大致相似、但由于 AM62XX 器件具有多级 UART UNIFLASH 应用程序、因此存在一些差异、稍后将重点介绍这些应用程序。
您需要更改 SBL UART UNIFLASH 中的 SYSCFG 闪存模块配置、并添加电路板上使用的闪存 器件的配置、所有 SoC 的 MCU+SDK 提供了添加对定制闪存器件支持的指南 此处是指向 AM64x 指南的链接、可用作参考:
对于 AM62XX 器件、此更改将在 2 级应用中完成。
要调试任何与闪存相关的故障、您可以参阅以下内容: https://www.ti.com/lit/an/sprads5/sprads5.pdf
如果电路板具有 DDR、并且该文件与 EVM 上使用的器件不同、则需要创建自己的 DDR/LPDDR 配置文件、然后使用该文件而不是默认文件。 为此、可以参考以下指南:
对于 AM62XX 器件、此更改将在阶段 1 应用中完成。
如果定制电路板没有 DDR、则 AM64/AM243 器件需要此接口。
UNIFLASH 使用放置在 DDR 中的缓冲器(gUniflashFileBuf、放置在.bss.filebuf 段)接收映像、然后稍后将其复制到闪存。 如果您的电路板没有 DDR、则您需要更改 SYSCFG 中的存储器配置、并将本节放在 MSRAM 而不是 DDR 中、同时从 SYSCFG 中删除 DDR 实例、请参阅以下内容 以了解更多详细信息:AM2431:AM2431–UART Uniflash 到定制电路板上使用 HS-SBL 刷写 FS 故障
以下补丁包含 example.syscfg 中所需的所有更改:
diff --git a/examples/drivers/boot/sbl_uart_uniflash/am64x-evm/r5fss0-0_nortos/example.syscfg b/examples/drivers/boot/sbl_uart_uniflash/am64x-evm/r5fss0-0_nortos/example.syscfg
index 81749d5..3bbe41b 100644
--- a/examples/drivers/boot/sbl_uart_uniflash/am64x-evm/r5fss0-0_nortos/example.syscfg
+++ b/examples/drivers/boot/sbl_uart_uniflash/am64x-evm/r5fss0-0_nortos/example.syscfg
@@ -12,8 +12,6 @@ const flash = scripting.addModule("/board/flash/flash", {}, false);
const flash1 = flash.addInstance();
const bootloader = scripting.addModule("/drivers/bootloader/bootloader", {}, false);
const bootloader1 = bootloader.addInstance();
-const ddr = scripting.addModule("/drivers/ddr/ddr", {}, false);
-const ddr1 = ddr.addInstance();
const mmcsd = scripting.addModule("/drivers/mmcsd/mmcsd", {}, false);
const mmcsd1 = mmcsd.addInstance();
const uart = scripting.addModule("/drivers/uart/uart", {}, false);
@@ -48,8 +46,6 @@ flash1.peripheralDriver.$name = "CONFIG_OSPI0";
bootloader1.$name = "CONFIG_BOOTLOADER_MEM";
bootloader1.bootMedia = "MEM";
-ddr1.$name = "CONFIG_DDR0";
-
mmcsd1.$name = "CONFIG_MMCSD0";
mmcsd1.moduleSelect = "MMC0";
@@ -115,10 +111,8 @@ region1.memory_region[5].$name = "MSRAM_1";
region1.memory_region[5].auto = false;
region1.memory_region[5].manualStartAddress = 0x70080000;
region1.memory_region[5].size = 0x18000;
-region1.memory_region[6].type = "DDR_ALL";
-region1.memory_region[6].$name = "DDR";
-region1.memory_region[6].auto = false;
-region1.memory_region[6].size = 0x800000;
+region1.memory_region[6].$name = "MSRAM_2";
+region1.memory_region[6].size = 0x150000;
section1.$name = "Vector Table";
section1.group = false;
@@ -188,9 +182,9 @@ section4.output_section[4].input_section.create(1);
section4.output_section[4].input_section[0].$name = ". = . + __UNDEFINED_STACK_SIZE;";
section5.$name = "CONFIG_SECTION0";
-section5.load_memory = "DDR";
section5.type = "NOLOAD";
section5.group = false;
+section5.load_memory = "MSRAM_2";
section5.output_section.create(1);
section5.output_section[0].$name = ".bss.filebuf";
section5.output_section[0].alignment = 0;
需要将以下补丁应用于 main.c、以使文件缓冲区能够放入配置的 MSRAM 区域:
diff --git a/examples/drivers/boot/sbl_uart_uniflash/am64x-evm/r5fss0-0_nortos/main.c b/examples/drivers/boot/sbl_uart_uniflash/am64x-evm/r5fss0-0_nortos/main.c
index 65eb60f5..c25037be 100644
--- a/examples/drivers/boot/sbl_uart_uniflash/am64x-evm/r5fss0-0_nortos/main.c
+++ b/examples/drivers/boot/sbl_uart_uniflash/am64x-evm/r5fss0-0_nortos/main.c
@@ -41,7 +41,7 @@
#include <drivers/bootloader/bootloader_xmodem.h>
#include <drivers/bootloader/bootloader_uniflash/bootloader_uniflash.h>
-#define BOOTLOADER_UNIFLASH_MAX_FILE_SIZE (0x800000) /* This has to match the size of DDR section in linker.cmd */
+#define BOOTLOADER_UNIFLASH_MAX_FILE_SIZE (0x150000) /* This has to match the size of DDR section in linker.cmd */
uint8_t gUniflashFileBuf[BOOTLOADER_UNIFLASH_MAX_FILE_SIZE] __attribute__((aligned(128), section(".bss.filebuf")));
#define BOOTLOADER_UNIFLASH_VERIFY_BUF_MAX_SIZE (32*1024)
这适用于所有 SoC。
SBL_UART_UNIFLASH 尝试初始化 OSPI 和 EMMC。 如果定制电路板上缺失其中一个、SBL_UART_UNIFLASH 将难以初始化、因此刷写过程不会继续进行、导致失败。
如果电路板没有闪存:
从 SBL_UART_UNIFLASH 的 syscfg 中删除闪存实例。 由于缺少一些变量、A/64/AM243 器件会收到一些编译器错误、请在 main.c 中将这些变量添加为虚拟变量以解决此问题:
#include<board/flash.h> #define CONFIG_FLASH_NUM_INSTANCES 0 Flash_Config gFlashConfig[CONFIG_FLASH_NUM_INSTANCES]; uint32_t gFlashConfigNum = CONFIG_FLASH_NUM_INSTANCES; #define CONFIG_FLASH0 0
如果电路板没有 eMMC:
从 SBL_UART_UNIFLASH 的 syscfg 中删除 MMCSD 实例。 由于缺少一些变量、AM64/AM243 器件可能会出现一些编译器错误、请在 main.c 中将这些变量添加为虚拟变量以解决此问题。
#include <drivers/mmcsd.h> #define CONFIG_MMCSD_NUM_INSTANCES 0 MMCSD_Config gMmcsdConfig[CONFIG_MMCSD_NUM_INSTANCES]; uint32_t gMmcsdConfigNum = CONFIG_MMCSD_NUM_INSTANCES;
请在进行相关更改后重新编译 SBL UART UNIFLASH 示例 (AM62XX 的 stage-1 和 stage-2)、并通过运行 uart_uniflash.py 脚本测试移植是否成功。