def display(hex_file): sett = BLDFUSettings() try: sett.fromhexfile(hex_file) except NordicSemiException as err: raise click.UsageError(err) click.echo("{0}".format(str(sett)))
def display(hex_file): sett = BLDFUSettings() try: sett.fromhexfile(hex_file) except NordicSemiException as err: click.echo(err) return click.echo("{0}".format(str(sett)))
def test_fromhexfile(self): settings = BLDFUSettings() settings.fromhexfile('firmwares/bl_settings_nrf52.hex') self.assertEqual(nRFArch.NRF52, settings.arch) self.assertEqual('nRF52', settings.arch_str) self.assertEqual(0x0007F000, settings.bl_sett_addr) self.assertEqual(0xF6744851, settings.crc) self.assertEqual(0x00000001, settings.bl_sett_ver) self.assertEqual(0x00000003, settings.app_ver) self.assertEqual(0x00000003, settings.bl_ver) self.assertEqual(0x00000000, settings.bank_layout) self.assertEqual(0x00000000, settings.bank_current) self.assertEqual(0x0002C160, settings.app_sz) self.assertEqual(0x62C83F81, settings.app_crc) self.assertEqual(0x00000001, settings.bank0_bank_code)
def test_fromhexfile(self): settings = BLDFUSettings() settings.fromhexfile('firmwares/bl_settings_v1_nrf52.hex') self.assertEqual(nRFArch.NRF52, settings.arch) self.assertEqual('nRF52', settings.arch_str) self.assertEqual(0x0007F000, settings.bl_sett_addr) self.assertEqual(0xF6744851, settings.crc) self.assertEqual(0x00000001, settings.bl_sett_ver) self.assertEqual(0x00000003, settings.app_ver) self.assertEqual(0x00000003, settings.bl_ver) self.assertEqual(0x00000000, settings.bank_layout) self.assertEqual(0x00000000, settings.bank_current) self.assertEqual(0x0002C160, settings.app_sz) self.assertEqual(0x62C83F81, settings.app_crc) self.assertEqual(0x00000001, settings.bank0_bank_code)
def test_fromhexfile(self): settings = BLDFUSettings() settings.fromhexfile('firmwares/bl_settings_v2_nrf52.hex') self.assertEqual(nRFArch.NRF52, settings.arch) self.assertEqual('nRF52', settings.arch_str) self.assertEqual(0x0007F000, settings.bl_sett_addr) self.assertEqual(0x2914E4A9, settings.crc) self.assertEqual(0x00000002, settings.bl_sett_ver) self.assertEqual(0x00000001, settings.app_ver) self.assertEqual(0x00000001, settings.bl_ver) self.assertEqual(0x00000000, settings.bank_layout) self.assertEqual(0x00000000, settings.bank_current) self.assertEqual(0x000148B4, settings.app_sz) self.assertEqual(0xF272EEBF, settings.app_crc) self.assertEqual(0x00000001, settings.bank0_bank_code) self.assertEqual(0x00024150, settings.sd_sz) self.assertEqual(0x467B5555, settings.boot_validation_crc) self.assertEqual(0x01, settings.sd_boot_validation_type) #self.assertEqual(0x5B00BDCE, settings.sd_boot_validation_bytes) self.assertEqual(0x01, settings.app_boot_validation_type)
def display(hex_file): sett = BLDFUSettings() sett.fromhexfile(hex_file) click.echo("{0}".format(str(sett)))