Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(rt): fix the image header of bl808 #22

Merged
merged 2 commits into from
Feb 4, 2025
Merged

Conversation

xiaobor123
Copy link
Contributor

This commit modified some fields According to the content of the image generated by the official BLDevcube, so that the generated image can be run directly.
Previously, we compiled an image with:
cargo build --target riscv64imac-unknown-none-elf --release -p sdcard-demo rust-objcopy --binary-architecture=riscv64 --strip-all -O binary ./target/riscv64imac-unknown-none-elf/release/sdcard-demo ./target/riscv64imac-unknown-none-elf/release/sdcard-demo.bin
And then flash in with the BLDEVCUBE GUI to run successfully.
Now that we've fixed the fields, run the following command on the compiled image to fix the checksum-related fields:
cargo blri ./target/riscv64imac-unknown-none-elf/release/sdcard-demo.bin
After that, we get a correct .bin file that can be run directly.

@jakezhu9
Copy link
Member

jakezhu9 commented Feb 4, 2025

Good job! But please fix the bug in this test:

https://github.com/rustsbi/bouffalo-hal/actions/runs/13126659197/job/36624197072?pr=22

failures:

---- soc::bl808::tests::magic_crc32_hal_pll_config stdout ----

thread 'soc::bl808::tests::magic_crc32_hal_pll_config' panicked at bouffalo-rt/src/soc/bl808.rs:1049:9:
assertion `left == right` failed
  left: 702727360
 right: 2253097226
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::assert_failed_inner
   3: core::panicking::assert_failed
   4: bouffalo_rt::soc::bl808::tests::magic_crc32_hal_pll_config
   5: bouffalo_rt::soc::bl808::tests::magic_crc32_hal_pll_config::{{closure}}
   6: core::ops::function::FnOnce::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.


failures:
    soc::bl808::tests::magic_crc32_hal_pll_config

@jakezhu9 jakezhu9 self-requested a review February 4, 2025 02:25
@jakezhu9
Copy link
Member

jakezhu9 commented Feb 4, 2025

LGTM👍

Now we can brun the image using the following command without bldevcube gui:

.\bflb_iot_tool.exe --chipname bl808  --interface uart --port com6 --baudrate 2000000 --addr 0x00000000 --firmware "sdcard-demo.bin" --single

And it works on my m1s dock development board

Some fields in the header may be unnecessary/have other uses, we can explore them further in the future

@luojia65 luojia65 merged commit d4407ee into rustsbi:main Feb 4, 2025
4 of 15 checks passed
@luojia65 luojia65 changed the title Fix the image header of bl808 fix(rt): fix the image header of bl808 Feb 4, 2025
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.

4 participants