"UnicodeDecodeError: 'charmap' codec can't decode byte 0x98" when compiling project on my PC

Since last month I cant compile my project code in PlatformIO (Windows 10, Visual Studio Code), every time I try to do it so, I get this error message:


It was working fine before, I didn’t make any changes to the code.

Things I tried to fix this error:

  • Moving to PlatformoIO version 2.0.0 beta5 from 1.10.0 - no change
  • Downgrading to earlier PlatformoIO versions - no change
  • Uninstalling all pythons from my PC and reinstalling PlatformoIO - no change
  • Moving project directory to different location - no change
  • Installing Visual Studio Code with PlatformoIO in fresh Windows 10 virtual machine and compiling my project here - it works!

Since my code compile in virtual machine it looks like it is some PlotformIO build-in python problem that for some reason occurs only on my PC, but I have no idea why.

  • What Python versions do you have installed?
  • What Python interpreter have you set in your VSCode settings (File -> Preferences -> Settings -> Python Interpeter)? What version of Python does this map to?
  • Do your src\cube files contain special UTF8 chars (or chars from another encoding)?
  • Is the source code sharable?

What Python versions do you have installed?

One included with PlatformIO 2.0.0 beta5 - Python 3.7.7

What Python interpreter have you set in your VSCode settings

This is only Python related setting I got (I don’t have other extensions installed besides PlatformIO):

Do your src\cube files contain special UTF8 chars (or chars from another encoding)?

This folder contains only files generated by CubeMX, even if I delete everything from this folder error still appears (it just comes from other files)

Is the source code sharable?

Yes, it just a university project - https://github.com/PUT-PTM-2020/P44/tree/master/pong_stm

Hm, unable to reproduce, compiles for me.

