Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stm32 nucleo f207zg: Sample code fails to compile, but compiles in ARM mbed online compiler #36

Closed
aschmidt75 opened this issue Mar 23, 2017 · 1 comment

Comments

@aschmidt75
Copy link

aschmidt75 commented Mar 23, 2017

$ pio --version
PlatformIO, version 3.3.0a17

$ pio update

Platform Manager
================
Platform Atmel AVR
--------
Updating atmelavr                        @ 1.4.5          [Up-to-date]
Updating toolchain-atmelavr              @ 1.40902.0      [Up-to-date]
Updating tool-avrdude                    @ 1.60300.0      [Up-to-date]

Platform Espressif 8266
--------
Updating espressif8266                   @ 1.3.0          [Up-to-date]
Updating tool-mkspiffs                   @ 1.102.0        [Up-to-date]
Updating tool-esptool                    @ 1.409.0        [Up-to-date]
Updating tool-espotapy                   @ 1.0.0          [Up-to-date]
Updating framework-arduinoespressif8266  @ 1.20300.1      [Up-to-date]
Updating toolchain-xtensa                @ 1.40802.0      [Up-to-date]

Platform Native
--------
Updating native                          @ 1.1.0          [Up-to-date]

Platform ST STM32
--------
Updating ststm32                         @ 1.8.1          [Up-to-date]
Updating tool-stm32duino                 @ 1.0.0          [Up-to-date]
Updating framework-mbed                  @ 3.137.0        [Up-to-date]
Updating toolchain-gccarmnoneeabi        @ 1.40804.0      [Up-to-date]
Updating tool-stlink                     @ 1.10200.0      [Up-to-date]


Library Manager
===============

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(&eth);

    /* 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.

@123TzTz321
Copy link

i have the same problem with nucleo-f767ZI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants