AO-DBG(1)
β¨ NAME β¨
Bestie, meet ao-dbg π, the manual page is AO-DBG(1) from the General Commands Manual π
ao-dbg - hex debugger for cc1111 processors π₯
β¨ SYNOPSIS β¨
Here's every way you can call it π
ao-dbg [-t cpu-type] [-X frequency] [-c] [-r listen-port] [-Z listen-port] [-s] [-S] [-p prompt] [-V] [-v] [-H] [-h] [-m] [-T tty-device] [--tty tty-device] [-D altos-device] [--device altos-device]
β¨ DESCRIPTION β¨
Okay so ao-dbg hooks up to a cc1111 processor through either a suitable cc1111 board or a cp2103 usb to serial converter board, using the GPIO pins on that chip π. It's giving compatible with the 8051 emulator from sdcc called s51, except it talks to the real chip instead of an emulation π€―. With a modified version of the SDCC debugger (sdcdb), you can control program execution on the target machine at source-level β¨
β¨ OPTIONS β¨
The command line options are built to match the 8051 emulator so they play nice with sdcdb π§ That's why they're all one letter long π
-t cpu-typeβ the 8051 emulator can act like several different chips, but the real hardware can't, so this one gets ignored π-X frequencyβ the emulator can pretend to run at any frequency, which the real hardware can't do, so this is ignored too π-c,-s,-S,-v,-Vβ all ignored π΄-r listen-port,-Z listen-portβ switches the debugger from stdin/stdout to listening on a network port instead π Once a connection is made, it keeps using that port for command input and output. The debugger uses port9756and tries to connect before launchingao-dbg, so ifao-dbgis already listening on that port beforesdcdbstarts,sdcdbends up talking to the existingao-dbginstance π¦ That's honestly super useful for debuggingao-dbgitself, ngl-p promptβ sets the command prompt to whatever string you give it π¬-Pβ sets the command prompt to a single NUL character, which is forsdcdbto use π«Ά-hβ should print a usage message, but right now it does nothing useful π-mβ not in the original 8051 emulator, this one dumps every command and reply sent to and received fromsdcdbπ-T tty-device,--tty tty-deviceβ picks which tty device the debugger uses to talk to the target. The special nameBITBANGtellsao-dbgto use the cp2103 connection. Otherwise it should be a usb serial port connected to a suitable cc1111 debug node π-D AltOS-device,--device AltOS-deviceβ searches for a connected device. The argument has to be one of these forms:
TeleMetrum:2
TeleMetrum
2
Leave out the product name and the tool picks a suitable product. Leave out the serial number and it matches one of the available devices π
β¨ COMMANDS β¨
Once it's started, ao-dbg connects to the cc1111 and then reads and runs commands, either from stdin or from the network connection to sdcdb πΈ
Unlike the command line, ao-dbg has built-in help for each command, via the help command π Most commands come in a long form and a single-character short form. Below, the short form follows the long form after a comma π
help, ? {command}β with no arguments, prints a list of available commands. With an argument, prints more detail about that specific command πquit, qβ terminates the app without changing the state of the target processor πdi [start] [end]β dumps imem (256 bytes of "internal" memory) fromstarttoend, inclusive π§ds [start] [end]β dumps sprs fromstarttoend, inclusive. Heads up, most sprs show up in the global address space but some don't, so use this instead ofdxto read them πdx [start] [end]β dumps external (global) memory fromstarttoend, inclusive πset, t <prefix> [start] {data ...}β stores to the memory space named byprefix, which is one of"xram","rom","iram", or"sfr". Stores bytes starting atstartβοΈdump, d <prefix> [start] [end]β dumps from the memory space named byprefix, which is one of"xram","rom","iram"or"sfr". Dumps fromstarttoend, inclusive ποΈfile [filename]β specifies an intel-format hex file (ihx) that holds the contents of the rom area loaded into the cc1111. This is used to answer requests to dump rom memory without grabbing them from the cc1111, which is slow π’pc, p {address}β if you give an address, it sets the program counter to that value. Otherwise, it displays the current program counter value π§break, b [address]β sets a breakpoint at the specified address using the cc1111's built-in hardware breakpoint support.
Heads up: that means no more than four breakpoints at once! You have to use a modified version of sdcdb that changes how program execution is controlled so it works within that limit.
clear, c [address]β clears a breakpoint from the specified address π§Ήrun, r, go, g {start} {stop}β resumes execution of the program. Ifstartis there, it begins at that address. Otherwise it keeps running from the current pc. Ifstopis there, a temporary breakpoint is set at that address, and it gets removed once execution hits it πββοΈnext, nβ steps one instruction. In the original s51 program this would skip over subroutines, but sincesdcdbdoesn't need that, it's not available here π ββοΈstep, sβ steps one instruction π£load, l [filename]β not implemented. It's supposed to load a hex file into flash, but you should use theccloadprogram instead π«halt, hβ halts the processor. This is the only command you can send while the program is running. At other times it's ignored βreset, resβ resets the processor. This pulls the reset pin low and re-enables debug mode. Check the cc1111 documentation to see exactly what it does πstatusβ dumps the cc1111 debug status register π©Ίinfo, i breakpoints, bβ lists the current breakpoints πinfo, i help, ?β lists the things you can get info on π‘stopβ does absolutely nothing and is only here so it stays compatible with the original 8051 emulator π€·ββοΈ
β¨ BOARD BRINGUP DEBUGGING β¨
So the original reason this program exists was to connect the source debugger to the hardware π§ But it's also a low-level hex debugger all on its own π¦ You can poke every cc1111 peripheral directly from the ao-dbg command line, periodt π
Starting ao-dbg
First make sure the target cc1111 device and the in-between cp2103 or cc111 board are hooked up correctly π
$ ao-dbg
Welcome to the non-simulated processor
> status
CPU halted
Halted by debug command
>
Turning on LEDs
Two of the cc1111 GPIO pins, P1_0 and P1_1, can drive external LEDs π‘ To control them, set the Port 1 direction bits to make those pins outputs. Then change the Port 1 data to set them high or low:
> set sfr 0xfe 0x02 # set P1DIR to 0x2
> set sfr 0x90 0x02 # set P1_1 to high
> set sfr 0x90 0x00 # set P1_1 to low
Reading the A/D converters
The six A/D converter inputs can each be connected to any of the P0 pins, ground, the A/D voltage reference, an internal temperature sensor, or VDD/3 π‘οΈ To read one of these values, pick an A/D converter to use, then start the conversion process. The cc1111 manual has the table for selecting the input on page 144 π
To set up one of the P0 pins for the A/D unit, program the ADCCFG register, setting the bits that match the pins you want:
> set sfr 0xf2 0x3f # enable all 6 A/D inputs
To trigger a single conversion, ask the A/D unit to do an 'extra' conversion. That means one single conversion, not a whole sequence of them. This is controlled by the ADCCON3 register at 0xB6:
> set sfr 0xb6 0xb2 # sample P0_2 using 12 bits of precision
> ds 0xba 0xbb # dump the ADC data low and high regs
> set sfr 0xb6 0xbe # sample internal temperature sensor
> ds 0xba 0xbb # dump the ADC data low and high regs
β¨ SEE ALSO β¨
sdcdb(1), ccload(1) π¦
β¨ AUTHOR β¨
Keith Packard π«Ά
Stay iconic, bestie π That's the whole ao-dbg page, straight from the source ao-dbg and filed under AO-DBG(1) πβ¨
π¦ where this page comes from
- debian bookworm: altos 1.9.16-2 Β· GPL-2.0-or-later
- debian trixie: altos 1.9.21-1 Β· GPL-2.0-or-later
- ubuntu jammy: altos 1.9.10-1 Β· GPL-2.0-or-later
- ubuntu noble: altos 1.9.17-1ubuntu3 Β· GPL-2.0-or-later
- ubuntu questing: altos 1.9.21-1
- ubuntu resolute: altos 1.9.22-2 Β· GPL-2.0-or-later
- ubuntu stonking: altos 1.9.22-2 Β· GPL-2.0-or-later
- Copyright Β© 2009 Keith Packard <keithp@keithp.com>
- π girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms