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.

CCS/TMS320F280049: real-time debugging problem

Part Number: TMS320F280049
Other Parts Discussed in Thread: C2000WARE

Tool/software: Code Composer Studio

Dear TI support,

I'm working with TMS320F280049 and I have problem with my code. I am using the CCS 6.2.0.00050. I try to investigate and find the root of the problem by using realtime debugging, but I can't to do it because at the process of connection to the device using XDS200USB debugger I obtain an error message:

Error connecting to the target:
(Error -1133 @ 0x0)
Device blocked debug access because it is currently executing non-debuggable code. You may retry after the device has had time to enter debuggable code, or you may cancel, disable realtime mode, and then attempt to connect.
(Emulation package 8.0.803.0)

How can i solve this problem?

The code itself is very simple and in this develop phase it only drive and read the state of two pins - GPIO28 and GPIO29. It is based on the driverlib project of programming flash (the path to the source project is TI\c2000\C2000Ware_1_00_05_00\driverlib\f28004x\examples\flash\flashapi_ex1_program_autoecc.c) and in the final phase it will program the flash memory of the device.

The code is:

//
// Included Files
//
#include "driverlib.h"
#include "device.h"

//
// Include Flash API include file
//
#include "F021_F28004x_C28x.h"

//
// Include Flash API example header file
//
#include "flash_programming_f28004x.h"


//
// Defines
//

// Length (in 16-bit words) of data buffer used for program
#define  WORDS_IN_FLASH_BUFFER    0xFF

//
// Globals
//

//Data Buffers used for program operation using the flash API program function
#pragma  DATA_SECTION(Buffer,"DataBufferSection");
uint16   Buffer[WORDS_IN_FLASH_BUFFER + 1];
uint32   *Buffer32 = (uint32 *)Buffer;


//
// Prototype of the functions used in this example
//
void Example_Error(Fapi_StatusType status);
void Example_Done(void);
void Example_CallFlashAPI(void);
void FMSTAT_Fail(void);

void InitMyGPIOs(void)
{
    GPIO_setPadConfig(29, GPIO_PIN_TYPE_STD);
    GPIO_setPadConfig(28, GPIO_PIN_TYPE_STD);
    //pin GPIO29 bude vystupny
    GPIO_setDirectionMode(29, GPIO_DIR_MODE_OUT);
    //pin GPIO28 bude vstupny
    GPIO_setDirectionMode(28, GPIO_DIR_MODE_IN);
}

void Synchronize_with_programmer(void)
{
	uint32 variable;
	uint16 i;

	//synchronization from device, set L
	GPIO_writePin(29,0);

	for (i = 0; i < 2; i++)
	{
		//synchronization from host, wait for H
		do
		{
			variable = GPIO_readPin(28);
		}
		while((variable & 0x1) < 1);

		// synchronization from device, set H
		GPIO_writePin(29,1);

		// synchronization from host, wait for L
		do
		{
			variable = GPIO_readPin(28);
		} while((variable & 0x1) == 0x1);

		//synchronization from device, set L
		GPIO_writePin(29,0);
	}
}

//
// Main
//
void main(void)
{

	//
    // Initialize device clock and peripherals
	// Copy the Flash initialization code from Flash to RAM
    // Copy the Flash API from Flash to RAM
    // Configure Flash wait-states, fall back power mode, performance features and ECC
    //
    Device_init();

    //
    // Initialize GPIO
    //
    Device_initGPIO();

    //
    // Initialize PIE and clear PIE registers. Disables CPU interrupts.
    //
    Interrupt_initModule();

    //
    // Initialize the PIE vector table with pointers to the shell Interrupt
    // Service Routines (ISR).
    //
    Interrupt_initVectorTable();

    //
    // Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
    //
    EINT;
    ERTM;

	//set the directions of pins
	InitMyGPIOs();

	//oscillate with pins as the start condition
	Synchronize_with_programmer();

    //
    //  Notice that Flash API functions are mapped to RAM for execution in this example.
    //  In F28004x devices that have two banks, Flash API functions may be executed from
    //  one bank to perform Flash erase and program operations on the other bank.
    //  Flash API functions should not be executed from the same bank on which erase/
    //  program operations are in progress.
    //  Also, note that there should not be any access to the Flash bank on which erase/
    //  program operations are in progress.  Hence below function is mapped to RAM for
    //  execution.
    //
    //Example_CallFlashAPI();

}

 

Any ideas where can be the problem with the realtime debugging?

Best regards,

