feat: add EFR32MG21 (xG21) CPU platform and BRD4180A board - #3
Conversation
Add the EFR32xG21 CPU platform description and BRD4180A radio board support, enabling emulation of EFR32MG21A020F1024IM32 (Series 2 Config 1, Cortex-M33) targets. The memory map and interrupt assignments follow the EFR32xG21 Reference Manual (Rev. 1.0). Peripheral IP-version models are reused from the architecturally-closest supported part (xG22 generation); crypto is provided by the Secure Engine mailbox (SEMAILBOX) as on xG24. The HFXO configuration includes releaseFsmLockOnDisableOnDemand since MG21 has no HFXO MANUALOVERRIDE command — without it, CMU_HFXOInit() spins forever polling FSMLOCK. Validated by booting stripped Zigbee application firmware through clock, power and radio init into a steady-state idle loop.
There was a problem hiding this comment.
Pull request overview
This PR adds Renode platform descriptions to emulate Silicon Labs EFR32xG21 (Series 2 Config 1, Cortex-M33) devices and the BRD4180A (EFR32MG21A020F1024IM32) radio board, aligning memory map/IRQ layout with the EFR32xG21 Reference Manual and reusing existing Series-2 peripheral models.
Changes:
- Added a new CPU/platform
.replfor EFR32xG21, including CMU/EMU/MSC, radio (LPW), TrustZone NVIC mappings, and Secure Engine mailbox crypto. - Added a new board
.replfor BRD4180A with LED/button GPIO wiring and flash/lockbits sizing.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| platforms/cpus/silabs/efr32s2/efr32xG21.repl | Introduces the EFR32xG21 SoC platform definition (memory map, IRQ wiring, peripherals, radio/sequencer). |
| platforms/boards/silabs/brd4180a.repl | Adds the BRD4180A board wrapper with GPIO mappings and flash/lockbits layout. |
Comments suppressed due to low confidence (1)
platforms/cpus/silabs/efr32s2/efr32xG21.repl:236
prortcis currently assignedIRQ -> nvic@39, which conflicts with the radio's host mailbox interrupt assignment used on other EFR32S2 parts (and would also conflict with the addedHostMailboxIRQ -> nvic@39). Consider aligningprortctonvic@41like other platforms using the same PRORTC model to avoid sharing an NVIC line between unrelated peripherals.
IRQ -> nvic@39
SeqIRQ -> seqnvic@21
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| cpu0: cpu | ||
| SecureIRQ -> nvic@3 | ||
| SecurePriviledgedIRQ -> nvic@4 | ||
| NonSecurePriviledgedIRQ -> nvic@4 |
| } | ||
| sequencer: seqcpu | ||
| bufferController: lpwBufferController | ||
| prortc: prortc | ||
| // Main CPU interrupts |
| RadioControllerRadioStateMachineIRQ -> nvic@37 | ||
| RadioControllerSequencerIRQ -> nvic@38 | ||
| SynthesizerIRQ -> nvic@40 |
764ca77 to
e0f62f8
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 764ca77194
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "Codex (@codex) review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".
| sequencer: seqcpu | ||
| bufferController: lpwBufferController | ||
| prortc: prortc |
There was a problem hiding this comment.
Configure the radio clock frequency
When firmware transmits or schedules protocol-timer events, this SiLabs_xG22_LPW instance has no clockFrequency configured in either the CPU or board description. The reused xG22 platform explicitly supplies 38.4 MHz, as do the other Series 2 radio platforms; leaving it unset makes radio timing use an uninitialized/default frequency, so initialization reaching idle does not validate actual packet timing or transmission.
Useful? React with 👍 / 👎.
| } | ||
| -> nvic@21 |
There was a problem hiding this comment.
Assign the CPU context to LDMA
When a UART or radio request starts an LDMA transfer, this reused SiLabs_LDMA_0_1 instance has no context: cpu. Every existing Series 2 LDMA platform, including the xG22 configuration this file derives from, supplies that context so DMA bus accesses carry the Cortex-M33 security state; without it, descriptor and payload accesses can use the wrong access context or fail once DMA is exercised.
Useful? React with 👍 / 👎.
- Add clockFrequency: 38400000 to the Wireless.SiLabs_xG22_LPW radio block, matching the xG22 platform and 802.15.4 timing requirements. - Add context: cpu to the LDMA block, matching xG22/xG24 platforms. Without it DMA transfers use wrong TrustZone access context. Both issues identified by PR review; verified against EFR32MG21 CMSIS header (efr32mg21a010f768im32.h IRQn_Type enum). Three other review comments about SMU/HostMailbox/PRORTC IRQ routing are not applicable — xG21 has different interrupt assignments from xG22 (verified at source).
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0ca661aff2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "Codex (@codex) review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".
| cpu0: cpu | ||
| SecureIRQ -> nvic@3 | ||
| SecurePriviledgedIRQ -> nvic@4 | ||
| NonSecurePriviledgedIRQ -> nvic@4 |
There was a problem hiding this comment.
Route the nonsecure SMU interrupt to IRQ 5
On xG21, the SMU nonsecure-privileged interrupt is IRQ 5, while IRQ 4 is the separate secure-privileged interrupt. With both outputs connected to IRQ 4 here, firmware enabling the IRQ 5 handler will never receive nonsecure SMU events, and those events can instead invoke the wrong secure handler.
Useful? React with 👍 / 👎.
|
This PR depends on the following upstream changes. After each is merged, the corresponding submodule pointer needs to be bumped.
|
Add the EFR32xG21 CPU platform description and BRD4180A radio board
support, enabling emulation of EFR32MG21A020F1024IM32 (Series 2 Config 1,
Cortex-M33) targets.
The memory map and interrupt assignments follow the EFR32xG21 Reference
Manual (Rev. 1.0). Peripheral IP-version models are reused from the
architecturally-closest supported part (xG22 generation); crypto is
provided by the Secure Engine mailbox (SEMAILBOX) as on xG24.
The HFXO configuration includes
releaseFsmLockOnDisableOnDemandsinceMG21 has no HFXO MANUALOVERRIDE command — without it, CMU_HFXOInit()
spins forever polling FSMLOCK.
Validated by booting stripped Zigbee application firmware through clock,
power and radio init into a steady-state idle loop.
Closes #2