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.

NDK Memory Footprint

Hi,

  I have been using the NDK successfully on the C6474, however I am concerned about the memory footprint.  I link the different subsections into L2RAM, however the size of the FAR:PACKETMEM section from os.lib is ~330k, whereas in the user's guide it states it only requires 32k-48k

1) Is there an easy way to reduce this footprint, as I would prefer to keep it in L2RAM, but it is taking a large chunk of it.  Is there something I am setting incorrectly?

2) Do I need to recompile the NDK in order to reduce these buffer sizes.

         a) If so, I have all the source, but no project files.  Are the project files available?

 

I am using NDK 2.0.0 with CCSv4.1.3 and DSP/BIOS 5

 

Thanks,

Josh

  • Josh,

    Yes, this is compiled-in space for local packet buffers. From src/os/pbm.c:

    //
    // Local Packet Buffer Pool Definitions
    //

    // Number of buffers in PBM packet buffer free pool
    //
    // The number of buffers in the free pool can have a significant effect
    // on performance, especially in UDP packet loss. Increasing this number
    // will increase the size of the static packet pool use for both sending
    // and receiving packets.
    //
    // DM642 Users Note: The DM642 Ethernet driver assumes that its local
    // buffer allocation (EMAC_MAX_RX in dm642.c) plus PKT_NUM_FRAMEBUF
    // defined below is less than or equal to 256. The default value for
    // EMAC_MAX_RX in the DM642 Ethernet driver is 16.
    //
    #define PKT_NUM_FRAMEBUF    192

    // Max size buffer
    //
    // On L2 cached CPUs, this size must be cache-line multiple
    // The LogicIO Etherent (Macronix MAC) requires a larger buffer because
    // it transfers data in 16 byte chunks, and with its pre-pad and data
    // alignment, it will overflow a 1536 byte buffer.
    //
    // If the LogicIO/Maxcronix support is not required, this value can
    // be reduced to 1536.
    //
    #define PKT_SIZE_FRAMEBUF   1664

    //
    // Data space for packet buffers
    //
    #pragma DATA_ALIGN(pBufMem, 128);
    #pragma DATA_SECTION(pBufMem, ".far:NDK_PACKETMEM");
    static UINT8 pBufMem[PKT_NUM_FRAMEBUF*PKT_SIZE_FRAMEBUF];

    So, you can see that 319,488 bytes are set aside.

    It's not clear to me how much having these buffers in L2RAM will impact performance. You could put them in external memory and measure the performance difference. Unfortunately, we do not have benchmarks for all the various possible configurations and it may be highly application dependent, so you should probably try yourself.

    Since these are compiled buffers, the only option now to change the sizes is to rebuild the source file. NDK 2.01.00 includes build scripts (but they are NOT CCS projects), so you could use that to rebuild. You can get 2.01.00 here:

    http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/ndk/2_01_00/index_FDS.html

    In the future, we could make this "configurable" using the BIOS configuration tool so that you would not have to re-build the stack. Would that work for you?

    Mark

  • Certainly a more BIOS configurable group of settings for NDK parameters would be highly desirable in the future. 

    I had tried the NDK 2.1.0, but ran into a lot of issues getting it up and running, whereas the 2.0.0 just ran "out of the box", so that is what I have stuck with.  This is helpful though, thank you.

     

    Josh