]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/sbl.git/commitdiff
PRSDK-4440 Add eMMc multi partition support
authorSinthu Raja M <x0257345@ti.com>
Thu, 6 Sep 2018 12:24:08 +0000 (17:54 +0530)
committerMadan Srinivas <a0756974@ti.com>
Fri, 7 Dec 2018 21:13:32 +0000 (16:13 -0500)
 Add eMMc multi partition support to read app and execute the same
 from any available partition not more than 4.

PRSDK-4440 Build scrip update for eMMc boot

 Update build script for eMMC boot to enable yocto build for eMMc
 binaries.

PRSDK-4440 Remove Multi-partition macro

 Remove multi-partition macro.
 Update code to use fatfs library which is common for single and
 multi-partition library.

PRSDK-4440 Enable multi-partition support for MMCSD boot

 Enable multi-partition support for MMCSD boot as a default mode

board/evmAM572x/build/makefile
build/sbl_am57xx.sh
soc/am57xx/sbl_slave_core_boot.c
src/mmcsd/sbl_mmcsd.c

index 2c849a7b63a0aed8e645c23a25d94c07e11c5411..e0f0c91a354764f03c12b29a40092e8283c464b9 100644 (file)
@@ -71,6 +71,11 @@ PM_HAL_LIB = "$(PDK_INSTALL_PATH)/ti/drv/pm/lib/am572x/a15/release/pm_hal.aa15fg
 # BOOTMODE specific CFLAGS
 ifeq ($(BOOTMODE), mmcsd)
   INTERNALDEFS += -DBOOT_MMCSD
+else ifeq ($(BOOTMODE), emmc)
+  INTERNALDEFS += -DBOOT_EMMC
+endif
+
+ifeq ($(BOOTMODE), $(filter $(BOOTMODE), mmcsd emmc))
   SBL_MMCSD_DIR = $(SBL_SRC_DIR)/src/mmcsd
   INCDIR := $(CSL_DIR);$(PDK_INSTALL_PATH);$(BOARD_DIR);$(SBL_INC_DIR);$(SBL_LIB_INC_DIR);$(SBL_MMCSD_DIR);$(SBL_SOC_DIR);$(SBL_SRC_DIR)/soc
   PERIPHERAL_LIB = $(UART_LIB) $(I2C_LIB) $(MMCSD_LIB) $(FATFS_LIB) $(CSL_LIB) $(CSL_INIT_LIB) $(OSAL_LIB) $(PM_HAL_LIB)
@@ -107,6 +112,9 @@ INCS = -I. -I$(strip $(subst ;, -I,$(INCDIR)))
 
 VPATH=$(SRCDIR):$(SRCDIR)/$(BOARD):$(SBL_SRC_DIR)/soc/am57xx:$(SBL_SRC_DIR)/src/$(BOOTMODE):$(SBL_SRC_DIR)/src/rprc:$(SBL_SRC_DIR)/board/src:$(PDK_INSTALL_PATH)/ti/drv/uart/soc/am572x:$(PDK_INSTALL_PATH)/ti/drv/mmcsd/soc/am57xx:$(PDK_INSTALL_PATH)/ti/drv/spi/soc/am572x
 
+ifeq ($(BOOTMODE), emmc)
+VPATH+=:$(SBL_SRC_DIR)/src/mmcsd
+endif
 #List the Source Files
 SRC_C = \
        sbl_main.c \
@@ -119,7 +127,7 @@ SRC_C = \
 SRC_DRV = \
        UART_soc.c
 
-ifeq ($(BOOTMODE), mmcsd)
+ifeq ($(BOOTMODE), $(filter $(BOOTMODE), mmcsd emmc))
     SRC_C += sbl_mmcsd.c
     SRC_DRV += MMCSD_soc.c
 endif
@@ -131,6 +139,7 @@ ENTRY_SRC = sbl_init.S
 CFLAGS += -Wall -O2
 SRC_CFLAGS = -I. $(CFLAGS) -g -gdwarf-3 -gstrict-dwarf -Wall 
 
+
 # Make Rule for the SRC Files
 SRC_OBJS = $(patsubst %.c, $(SBLOBJDIR)/%.$(OBJEXT), $(SRC_C))
 ENTRY_OBJ = $(patsubst %.S, $(SBLOBJDIR)/%.$(ASMOBJEXT), $(ENTRY_SRC))
