Configuration Guide

All compile-time options are controlled in src/xelpcfg.h. Comment in or out #define lines to enable or disable features. Each feature that is compiled out saves code space.

Build Profiles

xelp is modular — enable only what you need. Three profiles cover most use cases:

KEY only (~1 KB)

Single-keypress dispatch: each key triggers a function immediately, no ENTER needed. Ideal for debug menus and hardware test jigs.

#define XELP_ENABLE_KEY  1

Representative size: ~550 bytes on ARM Thumb, ~900 bytes on AVR.

CLI (~3–5 KB)

Line-buffered command prompt with cursor movement, line editing, multi-byte ANSI key recognition, tokenizer, scripting, and help. This is the typical interactive configuration.

#define XELP_ENABLE_CLI        1
#define XELP_ENABLE_LINE_EDIT  1
#define XELP_ENABLE_KEY        1
#define XELP_ENABLE_HELP       1

Optional: add XELP_ENABLE_HISTORY for UP/DOWN arrow command recall (~420 bytes, requires XELP_ENABLE_LINE_EDIT).

Representative size: ~2600 bytes on ARM Thumb, ~4200 bytes on AVR.

Full (~3–5 KB)

Everything in CLI plus THR (pass-through) mode, which forwards all keystrokes to another peripheral — a modem, radio module, or debug port. Adds ~50–125 bytes over CLI.

#define XELP_ENABLE_FULL  1

Every flag is independent — mix and match. See the Build Profiles & Configuration Guide for full details.

Feature flags

FlagPurposeSize impact
XELP_ENABLE_CLICommand line mode with prompt, backspace, and command dispatchRequired for CLI and scripting
XELP_ENABLE_LINE_EDITCursor movement (left/right, Home/End), insert-at-cursor, Delete. Requires XELP_ENABLE_CLI.~800–1000 bytes
XELP_ENABLE_KEYSingle key press mode (menus, immediate actions)~200–500 bytes
XELP_ENABLE_THRPass-through mode (redirect keys to another peripheral)~50–125 bytes
XELP_ENABLE_HELPBuilt-in help function listing all commands~180–350 bytes
XELP_ENABLE_HISTORYCommand history (UP/DOWN arrow recall). Requires XELP_ENABLE_CLI + XELP_ENABLE_LINE_EDIT.~420 bytes
XELP_ENABLE_FULLEnable all of the aboveAll combined

Key mappings

These define which key presses switch between modes at the command line:

DefineDefaultPurpose
XELPKEY_CLICTRL-P (0x10)Enter CLI mode
XELPKEY_KEYESC (0x1B)Enter KEY mode
XELPKEY_THRCTRL-T (0x14)Enter THRU mode

Override by redefining in xelpcfg.h, e.g. #define XELPKEY_CLI ('c')

Escape characters

DefineDefaultPurpose
XELP_CLI_ESC` (backtick)Escape character at command line / in scripts
XELP_QUO_ESC\ (backslash)Escape character inside quoted strings

Buffer and register sizes

DefineDefaultPurpose
XELP_CMDBUFSZ64Command line buffer size in bytes
XELP_HIST_DEPTH4Number of commands stored in history ring (requires XELP_ENABLE_HISTORY)
XELP_REGS_SZ4Number of callee-clobbers-all return registers (minimum 4). R0 is command status, R1–R3 are command-specific.
XELPREGintRegister type (change for platforms where int is not ideal)

Prompt

DefineDefaultPurpose
XELP_CLI_PROMPT"xelp>"String shown at CLI prompt

For per-instance prompts, set to (ths->mpPrompt) and use XELP_SET_VAL_CLI_PROMPT(myXelp, "myPrompt>") at runtime.

Help strings

DefineDefaultPurpose
XELP_HELP_KEY_STR"\nKey functions\n"Header for KEY command help section
XELP_HELP_CLI_STR"\nCLI functions\n"Header for CLI command help section
XELP_HELP_ABT_STR(ths->mpAboutMsg)About message shown at top of help

Config override

If XELP_CONFIG_OVERRIDE is defined before including xelpcfg.h, the file includes xelp_ovr.h instead of using its built-in defaults. This allows project-specific configuration without modifying the library’s xelpcfg.h directly. The 8.3 filename convention is used for compatibility with legacy filesystems.

Example configurations

Minimal (KEY mode only)

/* xelpcfg.h */
#define XELP_ENABLE_KEY   1
/* Leave CLI, LINE_EDIT, THR, HELP undefined */

Estimated size: ~900 bytes

CLI with help

#define XELP_ENABLE_CLI   1
#define XELP_ENABLE_HELP  1

Estimated size: ~2 KB

Full

#define XELP_ENABLE_FULL  1

Estimated size: ~3–4 KB (platform dependent)