-
Notifications
You must be signed in to change notification settings - Fork 145
PolarFire SoC M-Mode, QSPI and L2-LIM support #667
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,4 +4,3 @@ add-symbol-file test-app/image.elf | |
| set pagination off | ||
| foc c | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,7 +19,6 @@ jobs: | |
| build: | ||
| runs-on: ubuntu-24.04 | ||
| timeout-minutes: 30 | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
|
|
@@ -80,26 +79,30 @@ jobs: | |
| - name: Update repository | ||
| run: sudo apt-get update -o Acquire::Retries=3 | ||
|
|
||
| - name: Download and install RISC-V toolchains | ||
| # ============================================================ | ||
| # Prebuilt RISC-V toolchains from riscv-collab | ||
| # https://github.com/riscv-collab/riscv-gnu-toolchain/releases | ||
| # Extracts to: riscv/bin/riscv{32,64}-unknown-elf-* | ||
| # ============================================================ | ||
| - name: Download and install RISC-V toolchain (riscv32) | ||
| if: ${{ inputs.arch == 'riscv' }} | ||
| run: | | ||
| # Download SiFive prebuilt toolchain with newlib | ||
| wget -q https://static.dev.sifive.com/dev-tools/freedom-tools/v2020.12/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14.tar.gz | ||
| tar xzf riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14.tar.gz | ||
| echo "$GITHUB_WORKSPACE/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14/bin" >> $GITHUB_PATH | ||
|
|
||
| # Download latest prebuilt RISC-V toolchains | ||
| #wget -q https://github.com/RISCV-Tools/riscv-gnu-toolchain/releases/latest/download/riscv32-elf-ubuntu-24.04-gcc.tar.xz | ||
| #tar -xf riscv32-elf-ubuntu-24.04-gcc.tar.xz | ||
| #echo "$GITHUB_WORKSPACE/riscv/bin" >> $GITHUB_PATH | ||
| wget -q https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2025.01.17/riscv32-elf-ubuntu-24.04-gcc-nightly-2025.01.17-nightly.tar.xz | ||
| tar -xf riscv32-elf-ubuntu-24.04-gcc-nightly-2025.01.17-nightly.tar.xz | ||
| echo "$GITHUB_WORKSPACE/riscv/bin" >> $GITHUB_PATH | ||
| $GITHUB_WORKSPACE/riscv/bin/riscv32-unknown-elf-gcc --version | ||
|
|
||
| - name: Download and install RISC-V toolchains | ||
| - name: Download and install RISC-V toolchain (riscv64) | ||
| if: ${{ inputs.arch == 'riscv64' }} | ||
| run: | | ||
| wget -q https://github.com/RISCV-Tools/riscv-gnu-toolchain/releases/latest/download/riscv64-elf-ubuntu-24.04-gcc.tar.xz | ||
| tar -xf riscv64-elf-ubuntu-24.04-gcc.tar.xz | ||
| wget -q https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2025.01.17/riscv64-elf-ubuntu-24.04-gcc-nightly-2025.01.17-nightly.tar.xz | ||
| tar -xf riscv64-elf-ubuntu-24.04-gcc-nightly-2025.01.17-nightly.tar.xz | ||
|
Comment on lines
+98
to
+99
|
||
| echo "$GITHUB_WORKSPACE/riscv/bin" >> $GITHUB_PATH | ||
| $GITHUB_WORKSPACE/riscv/bin/riscv64-unknown-elf-gcc --version | ||
|
|
||
| # ============================================================ | ||
| # Build wolfboot | ||
| # ============================================================ | ||
| - name: make clean | ||
| run: | | ||
| make distclean | ||
|
|
@@ -115,10 +118,9 @@ jobs: | |
| - name: Build wolfboot (riscv32) | ||
| if: ${{ inputs.arch == 'riscv' }} | ||
| run: | | ||
| # using riscv64 for now since riscv32-unknown-elf- is missing "zicsr" extension | ||
| make CROSS_COMPILE=riscv64-unknown-elf- FREEDOM_E_SDK=$GITHUB_WORKSPACE/freedom-e-sdk ${{inputs.make-args}} | ||
| make CROSS_COMPILE=riscv32-unknown-elf- FREEDOM_E_SDK=$GITHUB_WORKSPACE/freedom-e-sdk ${{inputs.make-args}} | ||
|
|
||
| - name: Build wolfboot (riscv64)) | ||
| - name: Build wolfboot (riscv64) | ||
| if: ${{ inputs.arch == 'riscv64' }} | ||
| run: | | ||
| make CROSS_COMPILE=riscv64-unknown-elf- ${{inputs.make-args}} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| ARCH?=RISCV64 | ||
| TARGET?=mpfs250 | ||
|
|
||
| # ECC P384 + SHA384 | ||
| SIGN?=ECC384 | ||
| HASH?=SHA384 | ||
| IMAGE_HEADER_SIZE=512 | ||
|
|
||
| WOLFBOOT_VERSION?=1 | ||
| ARMORED?=0 | ||
| DEBUG?=0 | ||
| DEBUG_SYMBOLS?=1 | ||
| DEBUG_UART?=1 | ||
| VTOR?=1 | ||
|
|
||
| NO_XIP?=1 | ||
|
|
||
| NVM_FLASH_WRITEONCE?=0 | ||
| UART_FLASH?=0 | ||
| V?=0 | ||
| NO_MPU?=1 | ||
| RAM_CODE?=0 | ||
| SPMATH?=1 | ||
| DUALBANK_SWAP?=0 | ||
| PKA?=0 | ||
| ENCRYPT=0 | ||
| WOLFTPM?=0 | ||
| ELF?=0 | ||
|
|
||
| # U54 cores lack RISC-V crypto extensions (Zknh); use portable C implementations | ||
| NO_ASM?=1 | ||
|
|
||
| # QSPI Flash Configuration | ||
| # Using Micron MT25QL01GBBB (128MB, 64KB sectors) | ||
| EXT_FLASH?=1 | ||
| SPI_FLASH?=0 | ||
|
|
||
| # SPI Flash Controller Selection: | ||
| # MPFS_SC_SPI: Use SC QSPI Controller (0x37020100) for fabric-connected flash. | ||
| # Direct register access to System Controller's QSPI instance. | ||
| # DEFAULT: Use MSS QSPI Controller (0x21000000) for external flash | ||
| # on MSS QSPI pins. | ||
| CFLAGS_EXTRA+=-DMPFS_SC_SPI | ||
|
|
||
| # L2-LIM mode: wolfBoot loaded by HSS to L2-LIM (no DDR) | ||
| # HSS runs on E51 from eNVM, loads wolfBoot to L2-LIM on U54 (S-mode) | ||
| # wolfBoot loads application from SC ext SPI flash to L2-LIM | ||
| MPFS_L2LIM?=1 | ||
|
|
||
| # wolfBoot origin in L2-LIM (above HSS resident region) | ||
| # NOTE: Adjust based on HSS L2-LIM footprint. HSS typically uses ~200-400KB | ||
| # from 0x08000000. Check HSS linker map for actual end address. | ||
| WOLFBOOT_ORIGIN?=0x08040000 | ||
|
|
||
| # Application loaded from QSPI to L2-LIM (above wolfBoot, 128KB offset) | ||
| WOLFBOOT_LOAD_ADDRESS?=0x08060000 | ||
|
|
||
| # Stack at top of 1.5MB L2-LIM (grows downward) | ||
| WOLFBOOT_STACK_TOP?=0x08180000 | ||
|
|
||
| # L2-LIM size available for wolfBoot (STACK_TOP - ORIGIN) | ||
| WOLFBOOT_L2LIM_SIZE?=0x140000 | ||
|
|
||
| # Flash geometry (64 KB sector) | ||
| WOLFBOOT_SECTOR_SIZE?=0x10000 | ||
|
|
||
| # Partition layout for 128MB QSPI flash | ||
| # Boot partition: 0x00020000 - 0x01FFFFFF (~32MB) | ||
| # Update partition: 0x02000000 - 0x03FFFFFF (~32MB) | ||
| # Swap partition: 0x04000000 - 0x0400FFFF (64KB) | ||
| # Remaining: 0x04010000 - 0x07FFFFFF (~64MB available) | ||
| WOLFBOOT_PARTITION_SIZE?=0x1FE0000 | ||
| WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x20000 | ||
| WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x2000000 | ||
| WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x4000000 | ||
|
|
||
| # Speed up reads from flash by using larger blocks | ||
| CFLAGS_EXTRA+=-DWOLFBOOT_SHA_BLOCK_SIZE=4096 | ||
|
|
||
| # Optional Encryption | ||
| #CUSTOM_ENCRYPT_KEY=1 | ||
| #ENCRYPT=1 | ||
| #ENCRYPT_WITH_AES256=1 | ||
| #OBJS_EXTRA=src/my_custom_encrypt_key.o | ||
|
|
||
| # Optional QSPI debugging | ||
| # Uncomment for verbose QSPI debug output | ||
| #CFLAGS_EXTRA+=-DDEBUG_QSPI | ||
|
|
||
| # Optional QSPI flash test (erase/write/read on update partition) | ||
| # Uncomment to run test during hal_init() | ||
| #CFLAGS_EXTRA+=-DTEST_EXT_FLASH |
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.
The workflow downloads and extracts toolchain tarballs without verifying integrity (e.g., SHA256/SHA512 checksum or GPG signature). For supply-chain hardening and reproducibility, add checksum verification (ideally pinned in the repo/workflow) before extracting, or use a package/attestation mechanism that provides integrity guarantees.