index 64b9b1193c1b52437abb7339ac4875ea8668b483..002939d786521bc1d482ec86668d40eb37ae95c2 100755 (executable)
@@ -17,6 +17,7 @@ make all BOARD=idkAM572x SOC=AM572x BOOTMODE=qspi
 make all BOARD=idkAM571x SOC=AM571x BOOTMODE=mmcsd
 make all BOARD=idkAM571x SOC=AM571x BOOTMODE=qspi
 make all BOARD=evmAM572x SOC=AM572x BOOTMODE=mmcsd
+make all BOARD=evmAM572x SOC=AM572x BOOTMODE=emmc
 make flashwriter BOARD=idkAM572x SOC=AM572x
 make flashwriter BOARD=idkAM571x SOC=AM571x
 make flashwriter BOARD=idkAM574x SOC=AM574x
index d9bfd9c2b898813f1a6e5e1e0db920a66232ea05..4d70128d152d25de4f5c339737dbbfc437359ac3 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 /*
- * Copyright (C) 2015-2017 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2015-2018 Texas Instruments Incorporated - http://www.ti.com/
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -184,7 +184,7 @@ int32_t SBL_ImageCopy(sblEntryPoint_t *pEntry)
 {
     int32_t retval = 0;
 
-#if defined(BOOT_MMCSD)
+#if defined(BOOT_MMCSD) || defined(BOOT_EMMC)
     /* MMCSD Boot Mode Image Copy function. */
     if (SBL_MMCBootImage(pEntry) != 1U)
 #elif defined(BOOT_QSPI)
index 2e711522210513067297cd4d9cf4b1dc40e5d948..1fb21863420ba0149a04ce06f440f012611b3190 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 /*
- * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2015 - 2018 Texas Instruments Incorporated - http://www.ti.com/
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 #include "sbl_sec.h"
 #endif
 
+#define MMCSD_INSTANCE_SDCARD  0U
+#define MMCSD_INSTANCE_EMMC    1U
+
+#ifdef BOOT_EMMC
+#define MMCSD_INSTANCE MMCSD_INSTANCE_EMMC
+#else
+#define MMCSD_INSTANCE MMCSD_INSTANCE_SDCARD
+#endif
+
 /**
  * \brief    SBL_FileRead function reads N bytes from SD card and
  *           advances the cursor.
@@ -154,8 +163,6 @@ const FATFS_Config FATFS_config[_VOLUMES + 1] = {
          &FATFS_initCfg[2]
     },
 
-    {NULL, NULL, NULL},
-
     {NULL, NULL, NULL}
 };
 
@@ -226,7 +233,8 @@ int32_t SBL_ReadSysfwImage(void *pBuffer, uint32_t num_bytes)
 int32_t SBL_MMCBootImage(sblEntryPoint_t *pEntry)
 {
     int32_t retVal = E_PASS;
-    const TCHAR *fileName = "/app";
+    uint16_t pIndex = 0;
+    char fileName[7];
     FIL     fp;
     FRESULT  fresult;
     
@@ -241,18 +249,27 @@ int32_t SBL_MMCBootImage(sblEntryPoint_t *pEntry)
     MMCSDInitCfg[1].cardType = MMCSD_CARD_SD;
 #endif
 
-    if (sbl_fatfsHandle)
-    {
-    }
-    else
+    if (!sbl_fatfsHandle)
     {
         /* Initialization of the driver. */
         FATFS_init();
 
         /* MMCSD FATFS initialization */
-        FATFS_open(0U, NULL, &sbl_fatfsHandle);
+        fresult = (FRESULT)FATFS_open(MMCSD_INSTANCE, NULL, &sbl_fatfsHandles);
     }
-    fresult = f_open(&fp, fileName, ((BYTE)FA_READ));
+
+    for(pIndex = 0; pIndex < _VOLUMES; pIndex++)
+    {
+        /*Search file name in the indexed partition*/
+        snprintf(fileName, sizeof(fileName),"%d:/app", pIndex);
+        fresult = f_open(&fp, fileName, (uint8_t) FA_READ);
+
+        if(fresult == FR_OK)
+        {
+            break;
+        }
+    }
+
     if (fresult != FR_OK)
     {
         UART_printf("\n SD Boot - File open fails \n");