Skip to content

SDM : SDMShell Compile and Run

Benjamin Stürz edited this page Jan 23, 2025 · 3 revisions

Build SDMShell on your PC:

$ git clone https://github.com/evologics/sdmsh.git
Cloning into 'sdmsh'...
remote: Counting objects: 15, done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 15 (delta 1), reused 15 (delta 1), pack-reused 0
Unpacking objects: 100% (15/15), done.
$ cd sdmsh

How to build sdmsh for S2C WiSE sandbox.

You need to install readline and ncurses developer packages. On Debian/Ubuntu you can install them with:

$ sudo apt-get install libreadline-dev libncurses-dev

NOTE: if you use an old Linux distribution (like Ubuntu 16.04) with readline6
you'll need to pass COMPAT_READLINE6 = 1 to make.

$ make
make -C lib/libsdm
make[1]: Entering directory '/home/komar/work/proj/am/sdmsh/lib/libsdm'
cc -W -Wall -I. -I../libstream -lm -ggdb -DLOGGER_ENABLED -fPIC -fpack-struct   -c -o sdm.o sdm.c
cc -W -Wall -I. -I../libstream -lm -ggdb -DLOGGER_ENABLED -fPIC -fpack-struct   -c -o utils.o utils.c
cc -shared -W -Wall -I. -I../libstream -lm -ggdb -DLOGGER_ENABLED -fPIC -fpack-struct -o libsdm.so sdm.o utils.o
ar rcs libsdm.a sdm.o utils.o
make[1]: Leaving directory '/home/komar/work/proj/am/sdmsh/lib/libsdm'
make -C lib/libstream
make[1]: Entering directory '/home/komar/work/proj/am/sdmsh/lib/libstream'
cc -W -Wall -I. -lm -ggdb -DLOGGER_ENABLED -fPIC -fpack-struct   -c -o stream.o stream.c
cc -W -Wall -I. -lm -ggdb -DLOGGER_ENABLED -fPIC -fpack-struct   -c -o stream_raw.o stream_raw.c
cc -W -Wall -I. -lm -ggdb -DLOGGER_ENABLED -fPIC -fpack-struct   -c -o stream_ascii.o stream_ascii.c
cc -W -Wall -I. -lm -ggdb -DLOGGER_ENABLED -fPIC -fpack-struct   -c -o stream_tcp.o stream_tcp.c
cc -shared -W -Wall -I. -lm -ggdb -DLOGGER_ENABLED -fPIC -fpack-struct -o libstream.so stream.o stream_raw.o stream_ascii.o stream_tcp.o
ar rcs libstream.a stream.o stream_raw.o stream_ascii.o stream_tcp.o
make[1]: Leaving directory '/home/komar/work/proj/am/sdmsh/lib/libstream'
cc -W -Wall -I. -Ilib/libsdm -Ilib/libstream -lreadline -lm -ggdb -DLOGGER_ENABLED -fPIC -fpack-struct   -c -o sdmsh.o sdmsh.c
cc -W -Wall -I. -Ilib/libsdm -Ilib/libstream -lreadline -lm -ggdb -DLOGGER_ENABLED -fPIC -fpack-struct   -c -o shell.o shell.c
cc -W -Wall -I. -Ilib/libsdm -Ilib/libstream -lreadline -lm -ggdb -DLOGGER_ENABLED -fPIC -fpack-struct   -c -o sdmsh_commands.o sdmsh_commands.c
cc -W -Wall -I. -Ilib/libsdm -Ilib/libstream -lreadline -lm -ggdb -DLOGGER_ENABLED -fPIC -fpack-struct   -c -o history.o history.c
cc -o sdmsh sdmsh.o shell.o sdmsh_commands.o history.o lib/libsdm/libsdm.a lib/libstream/libstream.a -L. -lreadline

Do not forget put S2C modem to PHY state:

$ nc 192.168.0.127 9200

ATP

or

+++ATP

You will get

INITIATION PHY

$ ./sdmsh 192.168.0.127 4200

127> help
config    -	Config SDM command.
           	Usage: config <threshold> <gain> <source level> [<preamp_gain>]
usbl_config-	Config SDM USBL command.
           	Usage: usbl_config <delay> <samples> <gain> <sample_rate>
stop      -	Stop SDM command.
           	Usage: stop
ref       -	Update reference signal.
           	Usage: ref [<number of samples>] [<driver>:]<params>
tx        -	Send signal.
           	Usage: tx [<number of samples>] [<driver>:]<parameter>
rx        -	Receive signal [0 is inf].
           	Usage: rx <number of samples> [<driver>:]<params> [[<driver>:]<params>]
usbl_rx   -	Receive signal from USBL channel.
           	Usage: usbl_rx <channel> <number of samples> [<driver>:]<params>
systime   -	Request systime.
           	Usage: systime
waitsyncin-	Wait SYNCIN message.
           	Usage: waitsyncin
usleep    -	Delay in usec.
           	Usage: usleep <usec>
source    -	Run commands from file.
           	Usage: source <source-file>
help      -	This help
           	Usage: help [command]
history   -	Display history. Optional [number-lines] by default is 10.
           	Usage: history [number-lines]
<driver> is:
	ascii:<filename> or file extension ".dat" or ".txt".
	This is default driver File format: float (-1.0 .. 1.0) or short interger as text line, one value per line

	raw:<filename> or file extension ".raw", ".bin", ".dmp" or ".fifo".
	Binary format: int16_t per value

	tcp:<connect|listen>:<ip>:<port>.
	Opens TCP socket to send or receive data, int16_t per value

Supported drivers <drv>

  • ascii:<filename> This is default driver File format: float (-1.0 .. 1.0) or short interger as text line, one value per line
  • raw:<filename> Binary format: int16_t per value
  • tcp:<connect|listen>:<ip>:<port> Opens TCP socket to send or receive data, int16_t per value

rx command supports up to 2 sinks.

systime

127> systime
current_time = 1374704890, tx_time = 1374200191, rx_time = 4294950616
127>
  • current_time - current system 32-bit time counter
  • tx_time - 32-bit time counter of beginning last data transmit
  • rx_time - 32-bit time counter of beginning last data receiving