This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MCU-PLUS-SDK-AM243X: Lwip stack code/data size

Part Number: MCU-PLUS-SDK-AM243X
Other Parts Discussed in Thread: DP83869, AM2432

Hi,

we are looking at the example enet_lwip_cpsw_am243x-evm_r5fss0-0_freertos_ti-arm-clang in the MCU+ SDK to determine code/data size for the Lwip TCP/IP stack.

Looking at the .map file (attached) we see roughly the following:

 

size

 

.text

718,768

 

.rodata

141,632

Rom: 860,400   

.data

50,176

 

.bss

400,896

 

.bss:ENET_DMA_DESC_MEMPOOL

28,672

 

.bss:ENET_DMA_RING_MEMPOOL

16,384

 

.bss:ENET_DMA_PKT_MEMPOOL

172,032

 

.bss:ENET_DMA_OBJ_MEMPOOL

11,788

 

.bss:ENET_DMA_PKT_INFO_MEMPOOL

0

 

.bss:ENET_ICSSG_OCMC_MEM

0

Ram: 679,948

enet_lwip_cpsw.Debug.map

 

Q1) Can we consider the size of Rom and Ram in table is the footprint of Lwip stack? It may include the size of code and data for application as well.

Q2) Can we reduce the size of .bss:ENET_DMA_*? What is the minimum size for those?

 

Overall we are looking for opportunities to reduce code/data size for the network TCP/IP stack. Have you analyzed this and have maybe already suggestions on where things can be reduced?

Thanks!

