Skip to content

Reorganize into multi-workspace structure, simplify examples, remove defmt - #20

Merged
aq1018 merged 12 commits into
mainfrom
feat/workspace-reorg
Apr 14, 2026
Merged

aq1018 merged 12 commits into
mainfrom
feat/workspace-reorg

Conversation

@aq1018

@aq1018 aq1018 commented Apr 14, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Reorganize flat crate layout into three independent workspaces: lib/ (core + protocol), ch32/ (hal + boot + app), cli/
  • Rename tinyboot package to tinyboot-core, tinyboot-cli to tinyboot
  • Remove defmt from all library crates; delete tinyboot-macros crate entirely
  • Merge boot/app examples into a single workspace at examples/ch32/v003/
  • Establish standardized linker region contract (CODE, BOOT, APP, META, RAM) — all __tb_* symbols derived from regions in crate linker scripts, no magic numbers in memory.x
  • Replace hardcoded flash constants with linker symbols; Storage and BootCtl now use Default (read geometry from linker symbols at init)
  • new_app() takes zero parameters
  • run() convenience function takes just a transport — wires up Storage/BootMetaStore/BootCtl internally
  • Add prelude module to boot crate
  • Collapse 16 per-chip memory_x files to 4 (all V003 chips have identical flash/RAM)
  • Reduce user-flash bootloader reservation from 8KB to 2KB (binary is ~1.9KB)
  • Update all READMEs, CI, pre-commit, .gitignore

Boot example (entire main.rs)

tinyboot_ch32_boot::boot_version!();
use tinyboot_ch32_boot::prelude::*;

fn main() -> ! {
    let transport = Usart::new(&UsartConfig {
        duplex: Duplex::Full,
        baud: BaudRate::B115200,
        pclk: 8_000_000,
        mapping: UsartMapping::Usart1Remap0,
        rx_pull: Pull::None,
        tx_en: None,
    });
    tinyboot_ch32_boot::run(transport);
}

App example (init)

let mut app = tinyboot_ch32_app::new_app(); // zero args, all from linker symbols
app.confirm();

Binary sizes (CH32V003F4P6, release)

Binary Flash Budget Free
boot system-flash 1798 B 1920 B 122 B
boot user-flash 1888 B 2048 B 160 B
app system-flash 3980 B 16320 B 12340 B
app user-flash 3996 B 14272 B 10276 B

@aq1018 aq1018 changed the title Feat: workspace reorg and simplification Reorganize into multi-workspace structure, simplify examples, remove defmt Apr 14, 2026
@aq1018
aq1018 merged commit d9fcf55 into main Apr 14, 2026
6 checks passed
@aq1018
aq1018 deleted the feat/workspace-reorg branch April 14, 2026 17:37
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