diff --git a/profile/CICD.md b/profile/CICD.md index e6d2f7b..4d48c39 100644 --- a/profile/CICD.md +++ b/profile/CICD.md @@ -8,6 +8,16 @@ Modern embedded software development requires automated workflows that ensure co ![CI/CD Process Overview](CICD_Overview.png "CI/CD Process Overview") +[GitHub Actions](https://docs.github.com/en/actions) execute build or test jobs on runners. A `*.yml` file in a `.github/workflows` directory of a repository defines a set of tasks such as building and testing pull requests. + +The repositories on [github.com/Arm-Examples](https://github.com/Arm-Examples) use topics to label: + +- [cicd](https://github.com/search?q=topic%3Acicd+org%3AArm-Examples+fork%3Atrue&type=repositories) – repository with automated workflows. +- [simulation](https://github.com/search?q=topic%3Asimulation+org%3AArm-Examples+fork%3Atrue&type=repositories) – repository with test on simulation. +- [hardware](https://github.com/search?q=topic%3Ahardware+org%3AArm-Examples+fork%3Atrue&type=repositories) – repository with test on hardware target. + +[Arm-Software/cmsis-actions](https://github.com/ARM-software/cmsis-actions) are reusable workflows that let you install tools and active software licenses. Use the instructions of these actions to enable other CI/CD systems such as Azure DevOps or GitLab. + ## CI/CD Capabilities for Embedded Development The underlying build system of [Keil Studio](https://www.keil.arm.com/) uses the [CMSIS-Toolbox](https://open-cmsis-pack.github.io/cmsis-toolbox/) and CMake. [GitHub-hosted runners](https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners) provide virtual machines for automated build and execution tests using simulation models, while [self-hosted runners](https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/about-self-hosted-runners) enable testing on actual target hardware. [CI](https://en.wikipedia.org/wiki/Continuous_integration) is streamlined with: @@ -50,7 +60,7 @@ CI pipelines may store build artifact files, reports, and may further automate f ## HIL Testing with pyOCD -[Hardware-in-the-Loop (HIL)](https://en.wikipedia.org/wiki/Hardware-in-the-loop_simulation) testing is enabled with [self-hosted GitHub runners](https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/about-self-hosted-runners) that connect to Linux systems equipped with debug probes. Build artifacts (firmware images) are generated through automated build tests on GitHub-hosted runners, then deployed to self-hosted runners where pyOCD downloads the firmware to target hardware and executes the test suite. +[Hardware-in-the-Loop (HIL)](https://en.wikipedia.org/wiki/Hardware-in-the-loop_simulation) testing is enabled with [self-hosted GitHub runners](RPI_GH_Runner.md) that connect to Linux systems equipped with debug probes. Build artifacts (firmware images) are generated through automated build tests on GitHub-hosted runners, then deployed to self-hosted runners where pyOCD downloads the firmware to target hardware and executes the test suite. ![HIL Integration](https://raw.githubusercontent.com/Arm-Examples/Safety-Example-Infineon-T2G/main/Doc/CI_HIL.png "HIL Integration") diff --git a/profile/ImageSource/images.pptx b/profile/ImageSource/images.pptx index 0c410e6..ba94102 100644 Binary files a/profile/ImageSource/images.pptx and b/profile/ImageSource/images.pptx differ diff --git a/profile/README.md b/profile/README.md index 9d6ff1c..401b143 100644 --- a/profile/README.md +++ b/profile/README.md @@ -7,7 +7,7 @@ Arm-Examples show the usage of Arm technology on various platforms. - [Browse all repositories](https://github.com/orgs/Arm-Examples/repositories?q=archived%3Afalse) - [Recently updated repositories](https://github.com/orgs/Arm-Examples/repositories?sort=updated&?q=archived%3Afalse) - [Popular repositories (most stars)](https://github.com/orgs/Arm-Examples/repositories?sort=stargazers&?q=archived%3Afalse) -- Click on "Most Used Topics" (Desktop Webside only) +- Click on "Most used topics" (Desktop Webside only) ## Featured Examples for Keil MDK @@ -65,7 +65,7 @@ The [MDK Professional Edition](https://www.keil.arm.com/keil-mdk/#mdk-v6-edition ### CI/CD Automation (GitHub Actions) -Most of the above example projects include GitHub actions that run automated CI tests. The following projects help to get started with test automation. Read the section **[CI/CD](CICD.md)** to learn more. +Most of the above example projects include GitHub actions that run automated CI tests. The following projects help to get started with test automation. Test can execute to [FVP simulation models](https://arm-software.github.io/AVH/main/simulation/html/index.html) or [hardware targets using a self-hosted runner](RPI_GH_Runner.md). Read the section **[CI/CD](CICD.md)** to learn more. | Example | Hardware | Content | |:--------|:---------|:---------| diff --git a/profile/RPI_GH_Runner.md b/profile/RPI_GH_Runner.md new file mode 100644 index 0000000..388127e --- /dev/null +++ b/profile/RPI_GH_Runner.md @@ -0,0 +1,457 @@ +# Setup Self-Hosted GitHub Runner on Raspberry Pi 5 + +Setup of Raspberry Pi 5 for test execution + +
+ +This is a step-by-step guide for the configuration of a Raspberry Pi 5 that runs GitHub Actions for test execution on hardware targets. + +- [Setup Self-Hosted GitHub Runner on Raspberry Pi 5](#setup-self-hosted-github-runner-on-raspberry-pi-5) + - [1. Flash Ubuntu to microSD](#1-flash-ubuntu-to-microsd) + - [2. First boot and updates](#2-first-boot-and-updates) + - [3. Register MAC on corporate network](#3-register-mac-on-corporate-network) + - [4. Find IP address](#4-find-ip-address) + - [5. Connect with SSH from remote computer](#5-connect-with-ssh-from-remote-computer) + - [6. Install tools and packs](#6-install-tools-and-packs) + - [7. Add self-hosted runner](#7-add-self-hosted-runner) + - [8. Autostart runner (systemd)](#8-autostart-runner-systemd) + +## 1. Flash Ubuntu to microSD + +Use **Raspberry Pi Imager** to flash (image) Ubuntu Server onto a microSD card. + +- Download Raspberry Pi Imager: [raspberrypi.com/software](https://www.raspberrypi.com/software/) +- Documentation: [Imager install documentation](https://www.raspberrypi.com/documentation/computers/getting-started.html#imager-install) + +Before you start: + +- Download and install Raspberry Pi Imager on a computer with a microSD card reader. +- Insert the microSD card you’ll use with the Raspberry Pi. +- Start Raspberry Pi Imager. + +Use the following settings with the Raspberry Pi Imager: + +- **Device**: Raspberry Pi 5 +- **OS**: Other general-purpose OS → Ubuntu → Ubuntu Server 24.04.3 LTS (64-bit) +- **Storage**: Your microSD card (example: Generic STORAGE DEVICE USB Device) +- **Customization**: + - Enter a unique hostname, for example: `rpi-ci` + - Set locale, time zone, and keyboard layout + - Configure username and password (example: username `devuser`, password `devuser`) + - If the Raspberry Pi is connected via LAN, no Wi-Fi configuration is required + - SSH authentication: enable SSH access. For simplicity, use password authentication (default). +- **Write image**: It summarizes the configuration and lets you confirm the image setup. + +> [!CAUTION] +> Selecting a storage device and writing the image will erase the contents of the microSD card. + +## 2. First boot and updates + +1. **Power up the Raspberry Pi** + - Insert the microSD. + - Connect the Raspberry Pi to the monitor, keyboard, and LAN. + - Power on the Raspberry Pi. + +2. **Boot messages** + - Top left corner: `Ubuntu 24.04.3 LTS rpi-ci tty1` + - The boot process takes a long time during the initial setup because Ubuntu performs several initializations. + - If you see no progress, press **Enter**. + +3. **Login** + Prompt: `devuser@rpi-ci`. Log in with username `devuser` and password `devuser`. + +4. **Welcome screen** + + ```text + Welcome to Ubuntu 24.04.3 LTS (GNU/Linux 6.8.0-1031-raspi aarch64) + ::::: + 74 updates can be applied immediately. + ``` + +5. **Apply available updates** (this may take some time) + + ```bash + sudo apt update # Fetches the list of available updates + sudo apt upgrade # Installs some updates; does not remove packages + sudo apt full-upgrade # Installs updates; may also remove some packages, if needed + sudo apt autoremove # Removes any old packages that are no longer needed + ``` + +## 3. Register MAC on corporate network + +Some corporate networks require **device registration** (often called MAC address postive listing or whitelisting) before a new device can get network access. + +1. Check your corporate IT/network onboarding process. + - Look for a device registration portal, NAC onboarding page, or a helpdesk workflow. + +2. Find the LAN MAC address of your Raspberry Pi 5 with: + + ```bash + ip a + ``` + + In the `eth0` section, the value after `link/ether`, e.g., `88:A2:9E:49:E6:CB` is the LAN (Ethernet) MAC address of your Raspberry Pi 5. + +3. Register the Raspberry Pi's **Ethernet MAC address** (from Section 3) in your corporate system. + - Typical fields are: + - Device name: `rpi-ci` (example) + - Device ID / MAC: `88:A2:9E:49:E6:CB` (example) + - Description: Raspberry Pi 5 (runner) + +4. Wait for approval/propagation (if applicable), then reconnect the Ethernet cable, reboot the Raspberry Pi 5, and continue with the next section. + +## 4. Find IP address + +1. Connect to your Raspberry Pi with keyboard, monitor, and LAN. + - The Raspberry Pi is assigned an IP address. +2. Type: + + ```bash + ip a + ``` + + The value behind `eth0`, e.g. `10.41.0.178` is the assigned IP address that is used in section 5. + +## 5. Connect with SSH from remote computer + +1. Open PowerShell or Bash console and type: + + ```powershell + ssh devuser@10.41.0.178 + ``` + +2. Enter password: `devuser` to complete the connection. + +## 6. Install tools and packs + +1. Update and install build tools and other software + + ```bash + sudo apt update + sudo apt upgrade + sudo apt install cmake ninja-build -y + sudo apt install unzip -y + ``` + +2. Download and install CMSIS-Toolbox (any version newer then 2.14.1) + + ```bash + wget https://artifacts.tools.arm.com/cmsis-toolbox/2.14.1/cmsis-toolbox-linux-arm64.tar.gz + tar -xf cmsis-toolbox-linux-arm64.tar.gz + ``` + +3. Download and install pyOCD (any version newer than 0.44.1) + + ```bash + wget https://github.com/pyocd/pyOCD/releases/download/v0.44.1/pyocd-linux-arm64-0.44.1.zip + mkdir pyocd && cd pyocd + unzip ./../pyocd-linux-arm64-0.44.1.zip + cd .. + ``` + +4. Set up environment variables + + ```bash + export PATH="$HOME/pyocd:$PATH" + export CMSIS_TOOLBOX_ROOT="$HOME/cmsis-toolbox-linux-arm64" + export PATH="$CMSIS_TOOLBOX_ROOT/bin:$PATH" + export CMSIS_PACK_ROOT="$HOME/packs" + ``` + + **IMPORTANT:** Make paths available after a reboot of the Raspberry Pi hardware with: + + ```bash + echo 'export PATH="$HOME/pyocd:$PATH"' >> ~/.bashrc + echo 'export CMSIS_TOOLBOX_ROOT="$HOME/cmsis-toolbox-linux-arm64"' >> ~/.bashrc + echo 'export PATH="$CMSIS_TOOLBOX_ROOT/bin:$PATH"' >> ~/.bashrc + echo 'export CMSIS_PACK_ROOT="$HOME/packs"' >> ~/.bashrc + ``` + + **TIP:** Sanity check `pyOCD` and `cpackget` installation and version numbers: + + ```bash + pyocd --version # expected version 0.44.1 or higher + cpackget --version # expected version 2.2.1 or higher + ``` + +5. Install required software packs + + Install the BSP and DFP software packs for your target hardware. The [`*.cbuild-run.yml`](https://open-cmsis-pack.github.io/cmsis-toolbox/YML-CBuild-Format/#run-and-debug-management) file of your application lists this information. Alternatively, use [www.keil.arm.com/packs](https://www.keil.arm.com/packs) to discover this information. For the NUCLEO-H563ZI, these packs are required: + + ```bash + cpackget add Keil::NUCLEO-H563ZI_BSP@1.1.1 + cpackget add Keil::STM32H5xx_DFP@2.2.0 + ``` + + **NOTE:** This is a one-time installation that depends on the target hardware connected to the Raspberry Pi 5. + +6. Install udev rules (required for USB access) + + The udev rules control how USB devices are detected and what permissions they get. The following examples show typical setups: + + ```bash + # ---- STLINK V3 ---- + sudo wget https://raw.githubusercontent.com/pyocd/pyOCD/main/udev/49-stlinkv3.rules -O /etc/udev/rules.d/49-stlinkv3.rules + + # ---- CMSIS-DAP ---- + sudo wget https://raw.githubusercontent.com/pyocd/pyOCD/main/udev/50-cmsis-dap.rules -O /etc/udev/rules.d/50-cmsis-dap.rules + + # ---- KitProg3 CMSIS-DAP (Cypress) ---- + sudo tee -a /etc/udev/rules.d/99-kitprog3.rules > /dev/null << 'EOF' + # KitProg3 CMSIS-DAP (Cypress) - allow runner user access + SUBSYSTEM=="usb", ATTR{idVendor}=="04b4", ATTR{idProduct}=="f155", MODE="0666", GROUP="plugdev" + EOF + + # ---- Keil USB SDSIO Client ---- + sudo tee -a /etc/udev/rules.d/99-sdsio-client.rules > /dev/null << 'EOF' + # c251:8007 Keil USB SDSIO Client + SUBSYSTEM=="usb", ATTR{idVendor}=="c251", ATTR{idProduct}=="8007", MODE="0666" + EOF + ``` + +7. Reload udev so the new rules take effect: + + ```bash + sudo udevadm control --reload-rules + sudo udevadm trigger + ``` + +8. Ensure plugdev group + + Add your user to `plugdev` for USB device access: + + ```bash + sudo groupadd -f plugdev + sudo usermod -aG plugdev $USER + ``` + +9. Connect the target hardware to Raspberry Pi 5 and verify the debug adapter connection using the `pyOCD list` command. In this example, two debug adapters are connected. Use the Unique ID with the pyOCD option `--uid` to select a specific probe. + + ```bash + pyocd list + + # Probe/Board Unique ID Target + --------------------------------------------------------------------------------------------- + 0 KEIL - Tools By ARM Keil ULINKplus L96807771A n/a + + 1 STLINK-V3 001700054142501320353451 stm32h563zitx NUCLEO-H563ZI + ``` + + + +## 7. Add self-hosted runner + +Use GitHub’s official documentation for the most up-to-date steps: + +- [About self-hosted runners](https://docs.github.com/en/actions/hosting-your-own-runners/about-self-hosted-runners) +- [Adding self-hosted runners](https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/adding-self-hosted-runners) + +High-level flow (GitHub UI will generate the exact commands and a time-limited token): + +1. Decide where to add the runner: repository, organization, or enterprise. +2. In GitHub, go to **Settings** → **Actions** → **Runners**. +3. Click **New self-hosted runner** and select OS/architecture. +4. On the Raspberry Pi, run the **Download**, **Configure**, and **Run** commands shown by GitHub. +5. Verify the runner shows as **Idle** on the Runners page. + +## 8. Autostart runner (systemd) + +It is recommended to use the GitHub `svc.sh` helper that is created after you add/configure the runner on the Raspberry Pi 5. Refer to [Configuring the self-hosted runner application as a service](https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/configuring-the-self-hosted-runner-application-as-a-service). + +1. Open a shell **in the directory where you installed the runner** (the folder that contains `config.sh`). +2. If the runner is currently running interactively, stop it. +3. Install and start the service: + + ```bash + sudo ./svc.sh install + sudo ./svc.sh start + ``` + +4. Check status: + + ```bash + sudo ./svc.sh status + ``` + +> [!NOTE] +> If you need a custom `systemd` unit, GitHub recommends invoking the runner via `runsvc.sh` and using the service template under `bin/` in the runner directory. + + diff --git a/profile/RPi5-setup.png b/profile/RPi5-setup.png new file mode 100644 index 0000000..3c2ef2c Binary files /dev/null and b/profile/RPi5-setup.png differ