I have developed my own board with an STM32L412KB chip and I am using the ST-Link/V2 device to connect to it. I am using the latest version of Keil uVision. I am able to go into debug mode and change values in the system registers (I can turn on and off the LEDs on my board, so that's a good sign). However, it seems the code is stuck in some sort of startup loop. The program never reaches the main function if I set a breakpoint. If I turn off the 'run to main' option in the debug settings, the only thing I am able to see is the Disassembly. It does not show how it is correlated to any C code file or assembly file (such as the startup files). The loop is this:
0x1FFF2174 6B60 LDR r0,[r4,#0x34]0x1FFF2176 2800 CMP r0,#0x000x1FFF2178 F040811C BNE.W 0x1FFF23B40x1FFF217C 68E0 LDR r0,[r4,#0x0C]0x1FFF217E 6901 LDR r1,[r0,#0x10]0x1FFF2180 0549 LSLS r1,r1,#210x1FFF2182 BF5C ITT PL0x1FFF2184 2101 MOVS r1,#0x010x1FFF2186 62A1 STR r1,[r4,#0x28]0x1FFF2188 6921 LDR r1,[r4,#0x10]0x1FFF218A 6909 LDR r1,[r1,#0x10]0x1FFF218C 0709 LSLS r1,r1,#280x1FFF218E BF5C ITT PL0x1FFF2190 2101 MOVS r1,#0x010x1FFF2192 62E1 STR r1,[r4,#0x2C]0x1FFF2194 6961 LDR r1,[r4,#0x14]0x1FFF2196 6909 LDR r1,[r1,#0x10]0x1FFF2198 0509 LSLS r1,r1,#200x1FFF219A BF5C ITT PL0x1FFF219C 2101 MOVS r1,#0x010x1FFF219E 6321 STR r1,[r4,#0x30]0x1FFF21A0 4998 LDR r1,[pc,#608] ; @0x1FFF24040x1FFF21A2 6989 LDR r1,[r1,#0x18]0x1FFF21A4 0709 LSLS r1,r1,#280x1FFF21A6 D507 BPL 0x1FFF21B8
0x1FFF21B8 4995 LDR r1,[pc,#596] ; @0x1FFF24100x1FFF21BA 6989 LDR r1,[r1,#0x18]0x1FFF21BC 0709 LSLS r1,r1,#280x1FFF21BE D508 BPL 0x1FFF21D2
0x1FFF21D2 F8D91018 LDR r1,[r9,#0x18]0x1FFF21D6 0709 LSLS r1,r1,#280x1FFF21D8 D509 BPL 0x1FFF21EE
0x1FFF21EE F8BA1008 LDRH r1,[r10,#0x08]0x1FFF21F2 07C9 LSLS r1,r1,#310x1FFF21F4 D516 BPL 0x1FFF2224
0x1FFF2224 8929 LDRH r1,[r5,#0x08]0x1FFF2226 07C9 LSLS r1,r1,#310x1FFF2228 D517 BPL 0x1FFF225A
0x1FFF225A 6AA1 LDR r1,[r4,#0x28]0x1FFF225C 2901 CMP r1,#0x010x1FFF225E D136 BNE 0x1FFF22CE
0x1FFF22CE 6AE0 LDR r0,[r4,#0x2C]0x1FFF22D0 2801 CMP r0,#0x010x1FFF22D2 D132 BNE 0x1FFF233A
0x1FFF233A 6B20 LDR r0,[r4,#0x30]0x1FFF233C 2801 CMP r0,#0x010x1FFF233E F47FAF19 BNE.W 0x1FFF21740x1FFF2342 6960 LDR r0,[r4,#0x14]0x1FFF2344 6900 LDR r0,[r0,#0x10]0x1FFF2346 0500 LSLS r0,r0,#200x1FFF2348 F57FAF14 BPL.W 0x1FFF2174
I am hoping that somebody might be able to tell me what this is and how I can fix it.
Thank you to anyone who can provide me any advice whatsoever.
I think I may have solved it. After looking at this post: https://community.arm.com/developer/tools-software/tools/f/keil-forum/47236/program-does-not-reach-main-uvision5/166497#166497 it seems I have booted into System Memory and not Flash. After looking at my PCB layout, I see that I have directly connected the BOOT0 pin to VDD which causes the chip to boot up into System Memory. I will fix it and see how it is.
This solved it.
View all questions in Keil forum