--Gunter

  • Hi Gunter,

    Q1: Yes. the footprint of the Lwip is the code (ROM) size + data (RAM) size.

    Q2:There is an effort in progress to significantly reduce the footprint of the Lwip stack ( from 1.4MB to a few hundred KB).

    Best regards,

    Ming

  • Hi Ming,

    Can you share the footprint information for the current version of Enet (ICSS) only, without Lwip?

    Regards,

    Moonil

  • Hi Moonil,

    It is in the map file you attached. It is ~750KB (code, ro data and r/w data):

    C:/ti/mcu_plus_sdk_am243x_08_02_00_12/source/networking/enet/lib/enet-lwip.am243x.r5f.ti-arm-clang.debug.lib
    enet_app_memutils_cfg.obj 12 96 225152
    enet_soc.obj 6000 48657 22908
    cpsw_ale.obj 44728 1462 1
    enet_mcm.obj 9380 2076 26817
    icssg.obj 31068 5037 29
    lwip2enet.obj 6552 572 24061
    enet_udma_priv.obj 14124 1228 11857
    cpsw.obj 20988 4195 29
    icssg_utils.obj 20476 2232 345
    csl_cpsw.obj 21180 0 0
    enet_rm.obj 14432 2622 1
    enet_udma.obj 14060 2670 1
    enetphy.obj 12204 2063 614
    cpsw_macport.obj 11984 1430 1
    enet_appmemutils.obj 4900 1633 5621
    cpsw_cpts.obj 8860 1773 1
    enet_apputils.obj 1404 8487 1
    enet.obj 6740 1612 1
    csl_cpsw_ale_9g_tblcfg.obj 7552 0 0
    csl_cpsw_ale_4g_tblcfg.obj 7348 0 0
    enet_udmautils.obj 3692 715 2541
    lwip2lwipif.obj 1652 325 4097
    dp83869.obj 4156 1283 40
    dp83867.obj 4140 1283 40
    enet_osal_dflt.obj 1956 233 2960
    enet_phymdio_dflt.obj 3972 841 24
    cpsw_stats.obj 4004 830 1
    cpsw_hostport.obj 3960 659 1
    mdio.obj 3788 686 1
    icssg_timesync.obj 3116 978 1
    enet_osal.obj 2852 1061 61
    csl_cpts.obj 3496 0 0
    lwipifcb.obj 2560 593 97
    vsc8514.obj 2140 626 41
    enet_queue.obj 1796 519 1
    enet_board_cfg.obj 1416 853 1
    enet_utils.obj 1428 266 217
    enet_apputils_k3.obj 1480 369 1
    enet_hostport.obj 1372 319 1
    enet_ioctlutils.obj 1124 487 1
    icssg_stats.obj 1248 53 272
    dp83822.obj 1084 414 40
    k3_soc.obj 1216 237 0
    csl_cpgmac_sl.obj 1448 0 0
    pbufQ.obj 892 144 396
    csl_mdio.obj 1352 0 0
    generic_phy.obj 828 165 40
    csl_cpsw_ss.obj 600 0 0
    enet_apprmcfg.obj 248 272 72
    enet_appsoc.obj 328 209 1
    enet_app_cpsw_cfg.obj 496 31 4
    default_netif.obj 104 0 144
    enet_utils_dflt.obj 228 3 0
    enet_trace.obj 88 0 1
    +--+--------------------------------------+--------+---------+---------+
    Total: 328252 102299 328537

    Best regards,

    Ming

  • Hi Ming,

    Thank you for your prompt response. the reason why ask this is we are also considering another Ethernet/IP solution using Cesium Net(TCP/IP stack). So, first, we need to know how to port Cesium Net to our product (using AM2432). In my understanding, TCP/IP stack must run on top of Enet driver ICSS but not CPSW for Ethernet/IP. Is it correct?

    If a new TCP/IP stack porting to Enet driver is required, could you please share a porting guide and any references?

    Regards

    Moonil

     

  • Hi Moonil,

    The TCP/IP stack porting guide and references  is another topic. Can you close this thread and start another thread, so that we can find the right expert to help you. Thanks!

    Ming

  • Hi Ming,

    yes, I created another thread for porting.

    I was asking about the size of Enet driver ICSS. Can we consider the size ~750K is including both ICSS and CPSW?

    Regards

    Moonil

  • Hi Moonil,

    Yes. You are correct. The 750KB includes both ICSS and CPSW.

    To take out the CPSW related stuffs, you can substract the footprint for cpsw_* and csl_cpsw_*

    cpsw_ale.obj 44728 1462 1
    cpsw.obj 20988 4195 29
    cpsw_macport.obj 11984 1430 1
    cpsw_cpts.obj 8860 1773 1
    csl_cpsw_ale_9g_tblcfg.obj 7552 0 0
    csl_cpsw_ale_4g_tblcfg.obj 7348 0 0
    cpsw_stats.obj 4004 830 1
    csl_cpsw_ss.obj 600 0 0
    enet_app_cpsw_cfg.obj 496 31 4

    It is ~100KB. The total size for ENET for ICSS is about 650KB. Please notice that the MAP file is debug version, so the code size may reduce more for the release version.

    Best regards,

    Ming

  • Hi Ming

    Q2:There is an effort in progress to significantly reduce the footprint of the Lwip stack ( from 1.4MB to a few hundred KB).

    Can you let us know the estimated target size roughly and the release date for the stack?

    It would be very helpful for our decision if you or your team share the estimated size and timeline.

    Regards,

    Moonil

  • Hi Moonil, 

    I do not know the exactly KB numbers, since it is still in progress.

    Best regards,

    Ming 

  • Hi Moonil,

    Please find details about memory optimization plan from our SW team.

    1. Current footprint -

    2. Optimization plan (tentative). Our target is to get to 200KB by end of optimization exercise (also added below). 

    Target Summary ICSSG (excluding packet buffers)

    • 100M + MAC profile: ~200 KB
    • 100M + MAC + Switch profile: ~240 KB
    • Switch + Gigabit profile: ~336 KB
    • TSN profile: TBD

    Target Summary CPSW

    • 100M + MAC profile: ~158 KB
    • Switch + Gigabit profile: ~ 158 KB
    • TSN profile: TBD

    The SDK8.2 which we are release few days from now will have some optimizations.

  • Hi Prasad,

    Thank you for sharing the details. I have to know the total targeting size required for using TCP/IP. So, let me ask again to clarify the figures.

    Our target is to get to 200KB by end of optimization exercise

    Q1) I can see 1.4M in the first table which is including Enet LLD, Free RTOS, other Driver, and Lwip. Could you clarify again which module will be optimized to 200K? Do you mean Lwip(442KB) will be 200KB?

    Target Summary ICSSG (excluding packet buffers)

    Q2) Can you share the estimated packet buffer size as well?

    FYI, when I checked the example code in SDK, I found ICSS switch mode is supporting only one Enet Mac Port. But, according to SDK document, it should support 2 ports(ENET_MAC_PORT1, ENET_MAC_PORT2). Does it not support two ports yet? If you need to know more detail, just let me know. I will create another thread on this.

    Regards,

    Moonil

  • Hi Moonil,

    My responses below -

    Q1) I can see 1.4M in the first table which is including Enet LLD, Free RTOS, other Driver, and Lwip. Could you clarify again which module will be optimized to 200K? Do you mean Lwip(442KB) will be 200KB?

    Yes, plan is optimize driver and lwip config to get to 200KB. We are in process of publishing more detailed optimization plan which should have more granular details. We will publish plan by end of this month.

    FYI, when I checked the example code in SDK, I found ICSS switch mode is supporting only one Enet Mac Port. But, according to SDK document, it should support 2 ports(ENET_MAC_PORT1, ENET_MAC_PORT2). Does it not support two ports yet? If you need to know more detail, just let me know. I will create another thread on this.

    Will you be using CPSW or ICSSG in your application? Switch mode example of ICSSG does support two ports (link to documentation below). Can you please point me to example where you see only single port?

    AM243x MCU+ SDK: Enet VLAN ICSSG Example (ti.com)

    Regards,

    Prasad

  • Hi Prasad,

    Thank you for your prompt response. 

    Yes, plan is optimize driver and lwip config to get to 200KB.

    It means Driver (200KB) +  Lwip(442KB) will be optimized to 200KB. As a result, around 642KB will be reduced to 200KB. Is it correct?

    Can you please point me to example where you see only single port?

    The example is "examples\networking\lwip\enet_lwip_icssg\am243x-evm". In this example, EMAC Mode is "DUAL MAC" by default.

    I tried to change it to SWITCH Mode in the example code as below. FYI, when I changed EMAC Mode to SWITCH in syscfg, it didn't change any generated code in my compiliation.

    void EnetApp_getEnetInstInfo(Enet_Type *enetType,
                                 uint32_t *instId,
                                 Enet_MacPort macPortList[],
                                 uint8_t *numMacPorts)
    {
        *enetType = ENET_ICSSG_SWITCH;
        *instId   = 1;
        *numMacPorts = 2;
        macPortList[0] = ENET_MAC_PORT_1;
        macPortList[1] = ENET_MAC_PORT_2;
    }

    Please see the code below, Here, assert happened. "source\networking\enet\core\lwipif\src\v1\lwipifcb.c” in SDK.

    Could you reproduce this at your end with enet_lwip_icssg using EMAC Mode = SWITCH?

    Regards,

    Moonil

  • It means Driver (200KB) +  Lwip(442KB) will be optimized to 200KB. As a result, around 642KB will be reduced to 200KB. Is it correct?

    Yes, that's the plan.

    Regarding you

    I tried to change it to SWITCH Mode in the example code as below. FYI, when I changed EMAC Mode to SWITCH in syscfg, it didn't change any generated code in my compiliation.

    Can you please kindly post this as new thread? I will assign it to our ICSSG expert so he can help with switch mode config.

    Regards,

    Prasad

  • Thanks, Moonil! 

    I will close this thread as query regarding memory footprint is answered. 

  • Hi Prasad,

    I got the map file of "hsr_prp_demo" on the memory footprint via email from your team(through Gunter). it still seem big size as below, 

    ICSS_PKT_BUF_MEM

    00010000

    65,536

    64KB buffer

    .bss

    000585c0

    361,920

    230K = 360K – 130K (task stack)

    .data

    00000c10

    3,088

     

    .text

    00033600

    210,432

     

    .rodata

    00011500

    70,912

     

    and also it seems not the map file generated by example in 08.02.00.12 we have. I guess this is for the example in another latest version you have like 08.02.00.28.

    Can you clarify this size? and is this final footprint for your memory optimization work?

    Could you let me know the web url of SDK 08.02.00.28 to download?

    And also, please share your plan for memory optimization if it is not the final one.

    Regards,

    Moonil

  • Hi Moonil,

    I will close this thread as the queries related to Enet LwIP memory footprint are answered.

    Can you please create a new thread for HSR/PRP memory size? I will assign it to our industrial protocols expert.

    Regards,

    Prasad

  • Hi Prasad,

    Thank you for your support. This thread can be closed.

    I created a new thread for "Memory footprint of Lwip and ICSS_EMAC driver" as below link. 

    https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1088424/am2432-memory-footprint-of-lwip-and-icss_emac-driver

    Regards,

    Moonil