.pioinit:15: error while trying to debug

I get this error, as I’m trying to debug my SMT32F103VCT6 MCU. I’m using STLink-V3. I have tried providing as much information regarding my setup in the initialization file. I have seen this error (or similar ones) are quite common, but haven’t found a solution based on other answers.

This is the complete debug log from terminal.

	http://openocd.org/doc/doxygen/bugs.html
hla_swd
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : DEPRECATED target event trace-config; use TPIU events {pre,post}-{enable,disable}
Info : tcl server disabled
Info : telnet server disabled
Info : clock speed 1000 kHz
Info : STLINK V3J8M3 (API v3) VID:PID 0483:374E
Info : Target voltage: 3.294055
Info : stm32f1x.cpu: Cortex-M3 r1p1 processor detected
Info : stm32f1x.cpu: target has 6 breakpoints, 4 watchpoints
Info : starting gdb server for stm32f1x.cpu on pipe
Info : accepting 'gdb' connection from pipe
Info : device id = 0x10036414
Info : flash size = 256kbytes
0x08001b86 in ?? ()
Loading section ER_RO, size 0x12f74 lma 0x8000
.pioinit:15: Error in sourced command file:

This is the initialization file I’m using:

[env:genericSTM32F103VC]
platform = ststm32
board = genericSTM32F103VC
#framework = stm32cube                ; can't use, provide custom flags
extra_scripts = SetCompilerPath.py
platform_packages = toolchain-armcc@symlink://C:\Keil_v5\ARM\ARMCC\bin
board_build.ldscript = "PCV2-SES.sct" ; previously it was GCC "src\STM32F103VCTx_FLASH.ld" (which is indirectly supported by ARM via link options)
build_flags = 
    -Isrc/Core/Inc
    -Isrc/Drivers/STM32F1xx_HAL_Driver/Inc
    -Isrc/Drivers/CMSIS/Device/ST/STM32F1xx/Include
    -Isrc/Drivers/CMSIS/Include
    -Isrc/Drivers/STM32F1xx_HAL_Driver/
upload_protocol = stlink
debug_tool = stlink
#upload_command = ${platformio.packages_dir}/tool-stlink/st-flash write $SOURCE 0x8000000
board_build.mcu = stm32f103vct6

The address for the ER_RO section seems extremely low, Flash is at 0x08000000, RAM is at 0x2000000. 0x8000 seems like bootloader memory region? What’s the content of the scatter file that decides the load addresses?

I have managed to resolve this issue another way. Not sure what I did, but I modified/removed some build flags and now I’m able to build and debug without this issue.

Here is my scatter file for this project, just in case you want to check it out. But I really think everything is okay here.

LR_IROM1 0x08000000 0x00040000  {    ; load region size_region
  ER_IROM1 0x08000000 0x00040000  {  ; load address = execution address
   *.o (RESET, +First)
   *(InRoot$$Sections)
   .ANY (+RO)
   .ANY (+XO)
  }
  RW_IRAM1 0x20000000 0x0000C000  {  ; RW data
   .ANY (+RW +ZI)
  }
}