Keil studio cloud shows "ERROR: Unable to find any symbols" when debugging

Hello everyone,
I imported following project to keil studio cloud.
“mbed-os-tcp-server-example-A”

When I click ‘Debug project’, the message “ERROR: Unable to find any symbols” is shown on ‘Debug Console’.
So I can’t debug this project.
Would you tell me what I should investigate?

Best regards.

Hi Keiichi,

thanks for reaching out to us.

Your project uses a fairly old version of Mbed OS. Would it be possible for you to update it? This can be done easily from the Mbed Libraries panel at the bottom of Keil Studio Cloud.

Let me know if this helps you.

Federico - Keil Studio team

Dear federicobozzini,
Thank you for your reply.
I updated Mbed-OS to 6.15.1.
Then I can’t build the project.
Keil studio shows following messages;

compile main.cpp
/src/main.cpp:9:10: fatal error: ‘TCPServer.h’ file not found
#include “TCPServer.h”
^~~~~~~~~~~~~
1 error generated.
Internal error.
Build failed
Build failed

This system is too difficult to use for me because I have basic knowledge just a little.
Would you help me if possible?

Best regards.

Hello,

It is because there were made some changes and jump from 5.10 or something like that to latest is too much in this case.

The TCPServer does not exist anymore, all were moved to TCPSocket - Connectivity - API references and tutorials | Mbed OS 6 Documentation

Also some topics are here on forum about that - Search results for ‘TCP server’ - Arm Mbed OS support forum

However, the code might look like the one below

//#if !FEATURE_LWIP
//    #error [NOT_SUPPORTED] LWIP not supported for this target
//#endif
 
#define CHECKSUM_GEN_ICMP 1
 
#include "mbed.h"
#include "EthernetInterface.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"                                                  \
"<meta http-equiv=\"Refresh\" content=\"0.1\">"\
"  <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"                                 \
"      <a href=\"https://www.google.com/\">google</a>" "\r\n"    \
"      <a href=\"DETAILS.TXT\">text</a>" "\r\n"    \
"    </div>" "\r\n"                                              \
"    <h1 id=\"time\"></h1>" \
"    <script>"\
"    time();"\
"    function time(){" \
"        var now = new Date();"\
"        document.getElementById(\"time\").innerHTML = now.toLocaleTimeString();"\
"    }"\
"    setInterval(\'time()\',1000);"\
"    setTimeout(function () {"\
"           location.reload();"\
"    }, 10);"\
"    </script>"\
"  </body>" "\r\n"                                               \
"</html>"
 
#define HTTP_RESPONSE HTTP_STATUS_LINE "\r\n"   \
                      HTTP_HEADER_FIELDS "\r\n" \
                      "\r\n"                    \
                      HTTP_MESSAGE_BODY "\r\n"
 
DigitalOut led1(LED1);
 
int main()
{
    long i = 0;
    printf("Basic HTTP server example\n");
    
    EthernetInterface eth;
    eth.set_dhcp(false);
    eth.set_network("192.168.3.78","255.255.252.0","192.168.0.1");
    if(eth.connect() == 0){
        SocketAddress myDeviceAddress;
        eth.get_ip_address(&myDeviceAddress);
        printf("The target IP address is '%s'\n", myDeviceAddress.get_ip_address());
    }else{
        printf("Connect error!");
        exit(-1);    
    }
    
    TCPSocket 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(80);
    
    /* Can handle 5 simultaneous connections */
    srv.listen(5);
    
    while (true) {
        clt_sock = srv.accept();
        clt_sock->getpeername(&clt_addr);
        printf("accept %s:%d\r\n", clt_addr.get_ip_address(), clt_addr.get_port());
        clt_sock->send(HTTP_RESPONSE, strlen(HTTP_RESPONSE));
        printf("%d\r\n",i++);
        led1 = !led1;
        clt_sock->close();
    }
}

Not tested, but compilation is OK in KeilStudio, for MbedOS 6.15.1 and Nucleo-F767ZI

BR, Jan

1 Like

Dear federicobozzini,

I have done it!

First I removed ‘#include “TCPServer.h”’.
And the following changes have been made to the program;
a)TCPServer srv; => TCPSocket srv;
b)srv.bind(eth.get_ip_address(), 80); => srv.bind(80);
c)srv.accept(&clt_sock, &clt_addr); => srv.accept();
d)clt_sock.send(HTTP_RESPONSE, strlen(HTTP_RESPONSE));
=> clt_sock → send(HTTP_RESPONSE, strlen(HTTP_RESPONSE));

Now I can only debug it but I was able to take a step forward.

Thank you very much.

Dear Jan,
Thank you for your reply.
Thank you for introducing the useful links and showing the source code.

I tried it and it works very well!

I’m just ashamed of my ignorance.
I must study harder!

Thank you very very much!