Hey,

Just a note that I've added a shell, along with a few commands to the
console interface.

In order to play around with this, try the following target:

blinky_sim

name: blinky_sim

arch: sim

project: blinky

bsp: hw/bsp/native

Once you have created that target, build it:


$ newt target build blinky_sim

Building target blinky_sim (project = blinky)

Compiling case.c

Compiling suite.c

Compiling testutil.c

Compiling testutil_arch_sim.c

Archiving libtestutil.a

Compiling shell.c

Archiving libshell.a

Compiling os.c

Compiling os_callout.c

Compiling os_eventq.c

Compiling os_heap.c

Compiling os_info.c

Compiling os_mbuf.c

Compiling os_mempool.c

Compiling os_mutex.c

Compiling os_sanity.c

Compiling os_sched.c

Compiling os_sem.c

Compiling os_task.c

Compiling os_time.c

Compiling os_arch_sim.c

Archiving libos.a

Compiling hal_flash.c

Archiving libhal.a

Compiling cons_fmt.c

Compiling cons_tty.c

Archiving libfull.a

Compiling cbmem.c

Compiling log.c

Compiling stats.c

Archiving libutil.a

Compiling hal_cputime.c

Compiling hal_uart.c

Archiving libnative.a

Compiling main.c

Building project blinky

Linking blinky.elf

Successfully run!

$

Then you can run the resulting binary:

$ ./project/blinky/bin/blinky_sim/blinky.elf

uart0 at stdout

GPIO 1 is now 0

GPIO 1 is now 1

GPIO 1 is now 0

<snip>

Because stdout is the console interface, you can now interact with the
simulator.  i.e. to list tasks, type "tasks":

tasks

6634:6 tasks:

6634:  shell (prio: 3, nw: 0, flags: 0x0, ssize: 0, cswcnt: 64,
tot_run_time: 104ms)

6671:  idle (prio: 255, nw: 0, flags: 0x0, ssize: 0, cswcnt: 583,
tot_run_time: 0ms)

6705:  uart_poller (prio: 0, nw: 6644, flags: 0x0, ssize: 0, cswcnt: 535,
tot_run_time: 6507ms)

6753:  task1 (prio: 1, nw: 7021, flags: 0x0, ssize: 0, cswcnt: 7,
tot_run_time: 23ms)

6788:  os_sanity (prio: 254, nw: 7021, flags: 0x0, ssize: 0, cswcnt: 7,
tot_run_time: 0ms)

6829:  task2 (prio: 2, nw: 6020, flags: 0x3, ssize: 0, cswcnt: 7,
tot_run_time: 0ms)

To view stats, type the stats command:

stat stat

18676:s0: 1

To view logs, type the log command:

log

659:[0] bla

659:[0] bab

Over the next few days, I will be making these slightly more sophisticated
and fleshing them out.  Specifically:

- Right now the logs are not named, they need to be named.

- Adding statistics and logs for all the major packages, and the options
for filtering those logs out

- Improved shell functions (start with $ sign on every line, add basic
shell escaping, etc.)

But for now, take a look and play around.  (Separate note to follow on
stats and logs, when they are a bit further long -- there is some work to
do around filtering and masking, along with adding different types of
stats.)

Sterling

Reply via email to