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.

tms470 ram debug

Other Parts Discussed in Thread: TMS470R1A256

Hi

I have a tms470r1a256 board successfully connected  to CCS3.2  using xds510.I have  a simple project ready with memory  remapped to entire RAM section  in the  linker cmd file.

ram sections relocated map:-

RAM  is  0x10000 t0 102FFF (12K)

HET>is 0x80000 to 0x8003FF (1K)

I have successfully built the program and checked the map file.

I would like to debug the code in RAM using GEL file.Could you please provide me a  GEL file (for above r1a256 map) and how to load the program in RAM & use the GEL file(menu step to be executed)?

nands7

 

 

  • Nandu,

    The tms470r1a256 is an obsolete device, and we do not recommend using it for a new development.


    Never the less, I'm working on a solution to your problem.
    I will be back to you shortly.

    Regards,

    Jean-Marc

     

  • Nandu,

     

    To be able to execute code from RAM, it is necessary to remap the RAM to 0x0000_0000.

    ARM7 CPU fetches all exception from 0x0000_0000. So in your linker command file, you have to map your full project to 0x0000_0000.

    I assume that you are not using the flash at all.
    On your device (tms470r1a256), you have 12K of internal RAM. The remapping is possible via the Address Manager (part of system module 5001.F5AB5EC0d01.pdf).
    The RAM is selected via the CS2 and CS3. The address manager is able to define the base address, and the size for each Chip Select.
    The size has to be a power of 2, so in your case, you will have to use 2 CS (CS2 and CS3) to define your 12K.

    CS2 for 8k and CS3 for 4K so a total of 12K.

    The Memory manager is mapped at 0xFFFF_FE00

    0x00 mfbalR0           Use for Flash
    0x04 mfbahR0          Use for Flash
    0x08 mfbalR1           Use for Flash
    0x0C mfbahR1         Use for Flash
    0x10 mfbalR2           Use for RAM
    0x14 mfbahR2          Use for RAM
    0x18 mfbalR3           Use for RAM
    0x1F mfbahR3          Use for RAM
    0x20 mfbalR4           Use for HET RAM
    0x24 mfbahR4          Use for HET RAM
    .....

     

    /*******************************************************************************************/
    /*                                                                                         */
    /*             setup ROM/RAM chip selects SAR module                                       */
    /*                                                                                         */
    /*******************************************************************************************/
                                                             /*                                */
     e_SARDEC_ST.mfbahR0_UW = 0x0000;                        /* int FLASH/boot FLASH/ROM 64K   */
     e_SARDEC_ST.mfbahR1_UW = 0x0000;                        /* int FLASH 0K                                      */
     e_SARDEC_ST.mfbalR1_UW = 0x0000;                        /*                                                                */
     e_SARDEC_ST.mfbahR2_UW = 0x0000;                        /* int RAM block 0                                  */
     e_SARDEC_ST.mfbalR2_UW = 0x0040;                        /* 8K  mapped to 0x0000_0000          */
     e_SARDEC_ST.mfbahR3_UW = 0x0000;                        /* int RAM block 1                                  */
     e_SARDEC_ST.mfbalR3_UW = 0x2030;                        /* 4K  mapped to 0x0000_2000           */
     e_SARDEC_ST.mfbahR4_UW = 0x0008;                        /* HET RAM                                            */
     e_SARDEC_ST.mfbalR4_UW = 0x0010;                        /* 1K  mapped to 0x0008_0000           */
     e_SARDEC_ST.mfbalR0_UW = 0x0100;                        /* Enable the memory map                 */

     

    Here is the corresponding gel script you can use to perform this memory remap.

    /*
     * This GEL file is loaded on the command line of Code Composer
     * The StartUp() function is called every time you start
     * Code Composer.  You can customize this function to
     * initialize wait states or to perform other initialization.
     *
     */



    menuitem "TMS470 RAM Remap - TMS470R1A256"

    dialog RAM_Remap()
    {
      /*  */
      (*(long*)0xFFFFFE00) = 0x0000;
      (*(long*)0xFFFFFE04) = 0x0000;
      (*(long*)0xFFFFFE08) = 0x0000;
      (*(long*)0xFFFFFE0C) = 0x0000;
      (*(long*)0xFFFFFE10) = 0x0000;
      (*(long*)0xFFFFFE14) = 0x0040;
      (*(long*)0xFFFFFE18) = 0x0000;
      (*(long*)0xFFFFFE1c) = 0x2030;
      (*(long*)0xFFFFFE20) = 0x0008;
      (*(long*)0xFFFFFE24) = 0x0010;
      (*(long*)0xFFFFFE04) = 0x0100;
    }

    You have to remember that in case of reset, the memory manager will be back to the default state.
    Flash will be mapped to 0x0000_0000 and RAM will not be accessible.

    Please let me know if this answer will satisfy your need.

    Best Regards,

    Jean-Marc

     

     

     

  • 5751.example1.zip

     

    Hi Jean,

    Thank you very much for  your reply,but i am not able to single step and get it working.

    May i am not doing it  properly  ,I have attached the sample program for your reference.Please look into it and let me know what corrections i need to make in order to get it to work.

    Also i observed that the i was not able to  load the .out file and sometimes debugger pops out "disconnect retry" child window.

    Also shown below is the GEL script

    So after a cpu reset the pc starts from FLASH,then how or when does it execute from RAM.Though we instructed  the controller that the entire RAM starts from 0

    inside the linker cmd file and also initialized MAFBHamd BL registers .So after i do hard reset,do i need to execute the menu item (GEL menu)?

    /* This GEL file is loaded on the command line of Code Composer
     * The StartUp() function is called every time you start
     * Code Composer.  You can customize this function to
     * initialize wait states or to perform other initialization.
     */

    StartUp()
    {
    RAM_Remap();
    }

    OnTargetConnect()
    {
    }

    menuitem "TMS470"

    /* This function should be used instead of the Debug->Restart menu */
    /* selection when running ARM programs in mixed or 16 BIS (Thumb)  */
    /* mode.  It ensures the processor is in ARM mode at the entry     */
    /* point of TI C runtimes.                                         */
    hotmenu ResetRestart()
    {
     GEL_Reset();
     GEL_Restart();
     
    }
    dialog RAM_Remap()
    {
      /*  */
      (*(long*)0xFFFFFE00) = 0x0000;
      (*(long*)0xFFFFFE04) = 0x0000;
      (*(long*)0xFFFFFE08) = 0x0000;
      (*(long*)0xFFFFFE0C) = 0x0000;
      (*(long*)0xFFFFFE10) = 0x0000;
      (*(long*)0xFFFFFE14) = 0x0040;
      (*(long*)0xFFFFFE18) = 0x0000;
      (*(long*)0xFFFFFE1c) = 0x2030;
      (*(long*)0xFFFFFE20) = 0x0008;
      (*(long*)0xFFFFFE24) = 0x0010;
      (*(long*)0xFFFFFE04) = 0x0100;
    }

     

    Regards,

    nandu

  • Nandu,

    With the solution I've provided, you have to execute the gel after reset.

     

    After checking in my archive, there is another option you can try,

    If you have access to the test pin on the device, it should be tied to ground in normal operation.
    But when you are in debug mode, with nTRST high, if you connect TEST to high, the device will boot from RAM.
    In other word, the RAM will be mapped to 0x0000_0000 and you will be able to load your code directly.
    There is no more need to use the GEL script. With this option, reset will work and the CPU will be able to jump to 0x0000_0000 and found your internal RAM.

    Please can you try and let me know the result.

     

    Regards,

     

    Jean-Marc

  •  

     Hi Jean

    I tried the way yout suggested,i connected TEST pin to 3.3V althoughthis pin was pulled down to GND .With that ,i could see that remap starts from 0 and dosent show FFFFFFFF in disassembly mode.however when i single step ,i get target disconnect immediately.Sometimes i am not  able to load the program itself.

    Once i connect the device,after reset,when i click load the program ,i get the error window attached above.

     I think programming and executing from FLASH may be the best option .Jean,could you suggest any  method of programming the flash using xds510? Is it possible to  provide me a flash470win tool to program tms470r1a256  flash since i already have a xds510 with me and  CCS3.2 detects it?

     Regards,

    nandu

     

     

  • Hi Nandu,

    Will it be possible for you to send your out file so I can make a try.

    I can give you my email address so you will not have to share the out file on the forum.

    Also, what kind of board are you using? Is it a custom board?

     

    Best Regards,

     

    Jean-Marc

  • Hi Jean,

    my email id is  nandu008@yahoo.com.

    what i have here is just a basic tms470r1a256 with 12 Mhz XTAL soldered on a pcb with no peripherals pulled out other than JTAG lines.

    in have also shorted AWD to GND for watchdog disable.Please give your email id so that i could send you the out file.

    Regards,

    Nandu