C:\Users\Maxi\Desktop\P44-master\pong_stm>pio run
Processing disco_f407vg (platform: ststm32; board: disco_f407vg; framework: stm32cube)
----------------------------------------------------------------------------------------------
PackageManager: Installing tool-ldscripts-ststm32 @ ~0.1.0
Unpacking  [####################################]  100%
tool-ldscripts-ststm32 @ 0.1.0 has been successfully installed!
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/disco_f407vg.html
PLATFORM: ST STM32 7.0.0 > ST STM32F4DISCOVERY
HARDWARE: STM32F407VGT6 168MHz, 128KB RAM, 1MB Flash
DEBUG: Current (stlink) On-board (stlink) External (blackmagic, jlink)
PACKAGES:
 - framework-stm32cube 2.0.181130
 - tool-ldscripts-ststm32 0.1.0
 - toolchain-gccarmnoneeabi 1.70201.0 (7.2.1)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 27 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <BSP-Common>
Building in release mode
Compiling .pio\build\disco_f407vg\src\cube\fsmc.o
Compiling .pio\build\disco_f407vg\src\cube\gpio.o
Compiling .pio\build\disco_f407vg\src\cube\i2c.o
Compiling .pio\build\disco_f407vg\src\cube\main.o
Compiling .pio\build\disco_f407vg\src\cube\spi.o
Compiling .pio\build\disco_f407vg\src\cube\stm32f4xx_hal_msp.o
Compiling .pio\build\disco_f407vg\src\cube\stm32f4xx_it.o
Compiling .pio\build\disco_f407vg\src\cube\system_stm32f4xx.o
Compiling .pio\build\disco_f407vg\src\cube\tim.o
Compiling .pio\build\disco_f407vg\src\cube\usart.o
Compiling .pio\build\disco_f407vg\src\game\Ball.o
Compiling .pio\build\disco_f407vg\src\game\Collision.o
Compiling .pio\build\disco_f407vg\src\game\DrawnObject.o
Compiling .pio\build\disco_f407vg\src\game\Game.o
Compiling .pio\build\disco_f407vg\src\game\Gameplay.o
Compiling .pio\build\disco_f407vg\src\game\MovingObject.o
Compiling .pio\build\disco_f407vg\src\game\ObjectsVector.o
Compiling .pio\build\disco_f407vg\src\game\PhysicalObject.o
Compiling .pio\build\disco_f407vg\src\game\Physics.o
Compiling .pio\build\disco_f407vg\src\game\Player.o
Compiling .pio\build\disco_f407vg\src\game\Racket.o
Compiling .pio\build\disco_f407vg\src\game\Rect.o
Compiling .pio\build\disco_f407vg\src\game\SimObject.o
Compiling .pio\build\disco_f407vg\src\game\Table.o
Compiling .pio\build\disco_f407vg\src\game\UpdateObject.o
Compiling .pio\build\disco_f407vg\src\game\Wall.o
Compiling .pio\build\disco_f407vg\src\ge\circle.o
src\game\Ball.cpp: In constructor 'Ball::Ball(float, float)':
src\game\Ball.cpp:7:32: warning: base 'DrawnObject<GE::Circle>' will be initialized after [-Wreorder]
  MovingObject(BALL_DEFAULT_MASS) {
                                ^
src\game\Ball.cpp:7:32: warning:   base 'PhysicalObject' [-Wreorder]
src\game\Ball.cpp:4:1: warning:   when initialized here [-Wreorder]
 Ball::Ball(float posX, float posY) :
 ^~~~
src\game\Ball.cpp:13:45: warning: narrowing conversion of 'posX' from 'float' to 'short unsigned int' inside { } [-Wnarrowing]
  GE::Vector2i q= (Physics::swapY({posX,posY}));
                                             ^
src\game\Ball.cpp:13:45: warning: narrowing conversion of 'posY' from 'float' to 'short unsigned int' inside { } [-Wnarrowing]
src\game\Ball.cpp: In member function 'virtual void Ball::simulation(GE::Vector2i*)':
src\game\Ball.cpp:100:26: warning: narrowing conversion of '((Ball*)this)->Ball::pomoc' from 'int' to 'float' inside { } [-Wnarrowing]
      velocityVector = {0,pomoc};
                          ^~~~~
src\game\Physics.cpp: In static member function 'static GE::Vector2i Physics::floatVectorToIntVector(const Vector2f&)':
src\game\Physics.cpp:20:11: warning: narrowing conversion of '(int)(float)floatVector->GE::Vector2<float>::x' from 'int' to 'short unsigned int' inside { } [-Wnarrowing]
  return { (int)floatVector.x, (int)floatVector.y };
           ^~~~~~~~~~~~~~~~~~
src\game\Physics.cpp:20:31: warning: narrowing conversion of '(int)(float)floatVector->GE::Vector2<float>::y' from 'int' to 'short unsigned int' inside { } [-Wnarrowing]
  return { (int)floatVector.x, (int)floatVector.y };
                               ^~~~~~~~~~~~~~~~~~
src\game\Physics.cpp: In static member function 'static GE::Vector2i Physics::swapY(const Vector2i&)':
src\game\Physics.cpp:49:14: warning: narrowing conversion of '(320 - ((int)((short unsigned int)pos.GE::Vector2<short unsigned int>::y)))' from 'int' to 'short unsigned int' inside { } [-Wnarrowing]
  return { 320-(int)pos.y, 480-(int)pos.x };
           ~~~^~~~~~~~~~~
src\game\Physics.cpp:49:30: warning: narrowing conversion of '(480 - ((int)((short unsigned int)pos.GE::Vector2<short unsigned int>::x)))' from 'int' to 'short unsigned int' inside { } [-Wnarrowing]
  return { 320-(int)pos.y, 480-(int)pos.x };
                           ~~~^~~~~~~~~~~
src\game\Physics.cpp: In static member function 'static GE::Vector2i Physics::swapYR(const Vector2i&)':
src\game\Physics.cpp:54:14: warning: narrowing conversion of '(480 - ((int)((short unsigned int)pos.GE::Vector2<short unsigned int>::y)))' from 'int' to 'short unsigned int' inside { } [-Wnarrowing]
  return { 480-(int)pos.y, 320-(int)pos.x };
           ~~~^~~~~~~~~~~
src\game\Physics.cpp:54:30: warning: narrowing conversion of '(320 - ((int)((short unsigned int)pos.GE::Vector2<short unsigned int>::x)))' from 'int' to 'short unsigned int' inside { } [-Wnarrowing]
  return { 480-(int)pos.y, 320-(int)pos.x };
                           ~~~^~~~~~~~~~~
src\game\DrawnObject.cpp: In instantiation of 'DrawnObject<T>::~DrawnObject() [with T = GE::Circle]':
src\game\DrawnObject.cpp:29:16:   required from here
src\game\DrawnObject.cpp:26:2: warning: deleting object of polymorphic class type 'GE::Circle' which has non-virtual destructor might cause undefined behavior [-Wdelete-non-virtual-dtor]
  delete dObject;
  ^~~~~~
src\game\DrawnObject.cpp: In instantiation of 'DrawnObject<T>::~DrawnObject() [with T = GE::Rect]':
src\game\DrawnObject.cpp:30:16:   required from here
src\game\DrawnObject.cpp:26:2: warning: deleting object of polymorphic class type 'GE::Rect' which has non-virtual destructor might cause undefined behavior [-Wdelete-non-virtual-dtor]
src\game\DrawnObject.cpp: In instantiation of 'DrawnObject<T>::~DrawnObject() [with T = GE::Shape]':
src\game\DrawnObject.cpp:31:16:   required from here
src\game\DrawnObject.cpp:26:2: warning: deleting object of abstract class type 'GE::Shape' which has non-virtual destructor will cause undefined behavior [-Wdelete-non-virtual-dtor]
src\game\Collision.cpp: In member function 'short unsigned int Collision::ballRectCheck(Ball*, Rect*)':
src\game\Collision.cpp:305:58: warning: narrowing conversion of 'rect->Rect::localEP.GE::Vector2<short unsigned int>::x' from 'short unsigned int' to 'float' inside { } [-Wnarrowing]
   else if (proj_len > rad_segv) closest = {rect->localEP.x,rect->localEP.y};
                                            ~~~~~~~~~~~~~~^
src\game\Collision.cpp:305:74: warning: narrowing conversion of 'rect->Rect::localEP.GE::Vector2<short unsigned int>::y' from 'short unsigned int' to 'float' inside { } [-Wnarrowing]
   else if (proj_len > rad_segv) closest = {rect->localEP.x,rect->localEP.y};
                                                            ~~~~~~~~~~~~~~^
src\game\Collision.cpp:311:7: warning: unused variable 'x' [-Wunused-variable]
   int x = distance_len;
       ^
Compiling .pio\build\disco_f407vg\src\ge\display.o
Compiling .pio\build\disco_f407vg\src\ge\rect.o
Compiling .pio\build\disco_f407vg\src\ge\shape.o
Compiling .pio\build\disco_f407vg\src\he\buttons.o
Compiling .pio\build\disco_f407vg\src\he\clock.o
Compiling .pio\build\disco_f407vg\src\he\debug.o
Compiling .pio\build\disco_f407vg\src\he\oled.o
Compiling .pio\build\disco_f407vg\src\he\radio.o
src\game\ObjectsVector.cpp: In instantiation of 'ObjectsVector<T>::clear()::<lambda(T&)> [with T = GE::Shape*]':
src\game\ObjectsVector.cpp:32:11:   required from 'struct ObjectsVector<T>::clear() [with T = GE::Shape*]::<lambda(class GE::Shape*&)>'
src\game\ObjectsVector.cpp:32:9:   required from 'void ObjectsVector<T>::clear() [with T = GE::Shape*]'
src\game\ObjectsVector.cpp:61:16:   required from here
src\game\ObjectsVector.cpp:33:3: warning: deleting object of abstract class type 'GE::Shape' which has non-virtual destructor will cause undefined behavior [-Wdelete-non-virtual-dtor]
   delete obj;
   ^~~~~~
Compiling .pio\build\disco_f407vg\src\lcd\fonts\font12.o
Compiling .pio\build\disco_f407vg\src\lcd\fonts\font16.o
src\game\Racket.cpp: In member function 'virtual void Racket::setPos(GE::Vector2i)':
src\game\Racket.cpp:26:40: warning: narrowing conversion of '(((int)(((short unsigned int)((int)((Racket*)this)->Racket::<anonymous>.Rect::<anonymous>.DrawnObject<GE::Rect>::dObject->GE::Rect::getSizeX())) / 2)) + ((int)pos.GE::Vector2<short unsigned int>::x))' from 'int' to 'short unsigned int' inside { } [-Wnarrowing]
  localEP = { (dObject->getSizeX() / 2) + pos.x, pos.y};
              ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
src\game\Racket.cpp:27:40: warning: narrowing conversion of '(((int)(((short unsigned int)((int)((Racket*)this)->Racket::<anonymous>.Rect::<anonymous>.DrawnObject<GE::Rect>::dObject->GE::Rect::getSizeX())) / 2)) + ((int)pos.GE::Vector2<short unsigned int>::x))' from 'int' to 'short unsigned int' inside { } [-Wnarrowing]
  localSP = { (dObject->getSizeX() / 2) + pos.x, pos.y - dObject->getSizeY()};
              ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
src\game\Racket.cpp:27:55: warning: narrowing conversion of '(((int)pos.GE::Vector2<short unsigned int>::y) - ((int)((Racket*)this)->Racket::<anonymous>.Rect::<anonymous>.DrawnObject<GE::Rect>::dObject->GE::Rect::getSizeY()))' from 'int' to 'short unsigned int' inside { } [-Wnarrowing]
  localSP = { (dObject->getSizeX() / 2) + pos.x, pos.y - dObject->getSizeY()};
                                                 ~~~~~~^~~~~~~~~~~~~~~~~~~~~
Compiling .pio\build\disco_f407vg\src\lcd\fonts\font20.o
src\game\Rect.cpp: In constructor 'Rect::Rect(float, float, float, Physics::Material, float, float, int)':
src\game\Rect.cpp:14:67: warning: narrowing conversion of '((pixelSizeX / (float)2) + pixelPosX)' from 'float' to 'short unsigned int' inside { } [-Wnarrowing]
  if (pixelSizeX <= pixelSizeY) this->localSP = { (pixelSizeX / 2) + pixelPosX, pixelPosY };
                                                  ~~~~~~~~~~~~~~~~~^~~~~~~~~~~
src\game\Rect.cpp:14:90: warning: narrowing conversion of 'pixelPosY' from 'float' to 'short unsigned int' inside { } [-Wnarrowing]
  if (pixelSizeX <= pixelSizeY) this->localSP = { (pixelSizeX / 2) + pixelPosX, pixelPosY };
                                                                                          ^
src\game\Rect.cpp:15:64: warning: narrowing conversion of 'pixelPosX' from 'float' to 'short unsigned int' inside { } [-Wnarrowing]
  else this->localSP = { pixelPosX, (pixelSizeY / 2) + pixelPosY};
                                                                ^
src\game\Rect.cpp:15:53: warning: narrowing conversion of '((pixelSizeY / (float)2) + pixelPosY)' from 'float' to 'short unsigned int' inside { } [-Wnarrowing]
  else this->localSP = { pixelPosX, (pixelSizeY / 2) + pixelPosY};
                                    ~~~~~~~~~~~~~~~~~^~~~~~~~~~~
src\game\Rect.cpp:16:67: warning: narrowing conversion of '((pixelSizeX / (float)2) + pixelPosX)' from 'float' to 'short unsigned int' inside { } [-Wnarrowing]
  if (pixelSizeX <= pixelSizeY) this->localEP = { (pixelSizeX / 2) + pixelPosX, pixelPosY +pixelSizeY };
                                                  ~~~~~~~~~~~~~~~~~^~~~~~~~~~~
src\game\Rect.cpp:16:90: warning: narrowing conversion of '(pixelPosY + pixelSizeY)' from 'float' to 'short unsigned int' inside { } [-Wnarrowing]
  if (pixelSizeX <= pixelSizeY) this->localEP = { (pixelSizeX / 2) + pixelPosX, pixelPosY +pixelSizeY };
                                                                                ~~~~~~~~~~^~~~~~~~~~~
src\game\Rect.cpp:17:35: warning: narrowing conversion of '(pixelPosX + pixelSizeX)' from 'float' to 'short unsigned int' inside { } [-Wnarrowing]
  else this->localEP = { pixelPosX + pixelSizeX, (pixelSizeY / 2) + pixelPosY };
                         ~~~~~~~~~~^~~~~~~~~~~~
src\game\Rect.cpp:17:66: warning: narrowing conversion of '((pixelSizeY / (float)2) + pixelPosY)' from 'float' to 'short unsigned int' inside { } [-Wnarrowing]
Compiling .pio\build\disco_f407vg\src\lcd\fonts\font24.o
  else this->localEP = { pixelPosX + pixelSizeX, (pixelSizeY / 2) + pixelPosY };
                                                 ~~~~~~~~~~~~~~~~~^~~~~~~~~~~
Compiling .pio\build\disco_f407vg\src\lcd\fonts\font8.o
Compiling .pio\build\disco_f407vg\src\lcd\ili9486.o
Compiling .pio\build\disco_f407vg\src\lcd\lcd_io_fsmc16.o
Compiling .pio\build\disco_f407vg\src\lcd\stm32_adafruit_lcd.o
Compiling .pio\build\disco_f407vg\src\oled\ssd1306.o
Compiling .pio\build\disco_f407vg\src\oled\ssd1306_fonts.o
Compiling .pio\build\disco_f407vg\src\pong.o
Compiling .pio\build\disco_f407vg\src\radio\MY_NRF24.o
Archiving .pio\build\disco_f407vg\lib8bf\libCommon.a
Compiling .pio\build\disco_f407vg\FrameworkBSP\stm32f4_discovery.o
Compiling .pio\build\disco_f407vg\FrameworkBSP\stm32f4_discovery_accelerometer.o
Indexing .pio\build\disco_f407vg\lib8bf\libCommon.a
Compiling .pio\build\disco_f407vg\FrameworkBSP\stm32f4_discovery_audio.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_adc.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_adc_ex.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_can.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_cec.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_cortex.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_crc.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_cryp.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_cryp_ex.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_dac.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_dac_ex.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_dcmi.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_dcmi_ex.o
Archiving .pio\build\disco_f407vg\libFrameworkBSP.a
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_dfsdm.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_dma.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_dma2d.o
Indexing .pio\build\disco_f407vg\libFrameworkBSP.a
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_dma_ex.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_dsi.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_eth.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_flash.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_flash_ex.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_flash_ramfunc.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_fmpi2c.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_fmpi2c_ex.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_gpio.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_hash.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_hash_ex.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_hcd.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_i2c.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_i2c_ex.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_i2s.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_i2s_ex.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_irda.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_iwdg.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_lptim.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_ltdc.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_ltdc_ex.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_mmc.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_nand.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_nor.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_pccard.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_pcd.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_pcd_ex.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_pwr.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_pwr_ex.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_qspi.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_rcc.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_rcc_ex.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_rng.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_rtc.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_rtc_ex.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_sai.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_sai_ex.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_sd.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_sdram.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_smartcard.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_spdifrx.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_spi.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_sram.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_tim.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_tim_ex.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_uart.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_usart.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_hal_wwdg.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_ll_adc.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_ll_crc.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_ll_dac.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_ll_dma.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_ll_dma2d.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_ll_exti.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_ll_fmc.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_ll_fsmc.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_ll_gpio.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_ll_i2c.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_ll_lptim.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_ll_pwr.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_ll_rcc.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_ll_rng.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_ll_rtc.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_ll_sdmmc.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_ll_spi.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_ll_tim.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_ll_usart.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_ll_usb.o
Compiling .pio\build\disco_f407vg\FrameworkHALDriver\Src\stm32f4xx_ll_utils.o
Compiling .pio\build\disco_f407vg\FrameworkCMSISDevice\gcc\startup_stm32f407xx.o
Compiling .pio\build\disco_f407vg\FrameworkCMSISDevice\system_stm32f4xx.o
Archiving .pio\build\disco_f407vg\libFrameworkCMSISDevice.a
Indexing .pio\build\disco_f407vg\libFrameworkCMSISDevice.a
Archiving .pio\build\disco_f407vg\libFrameworkHALDriver.a
Indexing .pio\build\disco_f407vg\libFrameworkHALDriver.a
Linking .pio\build\disco_f407vg\firmware.elf
Checking size .pio\build\disco_f407vg\firmware.elf
Building .pio\build\disco_f407vg\firmware.bin
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   1.9% (used 2496 bytes from 131072 bytes)
Flash: [=         ]   5.2% (used 54060 bytes from 1048576 bytes)
================================================================ [SUCCESS] Took 13.61 seconds ================================================================

Ah, seems like you’re running an outdated version core version? Looking at History for platformio/proc.py - platformio/platformio-core · GitHub the second-last commit should fix the problem you’re seeing. Your project path probably has non-latin/non-ASCII characters (your username is non-ASCII or some folder in between), causing the problem.

Go into the extension settings and activate “Use latest development core version” or something. Then save, wait a bit and re-open VSCode. Open a PIO Terminal and execute pio --version to make sure you’re now on like PlatformIO, version 4.4.0a4. If it’s still not that version or later, manually execute pio upgrade --dev and restart VSCode. Then retry compilation.

Sadly, I have core version 4.4.0a4 and this problem still occurs, I had moved my project dir to C:\Projekt_PTM\Kod\P44\pong_stm to make sure that i don’t have any non latin characters in path and it didn’t help either

Can you add this on the top of your platformio.ini:

[platformio]
core_dir = C:\Projekt_PTM

(docs).

This prevents the possibility that it’s invoking a compiler somewhere in the user directory which might still have a non-ascii path in it, by putting the entire PIO core into C:\Projekt_PTM.

Still no luck

Maybe changing python installation path (from “C:\Users\Marcin.platformio\python37”) will help.

Weird that although the core directory is re-pointed, it still uses the Python installation from C:\Users\Marcin\.platformio, not from the new directory. Also it doesn’t seem to contain any non-ASCII chars?

It might be easier at this point to create a new Windows user like Test and re-install VSCode + PlatformIO in there, normally, without any special core_dir directives in the platformio.ini.

core_dir directive only moved packages and platforms folders, python stayed in C:\Users\Marcin\.platformio. Is there a way to move it manually?

The docs don’t seem to say so. Interesting, I don’t even have python3 binary in my C:\Users\<user>\.platformio… maybe because I had Python 3.7 preinstalled at the point I installed PlatformIO. Anyways, I think creating a new user might be the fastest way to test the hypothesis of non-ascii stuff easier.

Yes, it compiles on new “test” user, but “Marcin” doesn’t have any non ascii characters too… I had reinstalled Visual Studio Code with PlatformIO again, and .platformio folder looks like this:
z

Edit: “Marcim” works too, it is just “Marcin” that is cursed (or there is other problem with my home directory)

Edit2: It doesn’t work even if I will try to compile from “Marcim” account Visual Studio Code PlatformIO installation, when I am logged at “Marcin” account. It only works when I am logged at different account.

If I correctly read the stacktrace, PlatformIO executes a shell command (most likely the compiler) and tries to convert the command output from CP-1250 to UTF-8. It fails, because the byte 0x98 is not valid in CP-1250. Several things could be wrong:

  • PlatformIO is wrong about the language setting / code page of the compiler. It uses another encoding and produces the byte 0x98 as part of a diagnostic message.
  • The compiler is wrong about the encoding of the source file, echoes part of the source code and thereby produces the invalid byte 0x98.
  • As diagnostic message include file paths as well, it has potential to produce the invalid byte 0x98 as well if it includes characters that aren’t valid in all encodings.

Anyhow, the proper solution would be for PlatformIO to use an encoding conversion that never fails and instead replaces placeholder characters for bytes that cannot be translated.

I propose you open an issue at https://github.com/platformio/platformio-core/issues.

1 Like

After another 3 hours of repair attempts, I got tired and formatted my system partition (I wanted to do it anyway). Now everything (my user name, python path, PlatformIO installation location etc.) is same as before, but compilation works. I still have no idea what the problem was, but i guess it is fixed now… Thanks for trying to help