Skip to main content
HKabi.1
Associate II
November 13, 2022
Question

Build the code for Keil

  • November 13, 2022
  • 5 replies
  • 4254 views

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.

This topic has been closed for replies.

5 replies

Tesla DeLorean
Guru
November 13, 2022

>>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 VenmoUp vote any posts that you find helpful, it shows what's working..
HKabi.1
HKabi.1Author
Associate II
November 13, 2022

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
HKabi.1Author
Associate II
November 22, 2022

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?

Pavel A.
Super User
November 22, 2022

@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.

HKabi.1
HKabi.1Author
Associate II
November 22, 2022

This problem has nothing to do with keil or stlink.

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

Piranha
Principal III
November 23, 2022

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

HKabi.1
HKabi.1Author
Associate II
November 24, 2022

Hi @Piranha​ 

The stack size is correct. I didn't use printf, but I don't know if LWIP used it or not.

I didn't use COM or UART port in my device and therefore I didn't make settings for it and I didn't connect printf to it either.

When I run the same code with cubeide, it runs, but when it receives data from the network several times, only the network stops working and there is no ping, but everything else works.

https://community.st.com/s/question/0D53W00001vDY9ZSAW/stm32f107lwip203freertos-not-work

i remove freertos but the problem still exists

Visitor II
October 29, 2023

Hi  HKabi.1 !

I also had the same problem as you on CubeMx version 6.9.2 and stm32cube_fw_f4 V1.27.1. This is ST's latest software update. If you have found the solution, please guide me.