Skip to content

Commit b628fd8

Browse files
Fix wifi driver build, add an option to just include the wifi firmware in the image
1 parent b4e915f commit b628fd8

File tree

9 files changed

+20
-30
lines changed

9 files changed

+20
-30
lines changed

connectivity/drivers/wifi/COMPONENT_WHD/minimal-cyhal/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ add_library(mbed-minimal-cyhal STATIC
1616
target_include_directories(mbed-minimal-cyhal PUBLIC .)
1717
target_link_libraries(mbed-minimal-cyhal PUBLIC
1818
mbed-core-flags
19-
mbed-cy-rtos-abstraction)
19+
mbed-rtos-flags)
2020

2121
# This is needed in order to make cybsp_wifi.h include cycfg.h
2222
target_compile_definitions(mbed-minimal-cyhal PUBLIC COMPONENT_CUSTOM_DESIGN_MODUS)

connectivity/drivers/wifi/COMPONENT_WHD/minimal-cyhal/TARGET_STM32H7/TARGET_STM32H747_ARDUINO/wiced_filesystem_setup.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ MBED_WEAK wiced_result_t whd_firmware_check_hook(const char *mounted_name, int m
5858
return WICED_ERROR;
5959
}
6060

61+
wiced_filesystem_t resource_fs_handle = 0;
62+
6163
wiced_result_t wiced_filesystem_setup()
6264
{
6365
static QSPIFBlockDevice *qspi_bd = nullptr;
@@ -82,6 +84,7 @@ wiced_result_t wiced_filesystem_setup()
8284
mbr_bd = new mbed::MBRBlockDevice(qspi_bd, WIFI_DEFAULT_PARTITION);
8385
if(mbr_bd->init() != mbed::BD_ERROR_OK)
8486
{
87+
whd_firmware_check_hook(WIFI_DEFAULT_MOUNT_NAME, true);
8588
delete mbr_bd;
8689
mbr_bd = nullptr;
8790
return WICED_ERROR;

connectivity/drivers/wifi/COMPONENT_WHD/minimal-cyhal/cyhal_gpio.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include <stdio.h>
2323
#include "cyhal.h"
2424
#include "cybsp.h"
25-
#include "drivers/DigitalIn.h"
25+
#include "drivers/DigitalOut.h"
2626
#include "drivers/InterruptIn.h"
2727

2828
#include <minimal_cyhal_config.h>

connectivity/drivers/wifi/COMPONENT_WHD/minimal-cyhal/wiced_filesystem.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ typedef int wiced_file_t;
7676
*/
7777
typedef int wiced_filesystem_handle_type_t;
7878

79-
// Global "FS handle" object. Just here to match the WHD driver's expectations, we have one global
79+
// Global "FS handle" object. Just here to match the WHD driver's expectations, we in fact have one global
8080
// filesystem object.
81-
static wiced_filesystem_t resource_fs_handle = 0;
81+
extern wiced_filesystem_t resource_fs_handle;
8282

8383
/**
8484
* @brief Sets up the file system where the wifi module resources will be loaded from.

connectivity/drivers/wifi/COMPONENT_WHD/wifi-host-driver/resources/firmware/COMPONENT_4343W_FS/4343WA1_bin.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616
#include "wiced_resource.h"
17+
#include "mbed-target-config.h"
1718

1819
#if defined(CY_STORAGE_WIFI_DATA)
1920
CY_SECTION_WHD(CY_STORAGE_WIFI_DATA) __attribute__((used))
@@ -25489,5 +25490,9 @@ const unsigned char wifi_firmware_image_data[421098] = {
2548925490
49, 45, 53, 97, 102, 99, 56, 99, 49, 101, 0, 254, 0, 68, 86, 73, 68,
2549025491
32, 48, 49, 45, 101, 100, 48, 100, 55, 97, 53, 54
2549125492
};
25492-
resource_hnd_t wifi_firmware_image = { RESOURCE_IN_EXTERNAL_STORAGE, 421098, {.fs = { 0, "/wlan/4343WA1.BIN" }}};
2549325493

25494+
#if MBED_CONF_TARGET_WIFI_DRIVER_IN_QSPI_FLASH
25495+
resource_hnd_t wifi_firmware_image = { RESOURCE_IN_EXTERNAL_STORAGE, 421098, {.fs = { 0, "/wlan/4343WA1.BIN" }}};
25496+
#else
25497+
const resource_hnd_t wifi_firmware_image = { RESOURCE_IN_MEMORY, 421098, {.mem = { (const char *) wifi_firmware_image_data }}};
25498+
#endif

drivers/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ target_include_directories(mbed-core-flags
1414
.
1515
./include
1616
./include/drivers
17-
./include/drivers/internal
17+
./include/drivers/interfaces
1818
)
1919

2020
target_sources(mbed-core-sources

features/frameworks/cy_rtos_rtx_adapter/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ else()
1919
# Build as part of the minimal CyHAL if it's enabled
2020
if(TARGET mbed-minimal-cyhal)
2121
target_sources(mbed-minimal-cyhal PRIVATE ${CY_RTOS_RTX_ADAPTER_SOURCES})
22-
target_include_directories(mbed-minimal-cyhal INTERFACE ${CY_RTOS_RTX_ADAPTER_INCLUDE_DIRS})
22+
target_include_directories(mbed-minimal-cyhal PUBLIC ${CY_RTOS_RTX_ADAPTER_INCLUDE_DIRS})
2323
endif()
2424
endif()
Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
/* mbed Microcontroller Library
22
* Copyright (c) 2006-2013 ARM Limited
3-
=======
4-
/*
5-
* Copyright 2024 Arduino SA
63
* SPDX-License-Identifier: Apache-2.0
74
*
85
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,23 +19,4 @@
2219

2320
#include "objects.h"
2421

25-
#endif
26-
=======
27-
#include "cyhal_system.h"
28-
29-
#include "mbed_critical.h"
30-
31-
uint32_t cyhal_system_critical_section_enter(void)
32-
{
33-
bool were_interrupts_enabled = !core_util_in_critical_section();
34-
35-
core_util_critical_section_enter();
36-
37-
return were_interrupts_enabled;
38-
}
39-
40-
void cyhal_system_critical_section_exit(uint32_t old_state)
41-
{
42-
(void)old_state;
43-
core_util_critical_section_exit();
44-
}
22+
#endif

targets/targets.json5

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3645,6 +3645,10 @@
36453645
"usb_speed": {
36463646
"help": "USE_USB_OTG_FS or USE_USB_OTG_HS or USE_USB_HS_IN_FS",
36473647
"value": "USE_USB_OTG_HS"
3648+
},
3649+
"wifi_driver_in_qspi_flash": {
3650+
help: "If this is false, and wifi is used in the application, the wifi chip firmware will be included in the application firmware (+411kiB code size). If true, then the wifi firmware is loaded from the external QSPI flash instead, and you must install it using the Arduino IDE sketch for this purpose.",
3651+
value: false
36483652
}
36493653
},
36503654
"components_add": [

0 commit comments

Comments
 (0)