function not found eventhough header file already included.

If you have a simple question and just want an answer.
sani_nfz
New User
Posts: 2
Joined: Fri Jun 05, 2020 11:09 am

function not found eventhough header file already included.

Post by sani_nfz »

Hello,
I am a newbie with Xmos so please excuse my noob question. I am trying to build an example project "AN00121_udp_demo" using xCORE-200 Explorer Kit. The default target device is sliceKIT Core Board and I change it to xCORE-200 Explorer Kit. After press "Build Project", I get this weird error saying xtcp related functions are unknown and probably missing prototype. But in the Makefile editor module "lib_tcp" is already ticked and xtcp.h is already included.

What did i do wrong here and do I need to modify something in makefile?

Please someone help.

Here is error output from console:

Code: Select all

12:49:12 **** Incremental Build of configuration Default for project AN00121_udp_demo ****
xmake CONFIG=Default all 
Checking build modules
Using build modules: lib_xtcp(6.0.0) lib_ethernet(3.4.0) lib_otpinfo(2.0.1) lib_gpio(1.1.0) lib_locks(2.0.3) lib_logging(2.1.0) lib_xassert(3.0.0)
Analyzing main.xc
../src/main.xc:91:3: error: unknown function identifier `xtcp_listen' (possibly missing prototype?)
  xtcp_listen(c_xtcp, INCOMING_PORT, XTCP_PROTOCOL_UDP);
  ^
../src/main.xc:98:10: error: `xtcp_event' is not a transaction or select handler function (implied by `:')
    case xtcp_event(c_xtcp, conn):
         ^~~~~~~~~~~~~~~~~~~~~~~~
../src/main.xc:105:11: error: unknown function identifier `xtcp_connect' (possibly missing prototype?)
          xtcp_connect(c_xtcp,
          ^
../src/main.xc:114:13: error: unknown function identifier `xtcp_close' (possibly missing prototype?)
            xtcp_close(c_xtcp, responding_connection);
            ^
../src/main.xc:155:26: error: unknown function identifier `xtcp_recv_count' (possibly missing prototype?)
          response_len = xtcp_recv_count(c_xtcp, rx_buffer, RX_BUFFER_SIZE);
                         ^
../src/main.xc:164:13: error: unknown function identifier `xtcp_init_send' (possibly missing prototype?)
            xtcp_init_send(c_xtcp, conn);
            ^
../src/main.xc:173:12: error: use of undeclared identifer `XTCP_REQUEST_DATA'
      case XTCP_REQUEST_DATA:
           ^
../src/main.xc:179:11: error: unknown function identifier `xtcp_send' (possibly missing prototype?)
          xtcp_send(c_xtcp, broadcast_buffer, broadcast_len);
          ^
../src/main.xc:187:9: error: unknown function identifier `xtcp_complete_send' (possibly missing prototype?)
        xtcp_complete_send(c_xtcp);
        ^
../src/main.xc:211:12: error: use of undeclared identifer `XTCP_ALREADY_HANDLED'
      case XTCP_ALREADY_HANDLED:
           ^
