Skip to main content

Terminal console

Steamania terminal console could significantly improve the programming and debugging efficiency. With a series of command on a computer, the following features are realized in the current version:

  • Upload a program file
  • Edit lines
  • Edit registers
  • Run, stop, and debugging a program in step mode
  • Modify code line or register values at run-time
  • Save/Load programs to/from on-board flash
  • Change the current viewing page of the secondary screen

Download the Console Application

A Step-by-Step Instruction

Connect the USB serial module with the bluetooth module correctly. In Ubuntu (Virtual Machine), share the serial module from the host, it will appear in /dev/ as a serial port.

Open a terminal and type:

steamania@localPC:~$ ls /dev/ttyUSB*
tip

In Ubuntu, use shortcut Ctrl+T to open a terminal window.

The following respose should be displayed in the terminal:

ttyUSBx

Indicating that the serial module has been successfully connected as a port in Ubuntu, with name ttyUSB0.

In full path:

/dev/ttyUSB0

Suppose the console program is saved on the Desktop:

steamania@localPC:~$ cd Desktop
steamania@localPC:~/Desktop$

Type ./steamania-console /dev/ttyUSB0 to start the console.

steamania@localPC:~/Desktop$ ./steamania-console /dev/ttyUSB0
note
Console: [C] $ 
tip

rlwrap in Linux is strongly recommended to enable history features in the console with up arrow and down arrow keys, and a search in history using Ctrl+R.

rlwrap ./steamania-console /dev/ttyUSB0

Supported Commands

The console provides the following commands:

CategoryCommand
Setting deviceselect device
Uploading programupload
Modifying values in registerswreg
Modifying code lineswline wipe
Run-time commandsrun stop step n b jump
Information pagespage
Archiving programsload save
Otherhelp quit
info

Linux terminal commands ls reset clear are supported as well.

Setting device:select device

danger

The console tool needs a target device to communicate with using select , or the commands will not take effect correctly.

Suppose the target device with bluetooth ID C6 is set as the target:

Secondary Display
Console: [C] $ select 0xC6
Target device is set to 0xc6
tip

Target device bluetooth ID is shown on page 12 of the secondary display.

Target device can be changed at any time. Use device command to check the current target.

Secondary display
Console: [C] $ device
Target device is set to 0xc6

Linux commands ls clear reset

  • ls:List files in the current directory
  • reset:reset the current terminal window
  • clear:clear the screen

Uploading a program: upload

Code files are saved in plain text as below:

bitshift.code
000 10 0001 0001
001 13 0001 0000
002 02 0001 0001
003 15 1101 0001
004 0E 0000 0001

The code is uploaded by the following command:

Secondary display
Console: [C] $ upload bitshift.code
uploading file: bitshift.code to device 0xc6.
bitshift.code
000 10 0001 0001
001 13 0001 0000
002 02 0001 0001
003 15 1101 0001
004 0e 0000 0001

Modifying Register Values: wreg

Registers are specified by ID. In total 3 registers in a series can be modified in one command.

wreg [n] [ID] [Val1] [Val2] [Val3]
tip

n is the number of registers to be written.

Secondary display
Console: [C] $ wreg 3 0x00 0x1234 0x5678 0x90AB

The execution result: register R00, R01 and R02 are set to hexadecimal 12345678 and 90AB.

Secondary display
Console: [C] $ wreg 2 0x10 0x1111 0x2222 

Modify the values in register R00 and R01, to 0x1111 and 0x2222 in hexadecimal.

caution

Values for registers can be decimal or hexadecimal format with prefix 0x

wreg 3 0x00 0x1000 1000 500

The execution result: register R00, R01 and R02 are set to hexadecimal 100003E8 and 01C4.

Modifying a Program Line:wline wipe

Use wline to modify a single line of program, the parameters are:

wline [Line number] [Instruction] [Opcode0] [Opcode1]
Secondary display
Console: [C] $ wline 001 02 03E8 0000

Use wipe to clear the instruction and opcodes in a line.

Secondary display
Console: [C] $ wipe 001

Run-time command:run stop step n b jump

Use run to execute a program.

Secondary display
Console: [C] $ run

Use stop to terminate a program.

Secondary display
Console: [C] $ stop

Use step command to enter debugging mode, and use n for next line.

Secondary display
Console: [C] $ step
Console: [C] $ n

Use jump command to change the program counter to a specific line.

Secondary display
Console: [C] $ jump 0x010

Use b command to set the current line to 000

Secondary display
Console: [C] $ b

Secondary Screen:page

Use page command to turn to a specific page.

Secondary display
Console: [C] $ page 4

Turns to page 4, values of register 0x00 to 0x0F.

Archiving:load save

Use load command to load from a specified slot (1 to 5) on the storage flash to the board.

Secondary display
Console: [C] $ load 1

Use save command to save the current on-board program to a specified slot on the storage flash, 1 to 5.

Secondary display
Console: [C] $ save 4

Other: help quit

Use quit command or shortcut Ctrl+C to quit the program.

Secondary display
Console: [C] $ quit