STM32F042 boots in debugger only
Hi, I have designed a small project on the STM32F042F6Px MCU, and wrote a piece of software for it. Then I tried to run it outside of the debugger, and realized it won't boot. I've spent many hours on it already, and now I run out of ideas. It looks like no code is executed at all if the MCU is just powered (does not matter if STlink cable is connected or not). Everything runs fine if I power it on, and then choose "Debug" in Atollic.
I have stripped down the program of everything. No, really. I have even disabled everything in the startup file, so that only this remained:
Reset_Handler:
bl mainMy main function is just this:
int main(void)
{
__HAL_RCC_GPIOB_CLK_ENABLE();
GPIOB->MODER |= 0b01 << (8*2);
GPIOB->BSRR = GPIO_PIN_8;
while (1) { };
}The result is that the PB8 line goes high when the app is run from the debugger, and is floating when run outside of debugger.
I have even soldered another chip in case that one was faulty. No change.
I have over 5 years of experience with various STM32 MCUs, but have never seen anything like this.
