@@ -76,6 +76,7 @@ class BLDFUSettings(object):
7676 flash_page_52_sz = 0x1000
7777 bl_sett_51_addr = 0x0003FC00
7878 bl_sett_52_addr = 0x0007F000
79+ bl_sett_52840_addr = 0x000FF000
7980
8081
8182 def __init__ (self , ):
@@ -105,11 +106,15 @@ def set_arch(self, arch):
105106 self .arch_str = 'nRF52'
106107 self .flash_page_sz = BLDFUSettings .flash_page_52_sz
107108 self .bl_sett_addr = BLDFUSettings .bl_sett_52_addr
109+ elif arch == 'NRF52840' :
110+ self .arch = nRFArch .NRF52840
111+ self .arch_str = 'NRF52840'
112+ self .flash_page_sz = BLDFUSettings .flash_page_52_sz
113+ self .bl_sett_addr = BLDFUSettings .bl_sett_52840_addr
108114 else :
109115 raise RuntimeError ("Unknown architecture" )
110116
111117 def generate (self , arch , app_file , app_ver , bl_ver , bl_sett_ver ):
112-
113118 # Set the architecture
114119 self .set_arch (arch )
115120
@@ -215,7 +220,7 @@ def fromhexfile(self, f, arch=None):
215220 # autodetect based on base address
216221 base = self .ihex .minaddr ()
217222
218- # check the 2 possible addresses for CRC matches
223+ # check the 3 possible addresses for CRC matches
219224 try :
220225 self .probe_settings (BLDFUSettings .bl_sett_51_addr )
221226 self .set_arch ('NRF51' )
@@ -224,7 +229,11 @@ def fromhexfile(self, f, arch=None):
224229 self .probe_settings (BLDFUSettings .bl_sett_52_addr )
225230 self .set_arch ('NRF52' )
226231 except Exception as e :
227- return "Failed to parse .hex file: {0}" .format (e )
232+ try :
233+ self .probe_settings (BLDFUSettings .bl_sett_52840_addr )
234+ self .set_arch ('NRF52840' )
235+ except Exception as e :
236+ return "Failed to parse .hex file: {0}" .format (e )
228237
229238 def __str__ (self ):
230239 s = """
0 commit comments