Skip to content

Sync code base with latest official RAK4631 PR changes - #11

Merged
srcnert merged 17 commits into
rak-mainfrom
dev/variant-rak4631-sync
Oct 16, 2026
Merged

srcnert merged 17 commits into
rak-mainfrom
dev/variant-rak4631-sync

Conversation

@srcnert

@srcnert srcnert commented Oct 15, 2026 •

Copy link
Copy Markdown
Owner

Realigns the RAK4631 support in this downstream with the latest state of the
official upstream RAK4631 pull request, so that future merges from
arduino/ArduinoCore-zephyr stay conflict-free.

MCUboot is now part of the normal build

rak4631.build.zephyr_args carries --sysbuild, so the loader always builds
through MCUboot and the --mcuboot flag disappears:

  • extra/build.sh derives MCUboot mode from --sysbuild in the board's
    zephyr_args instead of a CLI flag, and the option parsing goes back to
    upstream's [ x$2 == x"--debug" ] form.
  • The bootloader image is renamed firmwares/zephyr-<variant>.mcuboot.hex so
    extra/package_core.sh (which globs firmwares/zephyr-${variant}.*) ships it
    with the core. .vscode/flash_loader.jlink, .vscode/tasks.json,
    extra/rak/checkall.py (the loader build dir is build/<variant>/loader
    under sysbuild) and rak-build.yml follow.
  • extra/bootstrap.sh installs MCUboot's Python requirements for image signing.

Loader and core sources back to upstream shape

  • cores/arduino/main.cpp returns to upstream's unconditional
    SerialUSB.begin(115200); the shell-port exception moves into the loader.
  • loader/main.c restores upstream's #if CONFIG_SHELL / #elif CONFIG_LOG
    blocks verbatim and adds the RAK case as a separate SHELL_ON_OWN_CDC_PORT
    branch, so the shell stays on its own CDC-ACM port instead of being moved
    onto the sketch's Serial.
  • extra/debug.conf goes back to upstream plus the single
    CONFIG_SHELL_LOG_BACKEND=n line; the RAK-specific logging and LoRa shell
    tuning moves out (CONFIG_SIZE_OPTIMIZATIONS lands in the variant .conf).

USB identity

RAK4631 stops borrowing Nordic's 0x1915:0x5300 and uses 0x1209:0x0003
(0x0004 for MCUboot) in boards.txt, the variant .conf, the samples and the
MCUboot fragment.

Tooling and CI

  • MCUmgr is built on a macOS runner (its macOS binaries need cgo, which cannot
    be cross-compiled from Linux) and extra/package_tool.sh uses
    shasum/wc -c so it runs on both hosts; dependabot now watches
    tools/mcumgr.
  • package_core.yml picks the loader's memory table out of the sysbuild
    output, which contains one table per image.
  • .editorconfig-checker.json and license_check.py exclusions follow the
    files touched above.

Signed-off-by: Sercan Erat <sercan.erat@rakwireless.com>
Signed-off-by: Sercan Erat <sercan.erat@rakwireless.com>
macOS ships bash 3.2 without mapfile and a BSD grep without -P, so
splitting a board's zephyr_args failed there. On darwin, split them
with perl, using the same regular expression.
Signed-off-by: Sercan Erat <sercan.erat@rakwireless.com>
- Arduino pin map
- Three USB CDC ACM ports: the sketch's Serial, plus shell and
  logging ports that only debug builds use
- LoRaWAN through the SX1262 on the module
- A flash layout and boot-mode retention area shared with MCUboot
  for a 1200-bps touch serial recovery

Signed-off-by: Sercan Erat <sercan.erat@rakwireless.com>
Signed-off-by: Sercan Erat <sercan.erat@rakwireless.com>
Signed-off-by: Sercan Erat <sercan.erat@rakwireless.com>
Signed-off-by: Sercan Erat <sercan.erat@rakwireless.com>
Signed-off-by: Sercan Erat <sercan.erat@rakwireless.com>
Signed-off-by: Sercan Erat <sercan.erat@rakwireless.com>
Signed-off-by: Sercan Erat <sercan.erat@rakwireless.com>
Signed-off-by: Sercan Erat <sercan.erat@rakwireless.com>
Signed-off-by: Sercan Erat <sercan.erat@rakwireless.com>
Signed-off-by: Sercan Erat <sercan.erat@rakwireless.com>
@srcnert srcnert closed this Oct 15, 2026
@srcnert srcnert reopened this Oct 15, 2026
@claude

claude Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Claude finished @srcnert's task in 10m 7s —— View job


