Skip to content

Nickez/bb03 binaries#1971

Open
NickeZ wants to merge 14 commits into
BitBoxSwiss:masterfrom
NickeZ:nickez/bb03-binaries
Open

Nickez/bb03 binaries#1971
NickeZ wants to merge 14 commits into
BitBoxSwiss:masterfrom
NickeZ:nickez/bb03-binaries

Conversation

@NickeZ

@NickeZ NickeZ commented May 6, 2026

Copy link
Copy Markdown
Collaborator

Some terminology

Platform - Everything that is common to the stm32u5 platform (basically the stm32u5 HAL)
Board - Everything that is specific to a single board and MCU, for example the STM32U5A9J-DK dev-kit, the bb03 "test board" or the bb03 "production board". Every board has at least a unique pinout and memory layout.

@NickeZ NickeZ requested a review from benma May 6, 2026 10:16
@NickeZ NickeZ force-pushed the nickez/bb03-binaries branch 13 times, most recently from 4da9335 to 7d3d4e5 Compare May 12, 2026 12:46
@NickeZ NickeZ force-pushed the nickez/bb03-binaries branch 6 times, most recently from 4dcbf07 to 671dc8e Compare May 15, 2026 09:40
@NickeZ NickeZ marked this pull request as ready for review May 15, 2026 09:42
@NickeZ NickeZ force-pushed the nickez/bb03-binaries branch 2 times, most recently from 82484f8 to a102a55 Compare May 26, 2026 09:05
@NickeZ NickeZ requested a review from cedwies May 26, 2026 09:05
@NickeZ NickeZ marked this pull request as draft May 26, 2026 10:27
@NickeZ NickeZ force-pushed the nickez/bb03-binaries branch 4 times, most recently from 56fade0 to 2314078 Compare May 27, 2026 12:10
@NickeZ NickeZ removed the request for review from benma May 27, 2026 13:32
@NickeZ NickeZ force-pushed the nickez/bb03-binaries branch 11 times, most recently from 19bd701 to f048234 Compare June 8, 2026 08:45
@NickeZ NickeZ force-pushed the nickez/bb03-binaries branch 3 times, most recently from 9862fc6 to c6341c4 Compare June 8, 2026 15:56
@NickeZ NickeZ force-pushed the nickez/bb03-binaries branch from c6341c4 to 9bd2aab Compare June 8, 2026 21:22
raise ValueError("board name '{}' is reserved".format(board))


def hal_driver_directories(source):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for HAL_CONF we have an exact path and name, but for the HAL_DRIVER folder we go for a loose/generic way. If possible, I would prefer consistency here. Are we really expecting multiple HAL drivers when we just expect a single stm32u5xx_hal_conf.h?

Path("USBX/Target"),
)
OPTIONAL_MIDDLEWARE_DIRECTORIES = (Path("Middlewares/ST/usbx"),)
RESERVED_BOARD_NAMES = frozenset(("Core", "Common", "Drivers"))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't "USBX" and "Middlewares" be part of that set too?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed for now

if directory.parts[0] == "Core":
dst = board_dir / directory.relative_to("Core")
else:
dst = board_dir / directory

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the else statement make sense here? How can it not have "Core" as the parts[0] but still be valid?

Path("Drivers/CMSIS"),
)
REQUIRED_FILES = (HAL_CONF,)
OPTIONAL_SHARED_DIRECTORIES = (

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding optional directories: If a later CubeMX project does not have e.g. USBX (for whatever reason), then the USBX folder can become stale. For USBX that might not be a problem but what's your opinion on potentially stale code?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed for now

use std::path::{Path, PathBuf};
use std::process::Command;

const ST_SOURCES: &[&str] = &[

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These sources are not minimal. The build succeeds, even without:

  • stm32u5xx_hal_dma.c
  • stm32u5xx_hal_dma_ex.c
  • stm32u5xx_hal_rcc_ex.c
  • stm32u5xx_hal_gpio.c
  • stm32u5xx_hal_exti.c
  • stm32u5xx_hal_pwr.c
  • stm32u5xx_hal_icache.c

Is this intentionally chosen as a base for upcoming work? Or should we keep this minimal for now?

);
}

println!("cargo::rustc-env=BITBOX03_IMAGE_HEADER_LEN={IMAGE_HEADER_LEN}");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is BITBOX03_IMAGE_HEADER_LEN intended for later build binaries? I do not see it used in this commit.

bitbox-boot-utils = { path = "../../bitbox-boot-utils" }
bitbox-board-stm32u5a9j-dk = { path = "../../bitbox-board-stm32u5a9j-dk", optional = true }

[target.'cfg(all(target_arch = "arm", target_os = "none"))'.dependencies]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Boot0 had these deps unconditionally. I think this (how it's done for Boot1) is an improvement, but should we then do it for Boot0 as well (also for consistency)?

println!("cargo::rustc-link-arg={}", header_object.display());
}

fn main() {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Boot0/Boot1 fail if no board feature is selected. Why don't we have the same behavior here?

use core::panic::PanicInfo;
use cortex_m_rt::entry;

const BOOT0_ADDR: u32 = 0x0800_2000;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use board::memory::BOOT0_ADDR?

@@ -0,0 +1,6 @@
MEMORY

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This duplicates memory assumptions. Should we make sure they don't accidentally drift?

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.

2 participants