Successful flash but program never reaches main()

Hi all,

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,#0x00
0x1FFF2178 F040811C BNE.W 0x1FFF23B4
0x1FFF217C 68E0 LDR r0,[r4,#0x0C]
0x1FFF217E 6901 LDR r1,[r0,#0x10]
0x1FFF2180 0549 LSLS r1,r1,#21
0x1FFF2182 BF5C ITT PL
0x1FFF2184 2101 MOVS r1,#0x01
0x1FFF2186 62A1 STR r1,[r4,#0x28]
0x1FFF2188 6921 LDR r1,[r4,#0x10]
0x1FFF218A 6909 LDR r1,[r1,#0x10]
0x1FFF218C 0709 LSLS r1,r1,#28
0x1FFF2190 2101 MOVS r1,#0x01
0x1FFF2192 62E1 STR r1,[r4,#0x2C]
0x1FFF2194 6961 LDR r1,[r4,#0x14]
0x1FFF2196 6909 LDR r1,[r1,#0x10]
0x1FFF2198 0509 LSLS r1,r1,#20
0x1FFF219C 2101 MOVS r1,#0x01
0x1FFF219E 6321 STR r1,[r4,#0x30]
0x1FFF21A0 4998 LDR r1,[pc,#608] ; @0x1FFF2404
0x1FFF21A2 6989 LDR r1,[r1,#0x18]
0x1FFF21A4 0709 LSLS r1,r1,#28
0x1FFF21A6 D507 BPL 0x1FFF21B8

0x1FFF21B8 4995 LDR r1,[pc,#596] ; @0x1FFF2410
0x1FFF21BA 6989 LDR r1,[r1,#0x18]
0x1FFF21BC 0709 LSLS r1,r1,#28
0x1FFF21BE D508 BPL 0x1FFF21D2

0x1FFF21D2 F8D91018 LDR r1,[r9,#0x18]
0x1FFF21D6 0709 LSLS r1,r1,#28
0x1FFF21D8 D509 BPL 0x1FFF21EE

0x1FFF21EE F8BA1008 LDRH r1,[r10,#0x08]
0x1FFF21F2 07C9 LSLS r1,r1,#31
0x1FFF21F4 D516 BPL 0x1FFF2224

0x1FFF2224 8929 LDRH r1,[r5,#0x08]
0x1FFF2226 07C9 LSLS r1,r1,#31
0x1FFF2228 D517 BPL 0x1FFF225A

0x1FFF225A 6AA1 LDR r1,[r4,#0x28]
0x1FFF225C 2901 CMP r1,#0x01
0x1FFF225E D136 BNE 0x1FFF22CE

0x1FFF22CE 6AE0 LDR r0,[r4,#0x2C]
0x1FFF22D0 2801 CMP r0,#0x01
0x1FFF22D2 D132 BNE 0x1FFF233A

0x1FFF233A 6B20 LDR r0,[r4,#0x30]
0x1FFF233C 2801 CMP r0,#0x01
0x1FFF233E F47FAF19 BNE.W 0x1FFF2174
0x1FFF2342 6960 LDR r0,[r4,#0x14]
0x1FFF2344 6900 LDR r0,[r0,#0x10]
0x1FFF2346 0500 LSLS r0,r0,#20
0x1FFF2348 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. 

Parents Reply Children
No data
More questions in this forum