ETH LwIP program runs only when debugging
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-19 3:04 AM - edited ‎2024-11-19 3:23 AM
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!
Solved! Go to Solution.
- Labels:
-
STM32H7 series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-19 5:28 AM - edited ‎2024-11-19 5:34 AM
Typically this happens when the application tries to use C library functions (like printf()) that use semi-hosting.
Semi hosting requires the debugger to do some actions like getting the string from the MCU (through debugger link) and printing it in the IDE .
When running without the debugger, the project must be compiled without semi hosting.
one possible way on MDK-ARM to disable semi hosting is to select "Use micro-lib" in "code generation" in Target tab of your project config.
The C library "micro-lib" doesn't use semi hosting. The printf() won't work.
Another way would be to replace the standard library functions with one that doesn't use semi hosting.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-19 5:28 AM - edited ‎2024-11-19 5:34 AM
Typically this happens when the application tries to use C library functions (like printf()) that use semi-hosting.
Semi hosting requires the debugger to do some actions like getting the string from the MCU (through debugger link) and printing it in the IDE .
When running without the debugger, the project must be compiled without semi hosting.
one possible way on MDK-ARM to disable semi hosting is to select "Use micro-lib" in "code generation" in Target tab of your project config.
The C library "micro-lib" doesn't use semi hosting. The printf() won't work.
Another way would be to replace the standard library functions with one that doesn't use semi hosting.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-19 5:32 AM
@TonyRuan wrote:4. Compiling with the option [ARM Compiler: Use default compiler version 5] results in an unusually very slow compilation time.
On MDK-ARM compiler 5 , it is the generation of code browsing information that takes time. To disable it, you can uncheck "Browse information" in Output tab of your project config.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-19 6:16 AM - edited ‎2024-11-19 7:05 AM
Thanks for your reply, Guillaume K!
Problem solved!
1. Use ARM Compiler version 5
2. Use MicroLIB
3. Uncheck Browse Information
However, if I want to use ARM Compiler version 6, is there another way?
Thanks you, Guillaume K!
