Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Merge pull request #52 from NordicSemiconductor/feature/graviton_sett…
Browse files Browse the repository at this point in the history
…ings_page

Generation and display of NRF52840 settings page added
  • Loading branch information
bihanssen authored Mar 2, 2017
2 parents 82a5ebc + 87209c6 commit 1e0f6e4
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
4 changes: 2 additions & 2 deletions nordicsemi/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ def settings():
@settings.command(short_help='Generate a .hex file with Bootloader DFU settings.')
@click.argument('hex_file', required=True, type=click.Path())
@click.option('--family',
help='nRF IC family: NRF51 or NRF52',
type=click.Choice(['NRF51', 'NRF52']))
help='nRF IC family: NRF51 or NRF52 or NRF52840',
type=click.Choice(['NRF51', 'NRF52', 'NRF52840']))
@click.option('--application',
help='The application firmware file. This can be omitted if'
'the target IC does not contain an application in flash.'
Expand Down
15 changes: 12 additions & 3 deletions nordicsemi/dfu/bl_dfu_sett.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class BLDFUSettings(object):
flash_page_52_sz = 0x1000
bl_sett_51_addr= 0x0003FC00
bl_sett_52_addr= 0x0007F000
bl_sett_52840_addr= 0x000FF000


def __init__(self, ):
Expand Down Expand Up @@ -105,11 +106,15 @@ def set_arch(self, arch):
self.arch_str = 'nRF52'
self.flash_page_sz = BLDFUSettings.flash_page_52_sz
self.bl_sett_addr = BLDFUSettings.bl_sett_52_addr
elif arch == 'NRF52840':
self.arch = nRFArch.NRF52840
self.arch_str = 'NRF52840'
self.flash_page_sz = BLDFUSettings.flash_page_52_sz
self.bl_sett_addr = BLDFUSettings.bl_sett_52840_addr
else:
raise RuntimeError("Unknown architecture")

def generate(self, arch, app_file, app_ver, bl_ver, bl_sett_ver):

# Set the architecture
self.set_arch(arch)

Expand Down Expand Up @@ -215,7 +220,7 @@ def fromhexfile(self, f, arch=None):
# autodetect based on base address
base = self.ihex.minaddr()

# check the 2 possible addresses for CRC matches
# check the 3 possible addresses for CRC matches
try:
self.probe_settings(BLDFUSettings.bl_sett_51_addr)
self.set_arch('NRF51')
Expand All @@ -224,7 +229,11 @@ def fromhexfile(self, f, arch=None):
self.probe_settings(BLDFUSettings.bl_sett_52_addr)
self.set_arch('NRF52')
except Exception as e:
return "Failed to parse .hex file: {0}".format(e)
try:
self.probe_settings(BLDFUSettings.bl_sett_52840_addr)
self.set_arch('NRF52840')
except Exception as e:
return "Failed to parse .hex file: {0}".format(e)

def __str__(self):
s = """
Expand Down
1 change: 1 addition & 0 deletions nordicsemi/dfu/nrfhex.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
class nRFArch(Enum):
NRF51 = 1
NRF52 = 2
NRF52840 = 3

class nRFHex(intelhex.IntelHex):
"""
Expand Down
2 changes: 1 addition & 1 deletion nordicsemi/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@

""" Version definition for nrfutil. """

NRFUTIL_VERSION = "2.1.0"
NRFUTIL_VERSION = "2.2.0"

0 comments on commit 1e0f6e4

Please sign in to comment.