Hi, I am new to the particle community and am highly interested in using the Particle Argon boards in conjunction with Zephyr to allow programming in c.
I have a particle debugger to program the argon but whenever I use the “west flash” command to program, an error shows indicating a “ValueError: invalid literal for int() with base 10: ‘\x01’”, shown in the cmd output below.
-- west flash: rebuilding
ninja: no work to do.
-- west flash: using runner pyocd
-- runners.pyocd: Flashing file: C:\Users\lches\zephyrproject\zephyr\build\zephyr\zephyr.hex
Debugger FW Version:
0254.2☺
String Length:
7
0001505:CRITICAL:__main__:invalid literal for int() with base 10: '\x01'
Traceback (most recent call last):
File "C:\Users\lches\AppData\Roaming\Python\Python39\site-packages\pyocd\__main__.py", line 150, in run
status = cmd.invoke()
File "C:\Users\lches\AppData\Roaming\Python\Python39\site-packages\pyocd\subcommands\flash_cmd.py", line 86, in invoke
with session:
File "C:\Users\lches\AppData\Roaming\Python\Python39\site-packages\pyocd\core\session.py", line 342, in __enter__
self.open()
File "C:\Users\lches\AppData\Roaming\Python\Python39\site-packages\pyocd\core\session.py", line 456, in open
self._probe.open()
File "C:\Users\lches\AppData\Roaming\Python\Python39\site-packages\pyocd\probe\cmsis_dap_probe.py", line 170, in open
self._link.open()
File "C:\Users\lches\AppData\Roaming\Python\Python39\site-packages\pyocd\utility\concurrency.py", line 28, in _locking
return func(self, *args, **kwargs)
File "C:\Users\lches\AppData\Roaming\Python\Python39\site-packages\pyocd\probe\pydapaccess\dap_access_cmsis_dap.py", line 643, in open
self._read_protocol_version()
File "C:\Users\lches\AppData\Roaming\Python\Python39\site-packages\pyocd\probe\pydapaccess\dap_access_cmsis_dap.py", line 619, in _read_protocol_version
patch = int(fw_version[1][1])
ValueError: invalid literal for int() with base 10: '\x01'
FATAL ERROR: command exited with status 1: pyocd flash -e sector -t nrf52840 -f 4000000 'C:\Users\lches\zephyrproject\zephyr\build\zephyr\zephyr.hex'
I looked into the python files listed in the traceback and found the problematic line and added in a print statement to show the following printing values.
Debugger FW Version:
0254.2☺
As can be seen, there appears to be a smiley character attached to the firmware version number which is causing the python file to raise the above mentioned error. From here I dove head first into the latest release version of the debugger firmware to try and find if the issue arose there.
In the info.c file in the latest release v254.2, there is a line that defines the “string_version” array as only 5 elements long.
static char string_version[4 + 1];
However, further in the same file, this string is populated with 7 elements, suggesting to me that overflow occurs in accessing this string.
// Version
idx = 0;
string_version[idx++] = '0' + (DAPLINK_VERSION / 1000) % 10;
string_version[idx++] = '0' + (DAPLINK_VERSION / 100) % 10;
string_version[idx++] = '0' + (DAPLINK_VERSION / 10) % 10;
string_version[idx++] = '0' + (DAPLINK_VERSION / 1) % 10;
string_version[idx++] = '.';
string_version[idx++] = '2';
string_version[idx++] = 0;
This doesn’t fully explain to me why I am seeing a smiley face in python but I believe it may be related.
I’d appreciate if anyway could help me to resolve this issue or assist me to get in contact with someone who may be able to help with it.