|
| 1 | +# West Manifest Setup for RP2040/RP2350 |
| 2 | + |
| 3 | +This project uses a minimal West manifest (`west.yml`) optimized specifically for Raspberry Pi RP2040 and RP2350 builds. This significantly reduces setup time and disk space compared to the full Zephyr workspace. |
| 4 | + |
| 5 | +## What's Included |
| 6 | + |
| 7 | +The minimal manifest includes only the essential modules for RP2040/RP2350: |
| 8 | + |
| 9 | +- **Zephyr RTOS core** (v4.2.0) |
| 10 | +- **hal_rpi_pico** - Raspberry Pi Pico Hardware Abstraction Layer (REQUIRED) |
| 11 | +- **hal_st** - STMicroelectronics HAL (for LIS2MDL, LSM6DSO sensors) |
| 12 | +- **cmsis** - ARM CMSIS support for Cortex-M processors |
| 13 | +- **cmsis_6** - ARM CMSIS v6 (required for Cortex-M33 in RP2350) |
| 14 | +- **picolibc** - Lightweight C library |
| 15 | +- **loramac-node** - LoRa/LoRaWAN support (for SX127x radios) |
| 16 | +- **mbedtls** - Cryptographic library |
| 17 | +- **tinycrypt** - Lightweight cryptographic library |
| 18 | +- **mcuboot** - Bootloader support |
| 19 | + |
| 20 | +## Fresh Installation |
| 21 | + |
| 22 | +### Option A: Automated Setup (Recommended) |
| 23 | + |
| 24 | +Use the convenience script that handles everything: |
| 25 | + |
| 26 | +```bash |
| 27 | +./scripts/setup-minimal-zephyr.sh |
| 28 | +``` |
| 29 | + |
| 30 | +This script will: |
| 31 | +1. Initialize the West workspace |
| 32 | +2. Download only the minimal modules |
| 33 | +3. Export the Zephyr CMake package |
| 34 | +4. Install only the ARM toolchain (~95 MB instead of ~1.2 GB) |
| 35 | + |
| 36 | +### Option B: Manual Setup |
| 37 | + |
| 38 | +If you prefer to run the commands manually: |
| 39 | + |
| 40 | +```bash |
| 41 | +# Initialize west workspace with this manifest |
| 42 | +west init -l . |
| 43 | + |
| 44 | +# Update all projects (downloads only the minimal set of modules) |
| 45 | +west update |
| 46 | + |
| 47 | +# Export Zephyr CMake package |
| 48 | +west zephyr-export |
| 49 | + |
| 50 | +# Install Zephyr SDK with ONLY the ARM toolchain (for RP2040/RP2350) |
| 51 | +# This avoids downloading 500+ MB of unnecessary toolchains |
| 52 | +cd lib/zephyr-workspace/zephyr |
| 53 | +python3 scripts/sdk-install/sdk_install.py --toolchains arm-zephyr-eabi |
| 54 | +cd ../../.. |
| 55 | +``` |
| 56 | + |
| 57 | +## Migrating from Full Zephyr Workspace |
| 58 | + |
| 59 | +If you already have a full Zephyr workspace installed: |
| 60 | + |
| 61 | +### Option 1: Clean Start (Recommended) |
| 62 | + |
| 63 | +```bash |
| 64 | +# Backup any local changes first! |
| 65 | + |
| 66 | +# Remove the old workspace |
| 67 | +rm -rf lib/zephyr-workspace |
| 68 | + |
| 69 | +# Initialize with the new minimal manifest |
| 70 | +west init -l . |
| 71 | + |
| 72 | +# Update with minimal modules |
| 73 | +west update |
| 74 | + |
| 75 | +# Export Zephyr CMake package |
| 76 | +west zephyr-export |
| 77 | + |
| 78 | +# Install only the ARM toolchain |
| 79 | +cd lib/zephyr-workspace/zephyr |
| 80 | +python3 scripts/sdk-install/sdk_install.py --toolchains arm-zephyr-eabi |
| 81 | +cd ../../.. |
| 82 | +``` |
| 83 | + |
| 84 | +### Option 2: Update Existing Workspace |
| 85 | + |
| 86 | +```bash |
| 87 | +# Update west configuration to use the new manifest |
| 88 | +west config manifest.path . |
| 89 | + |
| 90 | +# Update all projects |
| 91 | +west update |
| 92 | +``` |
| 93 | + |
| 94 | +## Disk Space Savings |
| 95 | + |
| 96 | +- **Full Zephyr workspace**: ~3-5 GB |
| 97 | +- **Minimal RP2040/RP2350 workspace**: ~500-800 MB |
| 98 | + |
| 99 | +This represents approximately **80-85% reduction** in disk space and download time. |
| 100 | + |
| 101 | +## Zephyr SDK Optimization |
| 102 | + |
| 103 | +The default Zephyr SDK installation downloads toolchains for all supported architectures (~1+ GB). Since this project only targets RP2040/RP2350 (ARM Cortex-M), you only need the `arm-zephyr-eabi` toolchain (~95 MB). |
| 104 | + |
| 105 | +### Installing Only the ARM Toolchain |
| 106 | + |
| 107 | +Instead of running the default SDK setup, use the selective installation: |
| 108 | + |
| 109 | +```bash |
| 110 | +cd lib/zephyr-workspace/zephyr |
| 111 | +python3 scripts/sdk-install/sdk_install.py --toolchains arm-zephyr-eabi |
| 112 | +``` |
| 113 | + |
| 114 | +This installs **only**: |
| 115 | +- `arm-zephyr-eabi` - ARM Cortex-M toolchain (required for RP2040/RP2350) |
| 116 | + |
| 117 | +This avoids downloading unnecessary toolchains for: |
| 118 | +- aarch64, arc64, arc, microblazeel, mips, nios2, riscv64, rx, sparc, x86_64, xtensa |
| 119 | + |
| 120 | +### SDK Space Savings |
| 121 | + |
| 122 | +- **Full SDK (all toolchains)**: ~1.2 GB |
| 123 | +- **ARM-only SDK**: ~95 MB |
| 124 | + |
| 125 | +This represents a **~92% reduction** in SDK size. |
| 126 | + |
| 127 | +### Reinstalling SDK with Minimal Toolchains |
| 128 | + |
| 129 | +If you've already installed the full SDK and want to reclaim disk space: |
| 130 | + |
| 131 | +```bash |
| 132 | +# Remove existing SDK (backs up ~1+ GB of space) |
| 133 | +rm -rf ~/zephyr-sdk-* |
| 134 | + |
| 135 | +# Install minimal SDK with only ARM toolchain |
| 136 | +cd lib/zephyr-workspace/zephyr |
| 137 | +python3 scripts/sdk-install/sdk_install.py --toolchains arm-zephyr-eabi |
| 138 | +cd - |
| 139 | +``` |
| 140 | + |
| 141 | +**Note**: Your existing builds will continue to work after reinstalling with the ARM-only toolchain since this project only uses RP2040/RP2350 boards. |
| 142 | + |
| 143 | +## Adding Additional Modules |
| 144 | + |
| 145 | +If your project requires additional Zephyr modules, you can add them to the `west.yml` file. For example: |
| 146 | + |
| 147 | +### Adding Filesystem Support |
| 148 | + |
| 149 | +```yaml |
| 150 | +- name: littlefs |
| 151 | + path: lib/zephyr-workspace/modules/fs/littlefs |
| 152 | + groups: |
| 153 | + - fs |
| 154 | + revision: 8f5ca347843363882619d8f96c00d8dbd88a8e79 |
| 155 | +``` |
| 156 | +
|
| 157 | +### Adding Display/GUI Support |
| 158 | +
|
| 159 | +```yaml |
| 160 | +- name: lvgl |
| 161 | + revision: b03edc8e6282a963cd312cd0b409eb5ce263ea75 |
| 162 | + path: lib/zephyr-workspace/modules/lib/gui/lvgl |
| 163 | +``` |
| 164 | +
|
| 165 | +After modifying `west.yml`, run: |
| 166 | + |
| 167 | +```bash |
| 168 | +west update |
| 169 | +``` |
| 170 | + |
| 171 | +## Verifying Your Setup |
| 172 | + |
| 173 | +To verify that your workspace is properly configured: |
| 174 | + |
| 175 | +```bash |
| 176 | +# Check west status |
| 177 | +west list |
| 178 | +
|
| 179 | +# Try building for one of your boards |
| 180 | +west build -b proves_flight_control_board_v5c FprimeZephyrReference/ReferenceDeployment |
| 181 | +``` |
| 182 | + |
| 183 | +## Troubleshooting |
| 184 | + |
| 185 | +### "Module not found" errors during build |
| 186 | + |
| 187 | +If you encounter errors about missing modules during build, you may need to add that specific module to `west.yml`. Check the error message for the module name and add it following the pattern in the manifest. |
| 188 | + |
| 189 | +### Reverting to Full Manifest |
| 190 | + |
| 191 | +If you need the full Zephyr workspace: |
| 192 | + |
| 193 | +```bash |
| 194 | +# Update west configuration to use Zephyr's manifest |
| 195 | +west config manifest.path lib/zephyr-workspace/zephyr |
| 196 | +
|
| 197 | +# Update to get all modules |
| 198 | +west update |
| 199 | +``` |
| 200 | + |
| 201 | +## Module Version Updates |
| 202 | + |
| 203 | +To update module versions: |
| 204 | + |
| 205 | +1. Check the latest revisions in [Zephyr's west.yml](https://github.com/zephyrproject-rtos/zephyr/blob/main/west.yml) |
| 206 | +2. Update the `revision` field for each module in your `west.yml` |
| 207 | +3. Run `west update` |
| 208 | + |
| 209 | +## References |
| 210 | + |
| 211 | +- [West Manifest Documentation](https://docs.zephyrproject.org/latest/develop/west/manifest.html) |
| 212 | +- [Zephyr Getting Started](https://docs.zephyrproject.org/latest/develop/getting_started/index.html) |
0 commit comments