📄 chip.cfg
字号:
## **** A procedure which sets up variant specifics ***
## ---------------------------------------------------------------------------
## Add help for chip and processor commands
## ---------------------------------------------------------------------------
addhelp chip \
"chip chiptype\n\
specify chiptype of current target, supported chiptypes are\n\
ST20C1SIM, ST20C2SIM,\n\
ST20DCU3C1SIM, ST20DCU3C2SIM,\n\
ST20TP4, ST20TP3, ST20GP6, ST20MC2\n\
STi5500H5, STi5500, STi5505, STi5508\n\
STi5510, STi5512, STi5518, STi5580, STi5588, STi5519, ST20DC1, ST20DC2\n\
ST20C2_C200, STi5514, STV0396, STV3500, STi5516\n"
if ( (clsymbol processor) != 3) {
addhelp processor \
"processor coretype\n\
specify coretype of current target, supported coretypes are\n\
c1, C1 or st20c1 and c2, C2 or st20c2\n"
}
## ---------------------------------------------------------------------------
## Some global variable declarations
## ---------------------------------------------------------------------------
## The following indexes refer to the position of the arguments in the
## call to _ST_AddDevice
_ST_global_ChipIndex_chipName = 1 ## the chip name, e.g. STi5512
_ST_global_ChipIndex_prodid = 2 ## the 16 bit prodid (devid bits 28..12)
_ST_global_ChipIndex_prodidMask = 3 ## a mask for bits ignore when checking
_ST_global_ChipIndex_coreType = 4 ## the core type
_ST_global_ChipIndex_cacheControl = 5 ## a proc for controlling the caches
_ST_global_ChipIndex_interruptControl = 6 ## a proc for controlling interrupts
_ST_global_ChipIndex_dcuType = 7 ## the DCU type
_ST_global_ChipIndex_dcuBase = 8 ## the DCU base address
_ST_global_ChipIndex_trapHandlerType = 9 ## the breakpoint trap handler type
_ST_global_ChipIndex_trapHandler = 10 ## the breakpoint trap handler executable
_ST_global_ChipIndex_configFile = 11 ## the name of the chip's config file
_ST_global_ChipIndex_configProc = 12 ## the name of the chip's config proc
_ST_global_ChipIndex_IntCType = 13 ## the interrupt controller type
_ST_global_ChipIndex_ILCType = 14 ## the interrupt level controller type
_ST_global_ChipIndex_cacheMap = 15 ## symbol name of cache map to be linked
## The folling keeps a count of the number of chip names in the
## name list, _ST_global_NameList
_ST_global_NameList.count = 0
## The folling keeps a count of the number of product ids in the
## prodid list, _ST_global_ProdidList
_ST_global_ProdidList.count = 0
## The following global is used as an override for the device id
## -1 means read the devid from the device, cannot use 0 because the
## simulator returns a devid of 0
_ST_global_DevidOverride = -1
## The following used to check DCU type. 1 for DCU3, 0 otherwise
_ST_global_dcuCheck = 0
## ---------------------------------------------------------------------------
## proc _ST_DefineDCUType
## This procedure creates an int in the application
## whose contents represent the chip's DCU type
## ---------------------------------------------------------------------------
proc _ST_DefineDCUType {
## dcu_type% is used by the ROM loader.
## Value is 2 for a DCU2, 3 for DCU3
if ((DCUType[spaceid]<<4)=="DCU2") {
define dcu_type% 2
} else if ((DCUType[spaceid]<<4)=="DCU3") {
define dcu_type% 3
}
}
## ---------------------------------------------------------------------------
## proc _ST_dummyproc
## This procedure is used as a stub
## ---------------------------------------------------------------------------
proc _ST_dummyproc { }
## ---------------------------------------------------------------------------
## proc ST20C2CPU
## This procedure defines the basic requirements of the ST20C2 core
## ---------------------------------------------------------------------------
proc ST20C2CPU {
register -cpu areg
register -cpu breg
register -cpu creg
register -cpu iptr
register -cpu wptr
register -cpu priority
register -cpu enables
register -cpu status
register -cpu shareg
register -cpu shbreg
register -cpu shcreg
register -cpu shiptr
register -cpu shwptr
register -cpu shenables
register -cpu shstatus
register -cpu fptr0
register -cpu bptr0
register -cpu fptr1
register -cpu bptr1
register -cpu timer0
register -cpu timer1
register -cpu clock0
register -cpu clock1
CacheControlProc[spaceid] = "_ST_dummyproc"
InterruptProc[spaceid] = "C2Interrupts"
CPUType[spaceid] = "st20c2"
DCUType[spaceid] = "DCU2H6"
runtime c2rtl
TrapHandlerType[spaceid] = "c2th"
TrapHandler[spaceid] = "c2trap.bin"
if ( (clsymbol processor) == 3) {
processor c2
} ## if it is inbuilt call it
}
## ---------------------------------------------------------------------------
## proc ST20C1CPU
## This procedure defines the basic requirements of the ST20C1 core
## ---------------------------------------------------------------------------
proc ST20C1CPU {
register -cpu areg
register -cpu breg
register -cpu creg
register -cpu iptr
register -cpu wptr
register -cpu tdesc
register -cpu status
CacheControlProc[spaceid] = "_ST_dummyproc"
InterruptProc[spaceid] = "C1Interrupts"
CPUType[spaceid] = "st20c1"
TrapHandlerType[spaceid] = "c1th"
DCUType[spaceid] = "DCU2H5"
runtime c1rtl
TrapHandler[spaceid] = "c1trap.bin"
if ( (clsymbol processor) == 3) {
processor c1
} ## if it is inbuilt call it
}
## This procedure adds a device to the list of devices regognised by
## the chip and processor commands
proc _ST_AddDevice _ST_local_prodid _ST_local_loop {
## $1 is the name
## $2 is the product id
## $3 is the product mask
## $4 is the core type
## see the definitions of _ST_global_ChipIndex_... for details of futher arguments
_ST_local_prodid = mknum($2)
## maintain a list of all valid chip names
_ST_global_NameList[_ST_global_NameList.count] = $1
_ST_global_NameList.count++
## maintain a list of all valid product id values
if (_ST_local_prodid != 0) {
_ST_global_ProdidList[_ST_global_ProdidList.count] = _ST_local_prodid
_ST_global_ProdidList.count++
}
## add a mapping from a prodid to chip name so the processor command
## may extract the prodid from the target and determine the chip type
_ST_global_ProdidToChipNameMap[_ST_local_prodid] = $1
_ST_global_ChipNameMap[$1].prodid = _ST_local_prodid
_ST_global_ChipNameMap[$1].coreType = $4
## add all arguments to this procedure to elements of a sub-array
for (_ST_local_loop=1; _ST_local_loop<$#+1; _ST_local_loop++) {
_ST_global_ChipNameMap[$1][_ST_local_loop] = $(_ST_local_loop)
}
}
proc _ST_ListDevice _ST_local_name=$1{
write (_ST_local_name):
write (" Product Id: " + mkstr (_ST_global_ChipNameMap[_ST_local_name][_ST_global_ChipIndex_prodid]))
write (" Core type: " + mkstr (_ST_global_ChipNameMap[_ST_local_name][_ST_global_ChipIndex_coreType]))
}
## This procedure prints out info about all known chips if an argument is
## not given, or the chip whose name is specified in the argument
proc _ST_ListChip _ST_local_name {
_ST_local_name = ""
if ($#==0) {
## list all devices
for (_ST_local_loop=0; _ST_local_loop<_ST_global_NameList.count; _ST_local_loop++) {
_ST_local_name = _ST_global_NameList[_ST_local_loop]
_ST_ListDevice (_ST_local_name)
}
} else {
## list a specific device
for (_ST_local_loop=0; _ST_local_loop<_ST_global_NameList.count; _ST_local_loop++) {
if (_ST_global_NameList[_ST_local_loop] == $1) {
_ST_local_name = _ST_global_NameList[_ST_local_loop]
}
}
if (_ST_local_name != "") {
_ST_ListDevice (_ST_local_name)
} else {
write Cannot find chip name $1
}
}
}
## This procedure prints out info about all known chips if an argument is
## not given, or the chip whose product id matches the argument
proc _ST_ListProductId _ST_local_name _ST_local_prodid _ST_local_loop {
_ST_local_name = ""
if ($#==0) {
## list all devices
for (_ST_local_loop=0; _ST_local_loop<_ST_global_ProdidList.count; _ST_local_loop++) {
_ST_local_prodid = _ST_global_ProdidList[_ST_local_loop]
_ST_local_name = _ST_global_ProdidToChipNameMap[_ST_local_prodid]
_ST_ListDevice (_ST_local_name)
}
} else {
## list a specific device
_ST_local_prodid = mknum($1)
for (_ST_local_loop=0; _ST_local_loop<_ST_global_ProdidList.count; _ST_local_loop++) {
if (_ST_global_ProdidList[_ST_local_loop] == _ST_local_prodid) {
_ST_local_name = _ST_global_ProdidToChipNameMap[_ST_local_prodid]
}
}
if (_ST_local_name != "") {
_ST_ListDevice (_ST_local_name)
} else {
write Cannot find prodid $1
}
}
}
proc _ST_ReadDeviceId _ST_local_ret {
## When using the nostdlib option to st20cc,
## space is a builtin which does not return a value
if ((clsymbol space)==3) {
_ST_local_ret = (space -deviceid)
} else {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -