ETH LwIP program runs only when debugging
Hello ST Community!
I have a problem and I need your help. I have searched and read most of the related articles but couldn't find a solution! I am using:
- Hardware: Nucleo H755 board connected directly to the computer.
- Software: STM32CubeMX version 6.12 and MDK-ARM compiler version 5.41
I have carefully read the article: https://community.st.com/t5/stm32-mcus/how-to-create-a-project-for-stm32h7-with-ethernet-and-lwip-stack/ta-p/49308 and some other related tutorials, as well as related comments. I have followed the following steps.
- Configure according to the instructions for CM7 core, no RTOS used.
- Generate code (MDK Toolchain; min version 5.32).
- Add MX_LWIP_Process to the main loop.
- Compiling with the option [ARM Compiler: Use default compiler version 5] results in an unusually very slow compilation time.
- Compile with option [ARM Compiler: Use default compiler version 6] then compile time is normal but there is an error: ../Middlewares/Third_Party/LwIP/system\arch/cc.h(50): error: 'sys/time.h' file not found
I have fixed this error according to: https://github.com/STMicroelectronics/STM32CubeF4/issues/29 specifically:
- In file cc.h, line 43:
#if defined (GNUC) & !defined (__CC_ARM)
is corrected to
#if defined (GNUC) && !defined (__CC_ARM) && !(defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
- In file lwip.c, line 25 and 178,
#if defined ( __CC_ARM )
is corrected to
#if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6100100)
And then, I compile and there is a warning in the ethernetif.c file, line 124: __attribute__((section(".Rx_PoolSection"))) extern u8_t memp_memory_RX_POOL_base[];
I corrected it to
__attribute__((section(".Rx_PoolSection"))) u8_t memp_memory_RX_POOL_base[];
extern u8_t memp_memory_RX_POOL_base[];
6. In the Scatter file I added the content for RW_DMARxDscrTab, RW_DMATxDscrTab and memory_RX_POOL_base
7. Compile successfully without error and warning
8. Download program to MCU, check ping from PC and get the result: Destination host unreachable.
9. Enter debug mode, press Run (F5) 3 time, the program runs and pings from PC successfully: bytes=32 time=1ms TTL=255.
I set the breakpoint at the beginning of the main function, I have to press the Run button 3 times before the cursor stops at this breakpoint.
10. If I press the hard reset button or turn off the power, the program does not run.
Please show me my mistakes and how to fix them! I'm a newbie. Thank you very much!
