Skip to content

Conversation

@dbeinder
Copy link
Contributor

@dbeinder dbeinder commented Apr 16, 2025

I have implemented support for a new flash type, tentatively named WB0. These devices were originally called BlueNRG, but a year ago ST has renamed them and now markets them under the STM32 brand. Probably because they were not originally intended to integrate into the STM32 ecosystem, they are a bit quirky:

  • Flash starts at 0x10040000
  • Completely different FLASH peripheral. No unlocking scheme, writing is done by filling data registers and triggering a write command.
  • No IDCODE register, however there is a JTAG_ID register which has a PART_NUMBER field. STM32CubeProg uses this as the DeviceID, so I've followed their example:
    grafik
  • No DBGMCU block to gate watchdogs conditionally when a debugger is attached.
  • No option bytes - there is a protection mechanism, but I haven't added this yet.
  • Writing to the OTP block is different from normal flash write.

I have written a fast flashloader and direct support for byte-granular writes to OTP.

Apparently STM32WL3x also shares this architecture, but for lack of a documented family name, I have stuck to WB0 as the flash_type.

Tested only on STM32WB07CC so far, with STLINK-V3MINIE and the on-board STLINK-V3EC on the NUCLEO-WB07CC dev board.

References

STM32WB05 (BlueNRG-LPS) RM0491
STM32WB06/07 (BlueNRG-LP) RM0530
STM32WB09 (BlueNRG-LPF) RM0505
STM32WL3x RM0511
ST's OpenOCD implementation: bluenrg-x.c

@dbeinder
Copy link
Contributor Author

dbeinder commented Apr 16, 2025

The reason I changed write_buffer_to_sram() to handle padding is because the approach used in the existing code seems to introduce out-of-bounds reads from the mmap'd file buffer?

if(sl->flash_type == STM32_FLASH_TYPE_L5_U5_H5 && (len % 16)) {
WLOG("Aligning data size to 16 bytes\n");
len += 16 - len % 16;
}

@Nightwalker-87 Nightwalker-87 changed the title [feature] Implement WB05, WB06/07, WB09, WL3x [feature] Implemented flash type for WB05, WB06/07, WB09, WL3x Apr 17, 2025
@Nightwalker-87 Nightwalker-87 changed the title [feature] Implemented flash type for WB05, WB06/07, WB09, WL3x [feature] Flash type implementation for WB05, WB06/07, WB09, WL3x Apr 17, 2025
@Nightwalker-87 Nightwalker-87 changed the title [feature] Flash type implementation for WB05, WB06/07, WB09, WL3x [feature] STM32 flash type implementation for WB05, WB06/07, WB09, WL3x Apr 17, 2025
@Nightwalker-87 Nightwalker-87 merged commit 5259daa into stlink-org:testing Apr 17, 2025
37 of 41 checks passed
@github-project-automation github-project-automation bot moved this from In review to Done in Release v1.8.1 Apr 17, 2025
@stlink-org stlink-org locked as resolved and limited conversation to collaborators Apr 17, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants