GEL是通用扩展语言(General Extension Language)的英文缩写,GEL是一个大小写敏感但缺少类型检测的解释性语言,只有int类型,在语法上可看作是C语言的一个子集。GEL主要用来扩展CCS的功能,方便用户调试程序,但不是必需的。当我们希望上电后立刻开启或实现某些功能,那么可以在项目中装载GEL文件(由TI提供或用户自行编写)来实现这个目的。此外,项目添加TI公司提供的GEL文件后往往会在CCS的GEL菜单中出现相关的子菜单,用户可以使用它,主要用于程序的调试控制。GEL文件可以看成你所建项目的“秘书”,可以帮你打打杂,处理一些繁琐的事情。

下面是一段VC5509的通用GEL文件代码:

 StartUp()
{
GEL_MapOn();
GEL_MapReset();
GEL_MapAdd(0x0000C0,,0x00FF40,,);
GEL_MapAdd(0x010000,,0x030000,,);
GEL_MapAdd(0x040000,,0x3C0000,,);
GEL_MapAdd(0x400000,,0x400000,,);
GEL_MapAdd(0x800000,,0x400000,,); GEL_MapAdd(0xC00000,,0x400000,,); GEL_MapAdd(0xFF0000,,0x010000,,); GEL_MapAdd(0x000000,,0x000050,,);
GEL_MapAdd(0x000060,,0x007FA0,,);
GEL_MapAdd(0x008000,,0x018000,,);
GEL_MapAdd(0x020000,,0x1E0000,,);
GEL_MapAdd(0x200000,,0x200000,,);
GEL_MapAdd(0x400000,,0x200000,,); GEL_MapAdd(0x600000,,0x200000,,); GEL_MapAdd(0x0001,,0x0002,,);
GEL_MapAdd(0x0400,,0x0300,,);
GEL_MapAdd(0x07FE,,0x0002,,);
GEL_MapAdd(0x0800,,0x0014,,);
GEL_MapAdd(0x0C00,,0x000C,,);
GEL_MapAdd(0x0C20,,0x000C,,);
GEL_MapAdd(0x0C40,,0x000C,,);
GEL_MapAdd(0x0C60,,0x000C,,);
GEL_MapAdd(0x0C80,,0x000C,,);
GEL_MapAdd(0x0CA0,,0x000C,,);
GEL_MapAdd(0x0E00,,0x0001,,);
GEL_MapAdd(0x0E03,,0x0001,,);
GEL_MapAdd(0x1000,,0x0004,,);
GEL_MapAdd(0x1800,,0x000D,,);
GEL_MapAdd(0x1C00,,0x0001,,);
GEL_MapAdd(0x1E00,,0x0001,,);
GEL_MapAdd(0x2400,,0x0004,,);
GEL_MapAdd(0x2800,,0x001F,,);
GEL_MapAdd(0x2C00,,0x001F,,);
GEL_MapAdd(0x3000,,0x001F,,);
GEL_MapAdd(0x3400,,0x0002,,);
GEL_MapAdd(0x3800,,0x0005,,);
GEL_MapAdd(0x3C00,,0x000D,,);
GEL_MapAdd(0x4000,,0x0004,,);
GEL_MapAdd(0x4400,,0x0006,,);
GEL_MapAdd(0x4800,,0x001B,,);
GEL_MapAdd(0x4C00,,0x001B,,);
GEL_MapAdd(0x5800,,0x1000,,);
GEL_MapAdd(0x6800,,0x0004,,);
GEL_MapAdd(0x6C00,,0x0001,,);
GEL_MapAdd(0x7000,,0x0002,,);
GEL_MapAdd(0x7400,,0x0001,,);
GEL_TextOut("Gel StartUp Complete.\n");
}
OnTargetConnect()
{
C5509_Init();
}
menuitem "C5509_Configuration";
hotmenu CPU_Reset()
{
GEL_Reset();
GEL_TextOut("CPU Reset Complete.\n");
} hotmenu C5509_Init()
{
GEL_Reset();
TMCR_Reset();
GEL_TextOut("C5509 Memory Map Initialization Complete.\n");
} hotmenu C5509_USB_Enable()
{
GEL_MemoryFill(0x7000,,,0x0004);
GEL_TextOut("C5509 USB Module enabled.\n");
}
menuitem "C5509 EBSR Config";
hotmenu Data_EMIF_En()
{
GEL_MemoryFill(0x6C00,,,0x0200);
GEL_TextOut("C5509 Ext. Bus set to Data EMIF.\n");
}
hotmenu Full_EMIF_En()
{
GEL_MemoryFill(0x6C00,,,0x0201);
GEL_TextOut("C5509 Ext. Bus set to Full EMIF.\n");
}
hotmenu NonMuxed_EHPI_En()
{
GEL_MemoryFill(0x6C00,,,0x0202);
GEL_TextOut("C5509 Ext. Bus set to Non Muxed EHPI.\n");
}
hotmenu MuxEHPI_En()
{
GEL_MemoryFill(0x6C00,,,0x0203);
GEL_TextOut("C5509 Ext. Bus set to Muxed EHPI.\n");
}
menuitem "C5509 EMIF CE0 Config";
hotmenu CE0_Async16_En()
{
GEL_MemoryFill(0x0803,,,0x1FFF);
GEL_TextOut("C5509 CE0 set to 16-bit Async mode.\n");
}
menuitem "C5509 EMIF CE1 Config";
hotmenu CE1_Async16_En()
{
GEL_MemoryFill(0x0806,,,0x1FFF);
GEL_TextOut("C5509 CE1 set to 16-bit Async mode.\n");
}
menuitem "C5509 EMIF CE2 Config";
hotmenu CE2_Async16_En()
{
GEL_MemoryFill(0x0809,,,0x1FFF);
GEL_TextOut("C5509 CE2 set to 16-bit Async mode.\n");
}
menuitem "C5509 EMIF CE3 Config";
hotmenu CE3_Async16_En()
{
GEL_MemoryFill(0x080C,,,0x1FFF);
GEL_TextOut("C5509 CE3 set to 16-bit Async mode.\n");
} TMCR_Reset()
{
#define TMCR_MGS3 0x07FE
#define TMCR_MM 0x07FF
*(short *)TMCR_MGS3@IO = 0x0510;
*(short *)TMCR_MM@IO = 0x0000;
}

可以看到:GEL文件主要用来对VC5509的程序空间、数据空间、I/O空间等进行初始化,同时配置CCS开发环境,建立子菜单供用户在调试程序时选择使用。CCS启动时,Startup()函数被执行。支持Connect/Disconnect的CCS启动时,Startup()函数中不包括访问目标处理器的代码,目标处理器由回调函数OnTargetConnect()来初始化。

注意:GEL文件在CCS启动后常驻内存,在仿真器和目标系统上电的时候起到初始DSP的作用。在上电后再改变GEL文件将不会对DSP产生影响。

04-19 23:44