Skip to content

Commit

Permalink
[REL] Ready for v5.1.0
Browse files Browse the repository at this point in the history
Signed-off-by: Jay Heng <[email protected]>
  • Loading branch information
JayHeng committed May 25, 2023
1 parent e8d68a0 commit b507e44
Show file tree
Hide file tree
Showing 53 changed files with 8,822 additions and 38 deletions.
2 changes: 1 addition & 1 deletion README-zh.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# NXP MCU Boot Utility

[![GitHub release](https://img.shields.io/github/release/JayHeng/NXP-MCUBootUtility.svg)](https://github.com/JayHeng/NXP-MCUBootUtility/releases/latest) [![GitHub commits](https://img.shields.io/github/commits-since/JayHeng/NXP-MCUBootUtility/v5.0.0.svg)](https://github.com/JayHeng/NXP-MCUBootUtility/compare/v5.0.0...master) ![GitHub All Releases](https://img.shields.io/github/downloads/JayHeng/NXP-MCUBootUtility/total.svg) [![GitHub license](https://img.shields.io/github/license/JayHeng/NXP-MCUBootUtility.svg)](https://github.com/JayHeng/NXP-MCUBootUtility/blob/master/LICENSE)
[![GitHub release](https://img.shields.io/github/release/JayHeng/NXP-MCUBootUtility.svg)](https://github.com/JayHeng/NXP-MCUBootUtility/releases/latest) [![GitHub commits](https://img.shields.io/github/commits-since/JayHeng/NXP-MCUBootUtility/v5.1.0.svg)](https://github.com/JayHeng/NXP-MCUBootUtility/compare/v5.1.0...master) ![GitHub All Releases](https://img.shields.io/github/downloads/JayHeng/NXP-MCUBootUtility/total.svg) [![GitHub license](https://img.shields.io/github/license/JayHeng/NXP-MCUBootUtility.svg)](https://github.com/JayHeng/NXP-MCUBootUtility/blob/master/LICENSE)

[English](./README.md) | 中文

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# NXP MCU Boot Utility

[![GitHub release](https://img.shields.io/github/release/JayHeng/NXP-MCUBootUtility.svg)](https://github.com/JayHeng/NXP-MCUBootUtility/releases/latest) [![GitHub commits](https://img.shields.io/github/commits-since/JayHeng/NXP-MCUBootUtility/v5.0.0.svg)](https://github.com/JayHeng/NXP-MCUBootUtility/compare/v5.0.0...master) ![GitHub All Releases](https://img.shields.io/github/downloads/JayHeng/NXP-MCUBootUtility/total.svg) [![GitHub license](https://img.shields.io/github/license/JayHeng/NXP-MCUBootUtility.svg)](https://github.com/JayHeng/NXP-MCUBootUtility/blob/master/LICENSE)
[![GitHub release](https://img.shields.io/github/release/JayHeng/NXP-MCUBootUtility.svg)](https://github.com/JayHeng/NXP-MCUBootUtility/releases/latest) [![GitHub commits](https://img.shields.io/github/commits-since/JayHeng/NXP-MCUBootUtility/v5.1.0.svg)](https://github.com/JayHeng/NXP-MCUBootUtility/compare/v5.1.0...master) ![GitHub All Releases](https://img.shields.io/github/downloads/JayHeng/NXP-MCUBootUtility/total.svg) [![GitHub license](https://img.shields.io/github/license/JayHeng/NXP-MCUBootUtility.svg)](https://github.com/JayHeng/NXP-MCUBootUtility/blob/master/LICENSE)

English | [中文](./README-zh.md)

Expand Down
Binary file not shown.
1,065 changes: 1,065 additions & 0 deletions apps/NXP_MIMXRT1180-EVK_Rev.B/cm33/led_blinky_0x30493000.hex

Large diffs are not rendered by default.

1,064 changes: 1,064 additions & 0 deletions apps/NXP_MIMXRT1180-EVK_Rev.B/cm33/led_blinky_0x30493000.srec

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
1,065 changes: 1,065 additions & 0 deletions apps/NXP_MIMXRT1180-EVK_Rev.B/cm33/led_blinky_0x3049a000.hex

Large diffs are not rendered by default.

1,064 changes: 1,064 additions & 0 deletions apps/NXP_MIMXRT1180-EVK_Rev.B/cm33/led_blinky_0x3049a000.srec

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
1,065 changes: 1,065 additions & 0 deletions apps/NXP_MIMXRT1180-EVK_Rev.B/cm33/led_blinky_0x3800b000.hex

Large diffs are not rendered by default.

1,064 changes: 1,064 additions & 0 deletions apps/NXP_MIMXRT1180-EVK_Rev.B/cm33/led_blinky_0x3800b000.srec

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
1,065 changes: 1,065 additions & 0 deletions apps/NXP_MIMXRT1180-EVK_Rev.B/cm33/led_blinky_0x38010000.hex

Large diffs are not rendered by default.

1,064 changes: 1,064 additions & 0 deletions apps/NXP_MIMXRT1180-EVK_Rev.B/cm33/led_blinky_0x38010000.srec

Large diffs are not rendered by default.

Binary file not shown.
Binary file modified bin/NXP-MCUBootUtility.exe
Binary file not shown.
34 changes: 34 additions & 0 deletions gui/NXP-MCUBootUtility.fbp
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,40 @@
<event name="OnMenuSelection">callbackSetIvtEntryToVectorTable</event>
</object>
</object>
<object class="submenu" expanded="0">
<property name="bitmap"></property>
<property name="label">Use Edgelock Fw</property>
<property name="name">m_menu_edgelockFwOpt</property>
<property name="permission">protected</property>
<object class="wxMenuItem" expanded="0">
<property name="bitmap"></property>
<property name="checked">0</property>
<property name="enabled">1</property>
<property name="help"></property>
<property name="id">wxID_ANY</property>
<property name="kind">wxITEM_RADIO</property>
<property name="label">Disable</property>
<property name="name">m_menuItem_edgelockFwDis</property>
<property name="permission">none</property>
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">callbackDisableEdgelockFw</event>
</object>
<object class="wxMenuItem" expanded="0">
<property name="bitmap"></property>
<property name="checked">0</property>
<property name="enabled">1</property>
<property name="help"></property>
<property name="id">wxID_ANY</property>
<property name="kind">wxITEM_RADIO</property>
<property name="label">Enable</property>
<property name="name">m_menuItem_edgelockFwEn</property>
<property name="permission">none</property>
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">callbackEnableEdgelockFw</event>
</object>
</object>
</object>
<object class="wxMenu" expanded="0">
<property name="label">Window</property>
Expand Down
2 changes: 2 additions & 0 deletions src/boot/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ def __init__(self, cpu, board='', build='', **kwargs):
self.flexspiNorDevice = misc.get_dict_default(kwargs, 'flexspiNorDevice', None)
self.flexspiNorMemBase = misc.get_dict_default(kwargs, 'flexspiNorMemBase0', None)
self.flexspiNorMemBase0 = misc.get_dict_default(kwargs, 'flexspiNorMemBase0', None)
self.flexspiNorMemBase0Aliased = misc.get_dict_default(kwargs, 'flexspiNorMemBase0Aliased', None)
self.flexspiNorMemBase1 = misc.get_dict_default(kwargs, 'flexspiNorMemBase1', None)
self.flexspiNorMemBase1Aliased = misc.get_dict_default(kwargs, 'flexspiNorMemBase1Aliased', None)
self.flexspiFreqs = misc.get_dict_default(kwargs, 'flexspiFreqs', None)
self.xspiNorCfgInfoOffset = misc.get_dict_default(kwargs, 'xspiNorCfgInfoOffset', None)
self.flexspiNorEfuseBootCfg0Bits = misc.get_dict_default(kwargs, 'flexspiNorEfuseBootCfg0Bits', None)
Expand Down
119 changes: 100 additions & 19 deletions src/gen/RTyyyy_gencore.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ def RTyyyy_initGen( self ):
self.destAppExecAddr = 0
self.destAppRawBinFilename = os.path.join(self.exeTopRoot, 'gen', 'bootable_image', 'raw_application.bin')
self.destAppContainerFilename = os.path.join(self.exeTopRoot, 'gen', 'bootable_image', 'container_application_nopadding.bin')
self.edgelockContainerName = 'edgelock_cntr.bin'
self.edgelockFwName = 'edgelock_fw.bin'
self.hasEdgelockFw = False

def _copyCstBinToElftosbFolder( self ):
shutil.copy(self.cstBinFolder + '\\cst.exe', os.path.split(self.elftosbPath)[0])
Expand Down Expand Up @@ -629,8 +632,12 @@ def _setDestAppInitialBootHeaderInfo( self, bootDevice ):
if bootDevice == RTyyyy_uidef.kBootDevice_FlexspiNor or \
bootDevice == RTyyyy_uidef.kBootDevice_SemcNor:
if self.tgt.bootHeaderType == gendef.kBootHeaderType_Container:
self.destAppContainerOffset = RTyyyy_gendef.kContainerOffset_NOR
self.destAppInitialLoadSize = RTyyyy_gendef.kContainerOffset_NOR + RTyyyy_memdef.kMemBlockSize_Container
if self.hasEdgelockFw:
self.destAppContainerOffset = RTyyyy_gendef.kContainerOffset_NOR + RTyyyy_gendef.kContainerSize_Edgelock
self.destAppInitialLoadSize = RTyyyy_gendef.kContainerOffset_NOR + RTyyyy_memdef.kMemBlockSize_Container + RTyyyy_memdef.kMemBlockSize_Edgelock
else:
self.destAppContainerOffset = RTyyyy_gendef.kContainerOffset_NOR
self.destAppInitialLoadSize = RTyyyy_gendef.kContainerOffset_NOR + RTyyyy_memdef.kMemBlockSize_Container
elif self.tgt.bootHeaderType == gendef.kBootHeaderType_IVT:
self.destAppIvtOffset = RTyyyy_gendef.kIvtOffset_NOR
self.destAppInitialLoadSize = RTyyyy_gendef.kInitialLoadSize_NOR
Expand All @@ -646,8 +653,12 @@ def _setDestAppInitialBootHeaderInfo( self, bootDevice ):
elif bootDevice == RTyyyy_uidef.kBootDevice_UsdhcSd or \
bootDevice == RTyyyy_uidef.kBootDevice_UsdhcMmc:
if self.tgt.bootHeaderType == gendef.kBootHeaderType_Container:
self.destAppContainerOffset = RTyyyy_gendef.kContainerOffset_SD
self.destAppInitialLoadSize = RTyyyy_gendef.kFirstLoadSize_SD
if self.hasEdgelockFw:
self.destAppContainerOffset = RTyyyy_gendef.kContainerOffset_SD + RTyyyy_gendef.kContainerSize_Edgelock
self.destAppInitialLoadSize = RTyyyy_gendef.kFirstLoadSize_SD + RTyyyy_memdef.kMemBlockSize_Edgelock
else:
self.destAppContainerOffset = RTyyyy_gendef.kContainerOffset_SD
self.destAppInitialLoadSize = RTyyyy_gendef.kFirstLoadSize_SD
elif self.tgt.bootHeaderType == gendef.kBootHeaderType_IVT:
self.destAppIvtOffset = RTyyyy_gendef.kIvtOffset_NAND_SD_EEPROM
self.destAppInitialLoadSize = RTyyyy_gendef.kInitialLoadSize_NAND_SD_EEPROM
Expand All @@ -664,14 +675,20 @@ def _setDestAppFinalBootHeaderInfo( self, bootDevice ):
if self.isXipApp:
self.destAppInitialLoadSize = self.destAppVectorOffset
else:
self.destAppInitialLoadSize = RTyyyy_gendef.kInitialLoadSize_NOR
if self.hasEdgelockFw:
self.destAppInitialLoadSize = RTyyyy_gendef.kContainerOffset_NOR + RTyyyy_gendef.kContainerSize_Edgelock + RTyyyy_memdef.kMemBlockSize_Container + RTyyyy_memdef.kMemBlockSize_Edgelock
else:
self.destAppInitialLoadSize = RTyyyy_gendef.kInitialLoadSize_NOR
elif bootDevice == RTyyyy_uidef.kBootDevice_FlexspiNand or \
bootDevice == RTyyyy_uidef.kBootDevice_SemcNand or \
bootDevice == RTyyyy_uidef.kBootDevice_UsdhcSd or \
bootDevice == RTyyyy_uidef.kBootDevice_UsdhcMmc or \
bootDevice == RTyyyy_uidef.kBootDevice_LpspiNor:
self.isXipApp = False
self.destAppVectorOffset = self.destAppInitialLoadSize
if self.hasEdgelockFw:
self.destAppVectorOffset = self.destAppInitialLoadSize + RTyyyy_gendef.kContainerSize_Edgelock
else:
self.destAppVectorOffset = self.destAppInitialLoadSize
else:
pass

Expand Down Expand Up @@ -927,8 +944,28 @@ def _RTyyyy_isValidAppImage( self, imageStartAddr ):
return False
return self._RTyyyy_isValidNonXipAppImage(imageStartAddr)

def _validateEdgelockFwFiles( self ):
if not self.edgelockFwEn:
self.hasEdgelockFw = False
elif self.tgt.bootHeaderType == gendef.kBootHeaderType_Container:
fwCntrFile = os.path.join(self.cpuDir, self.edgelockContainerName)
fwImgFile = os.path.join(self.cpuDir, self.edgelockFwName)
if os.path.isfile(fwCntrFile) and os.path.isfile(fwImgFile):
size = os.path.getsize(fwCntrFile)
if size > RTyyyy_gendef.kContainerSize_Edgelock:
self.popupMsgBox(uilang.kMsgLanguageContentDict['edgelockFwError_cntrSizeTooLarge'][self.languageIndex] + str(hex(size)) + " !")
return False
size = os.path.getsize(fwImgFile)
if size > RTyyyy_memdef.kMemBlockSize_Edgelock:
self.popupMsgBox(uilang.kMsgLanguageContentDict['edgelockFwError_imageSizeTooLarge'][self.languageIndex] + str(hex(size)) + " !")
return False
self.hasEdgelockFw = True
return True

def _createMatchedAppInfofile( self, ideRetryType ):
self.srcAppFilename = self.getUserAppFilePath()
if not self._validateEdgelockFwFiles():
return False
self._setDestAppInitialBootHeaderInfo(self.bootDevice)
imageStartAddr, imageEntryAddr, imageLength = self._RTyyyy_getImageInfo(self.srcAppFilename, ideRetryType)
if imageStartAddr == None or imageEntryAddr == None:
Expand All @@ -941,12 +978,26 @@ def _createMatchedAppInfofile( self, ideRetryType ):
if (imageStartAddr + imageLength <= self.tgt.flexspiNorMemBase + RTyyyy_rundef.kBootDeviceMemXipSize_FlexspiNor):
self.isXipApp = True
self.destAppVectorOffset = imageStartAddr - self.tgt.flexspiNorMemBase
minReservedSize = 0
if self.tgt.bootHeaderType == gendef.kBootHeaderType_Container:
minReservedSize = RTyyyy_gendef.kFirstLoadSize_NOR
if self.hasEdgelockFw:
minReservedSize += RTyyyy_memdef.kMemBlockSize_Edgelock
elif self.tgt.bootHeaderType == gendef.kBootHeaderType_IVT:
minReservedSize = RTyyyy_gendef.kInitialLoadSize_NOR
if self.destAppVectorOffset < minReservedSize:
self.popupMsgBox(uilang.kMsgLanguageContentDict['srcImgError_xipOffsetTooSmall'][self.languageIndex] + str(hex(minReservedSize)) + " !")

return False
else:
self.popupMsgBox(uilang.kMsgLanguageContentDict['srcImgError_xipSizeTooLarge'][self.languageIndex] + u"0x%s !" %(RTyyyy_rundef.kBootDeviceMemXipSize_FlexspiNor))
self.popupMsgBox(uilang.kMsgLanguageContentDict['srcImgError_xipSizeTooLarge'][self.languageIndex] + str(hex(RTyyyy_rundef.kBootDeviceMemXipSize_FlexspiNor)) + " !")
return False
else:
if self.tgt.bootHeaderType == gendef.kBootHeaderType_Container:
self.destAppVectorOffset = RTyyyy_gendef.kContainerOffset_NOR + RTyyyy_memdef.kMemBlockSize_Container
if self.hasEdgelockFw:
self.destAppVectorOffset = RTyyyy_gendef.kFirstLoadSize_NOR + RTyyyy_memdef.kMemBlockSize_Edgelock + RTyyyy_gendef.kContainerSize_Edgelock
else:
self.destAppVectorOffset = RTyyyy_gendef.kContainerOffset_NOR + RTyyyy_memdef.kMemBlockSize_Container
elif self.tgt.bootHeaderType == gendef.kBootHeaderType_IVT:
self.destAppVectorOffset = RTyyyy_gendef.kInitialLoadSize_NOR
elif self.bootDevice == RTyyyy_uidef.kBootDevice_SemcNor:
Expand All @@ -955,7 +1006,7 @@ def _createMatchedAppInfofile( self, ideRetryType ):
self.isXipApp = True
self.destAppVectorOffset = imageStartAddr - RTyyyy_rundef.kBootDeviceMemBase_SemcNor
else:
self.popupMsgBox(uilang.kMsgLanguageContentDict['srcImgError_xipSizeTooLarge'][self.languageIndex] + u"0x%s !" %(RTyyyy_rundef.kBootDeviceMemXipSize_SemcNor))
self.popupMsgBox(uilang.kMsgLanguageContentDict['srcImgError_xipSizeTooLarge'][self.languageIndex] + str(hex(RTyyyy_rundef.kBootDeviceMemXipSize_SemcNor)) + " !")
return False
else:
self.destAppVectorOffset = RTyyyy_gendef.kInitialLoadSize_NOR
Expand Down Expand Up @@ -1170,14 +1221,21 @@ def _RTyyyy_signPartOfImage( self ):
def _genCompleteContainerData( self, imageData ):
containerStruct = uiheader.containerStruct()
if self.bootDevice == RTyyyy_uidef.kBootDevice_FlexspiNor:
containerStruct.set_members(self.tgt.flexspiNorMemBase, self.destAppExecAddr, imageData)
containerStruct.set_members(self.tgt.flexspiNorMemBase, self.destAppExecAddr, imageData, self.hasEdgelockFw)
return containerStruct.out_bytes_str()
elif self.bootDevice == RTyyyy_uidef.kBootDevice_UsdhcSd or \
self.bootDevice == RTyyyy_uidef.kBootDevice_UsdhcMmc:
containerStruct.set_members(0, self.destAppExecAddr, imageData)
containerStruct.set_members(0, self.destAppExecAddr, imageData, self.hasEdgelockFw)
return containerStruct.out_bytes_str()
return None

def _genPaddingByteArrayStr( self, num, pattern=0x00 ):
paddingBytes = [pattern] * num
paddingBytesStr = ''
for i in range(num):
paddingBytesStr += chr(paddingBytes[i])
return paddingBytesStr

def _genCompleteAppWithContainer( self ):
if self.bootDevice == RTyyyy_uidef.kBootDevice_FlexspiNor:
pass
Expand All @@ -1186,21 +1244,44 @@ def _genCompleteAppWithContainer( self ):
self._setDestAppFinalBootHeaderInfo(self.bootDevice)
else:
return
finalBtAppData = ''
##############################################################
if self.hasEdgelockFw:
edgelockCntrFile = os.path.join(self.cpuDir, self.edgelockContainerName)
edgelockCntrBytes = None
with open(edgelockCntrFile, 'rb') as fileObj:
edgelockCntrBytes = fileObj.read()
fileObj.close()
num = RTyyyy_gendef.kContainerSize_Edgelock - len(edgelockCntrBytes)
if num > 0:
edgelockCntrBytes += self._genPaddingByteArrayStr(num, 0x00)
finalBtAppData = edgelockCntrBytes
##############################################################
imageDataBytes = None
with open(self.destAppRawBinFilename, 'rb') as fileObj:
imageDataBytes = fileObj.read()
fileObj.close()
containerDataBytes = self._genCompleteContainerData(imageDataBytes)
paddingByteNum = self.destAppVectorOffset - self.destAppInitialLoadSize
finalBtAppData += containerDataBytes
##############################################################
if self.hasEdgelockFw:
edgelockFwFile = os.path.join(self.cpuDir, self.edgelockFwName)
edgelockFwBytes = None
with open(edgelockFwFile, 'rb') as fileObj:
edgelockFwBytes = fileObj.read()
fileObj.close()
num = RTyyyy_memdef.kMemBlockSize_Edgelock - len(edgelockFwBytes)
if num > 0:
edgelockFwBytes += self._genPaddingByteArrayStr(num, 0x00)
finalBtAppData += edgelockFwBytes
##############################################################
num = self.destAppVectorOffset - self.destAppInitialLoadSize
#self.printDeviceStatus("destAppContainerOffset = " + str(hex(self.destAppContainerOffset)))
#self.printDeviceStatus("destAppVectorOffset = " + str(hex(self.destAppVectorOffset)))
#self.printDeviceStatus("destAppInitialLoadSize = " + str(hex(self.destAppInitialLoadSize)))
if paddingByteNum > 0:
paddingBytes = [0xFF] * paddingByteNum
paddingBytesStr = ''
for i in range(len(paddingBytes)):
paddingBytesStr += chr(paddingBytes[i])
containerDataBytes += paddingBytesStr
finalBtAppData = containerDataBytes + imageDataBytes
if num > 0:
finalBtAppData += self._genPaddingByteArrayStr(num, 0x00)
finalBtAppData += imageDataBytes
with open(self.destAppContainerFilename, 'wb') as fileObj:
fileObj.write(finalBtAppData)
fileObj.close()
Expand Down
2 changes: 2 additions & 0 deletions src/gen/RTyyyy_gendef.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
kContainerOffset_NOR = 0x1000
kContainerOffset_RAM_FLASHLOADER = 0x400

kContainerSize_Edgelock = 0x400

kFirstLoadSize_NAND_EEPROM = 0x2400
kFirstLoadSize_SD = 0x2800
kFirstLoadSize_NOR = 0x3000
Expand Down
Loading

0 comments on commit b507e44

Please sign in to comment.