-
Notifications
You must be signed in to change notification settings - Fork 305
Add learning path for MNIST inference on Alif E8 with Ethos-U85 #3506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Kwash45
wants to merge
6
commits into
ArmDeveloperEcosystem:main
Choose a base branch
from
Kwash45:observing-ethos-u-on-alif
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b0de88a
Add Alif Ethos-U learning path
fidel-makatia e7940ef
Update CMSIS-Toolbox install instructions with official Arm guide
fidel-makatia 3f6fafd
Merge remote-tracking branch 'upstream/main' into observing-ethos-u-o…
Kwash45 ea92035
replacing urls
Kwash45 db5e3eb
Update Ethos-U learning path content
Kwash45 fbd7500
addressing comments by Matt
Kwash45 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
...ing-paths/embedded-and-microcontrollers/observing-ethos-u-on-alif/1-overview.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| --- | ||
| title: Overview | ||
| weight: 2 | ||
| layout: learningpathall | ||
| --- | ||
|
|
||
| ## Overview | ||
|
|
||
| [MNIST](https://en.wikipedia.org/wiki/MNIST_database), widely classified as the "Hello World" of machine learning, is a dataset containing 70,000 28x28 pixel grayscale images of handwritten digits 0-9. It is commonly used for training image processing systems. | ||
|
|
||
| In this Learning Path, you will run an MNIST digit-classification model on the Arm Ethos-U85 NPU. You can either use the provided `.pte` model or follow an optional walkthrough to train and export your own MNIST model. | ||
|
|
||
| ## Hardware Overview - Alif Ensemble E8 Series | ||
|
|
||
| The Alif Ensemble E8 DevKit features two dual-core Arm processors (Cortex-A32 and Cortex-M55) and three neural processing units (NPUs): two Ethos-U55 and one Ethos-U85. | ||
|
|
||
| <div style="text-align:center;"> | ||
| <img src="/learning-paths/embedded-and-microcontrollers/observing-ethos-u-on-alif/alif-ensemble-e8-board-soc-highlighted.jpg" alt="Alif Ensemble E8 Board SoC highlighted" title="Arm Ethos-U NPU location" style="max-width:800px; width:100%;" /> | ||
| <div style="font-style:italic;">Arm Ethos-U NPU location</div> | ||
| </div> | ||
|
|
||
| ### Connecting to the DevKit | ||
|
|
||
| - Unplug all USB cables from the DevKit before changing any jumpers. | ||
|
|
||
| - Verify that the jumpers are in their factory default positions, as shown in the Alif Ensemble E8 DevKit (DK-E8) User Guide on [alifsemi.com](https://alifsemi.com/support/kits/ensemble-e8devkit/). | ||
|
|
||
| - Connect a USB-C cable from your computer to the PRG USB port on the bottom edge of the DevKit. | ||
|
|
||
|  | ||
| - Confirm that a green LED illuminates near the E1 device and the UART switch (SW4). | ||
|
|
||
| Leave SW4 in its default position. This routes the on-board USB UART to SEUART, which the Alif Security Toolkit (SETOOLS) uses for programming. | ||
|
|
||
| #### Verify USB connection | ||
|
|
||
| Check that your computer recognizes the DevKit: | ||
|
|
||
| {{< tabpane code=true >}} | ||
| {{< tab header="macOS" language="bash">}} | ||
| ls /dev/cu.* | ||
| {{< /tab >}} | ||
|
|
||
| {{< tab header="Linux" language="bash">}} | ||
| ls /dev/ttyACM* /dev/ttyUSB* 2>/dev/null | ||
| {{< /tab >}} | ||
|
|
||
| {{< tab header="Windows" language="powershell">}} | ||
| Get-CimInstance Win32_SerialPort | Select-Object DeviceID,Name,Description | ||
| {{< /tab >}} | ||
| {{< /tabpane >}} | ||
|
|
||
| {{% notice Important %}} | ||
| Close any terminal application that’s connected to SEUART, such as PuTTY, minicom, or screen, before you use the Security Toolkit (SETOOLS). The DevKit exposes only one SEUART interface, so SETOOLS can’t access the port if another application is already using it. | ||
| {{% /notice %}} | ||
|
|
||
| You should see a SEGGER J-Link device. If you are unsure which entry belongs to the DevKit, run the command before and after connecting the board and compare the output. In the case where no device appears, check that the USB cable is connected to the **PRG USB** port and that the cable supports data, not only charging. |
161 changes: 161 additions & 0 deletions
161
.../embedded-and-microcontrollers/observing-ethos-u-on-alif/2-tool-installation.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,161 @@ | ||
| --- | ||
| title: Install development tools | ||
| weight: 3 | ||
| layout: learningpathall | ||
| --- | ||
|
|
||
| ## Overview | ||
|
|
||
| This section covers installing all required tools for ExecuTorch development on the Alif Ensemble E8 DevKit. | ||
|
|
||
|
|
||
| Start by creating a project directory: | ||
| {{< tabpane code=true >}} | ||
| {{< tab header="macOS / Linux" language="bash" >}} | ||
| mkdir -p ~/mnist_alif | ||
| {{< /tab >}} | ||
|
|
||
| {{< tab header="Windows (PowerShell)" language="powershell" >}} | ||
| New-Item -ItemType Directory -Force -Path ~\mnist_alif | ||
| {{< /tab >}} | ||
| {{< /tabpane >}} | ||
|
|
||
| ## Install SETOOLS | ||
|
|
||
| SETOOLS (Secure Enclave Tools) is Alif's toolset for flashing firmware to MRAM via the Secure Enclave. | ||
|
|
||
| - Download the SETOOLS package from the [Alif Ensemble E8 DevKit support page](https://alifsemi.com/support/kits/ensemble-e8devkit/) and extract it to `~/mnist_alif`. | ||
| Make sure to edit the command below with the name of your `.tar` or `.zip` file. | ||
| {{< tabpane code=true >}} | ||
| {{< tab header="macOS / Linux" language="bash" >}} | ||
| cd ~/Downloads | ||
| tar xvf <replace_with_your_alif_security_toolkit_download.tar> -C ~/mnist_alif | ||
| {{< /tab >}} | ||
|
|
||
| {{< tab header="Windows (PowerShell)" language="powershell" >}} | ||
| cd ~/Downloads | ||
| Expand-Archive <.\replace_with_your_alif_security_toolkit_download.zip> -DestinationPath ~\mnist_alif | ||
| {{< /tab >}} | ||
| {{< /tabpane >}} | ||
|
|
||
| - Verify the installation. The extracted folder name can vary by SETOOLS release. The commands below assume the package extracts to `app-release-exec-*`. | ||
| Each command should print a `usage:` message. If either command fails, check that you are in the extracted SETOOLS directory for your operating system. | ||
| {{< tabpane code=true >}} | ||
| {{< tab header="macOS" language="bash" >}} | ||
| cd ~/mnist_alif/app-release-exec-macos | ||
| ./app-write-mram -h | ||
| ./app-gen-toc -h | ||
| {{< /tab >}} | ||
| {{< tab header="Linux" language="bash" >}} | ||
| cd ~/mnist_alif/app-release-exec-linux | ||
| ./app-write-mram -h | ||
| ./app-gen-toc -h | ||
| {{< /tab >}} | ||
| {{< tab header="Windows" language="powershell" >}} | ||
| cd ~\mnist_alif\app-release-exec-windows | ||
| .\app-write-mram.exe -h | ||
| .\app-gen-toc.exe -h | ||
| {{< /tab >}} | ||
| {{< /tabpane >}} | ||
|
|
||
| {{% notice Important %}} | ||
| On macOS, the system may block the unsigned binary the first time you run it. If this happens, open **System Settings** or **System Preferences**, go to **Privacy & Security**, and select **Allow Anyway**. Then run the command again. (You may need to reapprove for both ./app-* commands) | ||
| {{% /notice %}} | ||
|
|
||
|
|
||
| ## Install J-Link | ||
|
|
||
| SEGGER J-Link provides the debug connection for RTT (Real-Time Transfer) output, which you use later to view inference results. | ||
| Version 7.94 or later is required for Alif Ensemble E8 support. | ||
|
|
||
| {{< tabpane code=true >}} | ||
| {{< tab header="macOS" language="bash">}} | ||
| brew install --cask segger-jlink | ||
| JLinkExe --version | ||
| {{< /tab >}} | ||
| {{< tab header="Linux" language="bash">}} | ||
| wget https://www.segger.com/downloads/jlink/JLink_Linux_x86_64.deb | ||
| sudo dpkg -i JLink_Linux_x86_64.deb | ||
| JLinkExe --version | ||
| {{< /tab >}} | ||
| {{< tab header="Windows" language="text">}} | ||
| 1. Download installer from https://www.segger.com/downloads/jlink/ | ||
| 2. Run the installer and follow prompts | ||
| 3. Verify in Command Prompt: JLink.exe --version | ||
| {{< /tab >}} | ||
| {{< /tabpane >}} | ||
|
|
||
|
|
||
| ## Set up the Alif VS Code template | ||
| - Clone the Alif VS Code template repository and checkout to a known-working commit. This is to avoid breakage if the template has been updated. | ||
| ```bash | ||
| cd ~/mnist_alif | ||
| git clone https://github.com/alifsemi/alif_vscode-template.git | ||
| cd alif_vscode-template | ||
| git checkout 8b1aa0b09eacf68a28850af00c11f0b5af03c100 | ||
| git submodule update --init | ||
| ``` | ||
|
|
||
| - Open the project in VS Code: | ||
| ```bash | ||
| code . | ||
| ``` | ||
| VS Code might prompt you to install the recommended extensions for this workspace. If it does, install the following: | ||
|
|
||
| - Arm CMSIS Solution | ||
| - Arm Tools Environment Manager | ||
| - Cortex-Debug | ||
| - Microsoft C/C++ Extension Pack | ||
|
|
||
| When prompted, select **Always Allow** or **Allow for Selected Workspace**. | ||
|
|
||
| The recommended VS Code extensions are listed in .vscode/extensions.json. If you don’t get an automatic trigger to enable them, you can open the Extensions view and look for a “Workspace Recommendations” section to install or enable them manually. | ||
|
|
||
| Restart VS Code if prompted. | ||
|
|
||
| ## Install CMSIS packs | ||
| CMSIS (Common Microcontroller Software Interface Standard) is a set of APIs, software components, and metadata that simplifies development on Arm Cortex-M processors. | ||
| Installing the CMSIS pack will provide the device definitions, startup files, drivers, and middleware components we need for our Alif E8 target. To install, follow these steps: | ||
|
|
||
| In VS Code, open the Command Palette using **Ctrl+Shift+P** on Windows/Linux or **Command+Shift+P** on macOS. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a very concise note - what is CMSIS and why do we install these packs? |
||
|
|
||
| Click **Tasks: Run Task**, then select **First time pack installation**. When prompted, press **A** to accept all licenses. | ||
|
|
||
| If the task does not appear, run **Developer: Reload Window** from the Command Palette and try again. | ||
|
|
||
| ## Configure VS Code settings | ||
|
|
||
| VS Code need to know where the external Alif SETOOLS and SEGGER J-Link tools are installed. | ||
|
|
||
| Open the Command Palette and run **Preferences: Open User Settings (JSON)**. | ||
|
|
||
| Add the following settings, updating the paths for your operating system: | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a very concise note - what is this step doing by adding these paths? |
||
| ```json | ||
| { | ||
| "alif.setools.root": "path/to/your/setools-folder", | ||
| "cortex-debug.JLinkGDBServerPath": "/Applications/SEGGER/JLink/JLinkGDBServerCLExe" | ||
| } | ||
| ``` | ||
| If your settings file already contains entries, add only these two settings inside the existing braces. | ||
|
|
||
| ### Verify your toolchain with Blinky | ||
| Before moving on to the ML application, build and flash the built-in Blinky example. | ||
| - In VS Code, select the **CMSIS** icon in the left sidebar. | ||
| - Select the **gear icon**. | ||
| - Set **Active Target** to **E8-HE**. | ||
| - Set **Active Project** to **blinky**. | ||
| - Select the **Build** (hammer) icon. | ||
| - Open the **Command Palette** and run **Tasks: Run Task**. | ||
| - Select **Program with Security Toolkit (select COM port)**. | ||
| - Choose the DevKit port when prompted. | ||
|
|
||
| If the RGB LED blinks, your VS Code setup, CMSIS packs, SETOOLS configuration, and board connection are working. | ||
|
|
||
| ## Summary | ||
|
|
||
| You have installed: | ||
| - ✅ SETOOLS for flashing firmware to MRAM | ||
| - ✅ J-Link (7.94+) for programming and debugging | ||
| - ✅ Required VS Code extensions & CMSIS packs | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a note confirming expected output (not a full trace but along the lines of you will see the help menu for each command.