cancel
Showing results for 
Search instead for 
Did you mean: 

Build the code for Keil

HKabi.1
Associate II

I configured lwip in cube for stm32f107, when I generate code for keil and run it the micro hangs, but if I write a program without cube, it runs without any problem.

What is the problem?

Note: If I get the output for CubeIDE, it runs without any problem.

11 REPLIES 11

>>What is the problem?

Hard to say, perhaps debug it?

Could be stuck in some while() loop, perhaps the Hard Fault Handler or Error Handler.

Try stopping in the debugger, determine where it is within the code.

Uncheck "run to main()" if it doesn't get to main before stalling.

Check SystemInit() code, this should be called prior to main()

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

It is hard to describe.

The program is stopped here and does not go to main.

; Reset handler
Reset_Handler    PROC
                 EXPORT  Reset_Handler             [WEAK]
        IMPORT  SystemInit
        IMPORT  __main
                 LDR     R0, =SystemInit
                 BLX     R0
                 LDR     R0, =__main
                 BX      R0
                 ENDP

The program only works if I press the F5 button 4 times

HKabi.1
Associate II

In my opinion, st does not make suitable setup files for keil.

They don't even take the time to test to see what the problem is.

It is not known what this company and its employees are doing.

I sent a message to ST on August 6 but they did not reply.

Do they have a ticket system to solve problems?

@HKabi.1​ Keil is a larger software house than ST, they made these startup files. They also provide the C compiler and assembler, and the debugger. Their support is good (€).

Check the cables and target power supply. Try to disconnect and reconnect USB cable of the ST-LINK.

This problem has nothing to do with keil or stlink.

It happens when the project is built with stmcube for keil.

When you said " I write a program without cube" do you mean that you wrote also the startup, or you've started from a template provided in a Keil pack for STM32?

If the latter, it is easy to compare the files.

I remember having similar issue with program stuck at the reset address but cannot recall was it caused by bad connections or by outdated firmware of ST-LINK. It wasn't in the code.

Piranha
Chief II

Check the stack size and a possible printf()/malloc() usage.

And, of course, this:

https://community.st.com/s/question/0D50X0000BOtfhnSQB/how-to-make-ethernet-and-lwip-working-on-stm32

I use startup from a template provided in a Keil pack for STM32.

Even if you turn on the device when stlink is not connected, the device will not work.