AnsweredAssumed Answered

How to debug a project with custom bootloader in STVD?

Question asked by pavel a on Oct 16, 2017
Latest reply on Oct 20, 2017 by pavel a

Hi again.

I'm still stuck with the same problem as asked before.

The microcontroller model is STM8L101G3U.
The debugger interface is ST-Link USB.


I have a project with a custom bootloader, done as described in the app note AN2659, with Cosmic compiler (sorry to these who prefers other tools).


Cannot figure out how to debug the main firmware and keep the bootloader programmed on the device.


When the bootloader is programmed and protected using the option byte:

Debugger refuses to start the main app. It pops up the following error:

GDI Error: For better debugging performance, the user bootcode size must be reduced.

You need to change the UBC option


The bootloader size is 0x23 pages (0x23 * 0x40 = 0x8c0). Is it really too much??


When I remove all code protection bits in OPT2, starting debugger on the main firmware ERASES the bootloader.

The debugger breaks nicely at the start address 0x8000 - but there's no any program there. All zeroes.

In Tools->Programmer settings, erasing of the flash is NOT checked.



Is this supposed to work at all with the STVD If yes, what I am doing wrong?