From 7b10d55c5c48084794d2afdb533f03a20374c9b9 Mon Sep 17 00:00:00 2001 From: TheColector <62252229+TheColector@users.noreply.github.com> Date: Tue, 10 Mar 2026 20:30:32 +0100 Subject: [PATCH 1/2] Fix JLINK_DownloadFile return handling JLINK_DownloadFile from JLINK's DLL does not return number of bytes flashed. It returns error code --- pylink/jlink.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pylink/jlink.py b/pylink/jlink.py index 8ef21ba..a12387d 100644 --- a/pylink/jlink.py +++ b/pylink/jlink.py @@ -2269,11 +2269,11 @@ def flash_file(self, path, addr, on_progress=None, power_on=False): pass # Program the target. - bytes_flashed = self._dll.JLINK_DownloadFile(os.fsencode(path), addr) - if bytes_flashed < 0: - raise errors.JLinkFlashException(bytes_flashed) + res = self._dll.JLINK_DownloadFile(os.fsencode(path), addr) + if res < 0: + raise errors.JLinkFlashException(res) - return bytes_flashed + return res @connection_required def reset(self, ms=0, halt=True): From 8900a85e242763c58edcd77775b4877394e7d8d1 Mon Sep 17 00:00:00 2001 From: TheColector <62252229+TheColector@users.noreply.github.com> Date: Tue, 10 Mar 2026 20:36:34 +0100 Subject: [PATCH 2/2] Add myself to CONTRIBUTORS.md --- CONTRIBUTORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 777fc49..0e5b8b6 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -32,3 +32,4 @@ In the order of appearance in the commit history: | Issam E. Maghni | @concatime | | Patrik Bachan | @diggit | | - | @lweyrich1 | +| Michal Mlodecki | @TheColector |