Hello Shell

This is a derived work from the original Zephyr “Hello World” example! Most of the stuff in this README file needs to be redesigned and changed!

Overview

A simple Hello World example that can be used with any supported board and prints ‘Hello World! I’m THE SHELL’ to the console. This application can be built into modes:

Requirements

Building and Running

This project outputs ‘Hello World! I’m THE SHELL’ to the console. It can be built and executed as emulation in X86 Emulation (QEMU) as follows:

west build -b qemu_x86 -p -d build/helloshell-qemu_x86 bridle/samples/helloshell
west build -t run -d build/helloshell-qemu_x86

Also it can be built and executed on following targets:

  • As Native POSIX execution (native_posix), fancy command set mode:

    west build -b native_posix -p -d build/helloshell-native_posix bridle/samples/helloshell
    west build -t run -d build/helloshell-native_posix
    

    Hint

    Connect a terminal emulator to the given pseudotty or start the application directly with the autoconnect argument:

    ./build/helloshell-native_posix/zephyr/zephyr.exe -attach_uart
    
  • As emulation in ARM Cortex-M3 Emulation (QEMU), fancy command set mode:

    west build -b qemu_cortex_m3 -p -d build/helloshell-qemu_cortex_m3 bridle/samples/helloshell
    west build -t run -d build/helloshell-qemu_cortex_m3
    

    Hint

    Exit QEMU by pressing CTRL+A x.

  • On ST Nucleo F746ZG board, fancy command set mode:

    west build -b nucleo_f746zg -p -d build/helloshell-nucleo_f746zg bridle/samples/helloshell
    west flash -d build/helloshell-nucleo_f746zg
    

Further you can deside either to run in a basic or fancy command set mode:

  • On ST Nucleo F746ZG board, basic command set mode:

    west build -b nucleo_f746zg -p -d build/helloshell-nucleo_f746zg bridle/samples/helloshell -- -DCONF_FILE=prj-minimal.conf
    west flash -d build/helloshell-nucleo_f746zg
    
  • On ST Nucleo F746ZG board, fancy command set mode:

    west build -b nucleo_f746zg -p -d build/helloshell-nucleo_f746zg bridle/samples/helloshell -- -DCONF_FILE=prj.conf
    west flash -d build/helloshell-nucleo_f746zg
    

Sample Output

(text in bold is a command input, text in angle brackets are keys to press)

Hello World! I'm THE SHELL from nucleo_f746zg


uart:~$ <Tab>
  adc        bridle     clear      dac        device     devmem     flash
  gpio       hello      help       history    hwinfo     i2c        kernel
  led        log        pwm        regulator  rem        resize     retval
  sensor     shell      timer

uart:~$ help
Please press the <Tab> button to see all available commands.
You can also use the <Tab> button to prompt or auto-complete all commands or its subcommands.
You can try to call commands with <-h> or <--help> parameter for more information.

Shell supports following meta-keys:
  Ctrl + (a key from: abcdefklnpuw)
  Alt  + (a key from: bf)
Please refer to shell documentation for more details.

Available commands:
  adc        :ADC commands
  bridle     :Bridle commands.
  clear      :Clear screen.
  dac        :DAC shell commands
  device     :Device commands
  devmem     :Read/write physical memory
              Usage:
              Read memory at address with optional width:
              devmem address [width]
              Write memory at address with mandatory width and value:
              devmem address <width> <value>
  flash      :Flash shell commands
  gpio       :GPIO commands
  hello      :say hello
  help       :Prints the help message.
  history    :Command history.
  hwinfo     :HWINFO commands
  i2c        :I2C commands
  kernel     :Kernel commands
  led        :LED commands
  log        :Commands for controlling logger
  pwm        :PWM shell commands
  regulator  :Regulator playground
  rem        :Ignore lines beginning with 'rem '
  resize     :Console gets terminal screen size or assumes default in case the
              readout fails. It must be executed after each terminal width
              change to ensure correct text display.
  retval     :Print return value of most recent command
  sensor     :Sensor commands
  shell      :Useful, not Unix-like shell commands.
  timer      :Timer commands

uart:~$ hello -h
hello - say hello
uart:~$ hello
Hello from shell.

uart:~$ kernel version
Zephyr version 3.7.0

uart:~$ bridle version
Bridle version 3.6.99

uart:~$ bridle version long
Bridle version 3.6.99.0

uart:~$ bridle info
Zephyr: 3.7.0-rc1
Bridle: 3.6.99

uart:~$ kernel uptime
Uptime: 254707293 ms

uart:~$ kernel cycles
cycles: 4281597339 hw cycles

uart:~$ kernel threads
Scheduler: 328 since last call
Threads:
 0x20021650 sysworkq
        options: 0x0, priority: -1 timeout: 0
        state: pending, entry: 0x800e4f9
        stack size 1024, unused 832, usage 192 / 1024 (18 %)

*0x20020a80 shell_uart
        options: 0x0, priority: 14 timeout: 0
        state: queued, entry: 0x8004e75
        stack size 2048, unused 1016, usage 1032 / 2048 (50 %)

 0x20020588 logging
        options: 0x0, priority: 14 timeout: 0
        state: pending, entry: 0x8002bad
        stack size 768, unused 584, usage 184 / 768 (23 %)

 0x200214c0 idle
        options: 0x1, priority: 15 timeout: 0
        state: , entry: 0x80134c3
        stack size 320, unused 256, usage 64 / 320 (20 %)

uart:~$ kernel stacks
0x20021650 sysworkq   (real size 1024):      unused  832     usage  192 / 1024 (18 %)
0x20020a80 shell_uart (real size 2048):      unused  944     usage 1104 / 2048 (53 %)
0x20020588 logging    (real size  768):      unused  584     usage  184 /  768 (23 %)
0x200214c0 idle       (real size  320):      unused  256     usage   64 /  320 (20 %)
0x20025400 IRQ 00     (real size 2048):      unused 1684     usage  364 / 2048 (17 %)

uart:~$ _