|
1 | | -# nshtask |
| 1 | +# Apache NuttX RTOS: NSH Task Demo |
| 2 | + |
| 3 | +To build and run this NSH Demo App... |
| 4 | + |
| 5 | +1. Install the Build Prerequisites, skip the RISC-V Toolchain... |
| 6 | + |
| 7 | + ["Install Prerequisites"](https://lupyuen.github.io/articles/nuttx#install-prerequisites) |
| 8 | + |
| 9 | +1. Download the ARM64 Toolchain for |
| 10 | + AArch64 Bare-Metal Target `aarch64-none-elf` |
| 11 | + |
| 12 | + [Arm GNU Toolchain Downloads](https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads) |
| 13 | + |
| 14 | + (Skip the section for Beta Releases) |
| 15 | + |
| 16 | +1. Add the downloaded toolchain to the `PATH` Environment Variable... |
| 17 | + |
| 18 | + ```text |
| 19 | + gcc-arm-...-aarch64-none-elf/bin |
| 20 | + ``` |
| 21 | +
|
| 22 | + Check the ARM64 Toolchain... |
| 23 | +
|
| 24 | + ```bash |
| 25 | + aarch64-none-elf-gcc -v |
| 26 | + ``` |
| 27 | +
|
| 28 | +1. Download NuttX... |
| 29 | +
|
| 30 | + ```bash |
| 31 | + mkdir nuttx |
| 32 | + cd nuttx |
| 33 | + git clone https://github.com/apache/nuttx nuttx |
| 34 | + git clone https://github.com/apache/nuttx-apps apps |
| 35 | + cd nuttx |
| 36 | + ``` |
| 37 | +
|
| 38 | +1. Add `nshtask` to our NuttX Project... |
| 39 | +
|
| 40 | + ```bash |
| 41 | + pushd ../apps/examples |
| 42 | + git submodule add https://github.com/lupyuen/nshtask |
| 43 | + popd |
| 44 | + ``` |
| 45 | +
|
| 46 | +1. Configure our NuttX Project... |
| 47 | +
|
| 48 | + ```bash |
| 49 | + tools/configure.sh -l qemu-armv8a:nsh |
| 50 | + make menuconfig |
| 51 | + ``` |
| 52 | +
|
| 53 | +1. In "Application Configuration > Examples" |
| 54 | +
|
| 55 | + Enable "NSH Task Demo" |
| 56 | +
|
| 57 | +1. Optional: If we wish to start `nshtask` when NuttX boots... |
| 58 | +
|
| 59 | + In "RTOS Features > Tasks and Scheduling" |
| 60 | +
|
| 61 | + Set "Application entry point" to `nshtask_main` |
| 62 | +
|
| 63 | + Set "Application entry name" to `nshtask_main` |
| 64 | +
|
| 65 | +1. Save the configuration and exit `menuconfig` |
| 66 | +
|
| 67 | +1. Build NuttX... |
| 68 | +
|
| 69 | + ```bash |
| 70 | + make |
| 71 | + ``` |
| 72 | +
|
| 73 | +1. Run with QEMU... |
| 74 | +
|
| 75 | + ```bash |
| 76 | + qemu-system-aarch64 -cpu cortex-a53 -nographic \ |
| 77 | + -machine virt,virtualization=on,gic-version=3 \ |
| 78 | + -net none -chardev stdio,id=con,mux=on -serial chardev:con \ |
| 79 | + -mon chardev=con,mode=readline -kernel ./nuttx |
| 80 | + ``` |
| 81 | +
|
| 82 | +1. At the NSH Prompt, enter... |
| 83 | +
|
| 84 | + ```bash |
| 85 | + nshtask |
| 86 | + ``` |
| 87 | +
|
| 88 | +1. Press Ctrl-C to quit QEMU |
0 commit comments