Conversation
|
👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread! 为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。 🛠 操作步骤 | Steps
完成后,提交将自动更新至 如有问题欢迎联系我们,再次感谢您的贡献!💐 |
edf68ce to
dc5412d
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds a new RT-Thread BSP for the RDK S100 (Cortex-R52/ARMv8-R AArch32) platform under bsp/rdk/s100, including startup/exception handling, GICv3 interrupt support, linker script, and basic peripheral drivers (timer/UART/GPIO/pinmux), plus build and usage documentation.
Changes:
- Add Cortex-R52 startup code (EL2→EL1 transition), exception vectors/traps, context switch, and backtrace support.
- Add GICv3-based interrupt controller support with a board-level IRQ whitelist.
- Add board/drivers scaffolding (timer tick, UART v2, GPIO/pin device, pinmux) and SCons/Kconfig integration + README.
Reviewed changes
Copilot reviewed 43 out of 43 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| bsp/rdk/s100/startup/vector_gcc.S | Adds exception vector handlers (EL1/EL2) and FIQ handling. |
| bsp/rdk/s100/startup/trap.c | Implements trap handlers, register dump, IRQ/FIQ dispatch. |
| bsp/rdk/s100/startup/system.c | Defines S100 board IRQ whitelist and support check helper. |
| bsp/rdk/s100/startup/startup_gcc.S | Boot/MPU/cache init and EL2→EL1 reset path + stacks/BSS init. |
| bsp/rdk/s100/startup/stack.c | Thread stack initialization for Cortex-R52, optional FPU context. |
| bsp/rdk/s100/startup/interrupt.h | Declares interrupt/GIC control APIs used by BSP/drivers. |
| bsp/rdk/s100/startup/interrupt.c | Provides rt_hw_interrupt_* wrappers on top of GICv3 driver. |
| bsp/rdk/s100/startup/gicv3.h | GICv3 register defs/macros and API declarations. |
| bsp/rdk/s100/startup/gicv3.c | GICv3 implementation with board IRQ whitelist filtering. |
| bsp/rdk/s100/startup/cpuport.h | CPU mode/stack structs and constants for the port. |
| bsp/rdk/s100/startup/cpuport.c | CPU ID/affinity helpers and shutdown routine. |
| bsp/rdk/s100/startup/cp15_gcc.S | CP15 helpers (vector base, cache enable/flush, etc.). |
| bsp/rdk/s100/startup/cp15.h | Barrier and CP15 accessor macros. |
| bsp/rdk/s100/startup/context_gcc.S | Context switch, IRQ handler, and interrupt switch-do routine. |
| bsp/rdk/s100/startup/backtrace.h | Backtrace/unwind structures and APIs. |
| bsp/rdk/s100/startup/backtrace.c | ARM EABI unwind-based backtrace implementation. |
| bsp/rdk/s100/startup/armv8.h | ARMv8-R register/exception constants and exp stack structs. |
| bsp/rdk/s100/startup/SConscript | Adds startup sources to the build. |
| bsp/rdk/s100/rtconfig.py | Toolchain/options for S100 BSP (hard/soft float selection). |
| bsp/rdk/s100/rtconfig.h | Generated RT-Thread configuration header for this BSP. |
| bsp/rdk/s100/link.lds | Linker script for remoteproc-style MCU1 ELF layout. |
| bsp/rdk/s100/drivers/drv_uart_v2.c | UART v2 serial driver (UART4/5/6) + ISR hookup. |
| bsp/rdk/s100/drivers/drv_timer.c | Generic timer tick driver using CNTP registers. |
| bsp/rdk/s100/drivers/drv_pinmux.h | Pinmux helper API for S100 pins. |
| bsp/rdk/s100/drivers/drv_pinmux.c | Pinmux/pin config implementation + blacklist/validation. |
| bsp/rdk/s100/drivers/drv_gpio.h | GPIO access layer API. |
| bsp/rdk/s100/drivers/drv_gpio.c | GPIO/pin device implementation + GPIO IRQ dispatch. |
| bsp/rdk/s100/drivers/SConscript | Builds selected drivers based on Kconfig dependencies. |
| bsp/rdk/s100/drivers/Kconfig | Adds Kconfig menu for onboard drivers (UART/CAN/GPIO/pinmux). |
| bsp/rdk/s100/board/rsc_table.h | remoteproc resource table data structures. |
| bsp/rdk/s100/board/rsc_table.c | Resource table instance placed into .resource_table. |
| bsp/rdk/s100/board/board.h | Board definitions, heap symbols, GIC bases, IRQ whitelist API. |
| bsp/rdk/s100/board/board.c | Board init (interrupt init, heap init, components init, console). |
| bsp/rdk/s100/board/SConscript | Builds board sources. |
| bsp/rdk/s100/applications/main.c | Minimal main() printing a banner. |
| bsp/rdk/s100/applications/SConscript | Builds application sources. |
| bsp/rdk/s100/SConstruct | BSP-level SCons entry to build rtthread.elf. |
| bsp/rdk/s100/SConscript | Aggregates subdir SConscript groups. |
| bsp/rdk/s100/README.md | Build/run instructions for S100 remoteproc workflow. |
| bsp/rdk/s100/Kconfig | BSP Kconfig root and driver menu inclusion. |
| void rt_hw_trap_fiq(void) | ||
| { | ||
| void *param; | ||
| int ir; | ||
| rt_isr_handler_t isr_func; | ||
| extern struct rt_irq_desc isr_table[]; | ||
|
|
||
| ir = rt_hw_interrupt_get_irq(); | ||
| /* get interrupt service routine */ | ||
| isr_func = isr_table[ir].handler; | ||
| param = isr_table[ir].param; | ||
|
|
||
| /* turn to interrupt service routine */ | ||
| isr_func(ir, param); | ||
|
|
||
| /* end of interrupt */ | ||
| rt_hw_interrupt_ack(ir); | ||
| } |
|
|
||
| uart->regs->LCR |= UART_LCR_DLAB; | ||
| uart->regs->DLF = baud_div_fraction; | ||
| uart->regs->RBR = baud_div_int & 0xffu; |
| (*(uint32_t *)SYS_REG_UART_CTRL) |= uart->rx_mask; | ||
| uart->regs->MCR = 0u; | ||
|
|
||
| ret = s100_uart_config_prepare(uart); | ||
| if (ret == RT_EOK) | ||
| { | ||
| s100_uart_set_baud(uart, cfg->baud_rate); | ||
| ret = s100_uart_set_lcr(uart, cfg); | ||
| s100_uart_set_fifo(uart); | ||
| } | ||
|
|
||
| (*(uint32_t *)SYS_REG_UART_CTRL) &= ~uart->rx_mask; | ||
|
|
| const unsigned int VECTOR_BASE = 0x00; | ||
| extern void rt_cpu_vector_set_base(unsigned int addr); | ||
| extern int system_vectors; | ||
|
|
||
| void rt_hw_vector_init(void) | ||
| { | ||
| rt_cpu_vector_set_base((unsigned int)&system_vectors); | ||
| } |
| rt_kprintf("Execption:\n"); | ||
| rt_kprintf("r00:0x%08x r01:0x%08x r02:0x%08x r03:0x%08x\n", regs->r0, regs->r1, regs->r2, regs->r3); |
| # S100 BSP 编译与加载运行说明 | ||
|
|
||
| 本文说明 `bsp/s100` 这个 RT-Thread BSP 如何在主机侧编译,以及如何在 RDK S100 板端加载并运行。 | ||
|
|
||
| 说明分两部分: | ||
|
|
||
| - 本地 BSP 实际构建方式:以当前仓库中的 `SConstruct`、`rtconfig.py`、`link.lds` 为准 | ||
| - 板端启动流程:参考 D-Robotics 官方文档“[MCU快速入门指南](https://d-robotics.github.io/rdk_doc/rdk_s/Advanced_development/mcu_development/S100/basic_information/)” | ||
|
|
||
| ## 1. 背景说明 | ||
|
|
||
| 官方文档说明了 S100 的 MCU 启动链路: |
| # S100 BSP 编译与加载运行说明 | ||
|
|
||
| 本文说明 `bsp/s100` 这个 RT-Thread BSP 如何在主机侧编译,以及如何在 RDK S100 板端加载并运行。 | ||
|
|
📌 Code Review Assignment🏷️ Tag: workflowReviewers: Rbb666 kurisaW supperthomas Changed Files (Click to expand)
📊 Current Review Status (Last Updated: 2026-04-22 01:16 CST)
📝 Review Instructions
|
be2dd7b to
0756e35
Compare
拉取/合并请求描述:(PR description)
[
为什么提交这份PR (why to submit this PR)
你的解决方案是什么 (what is your solution)
请提供验证的bsp和config (provide the config and bsp)
]
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up