xtcp_lwip core usage

Technical questions regarding the XTC tools and programming with XMOS.
Post Reply
User avatar
RedDave
Experienced Member
Posts: 77
Joined: Fri Oct 05, 2018 4:26 pm

xtcp_lwip core usage

Post by RedDave »

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: 1913
Joined: Thu Jun 10, 2010 11:43 am
Contact:

Post by mon2 »

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.
User avatar
RedDave
Experienced Member
Posts: 77
Joined: Fri Oct 05, 2018 4:26 pm

Post by RedDave »

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

Results are identical (i.e. as above).
User avatar
RedDave
Experienced Member
Posts: 77
Joined: Fri Oct 05, 2018 4:26 pm

Post by RedDave »

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: 1913
Joined: Thu Jun 10, 2010 11:43 am
Contact:

Post by mon2 »

This thread (no pun) should help:

http://www.xcore.com/viewtopic.php?t=4642
User avatar
RedDave
Experienced Member
Posts: 77
Joined: Fri Oct 05, 2018 4:26 pm

Post by RedDave »

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.
User avatar
RedDave
Experienced Member
Posts: 77
Joined: Fri Oct 05, 2018 4:26 pm

Post by RedDave »

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: 1126
Joined: Thu May 27, 2010 10:08 am
Contact:

Post by infiniteimprobability »

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!
User avatar
RedDave
Experienced Member
Posts: 77
Joined: Fri Oct 05, 2018 4:26 pm

Post by RedDave »

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