📄 example_2833xda.gel
字号:
/*
// TI File $Revision: /main/11 $
// Checkin $Date: September 26, 2007 10:20:00 $
//###########################################################################
//###########################################################################
// $TI Release: DSP2833x Header Files V1.01 $
// $Release Date: September 26, 2007 $
//###########################################################################
*/
/********************************************************************/
/* f28335.gel */
/* Version 3.30 */
/* */
/* This GEL file is to be used with the TMS320F28335 DSP. */
/* Changes may be required to support specific hardware designs. */
/* */
/* Code Composer Studio supports six reserved GEL functions that */
/* automatically get executed if they are defined. They are: */
/* */
/* StartUp() - Executed whenever CCS is invoked */
/* OnReset() - Executed after Debug->Reset CPU */
/* OnRestart() - Executed after Debug->Restart */
/* OnPreFileLoaded() - Executed before File->Load Program */
/* OnFileLoaded() - Executed after File->Load Program */
/* OnTargetConnect() - Executed after Debug->Connect */
/* */
/********************************************************************/
StartUp()
{
/* The next line automatically loads the .gel file that comes */
/* with the DSP2833x Peripheral Header Files download. To use, */
/* uncomment, and adjust the directory path as needed. */
// GEL_LoadGel("c:\\CCStudio_v3.3\\cc\\gel\\DSP2833x_Peripheral.gel");
}
OnReset(int nErrorCode)
{
Unlock_CSM();
ADC_Cal();
}
OnRestart(int nErrorCode)
{
/* CCS will call OnRestart() when you do a Debug->Restart and */
/* after you load a new file. Between running interrupt based */
/* programs, this function will clear interrupts and help keep */
/* the processor from going off into invalid memory. */
IER = 0;
IFR = 0;
ADC_Cal();
}
OnPreFileLoaded()
{
}
OnFileLoaded(int nErrorCode, int bSymbolsOnly)
{
ADC_Cal();
}
OnTargetConnect()
{
F28335_Memory_Map(); /* Initialize the CCS memory map */
/* Check to see if CCS has been started-up with the DSP already */
/* running in real-time mode. The user can add whatever */
/* custom initialization stuff they want to each case. */
if (GEL_IsInRealtimeMode()) /* Do real-time mode target initialization */
{
}
else /* Do stop-mode target initialization */
{
GEL_Reset(); /* Reset DSP */
}
/* Display FPU register window */
All_FPU_Single_Precision_Regs();
}
/********************************************************************/
/* These functions are launched by the GEL_Toolbar button plugin */
/********************************************************************/
GEL_Toolbar1()
{
Run_Realtime_with_Reset();
}
GEL_Toolbar2()
{
Run_Realtime_with_Restart();
}
GEL_Toolbar3()
{
Full_Halt();
}
GEL_Toolbar4()
{
Full_Halt_with_Reset();
}
int GEL_Toolbar5_Toggle = 0;
GEL_Toolbar5()
{
if(GEL_Toolbar5_Toggle == 0)
{
GEL_Toolbar5_Toggle = 1;
GEL_OpenWindow("GEL_Buttons",1,4);
GEL_TextOut("Button 1: Run_Realtime_with_Reset()","GEL_Buttons",0,0);
GEL_TextOut("Button 2: Run_Realtime_with_Restart()","GEL_Buttons",0,1);
GEL_TextOut("Button 3: Full_Halt()", "GEL_Buttons",0,2);
GEL_TextOut("Button 4: Full_Halt_with_Reset()","GEL_Buttons",0,3);
}
else
{
GEL_Toolbar5_Toggle = 0;
GEL_CloseWindow("GEL_Buttons");
}
}
/********************************************************************/
/* These functions are useful to engage/dis-enagage realtime */
/* emulation mode during debug. They save the user from having to */
/* manually perform these steps in CCS. */
/********************************************************************/
menuitem "Realtime Emulation Control";
hotmenu Run_Realtime_with_Reset()
{
GEL_Reset(); /* Reset the DSP */
ST1 = ST1 & 0xFFFD; /* clear DBGM bit in ST1 */
GEL_EnableRealtime(); /* Enable Realtime mode */
GEL_Run(); /* Run the DSP */
}
hotmenu Run_Realtime_with_Restart()
{
GEL_Restart(); /* Reset the DSP */
ST1 = ST1 & 0xFFFD; /* clear DBGM bit in ST1 */
GEL_EnableRealtime(); /* Enable Realtime mode */
GEL_Run(); /* Run the DSP */
}
hotmenu Full_Halt()
{
GEL_DisableRealtime(); /* Disable Realtime mode */
GEL_Halt(); /* Halt the DSP */
}
hotmenu Full_Halt_with_Reset()
{
GEL_DisableRealtime(); /* Disable Realtime mode */
GEL_Halt(); /* Halt the DSP */
GEL_Reset(); /* Reset the DSP */
}
/********************************************************************/
/* F28335 Memory Map */
/* */
/* Note: M0M1MAP and VMAP signals tied high on F28335 core */
/* */
/* 0x000000 - 0x0003ff M0 SARAM (Prog and Data) */
/* 0x000400 - 0x0007ff M1 SARAM (Prog and Data) */
/* 0x000800 - 0x001fff Peripheral Frame0 (PF0) (Data only) */
/* 0x004000 - 0x004fff XINTF Zone 0 (Prog and Data) */
/* 0x005000 - 0x005fff Peripheral Frame3 (PF3) (Data only) */
/* 0x006000 - 0x006fff Peripheral Frame1 (PF1) (Data only) */
/* 0x007000 - 0x007fff Peripheral Frame2 (PF2) (Data only) */
/* 0x008000 - 0x008fff L0 SARAM (Prog and Data) */
/* 0x009000 - 0x009fff L1 SARAM (Prog and Data) */
/* 0x00A000 - 0x00Afff L2 SARAM (Prog and Data) */
/* 0x00B000 - 0x00Bfff L3 SARAM (Prog and Data) */
/* 0x00C000 - 0x00Cfff L4 SARAM (Prog and Data) */
/* 0x00D000 - 0x00Dfff L5 SARAM (Prog and Data) */
/* 0x00E000 - 0x00Efff L6 SARAM (Prog and Data) */
/* 0x00F000 - 0x00Ffff L7 SARAM (Prog and Data) */
/* 0x100000 - 0x1fffff XINTF Zone 6 (Prog and Data) */
/* 0x200000 - 0x2fffff XINTF Zone 7 (Prog and Data */
/* 0x300000 - 0x33ffff Flash (Prog and Data) */
/* 0x380080 - 0x380088 ADC_cal function (Prog and Data) */
/* 0x380400 - 0x3807ff OTP (Prog and Data) */
/* 0x3f8000 - 0x3f8fff L0 SARAM (Prog and Data) */
/* 0x3f9000 - 0x3f9fff L1 SARAM (Prog and Data) */
/* 0x3fA000 - 0x3fAfff L2 SARAM (Prog and Data) */
/* 0x3fB000 - 0x3fBfff L3 SARAM (Prog and Data) */
/* 0x3fe000 - 0x3fffff BOOT ROM (Prog and Data) */
/********************************************************************/
menuitem "Initialize Memory Map";
hotmenu F28335_Memory_Map()
{
GEL_MapReset();
GEL_MapOn();
/* Program memory map */
GEL_MapAdd(0x0,0,0x400,1,1); /* M0 SARAM */
GEL_MapAdd(0x400,0,0x400,1,1); /* M1 SARAM */
GEL_MapAdd(0x4000,0,0x1000,1,1); /* Zone 0 */
GEL_MapAdd(0x8000,0,0x1000,1,1); /* L0 SARAM */
GEL_MapAdd(0x9000,0,0x1000,1,1); /* L1 SARAM */
GEL_MapAdd(0xA000,0,0x1000,1,1); /* L2 SARAM */
GEL_MapAdd(0xB000,0,0x1000,1,1); /* L3 SARAM */
GEL_MapAdd(0xC000,0,0x1000,1,1); /* L4 SARAM */
GEL_MapAdd(0xD000,0,0x1000,1,1); /* L5 SARAM */
GEL_MapAdd(0xE000,0,0x1000,1,1); /* L6 SARAM */
GEL_MapAdd(0xF000,0,0x1000,1,1); /* L7 SARAM */
GEL_MapAdd(0x100000,0,0x100000,1,1); /* Zone 6 */
GEL_MapAdd(0x200000,0,0x100000,1,1); /* Zone 7 */
GEL_MapAdd(0x300000,0,0x40000,1,0); /* FLASH */
GEL_MapAdd(0x380080,0,0x00009,1,0); /* ADC_cal function*/
GEL_MapAdd(0x380400,0,0x00400,1,0); /* OTP */
GEL_MapAdd(0x3f8000,0,0x1000,1,1); /* L0 SARAM Mirror */
GEL_MapAdd(0x3f9000,0,0x1000,1,1); /* L1 SARAM Mirror */
GEL_MapAdd(0x3fA000,0,0x1000,1,1); /* L2 SARAM Mirror */
GEL_MapAdd(0x3fb000,0,0x1000,1,1); /* L3 SARAM Mirror */
GEL_MapAdd(0x3fe000,0,0x2000,1,0); /* BOOT ROM */
/* Data memory map */
GEL_MapAdd(0x000,1,0x400,1,1); /* M0 SARAM */
GEL_MapAdd(0x400,1,0x400,1,1); /* M1 SARAM */
GEL_MapAdd(0x800,1,0x1800,1,1); /* PF0 */
GEL_MapAdd(0x4000,1,0x1000,1,1); /* Zone 0 */
GEL_MapAdd(0x5000,1,0x1000,1,1); /* PF3 */
GEL_MapAdd(0x6000,1,0x1000,1,1); /* PF1 */
GEL_MapAddStr(0x7000,1,0x1000,"R|W|AS2",0); /* PF2 */
GEL_MapAdd(0x8000,1,0x1000,1,1); /* L0 SARAM */
GEL_MapAdd(0x9000,1,0x1000,1,1); /* L1 SARAM */
GEL_MapAdd(0xA000,1,0x1000,1,1); /* L2 SARAM */
GEL_MapAdd(0xB000,1,0x1000,1,1); /* L3 SARAM */
GEL_MapAdd(0xC000,1,0x1000,1,1); /* L4 SARAM */
GEL_MapAdd(0xD000,1,0x1000,1,1); /* L5 SARAM */
GEL_MapAdd(0xE000,1,0x1000,1,1); /* L6 SARAM */
GEL_MapAdd(0xF000,1,0x1000,1,1); /* L7 SARAM */
GEL_MapAdd(0x100000,1,0x100000,1,1); /* Zone 6 */
GEL_MapAdd(0x200000,1,0x100000,1,1); /* Zone 7 */
GEL_MapAdd(0x300000,1,0x40000,1,0); /* FLASH */
GEL_MapAdd(0x380400,1,0x00400,1,0); /* OTP */
GEL_MapAdd(0x380080,1,0x00009,1,0); /* ADC_cal function*/
GEL_MapAdd(0x3f8000,1,0x1000,1,1); /* L0 SARAM Mirror */
GEL_MapAdd(0x3f9000,1,0x1000,1,1); /* L1 SARAM Mirror */
GEL_MapAdd(0x3fA000,1,0x1000,1,1); /* L2 SARAM Mirror */
GEL_MapAdd(0x3fb000,1,0x1000,1,1); /* L3 SARAM Mirror */
GEL_MapAdd(0x3fe000,1,0x2000,1,0); /* BOOT ROM */
}
/********************************************************************/
/* The ESTOP0 fill functions are useful for debug. They fill the */
/* RAM with software breakpoints that will trap runaway code. */
/********************************************************************/
hotmenu Fill_F28335_RAM_with_ESTOP0()
{
GEL_MemoryFill(0x000000,1,0x000800,0x7625); /* Fill M0/M1 */
GEL_MemoryFill(0x008000,1,0x002000,0x7625); /* Fill L0/L1 */
GEL_MemoryFill(0x00A000,1,0x002000,0x7625); /* Fill L2/L3 */
GEL_MemoryFill(0x00C000,1,0x002000,0x7625); /* Fill L4/L5 */
GEL_MemoryFill(0x00E000,1,0x002000,0x7625); /* Fill L6/L7 */
}
/********************************************************************/
menuitem "Watchdog";
hotmenu Disable_WD()
{
*0x7029 = *0x7029 | 0x0068; /* Set the WDDIS bit */
*0x7025 = 0x0055; /* Service the WD */
*0x7025 = 0x00AA; /* once to be safe. */
GEL_TextOut("\nWatchdog Timer Disabled");
}
/********************************************************************/
menuitem "Code Security Module"
hotmenu Unlock_CSM()
{
/* Perform dummy reads of the password locations */
XAR0 = *0x33FFF8;
XAR0 = *0x33FFF9;
XAR0 = *0x33FFFA;
XAR0 = *0x33FFFB;
XAR0 = *0x33FFFC;
XAR0 = *0x33FFFD;
XAR0 = *0x33FFFE;
XAR0 = *0x33FFFF;
/* Write passwords to the KEY registers. 0xFFFF's are dummy passwords.
User should replace them with the correct password for their DSP */
*0xAE0 = 0xFFFF;
*0xAE1 = 0xFFFF;
*0xAE2 = 0xFFFF;
*0xAE3 = 0xFFFF;
*0xAE4 = 0xFFFF;
*0xAE5 = 0xFFFF;
*0xAE6 = 0xFFFF;
*0xAE7 = 0xFFFF;
}
/********************************************************************/
menuitem "Addressing Modes";
hotmenu C28x_Mode()
{
ST1 = ST1 & (~0x0100); /* AMODE = 0 */
ST1 = ST1 | 0x0200; /* OBJMODE = 1 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -