Skip to content

添加 rdk s100 bsp#11338

Open
rcitach wants to merge 4 commits intoRT-Thread:masterfrom
rcitach:rcitach/rdk_s100
Open

添加 rdk s100 bsp#11338
rcitach wants to merge 4 commits intoRT-Thread:masterfrom
rcitach:rcitach/rdk_s100

Conversation

@rcitach
Copy link
Copy Markdown
Contributor

@rcitach rcitach commented Apr 20, 2026

拉取/合并请求描述:(PR description)

[

为什么提交这份PR (why to submit this PR)

你的解决方案是什么 (what is your solution)

请提供验证的bsp和config (provide the config and bsp)

  • BSP:
  • .config:
  • action:

]

当前拉取/合并请求的状态 Intent for your PR

必须选择一项 Choose one (Mandatory):

  • 本拉取/合并请求是一个草稿版本 This PR is for a code-review and is intended to get feedback
  • 本拉取/合并请求是一个成熟版本 This PR is mature, and ready to be integrated into the repo

代码质量 Code Quality:

我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:

  • 已经仔细查看过代码改动的对比 Already check the difference between PR and old code
  • 代码风格正确,包括缩进空格,命名及其他风格 Style guide is adhered to, including spacing, naming and other styles
  • 没有垃圾代码,代码尽量精简,不包含#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up
  • 所有变更均有原因及合理的,并且不会影响到其他软件组件代码或BSP All modifications are justified and not affect other components or BSP
  • 对难懂代码均提供对应的注释 I've commented appropriately where code is tricky
  • 代码是高质量的 Code in this PR is of high quality
  • 已经使用formatting 等源码格式化工具确保格式符合RT-Thread代码规范 This PR complies with RT-Thread code specification
  • 如果是新增bsp, 已经添加ci检查到.github/ALL_BSP_COMPILE.json 详细请参考链接BSP自查

@github-actions
Copy link
Copy Markdown

👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread!

为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。
To ensure your code complies with RT-Thread's coding style, please run the code formatting workflow by following the steps below (If the formatting of CI fails to run).


🛠 操作步骤 | Steps

  1. 前往 Actions 页面 | Go to the Actions page
    点击进入工作流 → | Click to open workflow →

  2. 点击 Run workflow | Click Run workflow

  • 设置需排除的文件/目录(目录请以"/"结尾)
    Set files/directories to exclude (directories should end with "/")
  • 将目标分支设置为 \ Set the target branch to:rcitach/rdk_s100
  • 设置PR number为 \ Set the PR number to:11338
  1. 等待工作流完成 | Wait for the workflow to complete
    格式化后的代码将自动推送至你的分支。
    The formatted code will be automatically pushed to your branch.

完成后,提交将自动更新至 rcitach/rdk_s100 分支,关联的 Pull Request 也会同步更新。
Once completed, commits will be pushed to the rcitach/rdk_s100 branch automatically, and the related Pull Request will be updated.

如有问题欢迎联系我们,再次感谢您的贡献!💐
If you have any questions, feel free to reach out. Thanks again for your contribution!

@github-actions github-actions Bot added the BSP label Apr 20, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread bsp/rdk/s100/startup/trap.c Outdated
Comment on lines +325 to +342
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;
Comment on lines +357 to +369
(*(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;

Comment on lines +42 to +49
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);
}
Comment thread bsp/rdk/s100/startup/trap.c Outdated
Comment on lines +134 to +135
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);
Comment thread bsp/rdk/s100/README.md
Comment on lines +1 to +12
# 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 启动链路:
Comment thread bsp/rdk/s100/README.md
Comment on lines +1 to +4
# S100 BSP 编译与加载运行说明

本文说明 `bsp/s100` 这个 RT-Thread BSP 如何在主机侧编译,以及如何在 RDK S100 板端加载并运行。

@github-actions github-actions Bot added the action github action yml imporve label Apr 20, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 20, 2026

📌 Code Review Assignment

🏷️ Tag: workflow

Reviewers: Rbb666 kurisaW supperthomas

Changed Files (Click to expand)
  • .github/ALL_BSP_COMPILE.json

📊 Current Review Status (Last Updated: 2026-04-22 01:16 CST)

  • Rbb666 Pending Review
  • kurisaW Pending Review
  • supperthomas Pending Review

📝 Review Instructions

  1. 维护者可以通过单击此处来刷新审查状态: 🔄 刷新状态
    Maintainers can refresh the review status by clicking here: 🔄 Refresh Status

  2. 确认审核通过后评论 LGTM/lgtm
    Comment LGTM/lgtm after confirming approval

  3. PR合并前需至少一位维护者确认
    PR must be confirmed by at least one maintainer before merging

ℹ️ 刷新CI状态操作需要具备仓库写入权限。
ℹ️ Refresh CI status operation requires repository Write permission.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action github action yml imporve BSP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants