Add Nuvoton M251/M252 platform support#447
Open
Belonit wants to merge 5 commits into
Open
Conversation
Import the CMSIS device and StdDriver header sets from the official M251BSP V3.02.009 release at commit: 01ded248c420f27230214582883aa74a46553d81 Keep the headers in a single versioned vendor tree and record their Apache-2.0 licensing and provenance. No StdDriver source implementation is imported.
The aggregate include block in M251.h injects every StdDriver API into all CMSIS consumers and collides with ChibiOS HAL identifiers. Retain the original include list as a comment and require consumers to include individual relocated headers through M251/stddriver/. All other vendor headers remain unchanged.
Add a dedicated Cortex-M23 ARMv8-M Baseline ChibiOS/RT core port with GCC context switching, NMI-based preemption, and optional PendSV switching. Handle the ChibiOS 7 and 8 kernel ABI differences explicitly. Use global interrupt masking instead of BASEPRI. Reject unsupported CMSE, SMP, and runtime measurement configurations at compile time.
Add Cortex-M23 startup, CMSIS integration, linker scripts, and board support for the NuMaker-M252SD with an M252SD2AE MCU. Implement ST, PAL and events, GPT, BPWM-backed PWM, Serial, SPI, I2C, EFL/FMC, WDG, and M252 USB device low-level drivers. Describe concrete peripheral capabilities in the registry and keep unsupported family variants out of the advertised target set.
Add smoke targets for startup, EFL, GPT, I2C, PAL events, PWM, Serial, SPI, USB HID, and WDG on the NuMaker-M252SD board. Share one RT7/RT8-compatible chconf.h through CHCONFDIR while keeping HAL and MCU configuration local to each target. Add the M251 testhal tree to the stable_21.11.x CI build matrix.
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
Add a ChibiOS-Contrib platform implementation for the Nuvoton M251/M252
Cortex-M23 family, with an initial concrete target for the NuMaker-M252SD
board and its M252SD2AE MCU.
The port provides:
NUMAKER_M252SDboard definition;testhalapplications for the NuMaker-M252SD board;chconf.h;testhal/NUMICRO/M251onstable_21.11.x.The change is self-contained in ChibiOS-Contrib. It does not modify the ChibiOS core or existing NUMICRO platforms.
Supported hardware
Device scope
The drivers use the register model shared by the M251/M252 family. M252SD2AE is the currently described registry target and the device used for hardware validation. Additional family members can be enabled by adding registry entries describing their memory geometry, interrupt set and peripheral capabilities.
USB device support requires a device containing the USBD peripheral.
Vendor headers
The imported CMSIS device and StdDriver header sets are derived from the official Nuvoton M251BSP V3.02.009 release.
Original Apache-2.0 license, NOTICE, and copyright information are retained. No StdDriver source implementation is imported.
Current limitations
M251_I2C_USE_HW_TIMEOUT=FALSEfor slaves requiring longer clock stretching and use a finite API timeout.Validation
All targets build successfully with both supported ChibiOS generations, in checked and release configurations:
stable_21.11.x/ RT 7.0.6fd2e59c34878/ RT 8.0.0The required ChibiOS-Contrib test build is included in CI:
The second command compile-checks the optional dual-SSD1306 configuration; the
hardware matrix below remains the ten primary testhal targets.
All testhal targets were also validated on a NuMaker-M252SD v1.2:
BlinkyGPTSERIALPAL_EVENTSPWMSPII2CUSB_HIDEFLWATCHDOGReview notes
os/hal/ports/NUMICRO/M251.Existing
NUMICRO/LLD/*v1drivers are NUC123-specific and use incompatible peripheral register models.