Basic Buffer Dump Example
Demonstrates creating a new ZentriOS command.
- SDK directory:
apps/basic/buffer_dump
- Zentri App Store:
ZENTRI-BABUFFERDUMP
API Features Demonstrated
Platforms
This app works on:
- AMW004 - Zentri Mackerel evaluation board
- AMW106 - Zentri Moray evaluation board
- NXP-SCCK - NXP Secure Cloud Connectivity Kit
Requirements and Prerequisites
Requires a ZentriOS evaluation board.
Description
The buffer dump app demonstrates how to create a new ZentriOS Command API function.
The demonstration command, dump
, sends, to the ZentriOS log bus, a dummy ASCII text buffer according to the format specified in the dump
command options.
The app also overrides the ZentriOS 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 ZentriOS 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: