tgree / psdb

Python flasher and gdb server for various ARM debug probes.
GNU Lesser General Public License v2.1
15 stars 2 forks source link

Maintaining binaries.py for STM32WB #86

Closed bootladder closed 2 years ago

bootladder commented 2 years ago

Hi, thanks for this, really helps me get up the learning curve for this part. I believe what's happening is binaries.py has not been updated with the ST releases. eg. stm32wb5x_BLE_LLD_fw.bin is not there. I can follow the pattern and add more entries, cite the docs and submit a PR.
Can you advise?

tgree commented 2 years ago

It's true, I've been bad about keeping the firmware versions up to date since we aren't actively using the STM32WB in my work right now. I can take a look into updating the binaries a bit later tonight.

tgree commented 2 years ago

Yeah, it looks like with the latest STM32CubeWB release that the firmware upgrade steps are a bit different, especially for FUS. I'll need to spend a bit of time to work through this.

tgree commented 2 years ago

I've pushed the branch "stm32wb55_1.13.3_update" which has been updated to work with the binaries available in the ST 1.13.3 release, which is the latest release from ST available here:

https://github.com/STMicroelectronics/STM32CubeWB

I've tested updating FUS to 1.2.0 from 1.1.0 and it worked fine. I don't have a board with the ancient FUS 0.5.3 so I can't test the direct update from 0.5.3 -> 1.2.0 which is apparently now possible.

I flashed all of the different possible firmwares on to my Nucleo board and ran into some issues with 3 of them which I documented in the source code.

These two limit the amount of user RAM available to 4K. The psdb code tries to use a bit more than 4K for the memory pools it uses to talk to the firwmare, so to work around that one of the buffers needs to be reduced:

stm32wb5x_Zigbee_FFD_fw.bin stm32wb5x_Zigbee_RFD_fw.bin

This one limits the amount of user RAM available to 2K, but also requires that other buffers be placed in a different RAM area than you normally place them in to make up for it. Harder to work with since it is a special case, but instructions on how to recover from flashing it are also in the source comments:

stm32wb5x_BLE_Stack_full_extended_fw.bin

If you don't need to use any of those 3 images then I think the branch would work for you and I can commit the changes after you try them out if you are willing to test them in your environment. If you need to upgrade FUS, you should first delete any installed wireless firmware, then do the FUS upgrade:

python3 -m psdb.fus_tool --fw-delete

python3 -m psdb.fus_tool --bin-dir /path/to/STM32CubeWB/Projects/STM32WB_Copro_Wireless_Binaries/STM32WB5x --fus-upgrade

Then, you can flash your target wireless firmware:

python3 -m psdb.fus_tool --fw-upgrade /path/to/STM32CubeWB/Projects/STM32WB_Copro_Wireless_Binaries/STM32WB5x/stm32wb5x_BLE_LLD_fw.bin

tgree commented 2 years ago

I've checked in #87 which fixes this, so marking as closed.