Review

  • Read CLAUDE.md and gather PR context
  • Review build/CI tooling changes (extra/build.sh, package_*.yml, checkall.py, package_tool.sh)
  • Review loader + core sources (loader/main.c, cores/arduino/main.cpp, debug.conf)
  • Review variant consistency (overlay, .conf, boards.txt, samples, docs)
  • Post inline findings + summary

This PR realigns the RAK4631 port with the latest state of the upstream RAK4631 PR: MCUboot becomes part of the normal build (rak4631.build.zephyr_args=--sysbuild, --mcuboot gone, bootloader hex renamed to firmwares/zephyr-<variant>.mcuboot.hex), loader/main.c and cores/arduino/main.cpp go back to upstream shape with the RAK shell-on-its-own-CDC-port case added as a separate SHELL_ON_OWN_CDC_PORT branch, the USB identity moves off Nordic's 0x1915:0x5300, and MCUmgr is built on a macOS runner.

The direction is good and the downstream delta genuinely shrinks. I diffed loader/main.c against the upstream tip merged in here (38dbedf) and the remaining delta really is additive and isolated — the 1200-bps touch in loader_usb_msg_cb, the SHELL_ON_OWN_CDC_PORT branch, and the sketch_valid && guard. cores/arduino/main.cpp reverting to the unconditional SerialUSB.begin() is a no-op for RAK, since zephyr,shell-uart = &board_cdc_acm_shell already makes the old guard false. The variant overlay/.conf/boards.txt/samples/MCUboot fragment all agree on 0x1209:0x0003 + 0x0004, endpoint counts still fit the three CDC-ACM ports, .github/dependabot.yml matches what extra/ci_dependabot_config.sh generates (so the package_tool.yml verify step passes), there are no stale --mcuboot or firmwares/mcuboot-* references left, and the double-tap recovery text in variants/rak4631_nrf52840/doc/index.txt now matches modules/rak_double_tap/double_tap.c — that one is resolved.

New findings this round:

  • extra/debug.conf — dropping the # Logging block loses CONFIG_LOG_DEFAULT_LEVEL=3, so the variant's =2 (WRN) now applies to --debug builds and every LOG_INF/LOG_DBG in the loader is compiled out, including the new shell: port open (DTR set) message. Fix this →
  • extra/rak/checkall.py — the sysbuild /loader path was fixed here and in rak-build.yml, but README.rak.md:142-150 still runs west build -d build/rak4631_nrf52840 -t footprint|ram_report|rom_report, which now fails with an unknown-target error; README.rak.md:276 / extra/rak/lint.py:8-9 and .vscode/launch.json:8 are stale too. Fix this →

Still open from earlier rounds (no code change since, only the rak-main merge):

  • extra/debug.conf:32 — CONFIG_LOG_BACKEND_UART_AUTOSTART=y vs the variant's =n; both fragments reach the loader image through EXTRA_CONF_FILE, so the merge order silently decides. Fixing it the same way as the new finding above resolves both at once.
  • extra/build.sh:65 — MCUboot mode is only derived inside the boards.txt branch, so ./extra/build.sh rak4631/nrf52840 --sysbuild leaves mcuboot unset, LOADER_DIR points at the sysbuild top level, and -t llext-edk fails after a full two-image build.
  • .github/workflows/package_core.yml:229 — the new awk has no END rule (the loader table is dropped if stdout ends inside it) and discriminates MCUboot on the line following the table.
  • variants/rak4631_nrf52840/rak4631_nrf52840.conf:26 — 0x1209:0x0003/0x0004 are pid.codes test IDs, and boards.txt keys board detection plus the 1200-bps touch on them.
  • .vscode/launch.json:8 — covered in the second inline comment above.

Nothing here blocks the sync in principle; the debug.conf items are the ones I would settle before merge, since ./extra/build.sh rak4631 --debug is not covered by rak-build.yml or rak-checkall and both findings only show up in that configuration.

I did not run a build — no Zephyr workspace in this checkout — so the --debug claims are read off the Kconfig fragments and loader/main.c, not observed.
• branch dev/variant-rak4631-sync

Comment thread variants/rak4631_nrf52840/doc/index.txt Outdated
Comment thread extra/debug.conf
Comment thread variants/rak4631_nrf52840/rak4631_nrf52840.conf
Comment thread .github/workflows/package_core.yml
Signed-off-by: Sercan Erat <sercan.erat@rakwireless.com>
@srcnert
srcnert force-pushed the dev/variant-rak4631-sync branch from cff1488 to 9f05724 Compare October 16, 2026 07:59
Comment thread .vscode/flash_loader.jlink
Comment thread extra/build.sh
Comment thread extra/debug.conf
Comment thread extra/debug.conf
Comment thread extra/rak/checkall.py
@srcnert
srcnert merged commit 6a0c8fd into rak-main Oct 16, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant