Conversation
Contributor
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Pull request overview
Completes VA416xx interrupt vector tables to prevent corrupted exception dispatch (notably EDAC IRQs) and fixes multiple VA416x0 FRAM driver correctness issues, plus improves the target’s build/flash helper script and documentation.
Changes:
- Extend wolfBoot and demo-app vector tables to include all VA416xx IRQ entries (preventing EDAC IRQs from vectoring into
.text). - Fix FRAM driver bank selection, bounds checking (incl. overflow-safe), init binding behavior, and “no internal flash” stubs; add unit tests for these cases.
- Harden
build_test.sh(avoidset -efallthrough, size update-blanking from config, allow J-Link SN selection) and update VA416x0 target docs/output examples.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/unit-tests/unit-va416x0-fram.c | Adds/adjusts mocks and unit tests to cover FRAM bank/bounds/init behavior fixes. |
| tools/scripts/va416x0/build_test.sh | Makes build/sign/flash steps fail-fast, sizes blank update from config, supports selecting a specific J-Link probe. |
| test-app/startup_arm.c | Expands VA416x0 application vector table to all required IRQ slots. |
| test-app/app_va416x0.c | Adds VTOR + SysTick liveness reporting; fixes key index printf formatting. |
| src/boot_arm.c | Expands VA416x0 wolfBoot vector table to all required IRQ slots (incl. EDAC interrupts). |
| hal/va416x0.h | Clarifies default pin macro comments (no functional change). |
| hal/va416x0.c | Fixes FRAM driver defects, disables UART RX IRQ usage, makes “no internal flash” stubs fail loudly, avoids large stack allocation. |
| docs/Targets.md | Updates VA416x0 flash layout and documents vector-table sizing/alignment behavior; refreshes example logs. |
| config/examples/vorago_va416x0.config | Notes a known non-linking ML-DSA configuration constraint. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
dgarske
force-pushed
the
vorago_vector_table_fix
branch
from
September 16, 2026 17:10
2d35b89 to
20b3037
Compare
dgarske
force-pushed
the
vorago_vector_table_fix
branch
from
September 17, 2026 19:27
20b3037 to
23b9437
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR addresses vector table alignment faults, memory layout constraints, driver defects, and build script reliability. The alignment issue was originally reported by @jgeorge1316 in #885.
Key Fixes & Enhancements
1. Vector Table Alignment
WOLFBOOT_PARTITION_BOOT_ADDRESS + IMAGE_HEADER_SIZE, which the shipped layout placed at0xB800 + 0x200 = 0xBA00. With 212 exceptions, ARMv7-M requires that address to be 1024-byte aligned;0xBA00is only 512-aligned.VTORrather than adding it, so any vector whose offset shares a set bit with the low bits ofVTORresolves to the wrong entry. Measured on a VA41630 with a 212-entry table at a 512-aligned address: IRQ 77 (EDAC_SBE, offset0x174) and IRQ 111 (0x1FC) dispatched correctly, IRQ 112 (0x200) hard faulted because it fetches vector 0 (the initial MSP), and IRQ 128 (PORTD2,0x240) ran the wrong handler. The same table at a 1024-aligned address dispatched IRQ 128 correctly. Every IRQ from 112 upward was silently broken, covering the PORTA-PORTG pin interrupts, DMA and ADC/DAC, while SysTick and everything below IRQ 112 kept working.IMAGE_HEADER_SIZEto 1024, placing the table at0xBC00. Added a build-time check inhal/va416x0.cso any layout leaving(BOOT_ADDRESS + IMAGE_HEADER_SIZE)unaligned fails to compile, which matters for anyone re-carving the partitions to reclaim space.2. Vector Table Overflows & Exception Handling
hal_init()enabled EDAC single-bit and multi-bit error interrupts (IRQs 76 & 77) during scrubbing configuration. However, wolfBoot’s vector table only included the 16 standard Cortex-M4 system entries (64 bytes).0x170and0x174—260 bytes past the table. This hit SHA-512 round constants in.text(0x47EDAEE6and0x81C2C92E), which reside outside the 256KB IRAM. An EDAC interrupt (expected during normal radiation-hardened operation) loaded invalid PC addresses and faulted.TXEV_IRQn). Added a compile-time length check on each.__HAL_DISABLE_UART0/1/2prevents the SDK from building handlers for it.3. Memory Pooling for ML-DSA Level 5 Support
SRAM_0bank.SRAM_0(0x1FFF8000) andSRAM_1(0x20000000) into a single 64KB region.SRAM_1was previously unused because the SDK DMA driver is not linked.build_test.shto forward the complete signing tool environment instead of only three variables. This ensuresML_DSA_LEVELreaches the tool rather than falling back to Level 2 and rejecting the key.4. FRAM Driver Correctness
FRAM_Erase()ignoring itsspiBankargument.addr + leninteger overflow in bounds check logic.FRAM_Init().FRAM_Init().5. Build System & Stubs
set -efallthrough bug inbuild_test.shwhere a mid-chain failure in an&&list allowed broken builds to sign and flash stale images.6. Documentation & Hardware Alignment
0xFFFFFFFFtoVTORreads back0xFFFFFF80, so the implemented field isVTOR[31:7]and the register accepts 128-byte granularity. That is a red herring: the register holding a value does not mean the fetch honours it, and the 1024-byte table alignment is still required (see section 1). Documented along with the alternative of movingWOLFBOOT_PARTITION_BOOT_ADDRESSinstead of growing the header, for layouts that are tight on space.Hardware Validation
Tested and validated end-to-end on a VA416XX EVK over J-Link across ECC384/SHA384 and ML-DSA Level 5 configurations:
VTOR, whether it is 1024-aligned, and a SysTick liveness check. Note that SysTick alone does not prove correct placement: it is exception 15 at offset0x3C, below the bit alignment affects, so dispatch testing needs an IRQ at or above 112.