Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
800cb52
Add partitions for Wi-Fi firmware
will-v-pi Aug 16, 2024
462148f
Use common scope var for PICO_CYW43_DRIVER_CURRENT_PATH, and remove w…
will-v-pi Oct 8, 2024
2bb0f11
Use FLASH_SECTOR_SIZE instead of 4096
will-v-pi Oct 15, 2024
75d119e
Throw FATAL_ERROR when using RP2040
will-v-pi Nov 19, 2024
2cb5d14
Add Bazel todo referencing #2055
will-v-pi Nov 19, 2024
d690e3e
Change partition ID to 0x776966696669726d (wififirm) and use data UF2…
will-v-pi Nov 20, 2024
78f1b16
Review feedback
will-v-pi Nov 22, 2024
4394654
Rename CYW43_USE_PARTITION_FIRMWARE->CYW43_USE_FIRMWARE_PARTITION and…
will-v-pi Nov 22, 2024
c1bdf1b
Use hard copies of the firmware for Risc-V builds
will-v-pi Nov 22, 2024
caf5492
Requires increased bootrom stack size on Risc-V
will-v-pi Nov 22, 2024
918408a
pico_use_partition_firmware -> pico_use_wifi_firmware_partition
will-v-pi Nov 22, 2024
0fa63dd
Only embed partition table if one isn't already embedded
will-v-pi Apr 7, 2025
37ee6fa
Free extra Risc-V stack after use
will-v-pi Jun 3, 2025
f20b302
Fix Risc-V firmware build
will-v-pi Jun 5, 2025
643a925
Add error message when no firmware partition is found
will-v-pi Jun 5, 2025
dff70a9
Increase partition size for latest firmware, and add docs
will-v-pi Jun 5, 2025
1802cb9
Add CYW43_FIRMWARE_FAMILY_ID
will-v-pi Jun 19, 2025
d68e3ed
Fix family in wifi_pt.json
will-v-pi Jun 20, 2025
79ff41a
Tidy up UF2 defines a bit
will-v-pi Jun 26, 2025
116d898
Other tidyups
will-v-pi Jun 26, 2025
f258e01
Apply suggestions from code review
will-v-pi Jul 4, 2025
24f1ffa
Fix clang build
will-v-pi Jul 15, 2025
47d529f
Rename bootrom family ID min & max
will-v-pi Jul 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/common/boot_uf2_headers/include/boot/uf2.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,18 @@
#define UF2_FLAG_MD5_PRESENT 0x00004000u
#define UF2_FLAG_EXTENSION_FLAGS_PRESENT 0x00008000u

// Extra family IDs
#define CYW43_FIRMWARE_FAMILY_ID 0xe48bff55u
#define DEFAULT_FAMILY_ID_MIN 0xe48bff56u

// Bootrom supported family IDs
#define RP2040_FAMILY_ID 0xe48bff56u
#define ABSOLUTE_FAMILY_ID 0xe48bff57u
#define DATA_FAMILY_ID 0xe48bff58u
#define RP2350_ARM_S_FAMILY_ID 0xe48bff59u
#define RP2350_RISCV_FAMILY_ID 0xe48bff5au
#define RP2350_ARM_NS_FAMILY_ID 0xe48bff5bu
#define FAMILY_ID_MAX 0xe48bff5bu
#define DEFAULT_FAMILY_ID_MIN RP2040_FAMILY_ID
#define FAMILY_ID_MAX RP2350_ARM_NS_FAMILY_ID

// 04 e3 57 99
#define UF2_EXTENSION_RP2_IGNORE_BLOCK 0x9957e304
Expand Down
10 changes: 4 additions & 6 deletions src/rp2_common/pico_cyw43_driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,10 @@ if (EXISTS ${PICO_CYW43_DRIVER_PATH}/${CYW43_DRIVER_TEST_FILE})

find_package (Python3 REQUIRED COMPONENTS Interpreter)

