Skip to main content
Associate
April 2, 2025
Solved

Black Pill: Debugging STM32F103RCT6 in Keil Fails to Enter main()

  • April 2, 2025
  • 4 replies
  • 1735 views

Title edited to highlight that this is a "Black Pill" board


  • MCU: STM32F103RCT6

  • Toolchain: Keil MDK v5.31 + DAPLink debugger

  • Behavior:

    • Program flashes successfully via DAPLink.

    • Debug session starts but never enters main() – halts at address 0x200001E0 (check Disassembly/Register window).

    • All debug buttons (Step, Run) are grayed out except Reset/Stop.

  • Key Observations:

    • Same code runs correctly on another STM32F103 board.

    • Rebuild/Clean did not resolve the issue.

merose_0-1743582902994.png

The "Option for target" as below.

merose_1-1743583253545.png

merose_2-1743583272480.pngmerose_3-1743583294382.png

merose_4-1743583305233.png

merose_0-1743583956883.png

This topic has been closed for replies.
Best answer by mƎALLEm

Hello,

ST resources are dedicated to supporting genuine ST products. We are not committed to ensuring that clones/fakes work properly with the firmware we provide.

Thank you for your understanding.

4 replies

mƎALLEm
Technical Moderator
April 2, 2025

Hello @merose and welcome to the ST community,

Are you using Blue pill or Black pill board?

"To give better visibility on the answered topics, please click on ""Accept as Solution"" on the reply which solved your issue or answered your question."
meroseAuthor
Associate
April 2, 2025

It's Black Pill. What's the difference between them?

mƎALLEm
Technical Moderator
April 2, 2025

They at 99% contain a counterfeit STM32.

And this may confirm my saying:

  • Same code runs correctly on another STM32F103 board.

"To give better visibility on the answered topics, please click on ""Accept as Solution"" on the reply which solved your issue or answered your question."
Andrew Neil
Super User
April 2, 2025

Welcome to the forum.

Please give details of your two boards - see: How to write your question to maximize your chances to find a solution.

 


@merose wrote:
  • MCU: STM32F103RCT6


Are you sure it's a genuine ST chip?

 


@merose wrote:
    • Debug session starts but never enters main() – halts at address 0x200001E0 


So somewhere in the startup code.

Look at the startup code to see what should be happening ?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Ozone
Principal
April 2, 2025

As usual, try to locate the "Run to main" setting in your debugging environment, and disable it.
The code obviously fails in the init code, most probably during clock setup.
If the same code runs properly on "another board", memory size and lication issues are unlikely - unless these are not the same kind of board.
Differently placed jumpers that affect settings might be another reason.

meroseAuthor
Associate
April 2, 2025

Thanks.I will try this.

mƎALLEm
mƎALLEmBest answer
Technical Moderator
April 14, 2025

Hello,

ST resources are dedicated to supporting genuine ST products. We are not committed to ensuring that clones/fakes work properly with the firmware we provide.

Thank you for your understanding.

"To give better visibility on the answered topics, please click on ""Accept as Solution"" on the reply which solved your issue or answered your question."