diff --git a/source/drivers/bootloader/bootloader_mcelf.c b/source/drivers/bootloader/bootloader_mcelf.c index 6dcb2b4..ffa6c8e 100644 --- a/source/drivers/bootloader/bootloader_mcelf.c +++ b/source/drivers/bootloader/bootloader_mcelf.c @@ -71,6 +71,9 @@ (ELF_MAX_SEGMENTS * ELF_P_HEADER_MAX_SIZE) \ + ELF_NOTE_SEGMENT_MAX_SIZE) +#define BOOTLOADER_MCELF_FINAL_PACKET_ID (0x5AU) +#define BOOTLOADER_MCELF_PACKET_ID (0xA5U) + /* ========================================================================== */ /* Structure Declarations */ /* ========================================================================== */ @@ -130,7 +133,7 @@ static int32_t Bootloader_parseNoteSegment(Bootloader_Handle handle, /* Functions to call TISCI APIs for authentication */ static int32_t Bootloader_authInit(uint32_t certLoadAddr); -static int32_t Bootloader_authUpdate(uint32_t segAddr, uint32_t segSize, bool final_pkt, uint64_t dst); +static int32_t Bootloader_authUpdate(uint32_t segAddr, uint32_t segSize, uint32_t final_pkt, uint64_t dst); static int32_t Bootloader_authFinish(void); /* Function to copy DMA restricted regions */ @@ -201,7 +204,7 @@ int32_t Bootloader_parseAndLoadMultiCoreELF(Bootloader_Handle handle, Bootloader if(status == SystemP_SUCCESS) { uint32_t i = 1U, cslCoreId = 0U, mcelfCoreId = 0U, imgAddr; - bool isFinalPkt = FALSE; + uint8_t isFinalPkt = BOOTLOADER_MCELF_PACKET_ID; if(config->bootMedia == BOOTLOADER_MEDIA_FLASH) { @@ -258,7 +261,7 @@ int32_t Bootloader_parseAndLoadMultiCoreELF(Bootloader_Handle handle, Bootloader { if (i == elfPtr32->ePhnum - 1U) { - isFinalPkt = TRUE; + isFinalPkt = BOOTLOADER_MCELF_FINAL_PACKET_ID; } if(config->bootMedia == BOOTLOADER_MEDIA_FLASH) @@ -363,7 +366,7 @@ int32_t Bootloader_parseAndLoadMultiCoreELF(Bootloader_Handle handle, Bootloader { if (i == (elfPtr64->ePhnum - 1U)) { - isFinalPkt = TRUE; + isFinalPkt = BOOTLOADER_MCELF_FINAL_PACKET_ID; } if(config->bootMedia == BOOTLOADER_MEDIA_FLASH) @@ -969,7 +972,7 @@ static int32_t Bootloader_authInit(uint32_t certLoadAddr) return authStatus; } -static int32_t Bootloader_authUpdate(uint32_t segAddr, uint32_t segSize, bool final_pkt, uint64_t dst) +static int32_t Bootloader_authUpdate(uint32_t segAddr, uint32_t segSize, uint32_t final_pkt, uint64_t dst) { int32_t status; struct tisci_security_mesg_mcelf_update_req request; @@ -1129,7 +1132,7 @@ int32_t Bootloader_UartParseAndLoadMultiCoreELF(Bootloader_Handle handle, Bootlo if(status == SystemP_SUCCESS) { uint32_t i = 1U, cslCoreId = 0U, mcelfCoreId = 0U; - bool isFinalPkt = FALSE; + bool isFinalPkt = BOOTLOADER_MCELF_PACKET_ID; if(mcelfMetaInfo.elfClass == ELFCLASS_32) { @@ -1175,7 +1178,7 @@ int32_t Bootloader_UartParseAndLoadMultiCoreELF(Bootloader_Handle handle, Bootlo { if (i == (mcelfMetaInfo.elfPtr32->ePhnum - 1U)) { - isFinalPkt = TRUE; + isFinalPkt = BOOTLOADER_MCELF_FINAL_PACKET_ID; } Bootloader_UartArgs *uartArgs = (Bootloader_UartArgs *)(config->args); @@ -1257,7 +1260,7 @@ int32_t Bootloader_UartParseAndLoadMultiCoreELF(Bootloader_Handle handle, Bootlo { if (i == (mcelfMetaInfo.elfPtr64->ePhnum - 1U)) { - isFinalPkt = TRUE; + isFinalPkt = BOOTLOADER_MCELF_FINAL_PACKET_ID; } if(cslCoreId == CSL_CORE_ID_WKUP_R5FSS0_0) { diff --git a/source/drivers/bootloader/bootloader_uniflash.h b/source/drivers/bootloader/bootloader_uniflash.h index cba66d3..d8382f6 100644 --- a/source/drivers/bootloader/bootloader_uniflash.h +++ b/source/drivers/bootloader/bootloader_uniflash.h @@ -83,7 +83,7 @@ typedef struct Bootloader_UniflashFileHeader_s uint32_t flashType; /* Flash type used for flashing. Whether serial/parallel flash */ - + uint32_t rsv1; uint32_t rsv2; uint32_t rsv3; /* Reserved */ diff --git a/source/drivers/makefile.am275x.r5f.ti-arm-clang b/source/drivers/makefile.am275x.r5f.ti-arm-clang index d63c21e..137c95f 100644 --- a/source/drivers/makefile.am275x.r5f.ti-arm-clang +++ b/source/drivers/makefile.am275x.r5f.ti-arm-clang @@ -16,6 +16,17 @@ ConfigName:=$(PROFILE) LIBNAME:=drivers.am275x.r5f.ti-arm-clang.$(PROFILE).lib FILES_common := \ + bootloader.c \ + bootloader_dma.c \ + bootloader_flash.c \ + bootloader_mcelf.c \ + bootloader_mem.c \ + bootloader_mmcsd_raw.c \ + bootloader_profile.c \ + bootloader_soc.c \ + bootloader_uart.c \ + bootloader_uniflash.c \ + bootloader_xmodem.c \ aasrc.c \ aasrc_ch.c \ aasrc_clocking.c \ @@ -98,6 +109,9 @@ FILES_common := \ watchdog_soc.c \ FILES_PATH_common = \ + bootloader/soc/am275x \ + bootloader/tiELFuParser \ + bootloader \ adc/v0 \ aasrc/v0 \ aasrc/v0/soc/am275x \ diff --git a/source/drivers/soc/am275x/soc.c b/source/drivers/soc/am275x/soc.c index 381f934..1690aa9 100644 --- a/source/drivers/soc/am275x/soc.c +++ b/source/drivers/soc/am275x/soc.c @@ -475,6 +475,24 @@ void SOC_setDevStat(uint32_t bootMode) return; } +void SOC_generateSwWarmResetMcuDomain(void) +{ + /* Reset Ctrl belongs to partition 6 of the MCU CTRL MMR */ + uint32_t rstPartition = 6U, baseAddr; + + /* Unlock CONTROL MMR registers */ + SOC_controlModuleUnlockMMR(SOC_DOMAIN_ID_MCU, rstPartition); + + /* MCU domain warm reset */ + baseAddr = (uint32_t) AddrTranslateP_getLocalAddr(CSL_MCU_CTRL_MMR0_CFG0_BASE); + CSL_REG32_FINS(baseAddr + CSL_MCU_CTRL_MMR_CFG0_RST_CTRL, + MCU_CTRL_MMR_CFG0_RST_CTRL_SW_MCU_WARMRST, + 0x6U); + + /* Lock CONTROL MMR registers */ + SOC_controlModuleLockMMR(SOC_DOMAIN_ID_MCU, rstPartition); +} + void SOC_generateSwWarmResetMainDomain(void) { /* Reset Ctrl belongs to partition 6 of the CTRL MMR */