# Low-level functions *LinkServer* is using the *redlinkserv* low-level tool to communicate with a debug probe. The tool can be found in the `binaries` folder. The functions supported by *redlinkserv* can be accessed as follows: - directly, in command-line mode: `binaries/redlinkserv --commandline` - indirectly, via a client connected to the telnet port `23025` after starting the GDB server: - `./LinkServer gdbserver [other OPTIONS] DEVICE` - indirectly, from Basic like scripts that can be specified within a target JSON data file to be run before a connection and/or before a reset. Refer to [Scripting support](ScriptingSupport.md) for details. ## Probe related functions ``` PROBELIST : Enumerates and returns an indexed list of known probe types PROBENUM : Returns the number of probes attached PROBEOPENBYINDEX [<"FILENAME">] : Opens the probe associated with ProbeIndex FILENAME is text of pairs used for internal configuration PROBEOPENBYSERIAL <"SerialNumber"> : Opens the probe associated with SerialNumber PROBECLOSEBYINDEX : Closes the probe associated with ProbeIndex PROBECLOSEBYSERIAL <"SerialNumber"> : Closes the probe associated with SerialNumber PROBEFIRSTFOUND : Returns the THIS ProbeIndex or index of the first probe in the enumerated list PROBETIME : Returns elapsed time from firmware boot, if supported PROBESTATUS []: Returns an indexed list summary of the status of the probes connected to the system PROBEVERSION : Returns CMSIS-DAP version information PROBEDAPINFO : Returns CMSIS-DAP probe information PROBEISOPEN : Returns TRUE or FALSE PROBEHASJTAG : Returns TRUE or FALSE PROBEHASSWD : Returns TRUE or FALSE PROBEHASSWV : Returns TRUE or FALSE PROBEHASETM : Returns TRUE or FALSE PROBERESET : Resets the probe (use 1 for ISP reset) [MCU-Link only] PROBECONFIG <"get|set|reset::[Value]">: Sets or returns custom probe configurations. Use PROBECONFIG "get:help:" to see the details about the supported configurations. ``` ## Core/TAP related functions ``` CORECONFIG {[THIS] | []}: Queries the scan chain configuration CORESCONFIGURED : Returns TRUE or FALSE APLIMIT {[THIS] | []}: : Limit the AP Query (set once) APLIST {[THIS] | []}: []: Detailed list of APs connected to the specified probe. APLimit restricts queries to AP index. CORELIST {[THIS] | []}: []: Detailed list of APs/Cores connected to the specified probe. APLimit restricts queries to AP index. COREREADID {[THIS] | [ ]}: Returns the DpID DEBUGMAILBOXREQ {[THIS] | [ ]} : Debug Mailbox Request ``` ## Wire related functions ``` WIRESWDCONNECT {[THIS] | []}: Configures the wire for SWD and returns the DpID WIREJTAGCONNECT {[THIS] | []}: Configures the wire for JTAG WIREDISCONNECT {[THIS] | []}: Closes the wire connection (SWD/JTAG) WIREISPRESET {[THIS] | []}: Resets an LPC part into the ISP bootloader WIREBOOTCONFIGSET {[THIS] | []} <"DATA">: Stores boot configuration data that will be automatically applied during subsequent reset commands. DATA is a string with up to 4 characters describing how each ISP_CTRL[3..0] pin should be handled: '0' (= drive low), '1' (= drive high), 'x' (= do not drive) WIREBOOTCONFIGGET {[THIS] | []}: Returns previously stored configuration data WIREBOOTCONFIGREAD {[THIS] | []}: Returns the current state of ISP_CTRL[3:0] pins WIREBOOTCONFIGAPPLY {[THIS] | []} <1/0>: Immediately starts/stops driving the ISP_CTRL pins based on previously stored boot configuration data WIRETIMEDRESET : Asserts (Low) reset for ms milliseconds and returns the end state of the wire WIREHOLDRESET : Asserts/Releases (Low/High) reset and returns the end state of the wire WIRESETSPEED : Requests a particular wire speed in Hz WIREGETSPEED : Returns the current wire speed WIRESETIDLECYCLES : Sets the number of idle cycles between debug transactions WIREGETIDLECYCLES : Returns the current number of debug idle cycles WIREISCONNECTED : Returns TRUE or FALSE if WIRESWDCONNECT or WIREJTAGCONNECT is complete WIREGETPROTOCOL : Returns SWD or JTAG SELECTPROBECORE : Sets the THIS parameter Probe/Core pair THIS : Displays the current Probe, Core pair ``` ## Cortex-M related functions ``` CMINITAPDP {[THIS] | [ ]}: Initialize a CMx core ready for debug connections CMUNINITAPDP {[THIS] | [ ]}: UnInitialize a CMx core (de-assert debug and system power-up) CMWRITEDP {[THIS] | [ ]} : Returns zero on success CMWRITEAP {[THIS] | [ ]} : Returns zero on success CMREADDP {[THIS] | [ ]} : Returns data CMREADAP {[THIS] | [ ]} : Returns data (handles RDBUF on AP reads) CMCLEARERRORS {[THIS] | [ ]} CMHALT {[THIS] | [ ]} CMRUN {[THIS] | [ ]} CMSTEP {[THIS] | [ ]} CMREGS {[THIS] | [ ]} CMDEBUGSTATUS {[THIS] | [ ]} CMWRITEREG {[THIS] | [ ]} CMREADREG {[THIS] | [ ]} CMWATCHLIST {[THIS] | [ ]} CMWATCHSET {[THIS] | [ ]}
[] CMWATCHCLEAR {[THIS] | [ ]} CMBREAKLIST {[THIS] | [ ]} : List the FPB breakpoints CMBREAKSET {[THIS] | [ ]}
: Set an FPB CMBREAKCLEAR {[THIS] | [ ]} [
] : Clear an FPB CMSYSRESETREQ {[THIS] | [ ]} : System reset request CMVECTRESETREQ {[THIS] | [ ]} : Core reset request CMRESETVECTORCATCHSET {[THIS] | [ ]} : Enable reset vector catch CMRESETVECTORCATCHCLEAR {[THIS] | [ ]} : Disable reset vector catch ``` ## Generic BASIC like functions ``` PEEK8 {[THIS] | [ ]}
PEEK16 {[THIS] | [ ]}
PEEK32 {[THIS] | [ ]}
POKE8 {[THIS] | [ ]}
POKE16 {[THIS] | [ ]}
POKE32 {[THIS] | [ ]}
QPOKE8 {[THIS] | [ ]}
QPOKE16 {[THIS] | [ ]}
QPOKE32 {[THIS] | [ ]}
QSTARTTRANSFERS {[THIS] | [ ]} MEMDUMP {[THIS] | [ ]} MEMLOAD {[THIS] | [ ]} Loads binary file data to memory MEMSAVE {[THIS] | [ ]} Saves memory to binary file EXIT: Exit the server PRINT "TEXT"[;[~]Variable | Constant]: Print statement. Prints quoted text and/or value of an internal variable (a%% - z%%), or constant integer expression in decimal, or hexadecimal[~] format TIME : Returns an incrementing centisecond count from the host TIMEMS : Returns an incrementing millisecond count from the host WAIT : Wait for the number of milliseconds before proceding LIST: Lists a loaded script NEW: Erases a loaded script from memory RENUMBER : Renumber script lines with Delta increment (default is 10) LOAD <"FILENAME">: Loads a script from the current, absolute, or relative directory SAVE <"FILENAME">: Saves a script to the current, absolute, or relative directory ``` ## Generic BASIC like functions that only work inside scripts ``` GOTO IF THEN [ELSE ] REPEAT : Start of a repeat block UNTIL : End with condition of repeat block BREAKREPEATTO : Premature end of a repeat loop GOSUB RETURN ``` ## Miscellaneous ``` HELP : display help on LinkServer commands VERSION : returns the LinkServer version CONNECTIONS : display active connections ```