This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

DFU device_page_generator fails on Mesh SDK 2.0.1 when adding public key.

I'm adding key protection to DFU, a batch script is creating the bootloader_config_default.json. I'm using mesh SDK 2.0.1, but started developing using Mesh SDK 2.0.0. When I added public_key to my bootloader_config_default.json file device page generation fails. While testing with the device_page_generator.py from SDK 2.0.0 this was no issue. The only difference I can find are these: 

Fullscreen
1
2
3
4
5
6
7
8
9
10
#LINE 69 of device_page_generator.py
#From Mesh SDK 2.0.0
raise TypeError("Invalid type %r" % (type(data)))
#From Mesh SDK 2.0.1
raise TypeError
#Line 99
#From Mesh SDK 2.0.0
public_key = bytearray.fromhex(bootloader_config["public_key"]) \
#From Mesh SDK 2.0.1
public_key = bootloader_config["public_key"] \
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

As I am not very "fluent" in Python I'm not sure if I can use the device page generator from the Mesh SDK 2.0.0. so please advise.

The error I get is as follows:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
SDKROOT\Mesh\tools\dfu>python device_page_generator.py -d nrf52832_xxAA -sd "s132_6.0.0"
Traceback (most recent call last):
File "device_page_generator.py", line 241, in <module>
main()
File "device_page_generator.py", line 235, in main
write_specific_page(platforms, softdevices, args)
File "device_page_generator.py", line 178, in write_specific_page
device_page = DevicePage(platform, softdevice, bootloader_config)
File "device_page_generator.py", line 94, in __init__
self.generate_entries(platform, softdevice, bootloader_config)
File "device_page_generator.py", line 103, in generate_entries
DevicePageEntry(BLInfoType.ECDSA_PUBLIC_KEY, public_key))
File "device_page_generator.py", line 69, in __init__
raise TypeError
TypeError
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • I have also tested modifying the original bootloader_config_default.json directly, added only the line for public key, and a test where I copy/pasted the config from the DFU Quick Start Guide with the same results.

  • Hi Martin, 

     

    Your log look almost the same like this one. Should there be the same solution ?

  • Yes, that solved it. Thank you, wonder why I didn't see that when i searched DevZone.. You should update this line from the Mesh SDK DFU quick start guide then: " (works for both Python 2.7 and Python 3, requires the intelhex package from PyPi). " 
    Meanwhile, when using Python 3*  bootloader_verify.py from the same tools don't seem to work.. Isn't that weird?

  • Image of what is programmed. As you can see the bootloader_verify fails now, but the build functions. I can manage with using both python 2.7 and 3.*  but one toolbox should use one version of Python I think..