diff --git a/.agents/skills/prepare-ra8p1-trace/SKILL.md b/.agents/skills/prepare-ra8p1-trace/SKILL.md new file mode 100644 index 0000000..a1118dd --- /dev/null +++ b/.agents/skills/prepare-ra8p1-trace/SKILL.md @@ -0,0 +1,57 @@ +--- +name: prepare-ra8p1-trace +description: Prepare this repository's EK-RA8P1 CPU0 debug description and normal SWO trace runtime after a build or CMSIS refresh. Applies the temporary RA_DFP 6.6.0 configuration with CMake and the installed pyTS; does not start a hardware session. +--- + +# Prepare RA8P1 trace + +Apply the temporary CPU0/AP0 and SWO configuration for `EK-RA8P1@ULINKplus` +in the repository containing `Trace.csolution.yml`. Read the +[board procedure](../../../Board/EK-RA8P1/README.md#debug-and-trace-preparation) +for the DFP gap and the [trace workflow](../../../docs/TRACE_APP.md#configure-and-generate-trace) +for normal profile generation. Other targets use their existing setup. + +1. Check that the selected solution/target is this repository's + `EK-RA8P1@ULINKplus`, with `Renesas::R7KA8P1KF:CPU0` and + `Renesas::RA_DFP@6.6.0`. Do not switch a different active target silently or + apply this pinned description to another DFP version. +2. Complete any required build/refresh first. Use `cmsis_action build` when + available, or the documented `cbuild` command in the board procedure. + Require the current `out/TraceDemo/EK-RA8P1/Debug/TraceDemo.elf` and generated + `out/Trace+EK-RA8P1.cbuild-run.yml`. Preserve existing source trace settings. +3. From the repository root, apply the versioned description with the existing + build tool; no custom script or YAML rewrite is needed: + + ```sh + cmake -E copy_if_different Board/EK-RA8P1/debug-run.yml out/Trace+EK-RA8P1.cbuild-run.yml + ``` + +4. Generate the trace runtime from that run description and current ELF using + the installed CMSIS Debugger's pyTS. Resolve its executable from the installed + extension or the host's tool configuration; never hardcode a host path or + install a separate Python package. Quote the resolved executable path: + + ```sh + "$trace_pyts" out/Trace+EK-RA8P1.cbuild-run.yml --format json + ``` + + The normal **Trace Generation → Convert *.ctrace.yml to *.ctrace-run.yml** + command is equivalent. If neither route is available, report the missing + trace tool and stop before claiming preparation succeeded. +5. Check the generated + `.trace/Trace+EK-RA8P1@ULINKplus.ctrace-run.yml` against the selected source + profile and current ELF: resolve enabled watches without missing symbols, + retain the requested ITM/PC/timestamp/sync sources, and require CPU0-only + register operations. Disabled CPU1 metadata alone is not a register access. + The standard demo enables `g_trace_sine`, `g_trace_noise`, ITM1, PC samples, + 8 MHz timestamps and DWT synchronization. Require SWO `mode: file` at 1 Mbaud. + +Report the prepared target, ELF/profile and generation result. Preparation +does not flash, reset, start/stop debugging or open a live trace TCP service. +For a separately requested hardware run, use the CMSIS tools and the normal +file capture → automatic CSV conversion on pause/end workflow. + +A subsequent build, refresh or target change can replace the prepared run +description. Repeat the copy and trace generation after the last such operation +and before Enter Debug. Remove this skill and the template once the DFP/tool +flow supplies the required behavior natively and has been validated. diff --git a/.cmsis/Trace+EK-RA8P1@ULINKplus.ctrace.yml b/.cmsis/Trace+EK-RA8P1@ULINKplus.ctrace.yml new file mode 100644 index 0000000..81ff898 --- /dev/null +++ b/.cmsis/Trace+EK-RA8P1@ULINKplus.ctrace.yml @@ -0,0 +1,25 @@ +--- +ctrace: + setup: + - pname: CPU0 + core: Cortex-M85 + timestamps: + clock: 8000000 + itm-prescaler: 1 + data: + - location: g_trace_sine + label: Sine + access: W + size: 4 + output: value + - location: g_trace_noise + label: Noise + access: W + size: 4 + output: value + itm: + enable: 2 + pcsampling: + period: 8192 + synchronization: + DWT: 16M diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 77270a3..37878c8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,6 +30,7 @@ jobs: - TraceDemo.Debug+STM32F4-DISCO - TraceDemo.Debug+STM32F429I-DISCO - TraceDemo.Debug+STM32H7B3I-DK + - TraceDemo.Debug+EK-RA8P1 steps: - name: Checkout @@ -54,3 +55,9 @@ jobs: --packs --frozen-packs --update-rte + + - name: Check explicit RA8P1 debug preparation + if: matrix.context == 'TraceDemo.Debug+EK-RA8P1' + run: | + cmake -E copy_if_different Board/EK-RA8P1/debug-run.yml out/Trace+EK-RA8P1.cbuild-run.yml + cmp Board/EK-RA8P1/debug-run.yml out/Trace+EK-RA8P1.cbuild-run.yml diff --git a/Board/EK-RA8P1/Board.clayer.yml b/Board/EK-RA8P1/Board.clayer.yml new file mode 100644 index 0000000..b7e10c7 --- /dev/null +++ b/Board/EK-RA8P1/Board.clayer.yml @@ -0,0 +1,28 @@ +layer: + type: Board + description: EK-RA8P1 CPU0 with internal MRAM/SRAM0 and the 8 MHz MOCO reset clock + for-device: Renesas::R7KA8P1KF:CPU0 + + packs: + - pack: Renesas::RA_DFP@6.6.0 + + define: + - CMSIS_device_header: '"ra8p1.h"' + + add-path: + - ../../ThirdParty/Renesas/ek-ra8p1 + + groups: + - group: Board + files: + - file: main.c + - file: target.c + - group: CMSIS Device + files: + - file: ../../ThirdParty/Renesas/ek-ra8p1/startup_ra8p1.c + - file: ../../ThirdParty/Renesas/ek-ra8p1/system_ra8p1.c + + linker: + - script: ../Support/gcc_linker_script.ld.src + regions: regions.h + for-compiler: GCC diff --git a/Board/EK-RA8P1/README.md b/Board/EK-RA8P1/README.md new file mode 100644 index 0000000..a48a23e --- /dev/null +++ b/Board/EK-RA8P1/README.md @@ -0,0 +1,118 @@ +# Renesas EK-RA8P1 + +Target `EK-RA8P1`, debugger set `ULINKplus`, device +`Renesas::R7KA8P1KF:CPU0` (Cortex-M85). The board is fitted with +`R7KA8P1KFLCAC`; CPU1, the Cortex-M33, is outside this target. + +## Firmware and dependencies + +The layer uses `Renesas::RA_DFP@6.6.0`, CMSIS-Core 6.3.0 and RTX5 5.9.0. +Startup, core header and `SystemInit()` are adapted from the supplied +`Renesas_EK-RA8P1/RTOSDemo.csolution.yml` project, originally based on +`ARM::Cortex_DFP@1.1.0`. [The source manifest](../../ThirdParty/Renesas/sources.json) +records provenance, source hashes and local changes. The DFP's FSP-dependent +startup is not selected. No FSP generator, BSP or full SDK is required. + +The image uses 1 MiB code MRAM at `0x02000000` and 512 KiB SRAM0 at +`0x22000000`, with a 4 KiB main stack and no C-library heap. TCM and external +memory are unused. The 112-entry `.vectors` table is aligned to 512 bytes. +The shared GCC linker template retains it at the MRAM origin and provides +`__StackTop`/`__StackLimit` and the CMSIS C-runtime copy table; newlib startup +clears `.bss`. RTX supplies SVC, PendSV and SysTick handlers. + +CPU0 retains the **8 MHz MOCO reset clock**, with its divider at one. +`target_init()` checks the source, divider and oscillator state and stops +before RTX if that clock is not recognized (`SystemCoreClock == 0`). Start +from a device reset. The reference project's 1-GHz PLL/voltage/cache setup +is intentionally not imported: the reset-clock baseline also leaves adequate +SWO bandwidth for periodic PC sampling. The common RTX idle thread spins. + +`trustzone: off`, FPU/MVE off and branch protection off are compiler settings. +They do not provision device security. The MRAM/SRAM and system/debug registers +must already be accessible to CPU0 and the external debugger. This project +changes no lifecycle, OTP, option or security configuration. + +## Debug and trace preparation + +Select **EK-RA8P1 → ULINKplus** in CMSIS Manage Solution Settings and build: + +```sh +cbuild Trace.csolution.yml --active 'EK-RA8P1@ULINKplus' --packs --frozen-packs --update-rte +``` + +The firmware build has no custom preparation step. After the final build or +refresh, invoke `Use $prepare-ra8p1-trace` with an agent that can read this +repository's [skill](../../.agents/skills/prepare-ra8p1-trace/SKILL.md). It copies +the temporary [debug-run.yml](debug-run.yml) using the existing CMake executable +and generates the normal trace runtime with the installed pyTS. + +Without an agent, run the same copy from the repository root: + +```sh +cmake -E copy_if_different Board/EK-RA8P1/debug-run.yml out/Trace+EK-RA8P1.cbuild-run.yml +``` + +Then generate the trace runtime from the current ELF through the normal **Trace +Generation** view (or the bundled pyTS), as for the other targets. Use +**Enter Debug / Load & Debug** after generation. The debugger uses GDB port 3333. +A subsequent build, refresh or target change can replace the prepared description; +repeat preparation after that operation. No additional interpreter, YAML library +or CMSIS tools export is required. The skill is optional automation; the commands +also work for a fresh clone with the documented build/debug tools installed. + +Trace uses the normal **file capture → automatic CSV conversion** workflow. +Pausing or ending debugging converts the RAW file to +`.trace/Trace+EK-RA8P1@ULINKplus.SWO.csv`. There is no live trace TCP service. + +The unmodified DFP supplies no RA8P1 SWO sequences, processor/AP mapping or +`.dbgconf` defaults. The temporary debug description supplies: + +- CPU0 on AP0, with CPU0-only processor resources and trace configuration. +- P209 SWO routing and the trace clock before CoreSight discovery and after reset. + PRCR access enables are preserved while setting TRCKCR to MOCO `/8`. +- Legacy pyOCD ITM/TPIU setup; full trace setup is not enabled. +- The pinned DFP's programming algorithms and system descriptions, referenced + through `${CMSIS_PACK_ROOT}`. Solution and ELF paths are relative to `out/`. + +This is a maintained description for **RA_DFP 6.6.0**, not a general YAML patcher. +Keep its DFP paths, image paths, transport settings and resources consistent with +the layer and solution. Once the DFP/tool flow provides this behavior natively, +remove the template and preparation skill together and verify the generated +description. +Installed packs and the reference project remain unchanged. + +SWD is 10 MHz. MOCO `/8` gives a **1 MHz trace input**, serialized at **1 Mbaud**; +CPU0 timestamps use **8 MHz**. The profile watches `g_trace_sine` and +`g_trace_noise`, enables ITM1, samples the PC every 8192 core cycles and requests +DWT synchronization every 16M cycles. RA8P1 CPU0 implements eight DWT comparators, +ITM and a dedicated SWO TPIU. pyTS allocates the watch comparators. + +## Power and Debug In wiring + +The board manual Rev. 1.04, section 5.2.2 (PDF p. 27), specifies: + +| Setting | Debug In position | +| --- | --- | +| J6 | 2–3 | +| J8 | 1–2 | +| J9 | 1–2; holds the onboard debug MCU in reset | +| J29 | All four shunts: 1–2, 3–4, 5–6, 7–8 | +| External debugger | J13 (10-pin) or J20 (20-pin), correct pin-1 orientation | + +P209/SWO is pin 6 on J13/J20. Supply board power separately through J10, J11 +or J7 as described in section 5.1; VTref is a voltage reference. Change jumpers +with power disconnected. Confirm the physical board revision and probe locally +before loading. The solution retains automatic probe selection. + +## References and validation + +- [EK-RA8P1 v1 User's Manual](https://www.renesas.com/en/document/mat/ek-ra8p1-v1-users-manual), Rev. 1.04: power and Debug In, PDF pp. 23–28. +- [RA8P1 hardware manual](https://www.renesas.com/en/document/mah/ra8p1-group-users-manual-hardware), Rev. 1.30: CPU0 features pp. 115–116; debug/trace pp. 134–145; MRAM map pp. 238–239; clock registers pp. 330, 332, 343, 375–376; SRAM0 pp. 3537–3543. +- [Cortex-M85 TRM](https://developer.arm.com/documentation/101924/latest): DWT, ITM and TPIU. + +Build, Load & Debug to `main`, RTX runtime at 8 MHz and automatic CSV creation +on pause passed on 2026-11-17 through ULINKplus. The capture contains both DWT +sources, ITM1 and PC samples. Capture integrity remains open: one invalid ITM +packet near startup and one incomplete packet at pause/EOF were reported. +The supplied reference project's 1-GHz ITM0 results do not validate this image. +See the single [validation record](../../docs/VALIDATION.md). diff --git a/Board/EK-RA8P1/debug-run.yml b/Board/EK-RA8P1/debug-run.yml new file mode 100644 index 0000000..9834d68 --- /dev/null +++ b/Board/EK-RA8P1/debug-run.yml @@ -0,0 +1,164 @@ +# SPDX-License-Identifier: Apache-2.0 +# Temporary CPU0-only debug description for the unmodified RA_DFP 6.6.0. +# Apply after build/refresh with the prepare-ra8p1-trace skill or README command. +# Relative solution/image paths below are based on that out/ directory. +# Pack paths use the standard CMSIS_PACK_ROOT variable on each host. +# Remove this template and the preparation skill once the DFP/tool flow supplies +# CPU0/AP0, SWO routing/clock setup and CPU0-only trace operations. +--- +cbuild-run: + generated-by: TraceDemo EK-RA8P1 debug template for RA_DFP 6.6.0 + solution: "../Trace.csolution.yml" + target-type: EK-RA8P1 + target-set: ULINKplus + compiler: GCC + device: Renesas::R7KA8P1KF + device-pack: Renesas::RA_DFP@6.6.0 + device-pack-path: "${CMSIS_PACK_ROOT}/Renesas/RA_DFP/6.6.0" + output: + - file: TraceDemo/EK-RA8P1/Debug/TraceDemo.elf + info: generate by TraceDemo.Debug+EK-RA8P1 + type: elf + project: TraceDemo + load: image+symbols + pname: CPU0 + - file: TraceDemo/EK-RA8P1/Debug/TraceDemo.hex + info: generate by TraceDemo.Debug+EK-RA8P1 + type: hex + project: TraceDemo + load: none + pname: CPU0 + - file: TraceDemo/EK-RA8P1/Debug/TraceDemo.bin + info: generate by TraceDemo.Debug+EK-RA8P1 + type: bin + project: TraceDemo + load: none + pname: CPU0 + system-resources: + memory: + - name: ITCM + access: rwx + start: 0 + size: 131072 + pname: CPU0 + from-pack: Renesas::RA_DFP@6.6.0 + - name: DTCM + access: rw + start: 536870912 + size: 131072 + pname: CPU0 + from-pack: Renesas::RA_DFP@6.6.0 + - name: Flash + access: rx + start: 33554432 + size: 1048576 + default: true + from-pack: Renesas::RA_DFP@6.6.0 + - name: SRAM + access: rwx + start: 570425344 + size: 1703936 + default: true + from-pack: Renesas::RA_DFP@6.6.0 + - name: Config + access: r + start: 46788672 + size: 1984 + from-pack: Renesas::RA_DFP@6.6.0 + - name: OTP_Config + access: r + start: 48264704 + size: 66356 + from-pack: Renesas::RA_DFP@6.6.0 + processors: + - core: Cortex-M85 + revision: r0p0 + pname: CPU0 + endian: little + fpu: dp + mpu: present + dsp: present + trustzone: present + mve: fp + pacbti: present + max-clock: 480000000 + system-descriptions: + - file: "${CMSIS_PACK_ROOT}/Renesas/RA_DFP/6.6.0/SVD/R7KA8P1AD.svd" + type: svd + - file: "${CMSIS_PACK_ROOT}/ARM/CMSIS-RTX/5.9.0/RTX5.scvd" + type: scvd + pname: CPU0 + debugger: + name: ULINKplus@pyOCD + protocol: swd + clock: 10000000 + start-pname: CPU0 + gdbserver: + - port: 3333 + pname: CPU0 + trace: + - swo-uart: + mode: file + input-clock: 1000000 + output-clock: 1000000 + programming: + - algorithm: "${CMSIS_PACK_ROOT}/Renesas/RA_DFP/6.6.0/Flash/RA8P1_1M.FLM" + start: 33554432 + size: 1048576 + ram-start: 570425344 + ram-size: 30720 + - algorithm: "${CMSIS_PACK_ROOT}/Renesas/RA_DFP/6.6.0/Flash/RA8P1_CONF.FLM" + start: 46788672 + size: 1984 + ram-start: 570425344 + ram-size: 30720 + - algorithm: "${CMSIS_PACK_ROOT}/Renesas/RA_DFP/6.6.0/Flash/RA8P1_OTP.FLM" + start: 48264704 + size: 66356 + ram-start: 570425344 + ram-size: 30720 + debug-topology: + debugports: + - dpid: 0 + accessports: + - apid: 0 + index: 0 + processors: + - pname: CPU0 + apid: 0 + trace-sinks: + - serialwire: + debug-sequences: + - name: SetupRA8P1SWO + blocks: + - execute: | + __var saved_ap = __ap; + __ap = 0; + Write32(0x4001B030, 0x00000009); // TRPORTCR: CPU0 SWO on P209. + __var trace_clock = Read8(0x4001E03F); + - if: trace_clock != 0x83 + blocks: + - execute: | + __var saved_prcr = Read16(0x4001E3FA) & 0x000F; + Write16(0x4001E3FA, 0xA501 | saved_prcr); + - if: "(trace_clock & 0x80) != 0" + execute: | + Write8(0x4001E03F, trace_clock & 0x7F); + - execute: | + Write8(0x4001E03F, 0x03); // TRCK=/8 while stopped. + Write8(0x4001E03F, 0x83); // 8 MHz MOCO /8 = 1 MHz trace input. + Write16(0x4001E3FA, 0xA500 | saved_prcr); + - execute: | + __ap = saved_ap; + - name: DebugDeviceUnlock + blocks: + - if: "(__traceout & 1) != 0" + execute: | + // Enable the clock before CoreSight discovers the CPU0 TPIU. + Sequence("SetupRA8P1SWO"); + - name: TraceStart + blocks: + - if: "(__traceout & 1) != 0" + execute: | + // Restore routing after reset, before generic ITM/TPIU setup. + Sequence("SetupRA8P1SWO"); diff --git a/Board/EK-RA8P1/main.c b/Board/EK-RA8P1/main.c new file mode 100644 index 0000000..d3b2601 --- /dev/null +++ b/Board/EK-RA8P1/main.c @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: Apache-2.0 */ +#include "app.h" +#include "target.h" + +int main(void) +{ + target_init(); + (void)app_main(); + for (;;) { + /* app_main returns only when RTX5 startup fails. */ + } +} diff --git a/Board/EK-RA8P1/regions.h b/Board/EK-RA8P1/regions.h new file mode 100644 index 0000000..f4c8d02 --- /dev/null +++ b/Board/EK-RA8P1/regions.h @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: Apache-2.0 */ +#ifndef EK_RA8P1_REGIONS_H +#define EK_RA8P1_REGIONS_H + +/* RA8P1 hardware manual Rev. 1.30, pp. 238-239 and 3537-3543. + * CPU0 code MRAM and SRAM0 only; no TCM or external memory. + */ +#define __ROM0_BASE 0x02000000 +#define __ROM0_SIZE 0x00100000 +#define __RAM0_BASE 0x22000000 +#define __RAM0_SIZE 0x00080000 +#define __STACK_SIZE 0x00001000 +#define __HEAP_SIZE 0x00000000 + +#endif diff --git a/Board/EK-RA8P1/target.c b/Board/EK-RA8P1/target.c new file mode 100644 index 0000000..b2404be --- /dev/null +++ b/Board/EK-RA8P1/target.c @@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: Apache-2.0 */ +#include CMSIS_device_header +#include "target.h" + +/* RA8P1 hardware manual Rev. 1.30: SCKSCR (p. 332), SCKDIVCR2 + * (p. 330), MOCOCR (p. 343). Recognize the reset CPU0 clock only. + */ +#define SCKSCR (*(volatile const uint8_t *)0x4001E026UL) +#define SCKDIVCR2 (*(volatile const uint16_t *)0x4001E024UL) +#define MOCOCR (*(volatile const uint8_t *)0x4001E038UL) +#define MOCO_HZ 8000000U + +uint32_t SystemCoreClock = MOCO_HZ; + +void SystemCoreClockUpdate(void) +{ + const uint32_t source = SCKSCR & 7U; + const uint32_t divider = SCKDIVCR2 & 15U; + SystemCoreClock = (source == 1U && divider == 0U && (MOCOCR & 1U) == 0U) + ? MOCO_HZ : 0U; +} + +void target_init(void) +{ + SystemCoreClockUpdate(); + if (SystemCoreClock == 0U) { + for (;;) { + /* Reset the device; inherited clock configurations are unsupported. */ + } + } +} + +uint32_t target_core_clock_hz(void) +{ + return SystemCoreClock; +} diff --git a/README.md b/README.md index 6b2c7f6..a34e1f2 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,8 @@ bring-up project or a reference example, and is currently not intended as a starting point for customer projects. A common firmware baseline for testing trace across Cortex-M boards and debug - probes. One **CMSIS solution** builds a shared **RTX5 application** through eight -local board layers, covering Cortex-M4, Cortex-M7 and Cortex-M33. + probes. One **CMSIS solution** builds a shared **RTX5 application** through ten +local board layers, covering Cortex-M4, Cortex-M7, Cortex-M33 and Cortex-M85. The workload updates sine and deterministic-noise variables every 100 ms for DWT and emits an ITM channel 1 counter every 200 ms. Debugger profiles add PC sampling @@ -33,6 +33,13 @@ Capture-start and pause/end recording issues remain; see [Validation](docs/VALID | [NUCLEO-F446RE](Board/NUCLEO-F446RE/README.md) | Cortex-M4 | `STLink` | | [STM32H7B3I-DK](Board/STM32H7B3I-DK/README.md) | Cortex-M7 | `ULINKplus` | | [STM32F4-DISCO](Board/STM32F4-DISCO/README.md), MB997 B-02 | Cortex-M4 | `ULINKplus`, `STLink` | +| [EK-RA8P1](Board/EK-RA8P1/README.md) | Cortex-M85 CPU0, TrustZone build off | `ULINKplus` | + +EK-RA8P1: after build/refresh, run `Use $prepare-ra8p1-trace` +([skill](.agents/skills/prepare-ra8p1-trace/SKILL.md)) or follow the +[shell procedure](Board/EK-RA8P1/README.md#debug-and-trace-preparation). +This temporary RA_DFP 6.6.0 workaround uses CMake and bundled pyTS without a build +hook or extra interpreter. SWO uses the standard automatic CSV workflow. Hardware results and open capture issues are listed in [Validation](docs/VALIDATION.md). This project currently implements SWO; @@ -55,7 +62,10 @@ Missing CMSIS packs are installed by `cbuild --packs` using the pinned dependenc L552-only `ULINKplus StackCorruption`). Sets use automatic probe selection; select the intended probe locally when several are connected. Check the board README linked above and the [ST board wiring notes](docs/ST_BOARD_BRINGUP.md). -3. Build the selected target. Enable `vscode-cmsis-debugger.enableTraceGenerationView` +3. Build the selected target. For EK-RA8P1, apply its [debug description](Board/EK-RA8P1/README.md#debug-and-trace-preparation) + after the build, or invoke `Use $prepare-ra8p1-trace` to prepare it and generate + trace through the [repository skill](.agents/skills/prepare-ra8p1-trace/SKILL.md). + Enable `vscode-cmsis-debugger.enableTraceGenerationView` in local VS Code settings. In the CMSIS Debugger **Trace Generation** view, review its `.ctrace.yml` profile and run **Convert *.ctrace.yml to *.ctrace-run.yml**. Repeat conversion after rebuilding or changing the profile so DWT addresses @@ -97,8 +107,8 @@ If your agent does not discover repository skills, ask it to read the linked | File or directory | Purpose | | --- | --- | | `Trace.csolution.yml`, `Projects/TraceDemo/TraceDemo.cproject.yml` | Targets, debugger sets, common application and RTX5 components | -| `Common/`, `Board/` | Shared application and eight local board layers | -| `.cmsis/`, `Trace.cbuild-pack.yml`, `vcpkg-configuration.json` | Trace/debug profiles and pinned dependencies | +| `Common/`, `Board/` | Shared application and ten local board layers | +| `.cmsis/`, `Trace.cbuild-pack.yml`, `vcpkg-configuration.json` | Trace/debug profiles, Pack locks and tool requirements | | [DESIGN.md](docs/DESIGN.md) | Agreed requirements, architecture and how the baseline was assembled | | [BUILD.md](docs/BUILD.md), [DEBUG_PROBES.md](docs/DEBUG_PROBES.md) | Tool setup, builds and switching probes | | [TRACE_APP.md](docs/TRACE_APP.md) | Signal definitions, capture/CSV workflow and host-tool scope | diff --git a/ThirdParty/README.md b/ThirdParty/README.md index 2c33e2a..7cfe24d 100644 --- a/ThirdParty/README.md +++ b/ThirdParty/README.md @@ -31,3 +31,21 @@ symbols used by ST GNU startup. That startup initializes only the primary CMSIS-Core and RTX5 are consumed from packs. CMSIS tools copy application configuration and DFP debugger defaults into `RTE/` and `.cmsis/`; their original notices remain intact. + +## Renesas EK-RA8P1 core support + +[Renesas/sources.json](Renesas/sources.json) records the startup, system source +and core headers imported from the supplied `Renesas_EK-RA8P1` project, with the +source revision, original byte hashes and retained-file hashes. They adapt +`ARM::Cortex_DFP@1.1.0` Cortex-M85 templates and retain their Apache-2.0 notices. +The local system header removes the reference project's 1-GHz clock API; that +clock implementation and its FSP dependency are not imported. Board clock +recognition is project code in `Board/EK-RA8P1/target.c`. + +The CMSIS C startup places `.vectors` at MRAM origin using the shared linker +script, initializes data through the CMSIS copy table and lets newlib initialize +BSS. The DFP's FSP-generated startup is not selected. Renesas::RA_DFP@6.6.0 +supplies device metadata, SVD and programming algorithms from the installed pack; +its contents are unchanged. The board-local debug description adapts the supplied +project's historical CPU0 SWO sequence, with the reset-clock frequency and +explicit AP preservation. See the [board documentation](../Board/EK-RA8P1/README.md). diff --git a/ThirdParty/Renesas/ek-ra8p1/ra8p1.h b/ThirdParty/Renesas/ek-ra8p1/ra8p1.h new file mode 100644 index 0000000..e84643a --- /dev/null +++ b/ThirdParty/Renesas/ek-ra8p1/ra8p1.h @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2022-2023 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Adapted from ARM::Cortex_DFP@1.1.0, Device/ARMCM85/Include/ARMCM85.h. + */ + +#ifndef RA8P1_H +#define RA8P1_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* RA8P1 Hardware Manual Rev. 1.30, Cortex-M85 processor, pp. 115-116: + * docs/renesas/ra8p1-group-users-manual-hardware.pdf. + * Peripheral interrupt routing is outside this core-only board layer. + */ +#define RA8P1_DEVICE_IRQ_COUNT 96U +#define RA8P1_VECTOR_COUNT (16U + RA8P1_DEVICE_IRQ_COUNT) + +typedef enum IRQn { + NonMaskableInt_IRQn = -14, + HardFault_IRQn = -13, + MemoryManagement_IRQn = -12, + BusFault_IRQn = -11, + UsageFault_IRQn = -10, + SecureFault_IRQn = -9, + SVCall_IRQn = -5, + DebugMonitor_IRQn = -4, + PendSV_IRQn = -2, + SysTick_IRQn = -1, + IRQ0_IRQn = 0, + IRQ95_IRQn = 95 +} IRQn_Type; + +#define __CM85_REV 0x0101U +#define __NVIC_PRIO_BITS 4U +#define __Vendor_SysTickConfig 0U +#define __VTOR_PRESENT 1U +#define __MPU_PRESENT 1U +#define __FPU_PRESENT 1U +#define __FPU_DP 1U +#define __DSP_PRESENT 1U +#define __SAUREGION_PRESENT 1U +#define __PMU_PRESENT 1U +#define __PMU_NUM_EVENTCNT 8U +#define __ICACHE_PRESENT 1U +#define __DCACHE_PRESENT 1U + +#include "core_cm85.h" +#include "system_ra8p1.h" + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/ThirdParty/Renesas/ek-ra8p1/startup_ra8p1.c b/ThirdParty/Renesas/ek-ra8p1/startup_ra8p1.c new file mode 100644 index 0000000..525dea9 --- /dev/null +++ b/ThirdParty/Renesas/ek-ra8p1/startup_ra8p1.c @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2022 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Adapted from ARM::Cortex_DFP@1.1.0, Device/ARMCM85/Source/startup_ARMCM85.c. + */ + +#include "ra8p1.h" + +extern uint32_t __INITIAL_SP; +extern uint32_t __STACK_LIMIT; +#if defined(__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) +extern uint32_t __STACK_SEAL; +#endif +extern __NO_RETURN void __PROGRAM_START(void); + +__NO_RETURN void Reset_Handler(void); +__NO_RETURN void Default_Handler(void); + +void NMI_Handler(void) __attribute__((weak, alias("Default_Handler"))); +void HardFault_Handler(void) __attribute__((weak, alias("Default_Handler"))); +void MemManage_Handler(void) __attribute__((weak, alias("Default_Handler"))); +void BusFault_Handler(void) __attribute__((weak, alias("Default_Handler"))); +void UsageFault_Handler(void) __attribute__((weak, alias("Default_Handler"))); +void SecureFault_Handler(void) __attribute__((weak, alias("Default_Handler"))); +void SVC_Handler(void) __attribute__((weak, alias("Default_Handler"))); +void DebugMon_Handler(void) __attribute__((weak, alias("Default_Handler"))); +void PendSV_Handler(void) __attribute__((weak, alias("Default_Handler"))); +void SysTick_Handler(void) __attribute__((weak, alias("Default_Handler"))); + +/* 16 core exceptions and 96 ICU interrupts require 512-byte VTOR alignment. + * See RA8P1 Hardware Manual Rev. 1.30, pp. 115-116. RTX provides the strong + * SVC, PendSV and SysTick handlers; unused peripheral slots trap here. + */ +extern const VECTOR_TABLE_Type __VECTOR_TABLE[RA8P1_VECTOR_COUNT]; +const VECTOR_TABLE_Type __VECTOR_TABLE[RA8P1_VECTOR_COUNT] + __VECTOR_TABLE_ATTRIBUTE __ALIGNED(512) = { + (VECTOR_TABLE_Type) (&__INITIAL_SP), + Reset_Handler, + NMI_Handler, + HardFault_Handler, + MemManage_Handler, + BusFault_Handler, + UsageFault_Handler, + SecureFault_Handler, + 0, + 0, + 0, + SVC_Handler, + DebugMon_Handler, + 0, + PendSV_Handler, + SysTick_Handler, + [16 ... RA8P1_VECTOR_COUNT - 1U] = Default_Handler +}; + +__NO_RETURN void Reset_Handler(void) +{ + __set_PSP((uint32_t) (uintptr_t) &__INITIAL_SP); + __set_MSPLIM((uint32_t) (uintptr_t) &__STACK_LIMIT); + __set_PSPLIM((uint32_t) (uintptr_t) &__STACK_LIMIT); + +#if defined(__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) + __TZ_set_STACKSEAL_S((uint32_t *) &__STACK_SEAL); +#endif + + SystemInit(); + __PROGRAM_START(); +} + +__NO_RETURN void Default_Handler(void) +{ + for (;;) { + } +} diff --git a/ThirdParty/Renesas/ek-ra8p1/system_ra8p1.c b/ThirdParty/Renesas/ek-ra8p1/system_ra8p1.c new file mode 100644 index 0000000..5054e6d --- /dev/null +++ b/ThirdParty/Renesas/ek-ra8p1/system_ra8p1.c @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2022 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Adapted from ARM::Cortex_DFP@1.1.0, Device/ARMCM85/Source/system_ARMCM85.c. + */ + +#include "ra8p1.h" + +extern const VECTOR_TABLE_Type __VECTOR_TABLE[RA8P1_VECTOR_COUNT]; + +void SystemInit(void) +{ + SCB->VTOR = (uint32_t) (uintptr_t) &__VECTOR_TABLE[0]; + + /* Cortex-M85 template setup for low-overhead loops and branch prediction. + * Instruction/data caches, SAU partitioning and vendor registers retain + * their reset settings. The project disables FPU, MVE and PAC/BTI use. + */ + SCB->CCR |= SCB_CCR_LOB_Msk | SCB_CCR_BP_Msk; + __DSB(); + __ISB(); +} diff --git a/ThirdParty/Renesas/ek-ra8p1/system_ra8p1.h b/ThirdParty/Renesas/ek-ra8p1/system_ra8p1.h new file mode 100644 index 0000000..ea4228d --- /dev/null +++ b/ThirdParty/Renesas/ek-ra8p1/system_ra8p1.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2022 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Adapted from ARM::Cortex_DFP@1.1.0, Device/ARMCM85/Include/system_ARMCM85.h. + */ + +#ifndef SYSTEM_RA8P1_H +#define SYSTEM_RA8P1_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void (*VECTOR_TABLE_Type)(void); +extern uint32_t SystemCoreClock; + +void SystemInit(void); +void SystemCoreClockUpdate(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/ThirdParty/Renesas/sources.json b/ThirdParty/Renesas/sources.json new file mode 100644 index 0000000..9bf8c4e --- /dev/null +++ b/ThirdParty/Renesas/sources.json @@ -0,0 +1,35 @@ +{ + "source_project": "Renesas_EK-RA8P1", + "source_revision": "3d94574ee1e95704ebca3d6ba173e0360b92872a", + "note": "Imported working-tree bytes are identified by source_sha256; the source project may contain uncommitted changes. CMSIS files adapt ARM::Cortex_DFP@1.1.0. The local system header removes the reference project clock-configuration API; the board uses the 8 MHz MOCO reset clock.", + "files": [ + { + "source_path": "src/startup_ra8p1.c", + "path": "ek-ra8p1/startup_ra8p1.c", + "sha256": "13a51131dc0480bac4c5e09e487008bb0e86afeaa43bf46ea7bc624cfec94051", + "size": 3008, + "source_sha256": "13a51131dc0480bac4c5e09e487008bb0e86afeaa43bf46ea7bc624cfec94051" + }, + { + "source_path": "src/system_ra8p1.c", + "path": "ek-ra8p1/system_ra8p1.c", + "sha256": "6f1b578f94faf0f6b575e1a80b433164b4cc96c47eb7dfc8dd131e743e25225d", + "size": 1221, + "source_sha256": "6f1b578f94faf0f6b575e1a80b433164b4cc96c47eb7dfc8dd131e743e25225d" + }, + { + "source_path": "board/ek-ra8p1/ra8p1.h", + "path": "ek-ra8p1/ra8p1.h", + "sha256": "7a07ab94dcecdabbf4450455c978bb4ec53e1c34f6221a1633fe3cd09013ee2c", + "size": 2057, + "source_sha256": "7a07ab94dcecdabbf4450455c978bb4ec53e1c34f6221a1633fe3cd09013ee2c" + }, + { + "source_path": "board/ek-ra8p1/system_ra8p1.h", + "path": "ek-ra8p1/system_ra8p1.h", + "sha256": "541e2c409597ff41644fe399a5a96bbdd0f6ac880c8af5d99c1ce837ed436d30", + "size": 1009, + "source_sha256": "db81d5c3259db1e79b57917f92a5a20a8869b5bf0e2c407af2a4cb252c15145d" + } + ] +} diff --git a/Trace.cbuild-pack.yml b/Trace.cbuild-pack.yml index 77b7f18..b73ce32 100644 --- a/Trace.cbuild-pack.yml +++ b/Trace.cbuild-pack.yml @@ -21,3 +21,6 @@ cbuild-pack: - resolved-pack: Keil::STM32L5xx_DFP@2.0.0 selected-by-pack: - Keil::STM32L5xx_DFP@2.0.0 + - resolved-pack: Renesas::RA_DFP@6.6.0 + selected-by-pack: + - Renesas::RA_DFP@6.6.0 diff --git a/Trace.csolution.yml b/Trace.csolution.yml index 581ed65..ad4a602 100644 --- a/Trace.csolution.yml +++ b/Trace.csolution.yml @@ -1,7 +1,7 @@ # Build inputs; cbuild generates *.cbuild*.yml and the debugger run description. solution: created-for: CMSIS-Toolbox@2.15.0 - compiler: GCC@14.3.1 + compiler: GCC cdefault: packs: @@ -47,7 +47,7 @@ solution: images: - project-context: TraceDemo.Debug debugger: - name: ULINKplus@pyOCD + name: ULINKpro@pyOCD protocol: swd clock: 10000000 trace: @@ -268,6 +268,31 @@ solution: input-clock: 16000000 output-clock: 1000000 + - type: EK-RA8P1 + device: Renesas::R7KA8P1KF:CPU0 + processor: + trustzone: off + fpu: off + mve: off + branch-protection: off + variables: + - Board-Layer: $SolutionDir()$/Board/EK-RA8P1/Board.clayer.yml + target-set: + - set: ULINKplus + images: + - project-context: TraceDemo.Debug + debugger: + name: ULINKplus@pyOCD + protocol: swd + clock: 10000000 + gdbserver: + - port: 3333 + trace: + - swo-uart: + mode: file + input-clock: 1000000 + output-clock: 1000000 + projects: - project: Projects/TraceDemo/TraceDemo.cproject.yml for-context: diff --git a/docs/BOARD_SUPPORT.md b/docs/BOARD_SUPPORT.md index 126d017..5948b7b 100644 --- a/docs/BOARD_SUPPORT.md +++ b/docs/BOARD_SUPPORT.md @@ -1,11 +1,11 @@ # Board support and references -All eight targets use local device-based layers in `Board//Board.clayer.yml`. +All ten targets use local device-based layers in `Board//Board.clayer.yml`. The solution selects each through `Board-Layer`. Device names and pinned DFPs below match the local configuration. Confirm the physical PCB revision separately from the catalog board revision. -| Local board layer | CMSIS device (`STMicroelectronics::`) | Core | Pinned DFP (`Keil::`) | +| Local board layer | CMSIS device (ST unless qualified) | Core | Pinned DFP (Keil unless qualified) | | --- | --- | --- | --- | | [MCBSTM32F400](../Board/MCBSTM32F400/README.md) | `STM32F407IGHx` | Cortex-M4 | `STM32F4xx_DFP@3.0.0` | | [NUCLEO-L552ZE-Q](../Board/NUCLEO-L552ZE-Q/README.md) | `STM32L552ZETxQ` | Cortex-M33 | `STM32L5xx_DFP@2.0.0` | @@ -16,10 +16,11 @@ from the catalog board revision. | [NUCLEO-F446RE](../Board/NUCLEO-F446RE/README.md) | `STM32F446RETx` | Cortex-M4 | `STM32F4xx_DFP@3.0.0` | | [STM32H7B3I-DK](../Board/STM32H7B3I-DK/README.md) | `STM32H7B3LIHxQ` | Cortex-M7 | `STM32H7xx_DFP@4.1.3` | | [STM32F4-DISCO](../Board/STM32F4-DISCO/README.md) | `STM32F407VGTx` | Cortex-M4 | `STM32F4xx_DFP@3.0.0` | +| [EK-RA8P1](../Board/EK-RA8P1/README.md) | `Renesas::R7KA8P1KF:CPU0` | Cortex-M85 | `Renesas::RA_DFP@6.6.0` | ## Shared layer design -Each layer selects standalone ST CMSIS device headers, GCC startup assembly and +STM32 layers select standalone ST CMSIS device headers, GCC startup assembly and system sources from [ThirdParty/ST](../ThirdParty/README.md), plus the shared GCC linker template. `regions.h` selects one internal Flash region, one SRAM region and a 4 KiB main stack. The board `main()` calls `target_init()` and the common @@ -197,3 +198,18 @@ onboard-probe hardware; select documentation for the physical PCB revision. Use the [board README](../Board/STM32F4-DISCO/README.md) and [MB997 wiring notes](ST_BOARD_BRINGUP.md#stm32f4-disco--mb997-b-02). + +### EK-RA8P1 + +The [RA8P1 layer](../Board/EK-RA8P1/README.md) uses the supplied RTOSDemo project's +CMSIS-based CPU0 startup and core header, internal code MRAM/SRAM0 and the +8 MHz MOCO reset clock. It shares the application, RTX configuration and GCC +linker template. The Cortex-M33 CPU1 is not an application target. + +The original `Renesas::RA_DFP@6.6.0` remains unmodified. A documented local +CPU0-only debug description supplies the missing CPU0/AP0 and SWO setup. The +explicit preparation skill or documented CMake command copies it after build/refresh; +standard pyTS generates trace settings from the current ELF. No `.dbgconf` +defaults exist for this device in that DFP. +The board README records Debug In jumpers, separate power, security prerequisites, +manual links and the remaining hardware checks. diff --git a/docs/BUILD.md b/docs/BUILD.md index a3c3bc7..488b57f 100644 --- a/docs/BUILD.md +++ b/docs/BUILD.md @@ -2,14 +2,17 @@ ## Environment and dependencies -Use CMSIS-Toolbox 2.15.0, GNU Arm Toolchain 14.3.1, CMake 3.31.5 and Ninja 1.13.2. -Arm Environment Manager and CI install these versions from -[`vcpkg-configuration.json`](../vcpkg-configuration.json); the CMSIS Solution -extension can also supply the toolbox for local builds. +Arm Environment Manager and CI select the available build tools from +[`vcpkg-configuration.json`](../vcpkg-configuration.json), which currently uses +`*` version requirements. The earlier reference environment used CMSIS-Toolbox +2.15.0, GNU Arm Toolchain 14.3.1, CMake 3.31.5 and Ninja 1.13.2. Actual validation +versions are recorded in [Validation](VALIDATION.md). The CMSIS Solution extension +can also supply the toolbox for local builds. For a manual installation, put those tools on `PATH`, set `CMSIS_COMPILER_ROOT` -to the toolbox's `etc` directory and `GCC_TOOLCHAIN_14_3_1` to the compiler's `bin` -directory. Check the environment from the repository root: +to the toolbox's `etc` directory and the matching `GCC_TOOLCHAIN_` +variable to the compiler's `bin` directory (for example `GCC_TOOLCHAIN_14_3_1`). +Check the environment from the repository root: ```sh cbuild --version @@ -122,3 +125,25 @@ GNU newlib-nano/libnosys warns about unimplemented `_close`, `_lseek`, `_read` and `_write`. No STDIO transport is provided; the application makes no STDIO calls. See [Validation](VALIDATION.md) for hardware checks and results. + +## EK-RA8P1 trace setup + +Build `EK-RA8P1@ULINKplus` with the installed GCC toolchain using the IDE solution +build or `cbuild --active EK-RA8P1@ULINKplus Trace.csolution.yml`. The firmware +build has no custom preparation step. After the final build/refresh, invoke +`Use $prepare-ra8p1-trace` with the +[repository skill](../.agents/skills/prepare-ra8p1-trace/SKILL.md), or copy the +versioned CPU0-only debug description explicitly: + +```sh +cmake -E copy_if_different Board/EK-RA8P1/debug-run.yml out/Trace+EK-RA8P1.cbuild-run.yml +``` + +Generate the trace runtime from the current ELF with the normal Trace Generation +view or bundled pyTS, then use Load & Debug. Repeat preparation after a subsequent +build/refresh or target change. SWO is captured to a file and converted automatically +to CSV on pause/end. This needs no additional interpreter or CMSIS tools export. + +The [board README](../Board/EK-RA8P1/README.md) explains the temporary DFP 6.6.0 +workaround, clock baseline and hardware prerequisites. CI builds the firmware and +checks the explicit CMake copy separately; it does not require an AI agent. diff --git a/docs/DEBUG_PROBES.md b/docs/DEBUG_PROBES.md index 11fa4e8..666d60a 100644 --- a/docs/DEBUG_PROBES.md +++ b/docs/DEBUG_PROBES.md @@ -32,6 +32,10 @@ type are connected, select the intended probe before loading an image. | NUCLEO-F446RE | `STLink` | 16 MHz | | STM32H7B3I-DK | `ULINKplus` (unnamed set) | 64 MHz | | STM32F4-DISCO (MB997 B-02) | `ULINKplus`, `STLink` | 16 MHz | +| EK-RA8P1 | `ULINKplus` | 8 MHz CPU0/timestamps; 1 MHz trace input | + +The L552 target set is still named `ULINKplus`; its debugger selection currently +uses `ULINKpro@pyOCD`. For the two unnamed sets, select `--active MCBSTM32F400` or `--active STM32H7B3I-DK`, without an `@ULINKplus` suffix. The other boards @@ -63,3 +67,17 @@ cbuild Trace.csolution.yml --active 'NUCLEO-F756ZG@STLink' --packs --frozen-pack The generated `.cbuild-run.yml` represents the active set and is replaced when switching. Source and generated trace profiles include `@` for named sets; see the [file naming table](TRACE_APP.md#configuration-ownership). + +## EK-RA8P1 CPU0 debug description + +Use `EK-RA8P1@ULINKplus`, 10 MHz SWD, GDB port 3333 and 1 Mbaud SWO. +After the final build/refresh, apply the versioned CPU0/AP0 description with the +[preparation skill](../.agents/skills/prepare-ra8p1-trace/SKILL.md) or the explicit +CMake command in the [board procedure](../Board/EK-RA8P1/README.md#debug-and-trace-preparation). +Generate trace through the normal Trace Generation view or bundled pyTS before +Enter Debug. SWO uses file capture with automatic RAW-to-CSV conversion on +pause/end and no live trace TCP service. + +Repeat preparation after a later build, refresh or target change. +Load/debug, RTX and automatic CSV on pause passed with the same CPU0 settings; +capture-boundary errors remain in [Validation](VALIDATION.md#ek-ra8p1-cpu0--2026-11-17). diff --git a/docs/DESIGN.md b/docs/DESIGN.md index bdf4796..3a75f1c 100644 --- a/docs/DESIGN.md +++ b/docs/DESIGN.md @@ -6,7 +6,7 @@ hardware results and capture limitations are in [Validation](VALIDATION.md). ## Agreed requirements -- Reuse one compact application across Cortex-M4, Cortex-M7 and Cortex-M33 boards. +- Reuse one compact application across Cortex-M4, Cortex-M7, Cortex-M33 and Cortex-M85 boards. Keep device startup, memory layout and hardware adaptation in local board layers. - Use CMSIS csolution/cproject/clayer, CMSIS-Core and RTX5. Use device Packs for device descriptions, SVDs, Flash algorithms and debug/trace sequences. @@ -29,14 +29,14 @@ hardware results and capture limitations are in [Validation](VALIDATION.md). - Capture SWO through pyOCD and convert RAW to CSV automatically on debug pause or session end in VS Code. Add trace-buffer (TB) scenarios after the required target paths and pyOCD functionality are established; TB is not implemented here. -- Use internal Flash/SRAM and the vendor reset-clock baseline. L552 uses one image +- Use internal Flash or MRAM, SRAM and the vendor reset-clock baseline. L552 uses one image with TrustZone disabled; option-byte provisioning is outside this project. - Prepare for open-source release: preserve source provenance and license notices; exclude build outputs, `.trace/` and machine-specific settings from Git. The board order is MCBSTM32F400, NUCLEO-L552ZE-Q, NUCLEO-F756ZG, STM32F429I-DISCO, NUCLEO-F401RE, STM32H7B3I-DK, STM32F4-DISCO (MB997 B-02), -then NUCLEO-F446RE. +then NUCLEO-F446RE, NUCLEO-G474RE and EK-RA8P1. ## Architecture and ownership @@ -47,7 +47,7 @@ then NUCLEO-F446RE. | `Board//Board.clayer.yml` | Device header/startup/system selection, board `main()`, target adaptation and linker regions | | `Common/App`, `Common/Workloads`, `Common/Trace` | RTX startup, periodic signal generation and nonblocking ITM output | | `Projects/TraceDemo/RTE/CMSIS` | Shared RTX5 component configuration | -| `ThirdParty/ST`, `Board/Support` | Pinned ST CMSIS sources and shared linker template | +| `ThirdParty/ST`, `ThirdParty/Renesas`, `Board/Support` | Pinned CMSIS device sources and shared linker template | | `.cmsis/*.ctrace.yml` | Editable, symbol-based trace sources; pyTS resolves them against the built ELF | | `.cmsis/*.dbgconf` | Pack debug/trace variable configuration | | `out/*.cbuild-run.yml`, `.trace/` | Generated debug/trace runtime files and RAW/CSV captures; excluded from Git | @@ -96,6 +96,13 @@ and would not generate the call to `app_main()`. 5. Separated probe selection and trace traffic settings from the firmware build through [debugger target sets](DEBUG_PROBES.md). +EK-RA8P1 reuses the supplied Renesas RTOSDemo project's CMSIS-based CPU0 +startup/header, while retaining this project's 8 MHz reset-clock baseline. Its +DFP lacks CPU0/AP0 and SWO setup; the versioned CPU0 debug description and a +preparation skill with an explicit CMake command apply the run-description +override workflow without changing installed Packs or adding an interpreter +dependency. See the [board layer](../Board/EK-RA8P1/README.md). + The [board inventory](BOARD_SUPPORT.md) records exact devices and Pack choices; [ThirdParty/README.md](../ThirdParty/README.md) records the imported source subset. diff --git a/docs/TRACE_APP.md b/docs/TRACE_APP.md index fd19f3f..fd6d4b1 100644 --- a/docs/TRACE_APP.md +++ b/docs/TRACE_APP.md @@ -151,6 +151,14 @@ Their development status and source/release links are recorded there. watch and its writing-PC output as described above. Start the matching debugger configuration and inspect the resulting capture. +For EK-RA8P1, apply the versioned CPU0 debug description after the final +build/refresh using the [preparation skill](../.agents/skills/prepare-ra8p1-trace/SKILL.md) +or CMake command in the [board procedure](../Board/EK-RA8P1/README.md#debug-and-trace-preparation). +Trace generation then uses this description and the current ELF through the same +view or pyTS command as the other targets. Repeat preparation after a subsequent +build, refresh or target change. +Capture uses the normal SWO file and automatic CSV workflow. + Equivalent offline generation with the bundled pyTS executable, for example: ```sh diff --git a/docs/VALIDATION.md b/docs/VALIDATION.md index 7b51c62..266811e 100644 --- a/docs/VALIDATION.md +++ b/docs/VALIDATION.md @@ -29,6 +29,7 @@ This table covers the regular demo; the StackCorruption experiment has its own s | NUCLEO-F446RE | — | PASS | IDE test pending; command-line server shutdown reported an SWV-reader assertion after the valid capture was flushed | | STM32H7B3I-DK | FAIL | — | ULINK+: incomplete/malformed packets at pause/end | | STM32F4-DISCO (MB997 B-02) | PASS | PASS | ULINK+: unexpected ITM26 records at pause/resume boundaries; incomplete pause/end packets. ST-LINK: pause passes, end incomplete | +| EK-RA8P1 | OPEN | — | Load/debug, RTX and automatic CSV on pause passed 2026-11-17; startup/EOF packet errors | Controlled ULINK+ findings: @@ -222,3 +223,70 @@ checks above. execution, SWO and automatic pause/end CSV conversion. - [ ] Confirm physical board revisions and unresolved connector/variant details listed in the [board references](BOARD_SUPPORT.md). + +## EK-RA8P1 CPU0 — 2026-11-17 + +**Build, Load & Debug, RTX runtime and automatic CSV on pause: PASS. Capture integrity: OPEN.** +`TraceDemo.Debug+EK-RA8P1`, set `ULINKplus`, built through CMSIS Solution using +CMSIS-Toolbox `2.15.0-41-gb69523a` (cbuild `2.15.0-20-g82c1ed2`, csolution +`2.15.1+p60-g84b22690`), GCC `15.3.2`, CMake `3.29.6` and Ninja `1.13.2`. +Dependencies are the unchanged Renesas RA_DFP 6.6.0, CMSIS 6.3.0 and RTX 5.9.0. +The selected tools differ from the historical reference versions in BUILD.md. + +The image links one CMSIS C vector table/reset handler and the shared RTX5 +application in internal MRAM/SRAM0. The 448-byte `__Vectors` table starts at +`0x02000000`; `main` and the RTX SVC handler are linked. ELF totals are about +15,020 bytes ROM and 38,512 bytes RAM including the main stack, within the +layer's 1 MiB MRAM and 512 KiB SRAM0. It retains the 8 MHz MOCO reset clock, +a 4 KiB main stack and the common RTX pool. No existing application source, +RTX configuration, shared linker script or installed pack was changed. + +The initial preparation generated a CPU0/AP0 SWO description and ran installed +pyTS `1.0.1.dev2+ga70bcd1`. Both watched symbols resolved from the current ELF as +signed 32-bit values. The runtime retained the two DWT write sources, ITM1, +8192-cycle PC sampling, 8 MHz timestamps and 16M DWT sync. The run/runtime +descriptions contain no CPU1 register operations. SWO input/output clocks are +both 1 MHz (MOCO /8, 1 Mbaud). + +The initial Enter Debug attempt failed before attaching: the ordinary build +replaced the prepared run description, removing CPU0/AP0 mapping. The adapter +also generated an empty GDB port without a default port entry. The target now +has a default GDB port and a versioned, CPU0-only `debug-run.yml` description +with literal-block sequence code. Apply it after build/refresh using the +preparation skill or explicit CMake command in the board procedure. +Trace generation uses the normal view or bundled pyTS. +The description retains the debug topology and sequences used in the hardware +checks below; no YAML serializer or additional interpreter is required. + +A subsequent normal `cmsis_action load_and_debug` completed CMSIS Load with exit +0 and reached the board's `main()`. RTX ran the Sine100ms, Noise100ms and +ITM1_200ms threads plus idle/timer. Live inspection reported APP_RUNNING, +`SystemCoreClock = g_app_core_clock_hz = 8000000`, ITM counter 465 and zero +ITM drops. The unrelated thOS debug session was left unchanged. + +SWO used `mode: file` with no trace TCP server. Pausing automatically created +a fresh CSV: 90,735 PC samples, 1,866 DWT records across the two watches and +465 ITM1 records. There were two decoder errors: `Invalid ITM packet sequence` +near startup and `Incomplete ITM packet at EOF` at the pause boundary; no overflow +record was present. Automatic CSV creation is verified, but this capture is not +an integrity PASS. The target was resumed after inspection. + +CPU1/AP2 discovery still reports WAIT ACK, as in the supplied reference project; +CPU0 loading/debugging succeeded. One intermediate direct flash attempt completed +programming but reported an I/O error on exit; the subsequent normal CMSIS +Load & Debug completed successfully. Repeated launch/reset and debug-end capture +integrity remain to be checked. The reference project's 1-GHz ITM0 results do not +apply to this reset-clock image. + +**Skill/shell preparation — 2026-11-17:** a fresh source snapshot in a path +containing spaces passed the normal `cbuild --active EK-RA8P1@ULINKplus` build +without a custom build hook, `.cmsis/tools-environment.yml` or Ruby (a shim rejects +Ruby invocations). The build retained its ordinary generated run description. +The explicit CMake command then copied the versioned template byte for byte; +standard pyTS generated all six CPU0 trace references without missing symbols. +Trace register operations match the previously validated runtime, and the +template's CPU0 topology/sequences are unchanged. YAML, skill frontmatter, +local documentation links and diff checks passed. The common CProject now +matches `main`. The current debug session could not read the core and its server +previously reported `No such device`; no new hardware capture is claimed for +this preparation change. diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json index 1c63254..311864d 100644 --- a/vcpkg-configuration.json +++ b/vcpkg-configuration.json @@ -7,9 +7,9 @@ } ], "requires": { - "arm:tools/open-cmsis-pack/cmsis-toolbox": "2.15.0", - "arm:compilers/arm/arm-none-eabi-gcc": "14.3.1", - "arm:tools/kitware/cmake": "3.31.5", - "arm:tools/ninja-build/ninja": "1.13.2" + "arm:tools/open-cmsis-pack/cmsis-toolbox": "*", + "arm:compilers/arm/arm-none-eabi-gcc": "*", + "arm:tools/kitware/cmake": "*", + "arm:tools/ninja-build/ninja": "*" } }