Skip to content

Commit

Permalink
Merge pull request #11 from mossmann/lpc43xx
Browse files Browse the repository at this point in the history
Fix LPC43xx target
  • Loading branch information
mossmann authored Aug 1, 2024
2 parents 1f9484a + 25db95e commit 36ee9d7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fwup/lpc43xx.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ def __init__(self, *args, **kwargs):
if 'idProduct' not in kwargs:
kwargs['idProduct'] = self.PRODUCT_ID

# NXP's DFU bootloader claims to be in run-time mode but is actually in DFU mode.
kwargs['detach'] = False

super(LPC43xxTarget, self).__init__(*args, **kwargs)


Expand All @@ -52,7 +55,7 @@ def program(self, program_data, status_callback=None):
# This math rounds up to the next full block.
program_size_blocks = (len(program_data) + (self.BLOCK_SIZE - self.HEADER_SIZE - 1)) // 512

header = struct.pack(">BBH", 0xda, 0xff, program_size_blocks) + (b"\xff" *12)
header = struct.pack("<BBH", 0xda, 0xff, program_size_blocks) + (b"\xff" *12)
program_data[0:0] = header

# And call the main DFU functionality.
Expand Down

0 comments on commit 36ee9d7

Please sign in to comment.