cancel
Showing results for 
Search instead for 
Did you mean: 

Why are there random breakpoints in the assembly code and how to get rid of them?

Mysterious Wolf
Associate II

I'm migrating a project from STM32G431KB to STM32G431CBT6. Both projects were generated using STM32CubeMX and are developed in Keil (MDK ARM), so I only transferred the user code. However when debugging code on the new chip, random breakpoint commands in the disassembly window appear (not the user-defined red dots, but the BKPT mnemonic specifically).

It's always first 3 times between _sys_open and _sys_close, then one time between _sys_istty and_sys_seek and another one between _sys_write, _sys_read, then my program runs normally. I tried a full chip wipe, code regeneration, code rebuilds all without any luck. I'm guessing there might be a setting I forgot somewhere that could cause this or a library from CubeMX, but so far I haven't been able to figure out what it could be.

The CubeMX software packs I use:0693W00000SuBfxQAF.pngSelected features:

0693W00000SuBg2QAF.png

1 ACCEPTED SOLUTION

Accepted Solutions

Semi-hosting?

T​here type of file IO functions are not supported on the device, the breakpoints allow the debugger to interact with resources on the host PC

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

4 REPLIES 4

Semi-hosting?

T​here type of file IO functions are not supported on the device, the breakpoints allow the debugger to interact with resources on the host PC

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Mysterious Wolf
Associate II

Thank you very much. I thought it was something like that, but couldn't find what it's called. I managed to redirect the calls to ITM, but there is nothing in the debug window. Nevertheless, this solved the core issue!

ncode1
Associate

I'm running into a similar issue. Could someone give an example or more details on how they defined these missing functions?

It's been several years.

Things like STDIO (file and output), clock() functionality don't have an OS to fall back on. Absent some plumbing to YOUR hardware there will be functions with BKPT that the C library calls in hopes that the debugger will facilitate functionality on the HOST PC

https://github.com/timmy00274672/STM32-Learning/blob/master/CMSIS_V1P10/UartDev/Example/Retarget.c

 

See Semi-Hosting, Retargeting 

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..