Ethernet example converted to C++ does not reply to ARP requests

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Ethernet example converted to C++ does not reply to ARP requests

1,206 Views
scottalford
Contributor I

Hi, 

I have a working ping example on an RT1052 board using the evkbimxrt1050_lwip_lwip_ping_bm example. I can happily ping the board, no problem.

However, when I copy the example and change the nature to C++, the board fails to respond to ping requests. I do see an outgoing ARP request from the board on start-up.

To convert the example I  used the "Convert to a C/C++ Project (Adds C/C++ Nature)" and then copied preprocessor and includes in the MCU C++ Compiler settings. And change extensions to cpp for main source and startup files, and declaring the SysTick_Handler as extern "C" so that the weak version is overridden. 

The program compiles and runs, but does not seem to be receiving packets.

Any thoughts? Is there some other C code which needs to be extern "C" {}...?

Any help appreciated as I'm porting an existing C++ program to this new platform.

Thanks

Scott

Labels (1)
0 Kudos
Reply
2 Replies

1,102 Views
scottalford
Contributor I

I think I may have stumbled across the issue and the solution. When converting a C example to C++ the default settings in the Managed Linker Script are lost. Which results in the SRAM_DTC being cacheable. Restoring the following settings made the C++ converted ping example happy and replying to pings.

Hope this helps others out as this has taken a long long time to figure out.

Screenshot 2023-06-21 100124.png

0 Kudos
Reply

1,182 Views
EdwinHz
NXP TechSupport
NXP TechSupport

I'm afraid our module drivers are designed in C, and are meant to be used with C projects. This is most likely the leading cause for your error.

Is there any specific reason why you need to have your project as a C++ project? I would highly recommend to maintain the C project, without converting it.

0 Kudos
Reply