../src/main.xc:251:17: error: unknown function identifier `xtcp' (possibly missing prototype?)
    on tile[1]: xtcp(c_xtcp, 1, i_mii,
                ^
xmake[1]: *** [.build/src/main.xc.pca.xml.decouple] Error 1
xmake: *** [analyze] Error 2

12:49:27 Build Finished (took 15s.756ms)
You do not have the required permissions to view the files attached to this post.


User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am

Post by mon2 »

Hi. Tools are not perfect. First, do try Project -> CLEAN -> Build All.

Recommend that you try the following possible work around:

a) launch a fresh workspace (only for this testing)

b) once reaching the empty IDE -> select the EXAMPLES icon on the very left side pane

c) enter "AN00121" in the search bar to locate the same example

d) double click on this example to import this project into your workspace

e) once back to your IDE -> do not change anything -> Project (top bar) -> Build All. You will see errors but they will (should) auto-resolve.

Does this compile for you ok and without errors for the default XMOS kit?

If yes, only then proceed to manually change the TARGET inside the MAKEFILE for your desired new TARGET. Save this new setting.

Then again, Project (top bar) -> CLEAN -> Build All.

Does this work for you?

Having some local internet access issues with the XMOS website so will confirm the above process later in the day but should work.

Post your results.
sani_nfz
New User
Posts: 2
Joined: Fri Jun 05, 2020 11:09 am

Post by sani_nfz »

Hello mon2,
thank you for your fast reply. I did as you said, but the problem still persist.

After reading your answer, I kind of understand where the problem lies, maybe because I open a couple of program examples and libraries. So I do as you said, I create a clean workspace and import the project, it automatically import all the required libraries. But it still didnt work. The console gave the same error.

Do I need to tick all the required libraries in "Used Modules" in Makefile Editor? At the moment only "lib_xtcp" is ticked.

Code: Select all

15:06:46 **** Incremental Build of configuration Default for project AN00121_udp_demo ****
xmake CONFIG=Default all 
Checking build modules
Using build modules: lib_xtcp(6.0.0) lib_ethernet(3.4.0) lib_otpinfo(2.0.1) lib_gpio(1.1.0) lib_locks(2.0.3) lib_logging(2.1.0) lib_xassert(3.0.0)
Rebuild .build/_iflag.rsp
Analyzing psock.c
C:/Users/Nafiz/XMos-workspace_1/lib_xtcp/src/xtcp_uip/psock.c:230:16: warning: Dereferencing a function pointer whose declaration has no fptrgroup. The stack size will not be calculable. [-Wxcore-fptrgroup]
  s->sendlen = generate(arg);
               ^
C:/Users/Nafiz/XMos-workspace_1/lib_xtcp/src/xtcp_uip/psock.c:238:7: warning: Dereferencing a function pointer whose declaration has no fptrgroup. The stack size will not be calculable. [-Wxcore-fptrgroup]
      generate(arg);
      ^
2 warnings generated.
Analyzing uip-split.c
Analyzing uip.c
Analyzing uip_arp.c
Analyzing uip_timer.c
Analyzing uiplib.c
Analyzing autoip.c
Analyzing dhcpc.c
Analyzing igmp.c
Analyzing macaddr_filter_hash.c
Analyzing mii_buffering.c
Analyzing mii_ts_queue.c
Analyzing rgmii_buffering_c_support.c
Analyzing hwlock.c
Analyzing swlock.c
Analyzing debug_printf.c
Analyzing main.xc
../src/main.xc:91:3: error: unknown function identifier `xtcp_listen' (possibly missing prototype?)
  xtcp_listen(c_xtcp, INCOMING_PORT, XTCP_PROTOCOL_UDP);
  ^
../src/main.xc:98:10: error: `xtcp_event' is not a transaction or select handler function (implied by `:')
    case xtcp_event(c_xtcp, conn):
         ^~~~~~~~~~~~~~~~~~~~~~~~
../src/main.xc:105:11: error: unknown function identifier `xtcp_connect' (possibly missing prototype?)
          xtcp_connect(c_xtcp,
          ^
../src/main.xc:114:13: error: unknown function identifier `xtcp_close' (possibly missing prototype?)
            xtcp_close(c_xtcp, responding_connection);
            ^
../src/main.xc:155:26: error: unknown function identifier `xtcp_recv_count' (possibly missing prototype?)
          response_len = xtcp_recv_count(c_xtcp, rx_buffer, RX_BUFFER_SIZE);
                         ^
../src/main.xc:164:13: error: unknown function identifier `xtcp_init_send' (possibly missing prototype?)
            xtcp_init_send(c_xtcp, conn);
            ^
../src/main.xc:173:12: error: use of undeclared identifer `XTCP_REQUEST_DATA'
      case XTCP_REQUEST_DATA:
           ^
../src/main.xc:179:11: error: unknown function identifier `xtcp_send' (possibly missing prototype?)
          xtcp_send(c_xtcp, broadcast_buffer, broadcast_len);
          ^
../src/main.xc:187:9: error: unknown function identifier `xtcp_complete_send' (possibly missing prototype?)
        xtcp_complete_send(c_xtcp);
        ^
../src/main.xc:211:12: error: use of undeclared identifer `XTCP_ALREADY_HANDLED'
      case XTCP_ALREADY_HANDLED:
           ^
../src/main.xc:251:17: error: unknown function identifier `xtcp' (possibly missing prototype?)
    on tile[1]: xtcp(c_xtcp, 1, i_mii,
                ^
xmake[1]: *** [.build/src/main.xc.pca.xml.decouple] Error 1
xmake: *** [analyze] Error 2

15:07:07 Build Finished (took 21s.583ms)
You do not have the required permissions to view the files attached to this post.
User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am

Post by mon2 »

Hi. Noting the same issue here with the factory supplied AN00121 example project. Not sure on how to resolve this issue at this time. Perhaps the library is now broken but will study as time permits.

Historically, a simple import the golden examples from the toolchain would just compile and run as-is.
User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am

Post by mon2 »

Something is broken. We should not have to hack our way through this factory example. The premise was to start with an known good code example -> then change the target and you are on your way.

Have raised an official ticket - let us see what is the resolution. Will reply back.
User avatar
akp
XCore Expert
Posts: 579
Joined: Thu Nov 26, 2015 11:47 pm

Post by akp »

It appears XMOS didn't migrate their xTIMEcomposer example to work with the 6.x release of lib_xtcp. However, they did fix it in github and I can confirm it compiles. You'll need the Makefile and the main.xc at least from github

https://github.com/xmos/lib_xtcp/tree/m ... 1_udp_demo