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.

TMS320F28075: RAM Builds: Incorrect .text loaded to RAM GS1 from Code Composer Studio (CCS)

Part Number: TMS320F28075

Hi, 

Our team likes using RAM builds for our development since the programming cycle time is much faster than Flash Builds.

Unfortunately, I'm seeing an issue where the contents in RAM do not match the op-codes that I see when I disassemble the .out file.

For example:

In this example, I have RAMGS1 (Address 0xD000) configured as a .text sector in my linker.

   .text            : >> RAMGS1_3 | RAMGS4_7 | RAMLS4 | RAMLS5 | RAMD0_1, PAGE = 0, ALIGN(8)

The odd thing is that the code that is placed at 0xd000 and 0xd001 seems to be the same even if I change the ordering of the sectors in the .text ram linker and shuffle where functions live in RAM.  I have verified that the RAM contents are corrupted on Program Load before the program runs to main().  I.e. at _c_int00

Does CCS perform an optimization when loading the .out file to RAM?  What could cause the dis2000 output to not match what I see in CCS?

-Colin

  • Colin,

    The dis-assmbly from the .out should match what you see when you look at code loaded to the device through the JTAG. 

    Can you make sure that you have run to main before looking at the dis-assembly above? 

    As part of the C Init there are some instructions that effect how the C28x core interprets certain op-codes(for backward compatibility) and if we look at the dis-assembly before this is executed it might explain the difference.

    Best,

    Matthew

  • Hi Matthew,

    Thanks for the quick response.  I've tried that and the results are the same.  Thats actually how I identified the issue initially as the system wasn't executing functions that enabled my ISRs.

    Do you have any suggestions on what else I can try?  Is there any way to add additionally logging to see what the emulator is loading to flash? 


    -Colin  

  • Colin,

    When you load the code via CCS are you using the debug button to launch/load/etc the active project or are you connecting to the target manually and then using Run->Load->Load Program and then select the .out file?

    If you open the memory browser to the same location(0xD000) do the contents match what you see in the 2nd column in the dis-assembly window?

    Assuming this is a yes, if you refresh the memory window do you see the contents change?

    Best,
    Matthew

  • I have used both the debug button and the "Run->Load->Select Program To Load->*.out" procedures.  I am using CCS 11.2.0.00007 and CDT 21.6.0.

    The memory browser and the dis-assembly both show the same op code contents. The screen shot below shows the dis-assembly and memory contents after a refresh as well as the dissassembly of the .out file.  (This was taken with the debug button... but is no change with the load option)

  • Colin,

    Thanks for doing this, I don't use the dis-assembler that much, but once the .out is built nothing about the code load to the device should change the contents.

    Could you attach the .map file that is generated when you build the project, this will help me see what memory regions are in play, and if there is any adjacent memory usage.  If there was a memory over-run issue the linker shouldn't have continued, what we are seeing usually happens if there is stack over-run, or pointers that over-run/over-write memory.  Since this at code load, before main, that shouldn't be the case.

    Could you open up the registers tab and find the SP(stack pointer under core registers) and let me know what that reads when you read the memory?

    Best,

    Matthew

  • HI Matthew,

    I'm having a hard time uploading the map file in the E2E forum.  Is there another tool that I can use to share it?  In the interim, here is the sections output:

    ******************************************************************************
                 TMS320C2000 Linker Unix v21.6.0                   
    ******************************************************************************
    >> Linked Wed Jun  8 15:20:56 2022
    
    OUTPUT FILE NAME:   <tahoe_500-0120_rev002_RAM.out>
    ENTRY POINT SYMBOL: "_c_int00"  address: 00013c25
    
    
    MEMORY CONFIGURATION
    
             name            origin    length      used     unused   attr    fill
    ----------------------  --------  ---------  --------  --------  ----  --------
    PAGE 0:
      RAMLS3                00009800   00000800  000005ca  00000236  RWIX
      RAMLS4                0000a000   00000800  000000bc  00000744  RWIX
      RAMLS5                0000a800   00000800  00000000  00000800  RWIX
      RAMD0_1               0000b000   00001000  00000e1f  000001e1  RWIX
      RAMGS1_3              0000d000   00003000  00003000  00000000  RWIX
      RAMGS4_7              00010000   00003ff8  00003ff8  00000000  RWIX
      FLASHJ                000b0000   00008000  00001712  000068ee  RWIX
      RESET                 003fffc0   00000002  00000000  00000002  RWIX
    
    PAGE 1:
      BOOT_RSVD             00000002   00000121  00000000  00000121  RWIX
      RAMM0_1               00000124   000006d4  000006d4  00000000  RWIX
      RAMM1_RSVD            000007f8   00000008  00000000  00000008  RWIX
      ADCARESULT            00000b00   00000018  00000000  00000018  RWIX
      ADCBRESULT            00000b20   00000018  00000000  00000018  RWIX
      ADCDRESULT            00000b60   00000018  00000000  00000018  RWIX
      CPUTIMER0             00000c00   00000008  00000000  00000008  RWIX
      CPUTIMER1             00000c08   00000008  00000000  00000008  RWIX
      CPUTIMER2             00000c10   00000008  00000000  00000008  RWIX
      PIECTRL               00000ce0   0000001a  0000001a  00000000  RWIX
      PIEVECTTABLE          00000d00   00000200  00000000  00000200  RWIX
      DMA                   00001000   00000200  00000000  00000200  RWIX
      CLA1                  00001400   00000080  00000000  00000080  RWIX
      CLA1_MSGRAMLOW        00001480   00000080  00000000  00000080  RWIX
      CLA1_MSGRAMHIGH       00001500   00000080  00000000  00000080  RWIX
      CLB1LOGICCFG          00003000   00000052  00000000  00000052  RWIX
      CLB1LOGICCTRL         00003100   00000040  00000000  00000040  RWIX
      CLB1DATAEXCH          00003200   00000200  00000000  00000200  RWIX
      CLB2LOGICCFG          00003400   00000052  00000000  00000052  RWIX
      CLB2LOGICCTRL         00003500   00000040  00000000  00000040  RWIX
      CLB2DATAEXCH          00003600   00000200  00000000  00000200  RWIX
      CLB3LOGICCFG          00003800   00000052  00000000  00000052  RWIX
      CLB3LOGICCTRL         00003900   00000040  00000000  00000040  RWIX
      CLB3DATAEXCH          00003a00   00000200  00000000  00000200  RWIX
      CLB4LOGICCFG          00003c00   00000052  00000000  00000052  RWIX
      CLB4LOGICCTRL         00003d00   00000040  00000000  00000040  RWIX
      CLB4DATAEXCH          00003e00   00000200  00000000  00000200  RWIX
      EPWM1                 00004000   00000100  00000000  00000100  RWIX
      EPWM2                 00004100   00000100  00000000  00000100  RWIX
      EPWM3                 00004200   00000100  00000000  00000100  RWIX
      EPWM4                 00004300   00000100  00000000  00000100  RWIX
      EPWM5                 00004400   00000100  00000000  00000100  RWIX
      EPWM6                 00004500   00000100  00000000  00000100  RWIX
      EPWM7                 00004600   00000100  00000000  00000100  RWIX
      EPWM8                 00004700   00000100  00000000  00000100  RWIX
      EPWM9                 00004800   00000100  00000000  00000100  RWIX
      EPWM10                00004900   00000100  00000000  00000100  RWIX
      EPWM11                00004a00   00000100  00000000  00000100  RWIX
      EPWM12                00004b00   00000100  00000000  00000100  RWIX
      ECAP1                 00005000   00000020  00000000  00000020  RWIX
      ECAP2                 00005020   00000020  00000000  00000020  RWIX
      ECAP3                 00005040   00000020  00000000  00000020  RWIX
      ECAP4                 00005060   00000020  00000000  00000020  RWIX
      ECAP5                 00005080   00000020  00000000  00000020  RWIX
      ECAP6                 000050a0   00000020  00000000  00000020  RWIX
      EQEP1                 00005100   00000022  00000000  00000022  RWIX
      EQEP2                 00005140   00000022  00000000  00000022  RWIX
      EQEP3                 00005180   00000022  00000000  00000022  RWIX
      DACA                  00005c00   00000008  00000000  00000008  RWIX
      DACB                  00005c10   00000008  00000000  00000008  RWIX
      DACC                  00005c20   00000008  00000000  00000008  RWIX
      CMPSS1                00005c80   00000020  00000000  00000020  RWIX
      CMPSS2                00005ca0   00000020  00000000  00000020  RWIX
      CMPSS3                00005cc0   00000020  00000000  00000020  RWIX
      CMPSS4                00005ce0   00000020  00000000  00000020  RWIX
      CMPSS5                00005d00   00000020  00000000  00000020  RWIX
      CMPSS6                00005d20   00000020  00000000  00000020  RWIX
      CMPSS7                00005d40   00000020  00000000  00000020  RWIX
      CMPSS8                00005d60   00000020  00000000  00000020  RWIX
      SDFM1                 00005e00   00000080  00000000  00000080  RWIX
      SDFM2                 00005e80   00000080  00000000  00000080  RWIX
      MCBSPA                00006000   00000024  00000000  00000024  RWIX
      MCBSPB                00006040   00000024  00000000  00000024  RWIX
      SPIA                  00006100   00000010  00000000  00000010  RWIX
      SPIB                  00006110   00000010  00000000  00000010  RWIX
      SPIC                  00006120   00000010  00000000  00000010  RWIX
      WD                    00007000   0000002b  00000000  0000002b  RWIX
      NMIINTRUPT            00007060   00000007  00000000  00000007  RWIX
      XINT                  00007070   0000000b  00000000  0000000b  RWIX
      SCIA                  00007200   00000010  00000000  00000010  RWIX
      SCIB                  00007210   00000010  00000000  00000010  RWIX
      SCIC                  00007220   00000010  00000000  00000010  RWIX
      SCID                  00007230   00000010  00000000  00000010  RWIX
      I2CA                  00007300   00000022  00000000  00000022  RWIX
      I2CB                  00007340   00000022  00000000  00000022  RWIX
      ADCA                  00007400   00000080  00000000  00000080  RWIX
      ADCB                  00007480   00000080  00000000  00000080  RWIX
      ADCD                  00007580   00000080  00000000  00000080  RWIX
      INPUTXBAR             00007900   00000020  00000000  00000020  RWIX
      XBAR                  00007920   00000020  00000000  00000020  RWIX
      SYNCSOC               00007940   00000006  00000000  00000006  RWIX
      DMACLASRCSEL          00007980   0000001a  00000000  0000001a  RWIX
      EPWMXBAR              00007a00   00000040  00000000  00000040  RWIX
      CLBXBAR               00007a40   00000040  00000000  00000040  RWIX
      OUTPUTXBAR            00007a80   00000040  00000000  00000040  RWIX
      GPIOCTRL              00007c00   00000180  00000000  00000180  RWIX
      GPIODATA              00007f00   00000030  00000030  00000000  RWIX
      RAMLS0                00008000   00000800  00000800  00000000  RWIX
      RAMLS1                00008800   00000800  000003e8  00000418  RWIX
      RAMLS2                00009000   00000800  000000ea  00000716  RWIX
      RAMGS0                0000c000   00001000  00001000  00000000  RWIX
      RAMGS7_RSVD           00013ff8   00000008  00000000  00000008  RWIX
      EMIF1                 00047000   00000070  00000000  00000070  RWIX
      CANA                  00048000   00000200  00000000  00000200  RWIX
      CANB                  0004a000   00000200  00000000  00000200  RWIX
      DEVCFG                0005d000   0000012e  00000000  0000012e  RWIX
      ANALOGSUBSYS          0005d180   00000048  00000000  00000048  RWIX
      CLKCFG                0005d200   00000032  00000000  00000032  RWIX
      CPUSYS                0005d300   00000082  00000000  00000082  RWIX
      ROMPREFETCH           0005e608   00000002  00000000  00000002  RWIX
      DCSMZ1                0005f000   00000023  00000000  00000023  RWIX
      DCSMZ2                0005f040   00000023  00000000  00000023  RWIX
      DCSMCOMMON            0005f070   00000008  00000000  00000008  RWIX
      MEMCFG                0005f400   00000080  00000000  00000080  RWIX
      EMIF1CONFIG           0005f480   00000020  00000000  00000020  RWIX
      ACCESSPROTECTION      0005f4c0   00000040  00000000  00000040  RWIX
      MEMORYERROR           0005f500   00000040  00000000  00000040  RWIX
      ROMWAITSTATE          0005f540   00000002  00000000  00000002  RWIX
      FLASH0CTRL            0005f800   00000182  00000000  00000182  RWIX
      FLASH0ECC             0005fb00   00000028  00000000  00000028  RWIX
      BL_JUMP_TABLE         00085df8   00000008  00000006  00000002  RWIX
      APP_JUMP_TABLE        00086000   00000008  00000000  00000008  RWIX

  • Also, I will grab the SP when I am near hardware later today.

    Thank you for your help.  This problem is one that is confusing me :) 

  • Colin,

    I'm going to send you a friend request via the E2E, this has a bit more flex on attachments.  You should get a message shortly.

    Best,

    Matthew

  • Hi Colin,

    In your linker command file, if you have contents mapped to both flash and RAM memories, please note that the load of the RAM content is not guaranteed.

    Flash plugin is developed for fully embedded flash applications.  Meaning, all of the initialized sections in linker command file should be mapped to flash.  If anything needs to be executed from RAM, that content should be copied to RAM at runtime using memcpy() before executing that content. 

    Please see below FAQ for more info on this:

    [FAQ] Flash - How to modify an application from RAM configuration to Flash configuration?: https://e2e.ti.com/support/microcontrollers/c2000/f/171/t/878674 

    Thanks and regards,
    Vamsi

  • Colin,

    Was about to reply with something similar to Vamsi, although I didn't have the background he has given(thanks Vamsi). To expand on what Vamsi said, the flash plugin itself is using some of the RAM to program the flash, likely clobbering the code that should be in RAM as it was loaded first.

    With that said, I was able to get the RAM image to be correct if I set the flash tools to load to RAM only(Tools->On Chip Flash).  So, for this case, perhaps you can load once as normal(which will program the flash) with Erase/Program selected in the below image, then go into the flash tool and pick RAM only.  Then load the .out again and the RAM will get loaded correctly.  The flash will still have its contents from the 1st load.

    As Vamsi mentioned the flash tool is designed more for the final image where you would have everything in flash and copy it later to RAM, etc.  But I think the above will help for your debug phase.

    Best,
    Matthew

  • Thank you and .

    Your explanation make sense and I appreciate the work around.

    To give context, our .text code size has grown to the point where we can't fit everything into RAM that we want.  And RAM builds significantly shorten the development cycle.  So I was trying to write some library based code into a Flash Sector (Essentially as a ROM Library) so that we could continue using the available RAM for code that we were actively developing.

    My approach to the ROM Library was going to be incredibly brittle.  (Essentially call out the sectors of the rts, nanopb, etc. that aren't changing in the linker file and put them in flash). However, since I have the experts on call, can you point me to some documentation about how to create a true ROM library that I could reliably link against across varying builds?  I'm thinking I would love to emulate how F2837xRevB_c1bootROM_CLADataROMSymbols_eabi_fpu32.lib provides the address of the symbols that are provided in flash.

    Thank you,

    -Colin

  • Ignore the ROM library question.  I found www.ti.com/.../spraan5.pdf