xtcp_lwip core usage

Technical questions regarding the xTIMEcomposer, xSOFTip Explorer and Programming with XMOS.
RedDave
Active Member
Posts: 44
Joined: Fri Oct 05, 2018 4:26 pm

xtcp_lwip core usage

Postby RedDave » Wed Oct 24, 2018 11:27 am

I'm running a webserver and UDP task as part of a sensor application being developed on an xCORE-200 eXplorer board.

The basic par statement, before I add anything of my own is...

Code: Select all

    par
    {
        // Web
        on tile[1]: rgmii_ethernet_mac(i_rx, NUM_ETH_CLIENTS,
                                       i_tx, NUM_ETH_CLIENTS,
                                       null, null,
                                       c_rgmii_cfg,
                                       rgmii_ports,
                                       ETHERNET_DISABLE_SHAPER);
        on tile[1].core[0]: rgmii_ethernet_mac_config(i_cfg, NUM_CFG_CLIENTS, c_rgmii_cfg);
        on tile[1].core[0]: ar8035_phy_driver(i_smi, i_cfg[CFG_TO_PHY_DRIVER]);
        on tile[0]: xtcp_lwip(i_xtcp, NUM_XTCP_CLIENTS, null,
                              i_cfg[CFG_TO_XTCP], i_rx[ETH_TO_XTCP], i_tx[ETH_TO_XTCP],
                              null, ETHERNET_SMI_PHY_ADDRESS,
                              null, otp_ports, ipconfig);
        on tile[1]: smi(i_smi, p_smi_mdio, p_smi_mdc);
     }


By my reckoning this should use 3-4 cores (smi is distributable, so doesn't use a core of its own(?) ), two on tile1 and one on tile 0. Task Viewer agrees with that its its visualisation.

When I build the code it tells me it has used all 8 cores on tile 1 (and one on tile 0).

Is this right?
What are the unaccounted for 4-5 cores doing?
Is there a more efficient way to do this?

Code: Select all

Constraint check for tile[0]:
  Cores available:            8,   used:          1 .  OKAY
  Timers available:          10,   used:          1 .  OKAY
  Chanends available:        32,   used:          6 .  OKAY
  Memory available:       262144,   used:      72456 .  OKAY
    (Stack: 4908, Code: 44044, Data: 23504)
Constraints checks PASSED.
Constraint check for tile[1]:
  Cores available:            8,   used:          8 .  OKAY
  Timers available:          10,   used:          8 .  OKAY
  Chanends available:        32,   used:         21 .  OKAY
  Memory available:       262144,   used:      110588 .  OKAY
    (Stack: 78644, Code: 22304, Data: 9640)
Constraints checks PASSED.
User avatar
mon2
XCore Legend
Posts: 1338
Joined: Thu Jun 10, 2010 11:43 am

Postby mon2 » Wed Oct 24, 2018 12:38 pm

Inside your makefile is (should be) a compiler optimization flag of format -Ox.

What is the current value for x?

Try with -O3 and please post your results.
RedDave
Active Member
Posts: 44
Joined: Fri Oct 05, 2018 4:26 pm

Postby RedDave » Wed Oct 24, 2018 12:50 pm

It was on -O2, changed it to -O3.

Results are identical (i.e. as above).
RedDave
Active Member
Posts: 44
Joined: Fri Oct 05, 2018 4:26 pm

Postby RedDave » Wed Oct 24, 2018 12:55 pm

How do the optimisation settings in library modules work?

Changing -Os to -O3 in lib_xtcp/module_build_info increases the code size (presumably improving speed), but does not affect core count.


Code: Select all

Constraint check for tile[0]:
  Cores available:            8,   used:          1 .  OKAY
  Timers available:          10,   used:          1 .  OKAY
  Chanends available:        32,   used:          6 .  OKAY
  Memory available:       262144,   used:      95120 .  OKAY
    (Stack: 4836, Code: 66792, Data: 23492)
Constraints checks PASSED.
Constraint check for tile[1]:
  Cores available:            8,   used:          8 .  OKAY
  Timers available:          10,   used:          8 .  OKAY
  Chanends available:        32,   used:         21 .  OKAY
  Memory available:       262144,   used:      110588 .  OKAY
    (Stack: 78644, Code: 22304, Data: 9640)
Constraints checks PASSED.
User avatar
mon2
XCore Legend
Posts: 1338
Joined: Thu Jun 10, 2010 11:43 am

Postby mon2 » Wed Oct 24, 2018 1:10 pm

This thread (no pun) should help:

viewtopic.php?t=4642
RedDave
Active Member
Posts: 44
Joined: Fri Oct 05, 2018 4:26 pm

Postby RedDave » Wed Oct 24, 2018 1:34 pm

That explains it.
Unfortunately, Task Viewer won't run on rgmii_ethernet_mac.xc. I assume this is because there are multiple par blocks inside if statements.

I see that I can use 10/100 Mb/s real-time Ethernet MAC on 4 cores rather than 10/100/1000 Mb/s real-time Ethernet MAC on 8. If (when) I run out of cores, I will investigate that.

Thanks for your help.
RedDave
Active Member
Posts: 44
Joined: Fri Oct 05, 2018 4:26 pm

Postby RedDave » Wed Oct 24, 2018 1:37 pm

If anyone has an example code for 10/100 Mb/s real-time on eXplorerKit that would be helpful.
User avatar
infiniteimprobability
XCore Legend
Posts: 1120
Joined: Thu May 27, 2010 10:08 am

Postby infiniteimprobability » Wed Oct 24, 2018 3:29 pm

I'm pretty sure the AR8035 PHY PCS only supports RGMII (which requires the 1G component), whereas the Xmos 100M lib_ethernet version expects MII.

I think you'll need a change of HW to use the more compact MII/100M lib - sorry!
RedDave
Active Member
Posts: 44
Joined: Fri Oct 05, 2018 4:26 pm

Postby RedDave » Wed Oct 24, 2018 4:36 pm

We aren't committed to hardware yet, so that is good to know.
Thanks for the advice.

Who is online

Users browsing this forum: No registered users and 0 guests