2024-11-19 03:04 AM - edited 2024-11-19 03: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:
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.
I have fixed this error according to: https://github.com/STMicroelectronics/STM32CubeF4/issues/29 specifically:
#if defined (GNUC) & !defined (__CC_ARM)
is corrected to
#if defined (GNUC) && !defined (__CC_ARM) && !(defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
#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!
2024-11-19 05:28 AM - edited 2024-11-19 05: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.
2024-11-19 05: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.