Skip to content

Use Ariel OS to test across wider boards range#36

Draft
chrysn wants to merge 6 commits into
mainfrom
ariel
Draft

Use Ariel OS to test across wider boards range#36
chrysn wants to merge 6 commits into
mainfrom
ariel

Conversation

@chrysn

@chrysn chrysn commented Apr 20, 2026

Copy link
Copy Markdown
Member

This is a test shot at running on Ariel OS.

Current trouble is that I don't have hardware that both we have support for and that Ariel OS supports (I have an nRF54LM40A, but that's not in Ariel yet).

@WilliamTakeshi, could you see whether laze build -b st-nucleo-wba55 run in the new folder runs through?

@WilliamTakeshi

Copy link
Copy Markdown
Collaborator

After running laze build -b st-nucleo-wba55 run I get the following error:

panicked at /home/william/.cargo/git/checkouts/embassy-0012190963c274d8/1b75c3d/embassy-stm32/src/rcc/wba.rs:261:40:
  PLL1.P not configured
  Firmware exited with: Application exit (Unknown exit code 1)
  Core 0
      Frame 0: syscall_readonly @ 0x08001a48 inline
         /home/william/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/semihosting-0.1.25/src/sys/arm_compat/syscall/arm.rs:93:9
      Frame 1: sys_exit_extended @ 0x0000000008001a46 inline
         /home/william/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/semihosting-0.1.25/src/sys/arm_compat/mod.rs:287:9
      Frame 2: exit @ 0x0000000008001a3c
         /home/william/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/semihosting-0.1.25/src/sys/arm_compat/mod.rs:257:9
      Frame 3: exit @ 0x08001a30
         /home/william/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/semihosting-0.1.25/src/process.rs:73:5
      Frame 4: exit @ 0x08000436
         /home/william/projects/rust/embedded-cal/ariel-tests/build/imports/ariel-os/src/ariel-os-debug/src/lib.rs:55:5
      Frame 5: panic @ 0x080009da
         /home/william/projects/rust/embedded-cal/ariel-tests/build/imports/ariel-os/src/ariel-os-rt/src/lib.rs:143:5
      Frame 6: panic_fmt @ 0x08000b84
         /rustc/66da6cae1a6f12e9585493ab8f8f19cf753091fd/library/core/src/panicking.rs:80:14
      Frame 7: panic_display<&str> @ 0x08001246 inline
         /rustc/66da6cae1a6f12e9585493ab8f8f19cf753091fd/library/core/src/panicking.rs:259:5
      Frame 8: expect_failed @ 0x000000000800122c
         /rustc/66da6cae1a6f12e9585493ab8f8f19cf753091fd/library/core/src/option.rs:2260:5
      Frame 9: <unknown function @ 0x08000666> @ 0x08000666 inline
         /home/william/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:971:21
      Frame 10: init @ 0x000000000800064c inline
         /home/william/.cargo/git/checkouts/embassy-0012190963c274d8/1b75c3d/embassy-stm32/src/rcc/wba.rs:261:40
      Frame 11: init_rcc @ 0x0000000008000522 inline
         /home/william/.cargo/git/checkouts/embassy-0012190963c274d8/1b75c3d/embassy-stm32/src/rcc/mod.rs:399:9
      Frame 12: {closure#0} @ 0x0000000008000522 inline
         /home/william/.cargo/git/checkouts/embassy-0012190963c274d8/1b75c3d/embassy-stm32/src/lib.rs:626:13
      Frame 13: with<embassy_stm32::_generated::Peripherals, embassy_stm32::init_hw::{closure_env#0}> @ 0x0000000008000446 inline
         /home/william/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/critical-section-1.2.0/src/lib.rs:248:14
      Frame 14: init_hw @ 0x0000000008000440 inline
         /home/william/.cargo/git/checkouts/embassy-0012190963c274d8/1b75c3d/embassy-stm32/src/lib.rs:497:5
      Frame 15: init @ 0x0000000008000440 inline
         /home/william/.cargo/git/checkouts/embassy-0012190963c274d8/1b75c3d/embassy-stm32/src/lib.rs:325:5
      Frame 16: init @ 0x0000000008000440 inline
         /home/william/projects/rust/embedded-cal/ariel-tests/build/imports/ariel-os/src/ariel-os-stm32/src/lib.rs:96:23
      Frame 17: init @ 0x0000000008000440
         /home/william/projects/rust/embedded-cal/ariel-tests/build/imports/ariel-os/src/ariel-os-embassy/src/lib.rs:147:13
      Frame 18: startup @ 0x08000a96
         /home/william/projects/rust/embedded-cal/ariel-tests/build/imports/ariel-os/src/ariel-os-rt/src/lib.rs:178:9
      Frame 19: __cortex_m_rt_main @ 0x080009ea
         /home/william/projects/rust/embedded-cal/ariel-tests/build/imports/ariel-os/src/ariel-os-rt/src/cortexm.rs:194:5
      Frame 20: __cortex_m_rt_main_trampoline @ 0x080009e2
         /home/william/projects/rust/embedded-cal/ariel-tests/build/imports/ariel-os/src/ariel-os-rt/src/cortexm.rs:192:1
      Frame 21: Reset @ 0x0800019a> @ 0x000000000800019a

      Frame 22: Reset @ 0x0800019a> @ 0x000000000800019a

  Error: Application exit
  laze: error: command ` OPENOCD_ARGS="foo" SCRIPTS=./scripts CONFIG_BOARD=st-nucleo-wba55 CARGO_BUILD_TARGET=thumbv8m.main-none-eabihf
  CARGO_TARGET_THUMBV8M_MAIN_NONE_EABIHF_RUNNER='probe-rs run --protocol=swd --chip STM32WBA55CG --preverify' CARGO_TARGET_THUMBV8M_MAIN_NONE_EABIHF_RUSTFLAGS="--cfg
  context=\"st-nucleo-wba55\" --cfg context=\"stm32wba55cg\" --cfg context=\"stm32\" --cfg context=\"ariel-os\" --cfg context=\"default\" --cfg capability=\"hw/stm32-rng\" --cfg stable
  -Cembed-bitcode=yes -Clto=fat -Ccodegen-units=1 --cfg capability=\"hw/device-identity\" -Clink-arg=-Tdefmt.x --cfg armv8m --cfg armv8m_eabihf -Clink-arg=--nmagic
  -Clink-arg=--no-eh-frame-hdr -Clink-arg=-Tlinkme.x -Clink-arg=-Tlink.x -Clink-arg=-Teheap.x -Clink-arg=-Tdevice.x -Clink-arg=-Tisr_stack.x --cfg context=\"cortex-m\" --cfg
  context=\"cortex-m33f\"" CARGO_TARGET_DIR=./build/bin/st-nucleo-wba55/cargo CONFIG_EXECUTOR_STACKSIZE=8192 CONFIG_ISR_STACKSIZE=2048 CONFIG_SWI=USART2 DEFMT_LOG=info,  cargo   run
  --profile=release --features=ariel-os/semihosting,ariel-os/single-core,ariel-os/executor-interrupt,ariel-os/defmt-rtt,ariel-os/panic-printing,ariel-os/defmt,ariel-os/debug-console,embedded
  -cal-ariel-tests/embedded-cal-stm32wba55 $@`: task command had non-zero exit code

After trying for a bit I asked claude and he suggested add this on ariel-os src/ariel-os-stm32/src/lib.rs. I cannot confirm if this is correct, I didn't look deeply what these config means, but after changing this and the next commit everything worked

    #[cfg(context = "st-nucleo-wba55")]
    {
        use embassy_stm32::rcc::*;

        // PLL1: HSI16 / 1 * 10 / 2 = 80 MHz sysclk.
        // VoltageScale::RANGE1 is required for sysclk > 55 MHz.
        rcc.pll1 = Some(Pll {
            source: PllSource::HSI,
            prediv: PllPreDiv::DIV1,
            mul: PllMul::MUL10,
            divp: Some(PllDiv::DIV2), // satisfies ClockMux default sai1sel = PLL1_P
            divq: Some(PllDiv::DIV2),
            divr: Some(PllDiv::DIV2),
            frac: None,
        });
        rcc.sys = Sysclk::PLL1_R;
        rcc.voltage_scale = VoltageScale::RANGE1;
    }

WilliamTakeshi@c5acb42

Finished [`release` profile [optimized + debuginfo]](https://doc.rust-lang.org/cargo/reference/profiles.html#default-profiles) target(s) in 8.39s
     Running `probe-rs run --protocol=swd --chip STM32WBA55CG --preverify build/bin/st-nucleo-wba55/cargo/thumbv8m.main-none-eabihf/release/embedded-cal-ariel-tests`
    Verifying ✔ 100% [####################]  24.00 KiB @ 425.22 KiB/s (took 0s)                                                                                                                     Finished in 0.16s
[INFO ] Running tests for embedded-cal on a st-nucleo-wba55 board. (embedded_cal_ariel_tests ariel-tests/src/main.rs:10)
[INFO ] Running on a Cal instance of type embedded_cal_software::Extender<embedded_cal_ariel_tests::configured_cal::cal::ImplementSha256Short> (embedded_cal_ariel_tests ariel-tests/src/main.rs:17)
[INFO ] Running SHA256 tests (embedded_cal_ariel_tests ariel-tests/src/main.rs:22)
[INFO ] All tests done. (embedded_cal_ariel_tests ariel-tests/src/main.rs:29)
Firmware exited successfully

@ROMemories

Copy link
Copy Markdown

You can use the #[ariel_os::config(rcc)] macro to provide out-of-tree configuration for the STM32 clocks, in the application. In this case, this will likely look something like the following (not actually tested):

#[ariel_os::config(rcc)]
const RCC_CONFIG: embassy_stm32::rcc::Config = {
  use embassy_stm32::rcc::*;

  let mut rcc = embassy_stm32::rcc::Config::new();

  // PLL1: HSI16 / 1 * 10 / 2 = 80 MHz sysclk.
  // VoltageScale::RANGE1 is required for sysclk > 55 MHz.
  rcc.pll1 = Some(Pll {
      source: PllSource::HSI,
      prediv: PllPreDiv::DIV1,
      mul: PllMul::MUL10,
      divp: Some(PllDiv::DIV2), // satisfies ClockMux default sai1sel = PLL1_P
      divq: Some(PllDiv::DIV2),
      divr: Some(PllDiv::DIV2),
      frac: None,
  });
  rcc.sys = Sysclk::PLL1_R;
  rcc.voltage_scale = VoltageScale::RANGE1;

  rcc
};

You'll need to enable the rcc-config-override Cargo feature on ariel-os (as documented on the config macro) and add embassy-stm32 as a dependency of the application.

This may need some feature-gating so that embassy-stm32 is only added as a dependency and the RCC configuration only provided when needed.

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.

3 participants