[En-Nut-Discussion] STM32: Problems running code with an offset in flash (bootloader)

Philipp Burch phip at hb9etc.ch
Fri Mar 4 18:04:00 CET 2016

Hi Ole!

On 04.03.2016 00:34, Ole Reinhardt wrote:
> Hi Uwe,
> Am 03.03.2016 um 10:23 schrieb Uwe Bonnes:
>> cmsis/cortex_init.c line 431 is in charge to remap the interrupt vectors. I
>> guess something goes wrong there. Without a debugger, things are hard to
>> debug. But the ESP board has listed "SWD debug interface". And I know you have
>> some ST boards with Stlink at least version 2. So you could try to set up a
>> SWD connection from the SWD extension connector on the Stlink board to your
>> ESP board with flying wires.
> I got my STLink dongle today but this made things even more strange.
> If I connect the STLink with the board, the program continues running,
> but the output is unreadable. Looks like the baudrate (or any clock?)
> changed.
> If the STlink is _not connected_ the Program hangs after a few
> instructions during the first printf.
> What could be the difference when the STLink is connected or not? Really
> strange.

No idea if it is related, but some time ago, I faced such
debugger-related strange behaviour on a TIVA TM4C with a Segger J-Link.
It's a while since, but as far as I remember, I noted the following effects:

- When downloading the software, then unplug the debugger, power-cycle
the board, everything runs fine.
- When downloading the software, then power-cycle the board (with the
debugger still connected), everything runs fine.
- When downloading the software, then unplug the debugger and hard-reset
the MCU (with a pushbutton), the software crashed after some random time
with a bus fault or usage fault.
- When downloading the software, then leave the debugger connected and
reset the MCU by software or by the pushbutton, it crashed as well,
without a useful backtrace.

The crashes could usually be provoked by flooding the board with
Ethernet pings, but it still took between seconds and hours until it
actually happened.

What is really strange is the dependence on the power-cycle. I suppose
that something in the debugging interface is/was not properly reset even
by a hard-reset. Maybe there is some link to your problem.

Btw, I didn't use a bootloader or anything, just writing the image
directly into the MCU flash.


More information about the En-Nut-Discussion mailing list