Mbed CLI & mbed OS 6.2 - compiling error "UnicodeDecodeError: 'charmap' codec can't decode byte ..."

Hi all,

I am working with mbed CLI version 1.10.4 on a Win10 system. While I can compile the same source on mbedOS 5.15.4 just fine I am getting a weird error on mbedOS 6.2 that I can neither explain nor solve. The error happens very early in the build process (about 2%) and looks always like this:


Exception in thread Thread-2:
Traceback (most recent call last):
File “c:\python38\lib\threading.py”, line 932, in _bootstrap_inner
self.run()
File “c:\python38\lib\threading.py”, line 870, in run
self._target(*self._args, **self._kwargs)
File “c:\python38\lib\subprocess.py”, line 1366, in _readerthread
buffer.append(fh.read())
File “c:\python38\lib\encodings\cp1252.py”, line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: ‘charmap’ codec can’t decode byte 0x9d in position 142: character maps to
[ERROR] list index out of range
[mbed] ERROR: “c:\python38\python.exe” returned error.


The number of the thread that causes a exception varies. I could not figure out what is causing the issue. Google led me to python - UnicodeDecodeError: 'charmap' codec can't decode byte X in position Y: character maps to <undefined> - Stack Overflow but even this would not help me.

Does anyone can give me a hint or ever had a similar issue? Any help would be highly appreciated.

Thank you in advance.

Answering my own question here:

I have used the the simplest example (blinky) available and worked my way towards the issue. It turned out that my implementation of Segger RTT is causing the above mentioned issue. All other parts of the code are working fine on 6.2.1. Will try to find another library for the Rtt viewer.