You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Taking this sample code snippet from ARM mbed sources
#if !FEATURE_LWIP
#error [NOT_SUPPORTED] LWIP not supported for this target
#endif
#include "mbed.h"
#include "EthernetInterface.h"
#include "TCPServer.h"
#include "TCPSocket.h"
#define HTTP_STATUS_LINE "HTTP/1.0 200 OK"
#define HTTP_HEADER_FIELDS "Content-Type: text/html; charset=utf-8"
#define HTTP_MESSAGE_BODY "" \
"<html>" "\r\n" \
" <body style=\"display:flex;text-align:center\">" "\r\n" \
" <div style=\"margin:auto\">" "\r\n" \
" <h1>Hello World</h1>" "\r\n" \
" <p>It works !</p>" "\r\n" \
" </div>" "\r\n" \
" </body>" "\r\n" \
"</html>"
#define HTTP_RESPONSE HTTP_STATUS_LINE "\r\n" \
HTTP_HEADER_FIELDS "\r\n" \
"\r\n" \
HTTP_MESSAGE_BODY "\r\n"
int main()
{
printf("Basic HTTP server example\n");
EthernetInterface eth;
eth.connect();
printf("The target IP address is '%s'\n", eth.get_ip_address());
TCPServer srv;
TCPSocket clt_sock;
SocketAddress clt_addr;
/* Open the server on ethernet stack */
srv.open(ð);
/* Bind the HTTP port (TCP 80) to the server */
srv.bind(eth.get_ip_address(), 80);
/* Can handle 5 simultaneous connections */
srv.listen(5);
while (true) {
srv.accept(&clt_sock, &clt_addr);
printf("accept %s:%d\n", clt_addr.get_ip_address(), clt_addr.get_port());
clt_sock.send(HTTP_RESPONSE, strlen(HTTP_RESPONSE));
}
}
works with the online compiler on developer.mbed.org, but fails in pio:
$ pio run
(...)
Compiling .pioenvs/nucleo_f207zg/lib/rtos/RtosTimer.o
Compiling .pioenvs/nucleo_f207zg/lib/rtos/Semaphore.o
In file included from src/main.cpp:6:0:
/Users/cassini/.platformio/packages/framework-mbed/features/unsupported/net/eth/EthernetInterface/EthernetInterface.h:24:2: error: #error The Ethernet Interface library is not supported on this target
#error The Ethernet Interface library is not supported on this target
^
In file included from /Users/cassini/.platformio/packages/framework-mbed/platform/platform.h:28:0,
from /Users/cassini/.platformio/packages/framework-mbed/mbed.h:55,
from /Users/cassini/.platformio/packages/framework-mbed/rtos/RtosTimer.cpp:26:
/Users/cassini/.platformio/packages/framework-mbed/platform/toolchain.h:23:2: warning: #warning toolchain.h has been replaced by mbed_toolchain.h, please update to mbed_toolchain.h [since mbed-os-5.3] [-Wcpp]
#warning toolchain.h has been replaced by mbed_toolchain.h, please update to mbed_toolchain.h [since mbed-os-5.3]
^
src/main.cpp:7:23: fatal error: TCPServer.h: No such file or directory
$ cd ~/.platformio
$ find . -name "EthernetInterface.h"
./packages/framework-mbed/features/FEATURE_LWIP/lwip-interface/EthernetInterface.h
./packages/framework-mbed/features/unsupported/net/eth/EthernetInterface/EthernetInterface.h
The error message The Ethernet Interface library is not supported on this target is due to a check for presence of a define !defined(TARGET_STM32F4), suggesting that an STM32F2xx boards is not compatible. But when compiling and flashing this using the online compiler, the sample works.
The text was updated successfully, but these errors were encountered:
Taking this sample code snippet from ARM mbed sources
works with the online compiler on developer.mbed.org, but fails in pio:
The error message
The Ethernet Interface library is not supported on this target
is due to a check for presence of a define!defined(TARGET_STM32F4)
, suggesting that an STM32F2xx boards is not compatible. But when compiling and flashing this using the online compiler, the sample works.The text was updated successfully, but these errors were encountered: