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 QEMU Emulation for X86 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

Hint

Exit QEMU by pressing CTRL+A x.

Also it can be built and executed on following targets:

  • As Native simulator - native_sim, fancy command set mode:

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

    Hint

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

    ./build/helloshell-native_sim/zephyr/zephyr.exe -attach_uart
    
  • As emulation in QEMU Emulation for ARM Cortex-M3, 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 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 Nucleo F746ZG board, tiny command set mode for an absolutely minimal environment (lowest memory footprint):

    west build -b nucleo_f746zg -p -d build/helloshell-nucleo_f746zg bridle/samples/helloshell -- -DEXTRA_CONF_FILE="prj-tiny.conf"
    west flash -d build/helloshell-nucleo_f746zg
    
  • On Nucleo F746ZG board, minimal command set mode for basic system operations:

    west build -b nucleo_f746zg -p -d build/helloshell-nucleo_f746zg bridle/samples/helloshell -- -DEXTRA_CONF_FILE="prj-minimal.conf"
    west flash -d build/helloshell-nucleo_f746zg
    
  • On Nucleo F746ZG board, helpful command set mode for hardware startups and bug hunting:

    west build -b nucleo_f746zg -p -d build/helloshell-nucleo_f746zg bridle/samples/helloshell -- -DEXTRA_CONF_FILE="prj-hwstartup.conf"
    west flash -d build/helloshell-nucleo_f746zg
    
  • On Nucleo F746ZG board, fancy command set mode (implies prj.conf merged with board specific configuration):

    west build -b nucleo_f746zg -p -d build/helloshell-nucleo_f746zg bridle/samples/helloshell
    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        date       device     devmem
  eeprom     flash      gpio       hello      help       history    hwinfo
  i2c        kernel     led        log        pwm        regulator  rem
  resize     retval     rtc        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
  date       : Date 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>
  eeprom     : EEPROM shell commands
  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 4.3.99

uart:~$ bridle version
Bridle version 4.3.99

uart:~$ bridle version long
Bridle version 4.3.99.0

uart:~$ bridle info
Zephyr: 4.3.99
Bridle: 4.3.99
uart:~$ kernel uptime
Uptime: 327750 ms

uart:~$ kernel cycles
cycles: 3586181929 hw cycles
uart:~$ kernel thread list
Scheduler: 792 since last call
Threads:
*0x20010990 shell_uart
        options: 0x0, priority: 14 timeout: 0
        state: queued, entry: 0x8005025
        stack size 2048, unused 1008, usage 1040 / 2048 (50 %)

 0x20010d10
        options: 0x0, priority: 0 timeout: 0
        state: pending, entry: 0x8006d09
        stack size 1024, unused 832, usage 192 / 1024 (18 %)

 0x20010490 logging
        options: 0x0, priority: 14 timeout: 0
        state: pending, entry: 0x8002aed
        stack size 768, unused 568, usage 200 / 768 (26 %)

 0x20011610 idle
        options: 0x1, priority: 15 timeout: 0
        state: , entry: 0x8015079
        stack size 320, unused 256, usage 64 / 320 (20 %)
uart:~$ kernel thread stacks
0x20010990 shell_uart      (real size 2048):   unused 1008     usage 1040 / 2048 (50 %)
0x20010d10                 (real size 1024):   unused  832     usage  192 / 1024 (18 %)
0x20010490 logging         (real size  768):   unused  568     usage  200 /  768 (26 %)
0x20011610 idle            (real size  320):   unused  256     usage   64 /  320 (20 %)
0x20015900 IRQ 00          (real size 2048):   unused 1752     usage  296 / 2048 (14 %)

TCP/IP Network over Wi-Fi on the RPi Pico W or 2W

This project provides an extended board-specific configuration for the RPi Pico W or RPi Pico 2W with a pre-activated TCP/IP network stack via the Wi-Fi chip made by Infineon. It have to build at least with the Zephyr upstream Wi-Fi IPv4 and IPv6 Snippet (wifi-ip) and optional with the Bridle USB Console Snippet (usb-console):

For the RPi Pico W:

west build -b rpi_pico/rp2040/w -p -S "usb-console wifi-ip" -d build/helloshell-rpi_pico_w bridle/samples/helloshell
west flash -r uf2 -d build/helloshell-rpi_pico_w

For the RPi Pico 2W:

west build -b rpi_pico2/rp2350/m33/w -p -S "usb-console wifi-ip" -d build/helloshell-rpi_pico2_w bridle/samples/helloshell
west flash -r uf2 -d build/helloshell-rpi_pico2_w

You should see the following message on the console (e.g. on RPi Pico W):

WLAN MAC Address : 29:F7:28:FC:67:1C
WLAN Firmware    : wl0: Jun  5 2024 06:33:59 version 7.95.88 (cf1d613 CY) FWID 01-7b7cf51a
WLAN CLM         : API: 12.2 Data: 9.10.39 Compiler: 1.29.4 ClmImport: 1.36.3 Creation: 2024-04-16 21:20:55
WHD VERSION      : 3.3.2.25168 : v3.3.2 : GCC 12.2 : 2024-12-06 06:53:17 +0000

*** Booting Zephyr OS build v4.3.99***
Hello World! I'm THE SHELL from rpi_pico
[00:00:07.325,000] <inf> net_config: Initializing network
[00:00:07.325,000] <inf> net_config: Waiting interface 1 (0x20001bf0) to be up...
[00:00:07.325,000] <inf> net_config: Running dhcpv4 client...
[00:00:07.326,000] <inf> net_config: Running dhcpv6 client...

Simple test execution on target

(text in bold is a command input)