Files
sw_openocd/tools/scripts/camelcase.txt
Antonio Borneo d2aeb5fcc9 command: return OpenOCD error code as Tcl 'errorCode'
Commit 93f16eed4d ("command: fix OpenOCD commands return value
for next jimtcl") aligns the return of OpenOCD Tcl commands to the
standard Tcl error codes.

This has the side effect to hide the internal OpenOCD error codes
(e.g. ERROR_FAIL = -4) from the Tcl environment. These codes are
for internal use, can change during OpenOCD development and should
not be exposed to the user.
Nevertheless, some ACI test has been instrumented to check such
values and there is a requirement to make them available, possibly
without breaking the Tcl language rules.

Tcl allows procedures to return, through the 'return' command [1]:
- the result text;
- a return code like 'ok' or 'error';
- an optional 'errorcode';
- ...

The optional 'errorcode' can be exploited to propagate the OpenOCD
error code to the Tcl script for ACI test purpose.
It would be equivalent of considering the OpenOCD commands as Tcl
procedures that either returns as:
	return -code ok 'command output text'
or return an error as:
	return -code error -errorcode {OpenOCD -4} 'error text'
where '-4' is the OpenOCD value for ERROR_FAIL.

Tcl stores the errorcode in the global variable 'errorCode' that
can be easily accessed within a Tcl script [2].
The variable 'errorCode' is by default set to 'NONE' and has to be
set to a Tcl list. The first element of the list identifies the
general class of errors and determines the format of the rest of
the list. This allows the required flexibility to propagate the
OpenOCD error codes in a format unique that does not impact other
Tcl functionality.

Propagates the OpenOCD error code in the Tcl global variable
'errorCode' as a Tcl list formatted as {OpenOCD %s}.
Modify the test script to check for OpenOCD error code.

Link: https://www.tcl-lang.org/man/tcl8.6/TclCmd/return.htm [1]
Link: https://www.tcl-lang.org/man/tcl8.6/TclCmd/tclvars.htm [2]
Change-Id: Ia5007e04b3c061a0f7a74387b51ab2a57c658088
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9186
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
Reviewed-by: Evgeniy Naydanov <eugnay@gmail.com>
2025-11-22 19:03:49 +00:00

187 lines
2.5 KiB
Plaintext

# SPDX-License-Identifier: GPL-2.0-or-later
# The OpenOCD coding-style rules forbids CamelCase names for symbols,
# either functions, variables, macros and enums.
# The script checkpatch detects the CamelCase symbols.
# This file contains the exceptions to the coding-style, mainly due
# to external dependencies and libraries.
# format types from inttypes.h (only some are already used)
PRId8
PRId16
PRId32
PRId64
PRIi8
PRIi16
PRIi32
PRIi64
PRIo8
PRIo16
PRIo32
PRIo64
PRIu8
PRIu16
PRIu32
PRIu64
PRIx8
PRIx16
PRIx32
PRIx64
PRIX8
PRIX16
PRIX32
PRIX64
SCNd8
SCNd16
SCNd32
SCNd64
SCNi8
SCNi16
SCNi32
SCNi64
SCNo8
SCNo16
SCNo32
SCNo64
SCNu8
SCNu16
SCNu32
SCNu64
SCNx8
SCNx16
SCNx32
SCNx64
SCNX8
SCNX16
SCNX32
SCNX64
# OpenOCD format types
TARGET_PRIdADDR
TARGET_PRIoADDR
TARGET_PRIuADDR
TARGET_PRIxADDR
# from libusb.h
bcdDevice
bConfigurationValue
bEndpointAddress
bInterfaceClass
bInterfaceNumber
bInterfaceProtocol
bInterfaceSubClass
bmAttributes
bNumConfigurations
bNumEndpoints
bNumInterfaces
idProduct
idVendor
iInterface
iManufacturer
iProduct
iSerialNumber
wMaxPacketSize
# from jimtcl/jim.h and jimtcl/jim-eventloop.h
Jim_AppendString
Jim_AppendStrings
Jim_Cmd
Jim_CmdPrivData
Jim_CreateCommand
Jim_CreateInterp
Jim_DecrRefCount
Jim_DeleteAssocData
Jim_DeleteCommand
Jim_DictPairs
Jim_DuplicateObj
Jim_Eval
Jim_EvalObj
Jim_EvalObjPrefix
Jim_EvalSource
Jim_Eval_Named
Jim_FreeInterp
Jim_FreeObj
Jim_GetAssocData
Jim_GetCommand
Jim_GetDouble
Jim_GetEnum
Jim_GetExitCode
Jim_GetGlobalVariableStr
Jim_GetResult
Jim_GetString
Jim_GetWide
Jim_IncrRefCount
Jim_InitStaticExtensions
Jim_Interp
Jim_ListAppendElement
Jim_ListGetIndex
Jim_ListLength
Jim_MakeErrorMessage
Jim_NewEmptyStringObj
Jim_NewIntObj
Jim_NewListObj
Jim_NewStringObj
Jim_Obj
Jim_ProcessEvents
Jim_RegisterCoreCommands
Jim_SetAssocData
Jim_SetEmptyResult
Jim_SetGlobalVariableStr
Jim_SetResult
Jim_SetResultFormatted
Jim_SetResultString
Jim_String
Jim_WrongNumArgs
cmdProc
privData
returnCode
# from elf.h
Elf32_Addr
Elf32_Ehdr
Elf32_Half
Elf32_Off
Elf32_Phdr
Elf32_Size
Elf32_Word
Elf64_Addr
Elf64_Ehdr
Elf64_Half
Elf64_Off
Elf64_Phdr
Elf64_Word
Elf64_Xword
# for BSD's
__FreeBSD__
__FreeBSD_kernel__
# for Windows
CreateFile
CloseHandle
FormatMessage
GetModuleFileName
GetSystemTimeAsFileTime
GetTickCount
GetVersionEx
HighPart
LowPart
MsgWaitForMultipleObjects
PeekMessage
PeekNamedPipe
QuadPart
SetConsoleCtrlHandler
Sleep
WaitForSingleObject
WSACleanup
WSAGetLastError
WSASetLastError
WSAStartup
dwHighDateTime
dwLowDateTime
dwPlatformId
dwOSVersionInfoSize
# OpenOCD exceptions that should be removed
KiB