Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add section attributes to combined firmware blobs and metadata #97

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 6 additions & 2 deletions firmware/w43439A0_7_95_49_00_combined.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
static const unsigned char w43439A0_7_95_49_00_combined[] CYW43_RESOURCE_ATTRIBUTE = {
__attribute__((section(".fw_cyw43.blob"))) static const unsigned char w43439A0_7_95_49_00_combined[] CYW43_RESOURCE_ATTRIBUTE = {
mvds00 marked this conversation as resolved.
Show resolved Hide resolved
0x00, 0x00, 0x00, 0x00, 0x65, 0x14, 0x00, 0x00, 0x91, 0x13, 0x00, 0x00,
0x91, 0x13, 0x00, 0x00, 0x91, 0x13, 0x00, 0x00, 0x91, 0x13, 0x00, 0x00,
0x91, 0x13, 0x00, 0x00, 0x91, 0x13, 0x00, 0x00, 0x91, 0x13, 0x00, 0x00,
Expand Down Expand Up @@ -18772,4 +18772,8 @@ static const unsigned char w43439A0_7_95_49_00_combined[] CYW43_RESOURCE_ATTRIBU
};
#define CYW43_WIFI_FW_LEN (224190) // launch_firmware/43439A0.bin
#define CYW43_CLM_LEN (984) // launch_tuning/43439_raspberrypi_picow_v5_220624.clm_blob
const uintptr_t fw_data = (uintptr_t)&w43439A0_7_95_49_00_combined[0];
__attribute__((section(".fw_cyw43.meta"))) const struct cyw43_firmware_data fw_data = {
.size = sizeof(w43439A0_7_95_49_00_combined),
.wifi_fw_len = CYW43_WIFI_FW_LEN,
.addr = (uintptr_t)&w43439A0_7_95_49_00_combined[0],
};
8 changes: 6 additions & 2 deletions firmware/w4343WA1_7_45_98_102_combined.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
static const unsigned char w4343WA1_7_45_98_102_combined[] CYW43_RESOURCE_ATTRIBUTE = {
__attribute__((section(".fw_cyw43.blob"))) static const unsigned char w4343WA1_7_45_98_102_combined[] CYW43_RESOURCE_ATTRIBUTE = {
0x00, 0x00, 0x00, 0x00, 0xed, 0x21, 0x00, 0x00, 0x19, 0x21, 0x00, 0x00,
0x19, 0x21, 0x00, 0x00, 0x19, 0x21, 0x00, 0x00, 0x19, 0x21, 0x00, 0x00,
0x19, 0x21, 0x00, 0x00, 0x19, 0x21, 0x00, 0x00, 0x19, 0x21, 0x00, 0x00,
Expand Down Expand Up @@ -35719,4 +35719,8 @@ static const unsigned char w4343WA1_7_45_98_102_combined[] CYW43_RESOURCE_ATTRIB
};
#define CYW43_WIFI_FW_LEN (421331) // 7.45.98.102
#define CYW43_CLM_LEN (7222)
const uintptr_t fw_data = (uintptr_t)&w4343WA1_7_45_98_102_combined[0];
__attribute__((section(".fw_cyw43.meta"))) const struct cyw43_firmware_data fw_data = {
.size = sizeof(w4343WA1_7_45_98_102_combined),
.wifi_fw_len = CYW43_WIFI_FW_LEN,
.addr = (uintptr_t)&w4343WA1_7_45_98_102_combined[0],
};
8 changes: 6 additions & 2 deletions firmware/w4343WA1_7_45_98_50_combined.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
static const unsigned char w4343WA1_7_45_98_50_combined[] CYW43_RESOURCE_ATTRIBUTE = {
__attribute__((section(".fw_cyw43.blob"))) static const unsigned char w4343WA1_7_45_98_50_combined[] CYW43_RESOURCE_ATTRIBUTE = {
0x00, 0x00, 0x00, 0x00, 0xb1, 0x21, 0x00, 0x00, 0xdd, 0x20, 0x00, 0x00,
0xdd, 0x20, 0x00, 0x00, 0xdd, 0x20, 0x00, 0x00, 0xdd, 0x20, 0x00, 0x00,
0xdd, 0x20, 0x00, 0x00, 0xdd, 0x20, 0x00, 0x00, 0xdd, 0x20, 0x00, 0x00,
Expand Down Expand Up @@ -32578,4 +32578,8 @@ static const unsigned char w4343WA1_7_45_98_50_combined[] CYW43_RESOURCE_ATTRIBU
};
#define CYW43_WIFI_FW_LEN (383110) // 7.45.98.50
#define CYW43_CLM_LEN (7222)
const uintptr_t fw_data = (uintptr_t)&w4343WA1_7_45_98_50_combined[0];
__attribute__((section(".fw_cyw43.meta"))) const struct cyw43_firmware_data fw_data = {
.size = sizeof(w4343WA1_7_45_98_50_combined),
.wifi_fw_len = CYW43_WIFI_FW_LEN,
.addr = (uintptr_t)&w4343WA1_7_45_98_50_combined[0],
};
8 changes: 6 additions & 2 deletions firmware/wb43439A0_7_95_49_00_combined.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
static const unsigned char wb43439A0_7_95_49_00_combined[] CYW43_RESOURCE_ATTRIBUTE = {
__attribute__((section(".fw_cyw43.blob"))) static const unsigned char wb43439A0_7_95_49_00_combined[] CYW43_RESOURCE_ATTRIBUTE = {
0x00, 0x00, 0x00, 0x00, 0x71, 0x14, 0x00, 0x00, 0x9d, 0x13, 0x00, 0x00,
0x9d, 0x13, 0x00, 0x00, 0x9d, 0x13, 0x00, 0x00, 0x9d, 0x13, 0x00, 0x00,
0x9d, 0x13, 0x00, 0x00, 0x9d, 0x13, 0x00, 0x00, 0x9d, 0x13, 0x00, 0x00,
Expand Down Expand Up @@ -19370,4 +19370,8 @@ static const unsigned char wb43439A0_7_95_49_00_combined[] CYW43_RESOURCE_ATTRIB
};
#define CYW43_WIFI_FW_LEN (231077) // bluetooth_firmware_jan2023/43439A0.bin
#define CYW43_CLM_LEN (984) // launch_tuning/43439_raspberrypi_picow_v5_220624.clm_blob
const uintptr_t fw_data = (uintptr_t)&wb43439A0_7_95_49_00_combined[0];
__attribute__((section(".fw_cyw43.meta"))) const struct cyw43_firmware_data fw_data = {
.size = sizeof(wb43439A0_7_95_49_00_combined),
.wifi_fw_len = CYW43_WIFI_FW_LEN,
.addr = (uintptr_t)&wb43439A0_7_95_49_00_combined[0],
};
12 changes: 11 additions & 1 deletion src/cyw43_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
* \file
*/

#ifndef _CYW43_CONFIG_H
#define _CYW43_CONFIG_H

// Import port-specific configuration file.
#ifdef CYW43_CONFIG_FILE
#include CYW43_CONFIG_FILE
Expand All @@ -60,10 +63,15 @@
#define CYW43_ENABLE_BLUETOOTH (0)
#endif

struct cyw43_firmware_data {
uint32_t size;
uint32_t wifi_fw_len;
uintptr_t addr;
};
// This include should define:
// - CYW43_WIFI_FW_LEN
// - CYW43_CLM_LEN
// - const uintptr_t fw_data
// - const struct cyw43_firmware_data fw_data
#ifndef CYW43_CHIPSET_FIRMWARE_INCLUDE_FILE
#if CYW43_ENABLE_BLUETOOTH
#define CYW43_CHIPSET_FIRMWARE_INCLUDE_FILE "firmware/wb43439A0_7_95_49_00_combined.h"
Expand Down Expand Up @@ -171,3 +179,5 @@
#ifndef CYW43_DEFAULT_IP_DNS
#define CYW43_DEFAULT_IP_DNS LWIP_MAKEU32(8, 8, 8, 8)
#endif

#endif
4 changes: 2 additions & 2 deletions src/cyw43_ll.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ extern bool enable_spi_packet_dumping;
// Include the file containing the WiFi+CLM firmware blob as a C array.
#include CYW43_CHIPSET_FIRMWARE_INCLUDE_FILE

#define CYW43_CLM_ADDR (fw_data + ALIGN_UINT(CYW43_WIFI_FW_LEN, 512))
#define CYW43_CLM_ADDR (fw_data.addr + ALIGN_UINT(fw_data.wifi_fw_len, 512))
#define VERIFY_FIRMWARE_DOWNLOAD (0)

#define ALIGN_UINT(val, align) (((val) + (align) - 1) & ~((align) - 1))
Expand Down Expand Up @@ -1660,7 +1660,7 @@ int cyw43_ll_bus_init(cyw43_ll_t *self_in, const uint8_t *mac) {
cyw43_write_backplane(self, SOCSRAM_BANKX_PDA, 4, 0);

// Download the main WiFi firmware blob to the 43xx device.
int ret = cyw43_download_resource(self, 0x00000000, CYW43_WIFI_FW_LEN, 0, fw_data);
int ret = cyw43_download_resource(self, 0x00000000, fw_data.wifi_fw_len, 0, fw_data.addr);
if (ret != 0) {
return ret;
}
Expand Down