-
Notifications
You must be signed in to change notification settings - Fork 136
Description
Hi,
I just found the following code inconsistency compared to what is stated both in DLL API and flash_file code documentation.
In flash_file documentation on return value, it says:
Lines 2248 to 2249 in 9a06468
Returns: | |
Integer value greater than or equal to zero. Has no significance. |
Whereas, in code, it retreives the number of bytes written from DLL function called JLINK_DownloadFile - which actually does not return the number of bytes written, it returns either one of 6 status values (< 0 ) when error happens, or returns status ( > 0 ) when everything went OK
Lines 2273 to 2278 in 9a06468
# Program the target. | |
bytes_flashed = self._dll.JLINK_DownloadFile(path.encode(), addr) | |
if bytes_flashed < 0: | |
raise errors.JLinkFlashException(bytes_flashed) | |
return bytes_flashed |
Unless I'm interpreting something wrong here, it might be some leftover from flash method implementation:
Lines 2224 to 2230 in 9a06468
bytes_flashed = self._dll.JLINKARM_WriteMem(addr, len(data), data) | |
res = self._dll.JLINKARM_EndDownload() | |
if res < 0: | |
raise errors.JLinkEraseException(res) | |
return bytes_flashed |
In this case, it uses different DLL API call and it returns the number of bytes written, so this is correct.
I can make a PR with fix for that, but wanted to ask first if it's really a bug or there is some other reason for behind that.