For the STM32WL3x, stm32wb0.c is the best place because:
- Both are single-core Cortex-M0+ wireless MCUs
- Both share the same flash controller at 0x40001000 with identical register layout and command codes (0x11/0x22/0x33/0xBB)
- Same flash size formula: ((SIZE[15:0] + 1) << 2)
- Same erase granularity (2KB sectors)
- Both have the same write-then-poll pattern
- avoid creating specific target and increase flash size
Detailed description
This PR add ability to use STM32WL3x targets
Your checklist for this pull request
- I've read the Code of Conduct
- I've read the guidelines for contributing to this repository
- It builds for hardware native (see Building the firmware)
- It builds as BMDA (see Building the BMDA)
- I've tested it to the best of my ability
- My commit messages provide a useful short description of what the commits do
Here below output of testing running demo
charles@office:debug$ arm-zephyr-eabi-gdb-py -ex 'set confirm off' -ex 'target extended-remote /dev/cu.usbmodem81D759AC1'
GNU gdb (Zephyr SDK 0.17.4) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=aarch64-build_apple-darwin23.6.0 --target=arm-zephyr-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://github.com/zephyrproject-rtos/sdk-ng/issues>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
Remote debugging using /dev/cu.usbmodem81D759AC1
(gdb) monitor swdp_scan
Target voltage: 3.3V
Available Targets:
No. Att Driver
1 STM32WL3 M0+
(gdb) attach 1
Attaching to Remote target
warning: No executable has been specified and target does not support
determining executable automatically. Try using the "file" command.
0x10043d84 in ?? ()
(gdb) monitor erase_mass
Erasing device Flash: done
(gdb) file LCSC_BasicDemo.elf
Reading symbols from LCSC_BasicDemo.elf...
(gdb) load
Loading section .intvec, size 0xc0 lma 0x10040000
Loading section .text, size 0x6e90 lma 0x100400c0
Loading section .init, size 0x4 lma 0x10046f50
Loading section .fini, size 0x4 lma 0x10046f54
Loading section .ARM.exidx, size 0x8 lma 0x10046f58
Loading section .data, size 0x88 lma 0x10046f60
Start address 0x1004259c, load size 28648
Transfer rate: 3 KB/sec, 818 bytes/write.
(gdb) run
Starting program: LCSC_BasicDemo.elf