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.

MSP430 Flash memory requirement versus msp430-txt file size

Greetings,

I am new to MSP430. I have a code which I need to run on MSP430. When I built the code in IAR with output file format as msp430-txt, the size of the resultant file is 99 KB.

Is the msp430-txt file written directly to the flash?

Does this mean that I will have to choose a MSP430 chip having flash memory in access of 99 Kb (128 KB available)?

 

Thanks,

Amitkumar Solanki

(www.einfochips.com)

  • Amit,

    This is not true. The TXT file size is reflecting towards the size of ASCII data that is stored in Windows format. Data is stored as a binary inside the MSP430 hence this ASCII HEX is converted into Binary before it is programmed.

    To get the true flash size, you can generate a MAP file inside your IAR project. This map file contains all the necessary information in terms of Flash and RAM usage.

    Regards,

    William

  • Hello William,

    Thank you for your reply.

    William Goh said:

    To get the true flash size, you can generate a MAP file inside your IAR project. This map file contains all the necessary information in terms of Flash and RAM usage.

     

    Following is the summary of my MAP file:

    -----------------------------------------------

     END OF CROSS REFERENCE

    ----------------------------------------------

    27 458 bytes of CODE memory

    2 927 bytes of DATA memory (+ 103 absolute )

    5 556 bytes of CONST memory

     

    I understand that CODE and CONST memory are part of  flash memory and DATA memory is part of RAM.

    So I would require a flash of minimum (27,458 + 5,556)  = 33,014 Bytes and RAM of minimum 2927 Bytes.

    Can you please correct me if I am wrong?

     

    Thanks,

    Amit

  • This might be a miscalculation. If the 2927 bytes of DATA memory are initialized data, the inital values for this data is also stored in FLASH and copied to RAM on startup. Some more bytes might add if the data contains misaligned byte variables, so padding bytes are added (this might be the '103 absolute' value). But depending on the reporting tool, this might be already included in the CONST section.

    Also, the ram requirement by the DATA section does not contain any ram required for
    - stack
    - local variables (further increasing stack requirements)
    - dynamically allocated memory

    Roughly, the required flash memory for a txt file of a given size is 1/3 of the file size, because the binary bytes to be stored on flash are written as 2 digit HEX value plus a separating space in the txt file (plus some line breaks and position information)

  • In IAR, go to Project:Options, Linker, then List tab.

    Check "Generate linker listing", I also like to check HTML and "Module Summary".

    Output will be in the project's Output directory.

     

    Anyone know how to do this in Code Composer?

    --Derek

  • Do generate a map file in code composer, go to project properties, the C/C++ Buils, then under the tool setting tab, select Linker Output.

    There will be a filed labeled "Produce listing of input and output sections in <file> (-map_file). Just enter in the name you want for your map file.

    When you compile, the file will show up in the Debug folder.

     

     

  • Thank you Gross for your reply.

     

    I understand that a chip with 96 KB flash and 6 KB RAM will be enough for my application, even if my code size increase.

     

    Thanks,

    Amit

**Attention** This is a public forum