Tomas

  • Additional info:
    The reason for the realtime debugging is the fact that my code in debug mode works but when I load the generated hex file(from out file) using Boot Mode to the RAM and run it, nothing happens. It seems like some interrupt is activated and the code stuck... So I need to find the root, why in debug mode my application works and in real application not.
  • Tomas,

    Are you trying to load flash code to the RAM? Make sure you use ramfuncs to define code you want run on RAM. If you are trying to run it on ram, make sure to update the build configuration to RAM and to link the correct linker command files.

    Regards,
    Ozino
  • Hi Ozino,

    I want to run my application only from RAM. Running from the flash is not my goal. I'm using the linker cmd file as follows:

    MEMORY
    {
    PAGE 0 :
       /* BEGIN is used for the "boot to Flash" bootloader mode   */
    
       BEGIN           	: origin = 0x000000, length = 0x000002
       RAMM0           	: origin = 0x0000F5, length = 0x00030B
    
       RAMLS03        	: origin = 0x008000, length = 0x002000
       RAMLS4      		: origin = 0x00A000, length = 0x000800
       RESET           	: origin = 0x3FFFC0, length = 0x000002
       RAMGS0      		: origin = 0x00C000, length = 0x002000
       RAMGS1      		: origin = 0x00E000, length = 0x002000
    
    PAGE 1 :
    
       BOOT_RSVD       : origin = 0x000002, length = 0x0000F3     /* Part of M0, BOOT rom will use this for stack */
       RAMM1           : origin = 0x000400, length = 0x000400     /* on-chip RAM block M1 */
    
       RAMLS5      : origin = 0x00A800, length = 0x000800
       RAMLS6      : origin = 0x00B000, length = 0x000800
       RAMLS7      : origin = 0x00B800, length = 0x000800
    
       RAMGS2      : origin = 0x010000, length = 0x002000
       RAMGS3      : origin = 0x012000, length = 0x002000
    
       CLA1_MSGRAMLOW   : origin = 0x001480, length = 0x000080
       CLA1_MSGRAMHIGH  : origin = 0x001500, length = 0x000080
    
    }
    
    
    SECTIONS
    {
       codestart        : > BEGIN,     PAGE = 0, ALIGN(4)
       .text            : >>RAMGS0 | RAMGS1,   PAGE = 0, ALIGN(4)
       .cinit           : > RAMGS0,     PAGE = 0, ALIGN(4)
       .pinit           : > RAMGS0,     PAGE = 0, ALIGN(4)
       .switch          : > RAMGS0,     PAGE = 0, ALIGN(4)
       .reset           : > RESET,     PAGE = 0, TYPE = DSECT /* not used, */
    
       .cio             : > RAMLS03,    PAGE = 0
       .stack           : > RAMM1,     PAGE = 1
       .ebss            : > RAMLS5,    PAGE = 1
       .esysmem         : > RAMLS5,    PAGE = 1   
       .econst          : > RAMGS1,    PAGE = 0, ALIGN(4)
    
       GROUP
       {
           .TI.ramfunc
           { -l F021_API_F28004x_FPU32.lib}
    
       } LOAD = RAMGS1,
         RUN = RAMGS1,
         LOAD_START(_RamfuncsLoadStart),
         LOAD_SIZE(_RamfuncsLoadSize),
         LOAD_END(_RamfuncsLoadEnd),
         RUN_START(_RamfuncsRunStart),
         RUN_SIZE(_RamfuncsRunSize),
         RUN_END(_RamfuncsRunEnd),
         PAGE = 0, ALIGN(4)
    
       DataBufferSection : > RAMM1, PAGE = 1, ALIGN(4)
    }

    Do you see any trouble with this linker file?

  • Tomas,

    I see you are linking this library :{ -l F021_API_F28004x_FPU32.lib} Is there a reason you need this library? This is a flash specific library.
    Additionally, the GROUP section is needed if you are running a flash application.

    If you need help with RAM linker command files, I would recommend checking out the examples in C2000Ware under device_support\f28004x\common\cmd. There you file find some template ram linker command files.

    Regards,
    Ozino
  • Hi Ozino,

    the reason for linking the Flash API library is fact, that my application in the final phase will be something like the bootloader for the programming/erasing the flash. This is the reason why I put the code to the RAM. And this is the reason why I'm writing here, because I;m not able to debug the code in real-time mode due to the error message shown in the first post of this thread... Simply said, I don't know which instruction cause that the application stuck(or start the interrupt as I expect...). So, do you have any suggestion how can I debug the code in real-time mode?

    Regards,

    Tomas

  • Can I ask you, why is this thread labeled as "TI Thinks Resolved" but you don't give me any concrete suggestion how to resolve the debug problem with this MCU in real-time mode? I really don't understand this situation...what is the purpose of this forum, if you don't provide any concrete solution and let the thread uncertainly finish?
  • Tomas,

    I apologize for the late response. I've been out of office the last two business days due to holidays in the US.

    This wiki page provides debug options for the C2000: processors.wiki.ti.com/.../Debug_Handbook_for_CCS

    Here is a video link on how to debug in real-time mode: www.youtube.com/watch

    Let me know if you still have questions.

    Regards,
    Ozino
  • Hi Ozino,

    sorry for later response, I was out of office. I have found the root of the problem with the stucking of my code - the data sections in my linker cmd file make the trouble for running the code. I have modified the linker file and use the different locations for code placement into RAM and everything works OK. The thread can be closed.

    Best regards,

    Tomas

  • Tomas,

    Glad to hear you were able to get this resolved. Thanks for sharing your findings.

    Regards,
    Ozino