Bluetooth: shell: add bsim runner script
Spawns n instances of the bt-shell in separate xterm windows. Assumes in-tree build of the shell, can optionally specify another .exe image. Also add snippet for that use-case (`-S xterm-native-shell`). Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
This commit is contained in:
parent
e1b7b450c8
commit
f3f42d363b
43
tests/bluetooth/shell/run-bsim.sh
Executable file
43
tests/bluetooth/shell/run-bsim.sh
Executable file
@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright (c) 2024 Nordic Semiconductor
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set -e
|
||||
set -u
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Usage: run.sh <number_of_devices> [exe_image]"
|
||||
shift
|
||||
fi
|
||||
|
||||
if [ $# -gt 2 ]; then
|
||||
echo "Too many args"
|
||||
shift
|
||||
fi
|
||||
|
||||
echo "Starting simulation. Hit Ctrl-C to exit."
|
||||
|
||||
# Build it with e.g.
|
||||
# cd $ZEPHYR_BASE/tests/bluetooth/shell
|
||||
# west build -d build -b nrf52_bsim -S xterm-native-shell $ZEPHYR_BASE/tests/bluetooth/shell
|
||||
default_image=${ZEPHYR_BASE}/tests/bluetooth/shell/build/zephyr/zephyr.exe
|
||||
|
||||
num_devices=$1
|
||||
image="${2:-"${default_image}"}"
|
||||
|
||||
# Cleanup all existing sims
|
||||
$BSIM_OUT_PATH/components/common/stop_bsim.sh
|
||||
|
||||
# Force sim to real-time
|
||||
pushd $BSIM_OUT_PATH/components/device_handbrake
|
||||
./bs_device_handbrake -s=shell-sim -r=10 -d=0 &
|
||||
popd
|
||||
|
||||
for dev_id in $(seq 1 ${num_devices}); do
|
||||
echo "Start device $dev_id"
|
||||
$image -s=shell-sim -d=$dev_id -RealEncryption=1 -rs=$dev_id -attach_uart -wait_uart &
|
||||
done
|
||||
|
||||
# Start the PHY
|
||||
pushd $BSIM_OUT_PATH/bin
|
||||
$BSIM_OUT_PATH/bin/bs_2G4_phy_v1 -s=shell-sim -D=$((num_devices+=1))
|
||||
@ -0,0 +1,4 @@
|
||||
name: xterm-native-shell
|
||||
append:
|
||||
EXTRA_CONF_FILE: xterm-native-shell.conf
|
||||
EXTRA_DTC_OVERLAY_FILE: xterm-native-shell.overlay
|
||||
@ -0,0 +1,4 @@
|
||||
CONFIG_NATIVE_UART_0_ON_OWN_PTY=y
|
||||
CONFIG_UART_NATIVE_WAIT_PTS_READY_ENABLE=y
|
||||
CONFIG_SHELL_BACKEND_SERIAL_RX_RING_BUFFER_SIZE=8192
|
||||
CONFIG_LOG_PRINTK=n
|
||||
@ -0,0 +1,25 @@
|
||||
/ {
|
||||
chosen {
|
||||
zephyr,console = &uart0;
|
||||
zephyr,shell-uart = &uart0;
|
||||
};
|
||||
};
|
||||
|
||||
/* Use the PTY driver instead of the UART peripheral emulation that is now the
|
||||
* default on nrf52_bsim. */
|
||||
|
||||
&uart1 {
|
||||
status = "okay";
|
||||
compatible = "zephyr,native-posix-uart";
|
||||
/delete-property/ pinctrl-0;
|
||||
/delete-property/ pinctrl-1;
|
||||
/delete-property/ pinctrl-names;
|
||||
};
|
||||
|
||||
&uart0 {
|
||||
status = "okay";
|
||||
compatible = "zephyr,native-posix-uart";
|
||||
/delete-property/ pinctrl-0;
|
||||
/delete-property/ pinctrl-1;
|
||||
/delete-property/ pinctrl-names;
|
||||
};
|
||||
Loading…
Reference in New Issue
Block a user