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.

Code Size



How does one determine the compiled code size ... using Code Composer 4.0?

  • Hello,

    you can take a look at the .map file generated.  It is a good summary and near the bottom you will see actual code usage on the device.

    Best Regards,
    Lisa

  • It would be nice to allow the customer to determine if the answer is acceptable ... and it would be nice to allow a "maybe" choice.

    At the end of .map I see:

    00007be2   _nop
    0000fffe   _reset_vector
    ffffffff   .text

    I presume this means the code size is 31716 ... 31714 (0x7be2) plus two bytes for the reset vector ... correct?

  • Hi,

    ok, have a look at this utility as well.  And yes, the map file lays out usage per section for you with more detail perhaps than you are looking for.

    http://processors.wiki.ti.com/index.php/Code_Generation_Tools_XML_Processing_Scripts

    Best Regards,
    Lisa

  • I'm not interested in spending time for an in-depth analysis ... just need to know how large the MSP flash needs to be.

    At the end of .map I see:

    00007be2   _nop
    0000fffe   _reset_vector
    ffffffff   .text

    I presume this means the code size is 31716 ... 31714 (0x7be2) plus two bytes for the reset vector ... correct?

  • Hello

    The reason I sent you that link is that using secti.exe from the cg_xml package is the simplest way to measure code size.  You can do if from the map file but actually, your measurement makes assumptions, like no holes, start at address 0 etc.
    So give secti.exe a try.
    Best Regards,
    LIsa
  • It's surprising that Code Composer would not provide this info.  I don't like installing additional programs as it clutters my hard disk.

  •  

    The entries at the end of the map files are addresses of global symbols. The "Section Allocation Map" (more in the middle of the map file) is what you need to look at. This section will give you detail analysis of the code size in each seciton. Usually, the program is loaded in the .text section, so check the size of that out.  Also, when you load the program, the console output should tell you the size of the total program loaded.

    Raj

  • Thanks!  Also, interesting.  When the program is loaded it lists:"Code Size - Text: 14438 bytes".  However the Disassembly lists the last instruction at 0x7c76 (31862). 

    1) Will the code be compacted into 14438 bytes when compiled and not running in a debug mode?

    2) Will debugging be a problem when the MSP has only 16KB?

  • Hi,

    regarding your questions I hope the following helps

    1) the code size depends on the amount of code and your settings (eg optimization settings etc).   There is not code size guarantee and CCS does not compact code to fit a specific size.

    2) Your code needs to fit onto your msp and you need the correct license and then you are all set to debug

    Best Regards,

    Lisa

  • That does not answer the questions.  I'd like an answer to the specific numbers I provided.

  • Hello,

    as mentioned in a previous post, the code size and memory address do not necessarily have to do with each other as the start address may not be 0 and there may be holes.  This is why it is good to look at the details of how the memory and code is allocated.  However, as my colleague pointed out there is also the summary showing the code size in the map file.

    Then it is a matter of the code fitting onto your msp.

    Hope this is more helpful.

    Best Regards,
    Lisa

  • This does not answer the questions.

  • You have to look at the start address of the flash as well.

    Are you compiling/linking for a 64KB device at the moment?  This would give you a flash start address of 0x4400.  So, the # of bytes in your .text section would be your end address - the start address (0x7c78 - 0x4400 = 0x3878 [14456 bytes]).
    This is very close to what you stated, you might have another small section like below in front of .text.

    However, to get the flash usage number, you have to add the following sections: .text, .const, and .cinit.  The 'FLASH' line in the map file will give you the total.

    Below is a very simple program case for a 64KB device, but shows pertinent lines from a .map file.  The total flash used, 0xee, is equal to .text* + .const + .cinit.

    MEMORY CONFIGURATION

             name            origin    length      used     unused   attr    fill
    ----------------------  --------  ---------  --------  --------  ----  --------
    FLASH                 00004400   0000bb80  000000ee  0000ba92  RWIX
    [SNIP]
    .text:_isr
    *          0    00004400    0000001a    
                      00004400    0000001a     rts430x_lc_sd_eabi.lib : boot.obj (.text:_isr:_c_int00_noexit)

    .text      0    0000441a    000000be    
                      0000441a    0000006e     rts430x_lc_sd_eabi.lib : autoinit.obj (.text:_auto_init)
                      00004488    00000038                            : copy_zero_init.obj (.text:decompress:ZI:__TI_zero_init)
                      000044c0    00000010     main.obj (.text:main)
                      000044d0    00000004     rts430x_lc_sd_eabi.lib : pre_init.obj (.text:_system_pre_init)
                      000044d4    00000004                            : exit.obj (.text:abort)

    .const     0    000044d8    00000004    
                      000044d8    00000004     main.obj (.const)

    .cinit     0    000044dc    00000012    
                      000044dc    00000006     (.cinit..bss.load) [load image, compression = zero_init]
                      000044e2    00000004     (__TI_handler_table)
                      000044e6    00000008     (__TI_cinit_table)


    When you compile/link for a 16KB device, the start address will be shifted accordingly.

     

  • Thanks for the clear explanation ... a detail I should have caught a long time ago.