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.

Disassembly and listing do not match (Piccolo)

Hello,

I have a problem with the code generated for an assembler source file. The code listed in the listing file looks ok. Yet, the code as seen in the disassembly window does not look at all like my source code: for example, many instructions are replaced by TRAPs. The code that gets loaded and executed is the wrong one, I think, because the execution time is orders of magnitude larger than expected.

This happens too with assembly files that came from TI (for example DSP2802x_usDelay.asm) so I doubt it's an error in the source code.

There is no warning or error message; my code just gets replaced with junk and that's it. I have tried a few debug and optimization options to no avail.

Does anybody know what can be going on here?

 

Thank you!

  • This is an example of the code mismatch. This is a screen capture of the mixed source/asm window:

     

    (I have to use a screen capture because the accursed IDE does not support 'copy text' from the mixed view window).

    This is the listing file for the same source:

     

    <code>

      ....

          57                     .def _DSP28x_usDelay
          58 00000000              .sect "ramfuncs"
          59             
          60                      .global  __DSP28x_usDelay
          61 00000000       _DSP28x_usDelay:
          62 00000000 1901          SUB    ACC,#1
          63 00000001 56C3          BF     _DSP28x_usDelay,GEQ    ;; Loop if ACC >= 0
             00000002 FFFF
          64 00000003 0006          LRETR

    ....

    </code>

     

    As you can see, the listing matches the source, the disassembly does not. And the code that gets executed is the wrong one.

    Thanks!

     

  • Looks like I've solved the problem by randomly tweaking build options.

    Apparently I've done something that has fixed the problem, I'm not sure what. I've realized that I wasn't explicitly saving the project after changing build options...

    So, I'm now able to properly use assembly sources but the problem still remains that, under some circumstances, the compiler/assembler cripples your object code with no warning and the listing file does not reflect it.

     

    Thanks!

     

  • Jose,

    The delay function is in an assembly section called "ramfuncs".  In linker command files that have been setup to load programs in flash the ramfuncs will have both a load address as well as a run address.  This way the function can be copied from flash to ram so it can be executed at zero waitstate. 

    Is it possible your linker file has a load and run address for the ramfuncs section but the application function has not copied the section to its run address?  The C/C++ header files and peripheral examples documentation describes this procedure in the section that addresses how to modify examples to run from flash.

    -Lori

  • Hello,

     

    Yes, this is what was happening. The application was set up to run from flash, then I modified it to run from RAM and therefore commented out the functions that should have copied the code to RAM, but didn't properly adapt the linker command file. I should have realized... it looks obvious now you point it out :)

     

    Thank you very much!