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.

Complete Assembly Listing of C file?

I am using CCS4 version 4.1.2.00027 on a Windows XP machine.

I do not have an emulator or a target board.

I have a simple 5509A project written in C, with the "Release" active build configuration selected.

I have selected the option "Keep the generated assembly language (.asm) file (--keep_asm, -k)"

I build the active project, and the .asm file is generated.  I open this file to see how my C source code is compiled to assembly.  Where is my C source code?

It appears that NONE of my C source comments are in the assembly.  NONE of the original C source code is in the assembly.

When I have a function call like this...
  mcbsp_init();

I can fine a line of assembly like this...
  CALL #_mcbsp_init ; |551|

That's barely useful.  But if I have a line lie this...
  GPIO_pinWrite(AGPIO_PIN7, (GPIO_pinRead(AGPIO_PIN3)));

There is NOTHING in the assembly that clues me in to what code was generated from that line.  Stop.  Do not pick apart that line of code.  That is not what is important here.  What is important is that I cannot find the assembly generated from that line.

At first I thought the line number of the C source was included with the assembly; but, that is not true.  In the example above mcbsp_init() is on line 35, not 551.

I am aware of the Disassembly view in the Debug perspective.  However, remember I do not have an emulator or a target board.

How do I see the assembly generated from my C code?

 

  • Hi Audi,

    the assembly file doesn't include any C code; what you need is a list file.

    Click at PROJECT->ASSEMBLER OPTIONS and enable 'Generate Listing File'. The .lst file can be found in the DEBUG folder of your project.

    Rgds
    aBUGSworstnightmare

     

  • That does not appear to produce any new information.

    It just formats the .asm file (e.g. adds pagination, page headers, line numbers, etc.) to make a pretty print-out.

     

  • I notice that Mr Nightmare's screenshot shows a menu above the listing-file checkbox on which the --c_src_interlist option has been chosen.  Do you have that as well?

    For source or compiler comments to appear in the asm file, you need either -s (or the nearly-equivalent -os) or -ss.  The -s option includes the optimiser comments, showing an approximation to source code that reflects how the compiler has manipulated your code.  The -ss option includes quotes from the original source file.

    The -ss comments are easy to recognise as source, but it may be hard to relate heavily-optimised asm to those statements.  The -s comments are easier to associate with the asm, but harder to recognise as parts of your program.

     

  • I did not have a selection in that drop-down box.  Thank you for drawing that to my attention.

    I generated .asm files both ways -- the results are just brutal.  I don't see how either of those outputs are going to help me write better code.

    But, I did get the answer to my question.  Thank you both.

    - Audi

     

  • I have not seen your output but wanted to chime in that in
    my experience with several IDEs, it is almost impossible to
    connect the assembly-languge statements of a HEAVILY
    OPTIMIZED compiler output back to the HLL source, even when
    doing it by hand.

    Your luck might improve it you turn your optimizer down to
    the lowest level and try again.

  • If anyone else stumbles across this old thread trying to get a decent list output from CCS then it can now be done in CCS5.2.1 as shown below:

    Project properties -> build -> MSP430 compiler -> Advanced options -> assembler options:

    tick generate listing file

    tick keep local symbols

    drop down source interlist -> generate C source interlisted asm file.