Skip to content

BL602: add BL602PartitionInfo and BL602RepartitionPSM console commands#2151

Open
kruzer wants to merge 1 commit into
openshwprojects:mainfrom
kruzer:bl602-partition-info
Open

BL602: add BL602PartitionInfo and BL602RepartitionPSM console commands#2151
kruzer wants to merge 1 commit into
openshwprojects:mainfrom
kruzer:bl602-partition-info

Conversation

@kruzer

@kruzer kruzer commented Jul 1, 2026

Copy link
Copy Markdown

Summary

Adds two console commands, registered only on the classic BL602 SDK path (not PLATFORM_BL_NEW):

  • BL602PartitionInfo — reads the flash JEDEC id and parses the partition table, printing a human-readable summary of entries, sizes and the active table (read-only diagnostics).
  • BL602RepartitionPSM — rewrites the PSM partition entry (erases and updates the partition table via the SDK PtTable API) so the config partition can be relocated/resized. Verifies the target address/size before committing.

Motivation

CozyLife-based BL602 devices (1 MB flash) ship with a PSM (EasyFlash config) partition of only 8 KB. That is too small for OpenBeken to reliably persist its configuration, so config saves fail on those devices. BL602RepartitionPSM lets you relocate/enlarge the PSM partition from the console to give OpenBeken enough room to store its config, without reflashing the whole device.

BL602PartitionInfo is also handy for diagnosing flash layout differences between BL602 board variants directly from the device console.

Files

  • src/hal/bl602/hal_partition_bl602.c — command implementations
  • src/cmnds/cmd_main.c — registration in CMD_Init_Early()

Test plan

  • Builds and links via make OpenBL602 (canonical build)
  • BL602PartitionInfo prints correct partition summary on a dev board and a CozyLife 1 MB device
  • BL602RepartitionPSM enlarges PSM on a CozyLife 1 MB device and OpenBeken then persists config across reboots

Note for reviewers

BL602RepartitionPSM erases and rewrites the partition table. It verifies the target address/size before committing, but it is inherently a destructive flash operation — happy to split it into a separate PR (info-only vs. repartition) if preferred.

Adds two console commands (registered only on the classic BL602 SDK path,
not PLATFORM_BL_NEW):

- BL602PartitionInfo: reads the flash JEDEC id and parses the partition
  table, printing a human-readable summary of entries, sizes and the
  active table (read-only diagnostics).
- BL602RepartitionPSM: rewrites the PSM partition entry (erases and
  updates the partition table via the SDK PtTable API) so the config
  partition can be relocated/resized. Verifies the target address/size
  before committing.

Motivation: CozyLife-based BL602 devices (1 MB flash) ship with a PSM
(EasyFlash config) partition of only 8 KB. That is too small for OpenBeken
to reliably persist its configuration, so config saves fail on those
devices. BL602RepartitionPSM lets you relocate/enlarge the PSM partition
from the console to give OpenBeken enough room to store its config, without
reflashing the whole device.

Useful for diagnosing and fixing flash layout differences between BL602
board variants from the device console.
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