# Wifi firmware blob
add_custom_target(${TARGET}_firmware_blob DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/firmware_wb_blob.S)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/firmware_wb_blob.S
COMMAND ${Python3_EXECUTABLE} ${PICO_CYW43_DRIVER_CURRENT_PATH}/cyw43_firmware.py ${PICO_CYW43_DRIVER_PATH}/firmware/wb43439A0_7_95_49_00_combined.h ${CMAKE_CURRENT_BINARY_DIR}/firmware_wb_blob.S
# CYW43 firmware blob
add_custom_target(${TARGET}_firmware_blob DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/firmware_blob.S)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/firmware_blob.S
COMMAND ${Python3_EXECUTABLE} ${PICO_CYW43_DRIVER_CURRENT_PATH}/cyw43_firmware.py ${PICO_CYW43_DRIVER_PATH}/firmware/wb43439A0_7_95_49_00_combined.h ${CMAKE_CURRENT_BINARY_DIR}/firmware_blob.S
)

# Create UF2s for regular and TBYB firmwares
Expand All @@ -217,12 +217,10 @@ if (EXISTS ${PICO_CYW43_DRIVER_PATH}/${CYW43_DRIVER_TEST_FILE})

target_compile_definitions(${TARGET}_firmware PRIVATE
NO_PICO_PLATFORM=1
WB_FIRMWARE=1
)
target_compile_definitions(${TARGET}_firmware_tbyb PRIVATE
NO_PICO_PLATFORM=1
PICO_CRT0_IMAGE_TYPE_TBYB=1
WB_FIRMWARE=1
)

target_link_options(${TARGET}_firmware PRIVATE -nostartfiles -nodefaultlibs -N LINKER:--script=${PICO_CYW43_DRIVER_CURRENT_PATH}/wifi_firmware.ld)
Expand Down
24 changes: 15 additions & 9 deletions src/rp2_common/pico_cyw43_driver/cyw43_firmware.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,33 @@
# SPDX-License-Identifier: BSD-3-Clause

import sys
import re

assert len(sys.argv) == 3

cyw43_wifi_fw_len = -1
cyw43_clm_len = -1

with open(sys.argv[1], "r") as f:
data = f.read()
lines = data.split(";")
for line in lines[1].split("\n"):
statements = data.split(";")
for line in statements[1].split("\n"):
if "#define CYW43_WIFI_FW_LEN" in line:
cyw43_wifi_fw_len = int(line.split(")")[0].split("(")[-1])
matches = re.search(r"#define\s+\S+\s+\((\S+)\)", line)
cyw43_wifi_fw_len = int(matches[1])
if "#define CYW43_CLM_LEN" in line:
cyw43_clm_len = int(line.split(")")[0].split("(")[-1])
data = lines[0]
matches = re.search(r"#define\s+\S+\s+\((\S+)\)", line)
cyw43_clm_len = int(matches[1])
if cyw43_wifi_fw_len > 0 and cyw43_clm_len > 0:
break
data = statements[0]
bits = data.split(",")
bits[0] = bits[0].split("{")[-1]
bits[-1] = bits[-1].split("}")[0]
for i in range(len(bits)):
bits[i] = bits[i].strip()
bits[i] = bits[i].strip(',')
bits[i] = int(bits[i], base=0)
print(f"Start {bits[4]}, end {bits[-1]}, num {len(bits)}")
print(bits[:10])

print(f"Wifi {cyw43_wifi_fw_len}, clm {cyw43_clm_len}")

data = (
cyw43_wifi_fw_len.to_bytes(4, 'little', signed=True) +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#endif

#if CYW43_USE_FIRMWARE_PARTITION
// PICO_CONFIG: CYW43_FIRMWARE_PARTITION_ID, ID of Wi-Fi firmware partition, type=int, default=0x776966696669726d (wififirm), group=pico_cyw43_driver
// PICO_CONFIG: CYW43_FIRMWARE_PARTITION_ID, ID of Wi-Fi firmware partition which must match the ID used in the partition table JSON, type=int, default=0x776966696669726d, group=pico_cyw43_driver
#ifndef CYW43_FIRMWARE_PARTITION_ID
#define CYW43_FIRMWARE_PARTITION_ID 0x776966696669726d // wififirm
#endif
Expand Down
6 changes: 1 addition & 5 deletions src/rp2_common/pico_cyw43_driver/wifi_firmware.S
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ _lm_item:
.word PICOBIN_BLOCK_MARKER_END
embedded_block_end:

#if WB_FIRMWARE
#include "firmware_wb_blob.S"
#else
#include "firmware_w_blob.S"
#endif
#include "firmware_blob.S"

firmware_end:
Loading