Basic Buffer Dump Example

Demonstrates creating a new Gecko OS command.

API Features Demonstrated

Platforms

This app works on:

Requirements and Prerequisites

Requires a Gecko OS evaluation board, such as a WGM160P_eval.

Description

The buffer dump app demonstrates how to create a new Gecko OS Command API function.

The demonstration command, dump, sends, to the Gecko OS log bus, a dummy ASCII text buffer according to the format specified in the dump command options.

The app also overrides the Gecko OS Command API help question-mark function ? with descriptive help for the dump command.

Usage Instructions

After building, downloading and running the app, it displays the following output:

Success
> Buffer Dump App ready
Usage:
Dump a dummy buffer with specified formatting
> dump [-r <1-32>] [-w <1-4] [-s <0/1>] [-a <0/1>] [-c <0/1>] [-e <b/l>] [-l <1-1024>]
where:
-r <1-32>   : Number of words per row: 1,2,4,8,16,32. Default: 8
-w <1-4>    : Bytes per word: 1,2,4. Default: 4
-s <0/1>    : Add space between words. Default: 1
-a <0/1>    : Print addresses. Default: 1
-c <0/1>    : Print row ascii. Default: 1
-e <b/l>    : Word endianess, b = big, l = little. Default: little
-l <1-1024> : Size of dummy buffer. Default: 128 bytes

Enter a command at the Gecko OS terminal, e.g. dump -l 32 -r 2. Output is as shown:

> dump -l 32 -r 2
Flags: 1D1
Buffer: 0x10003180 (32): Buffer dump
 Address 3      0 7      4
10003180 23222120 27262524  !"#$%&'
10003188 2B2A2928 2F2E2D2C ()*+,-./
10003190 33323130 37363534 01234567
10003198 3B3A3938 3F3E3D3C 89:;<=>?
Success

Enter the command ? to see the dump command documentation:

> ?
Usage:
Dump a dummy buffer with specified formatting
> dump [-r <1-32>] [-w <1-4] [-s <0/1>] [-a <0/1>] [-c <0/1>] [-e <b/l>] [-l <1-1024>]
where:
-r <1-32>   : Number of words per row: 1,2,4,8,16,32. Default: 8
-w <1-4>    : Bytes per word: 1,2,4. Default: 4
-s <0/1>    : Add space between words. Default: 1
-a <0/1>    : Print addresses. Default: 1
-c <0/1>    : Print row ascii. Default: 1
-e <b/l>    : Word endianess, b = big, l = little. Default: little
-l <1-1024> : Size of dummy buffer. Default: 128 bytes

Source Code

See: