Skip to content

Commit e3c0bbb

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

File tree

11 files changed

+41
-31
lines changed

11 files changed

+41
-31
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

connectivity/netsocket/tests/TESTS/CMakeLists.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,19 @@ if(DEFAULT_IFC_IDX EQUAL -1)
55
set(TEST_SKIPPED "No default network interface on this target")
66
endif()
77

8+
# Set up variables for wi-fi SSID and password
9+
if("MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE=WIFI" IN_LIST MBED_CONFIG_DEFINITIONS)
10+
set(MBED_GREENTEA_WIFI_SECURE_SSID "" CACHE STRING "SSID of a secured wi-fi network with internet access, for greentea tests which need to connect to wifi")
11+
set(MBED_GREENTEA_WIFI_SECURE_PASSWORD "" CACHE STRING "Password to the network given by MBED_GREENTEA_WIFI_SECURE_SSID")
12+
13+
if("${MBED_GREENTEA_WIFI_SECURE_SSID}" STREQUAL "" OR "${MBED_GREENTEA_WIFI_SECURE_PASSWORD}" STREQUAL "")
14+
message(WARNING "MBED_GREENTEA_WIFI_SECURE_SSID and MBED_GREENTEA_WIFI_SECURE_PASSWORD must be set in order for wi-fi greentea tests to pass")
15+
else()
16+
add_compile_definitions(
17+
"MBED_GREENTEA_WIFI_SECURE_SSID=\"${MBED_GREENTEA_WIFI_SECURE_SSID}\""
18+
"MBED_GREENTEA_WIFI_SECURE_PASSWORD=\"${MBED_GREENTEA_WIFI_SECURE_PASSWORD}\"")
19+
endif()
20+
endif()
21+
822
add_subdirectory(netsocket)
923
add_subdirectory(network)

connectivity/netsocket/tests/TESTS/netsocket/udp/main.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
#define WIFI 2
2323
#if !defined(MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE) || \
24-
(MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE == WIFI && !defined(MBED_CONF_NSAPI_DEFAULT_WIFI_SSID))
24+
(MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE == WIFI && !defined(MBED_GREENTEA_WIFI_SECURE_SSID))
2525
#error [NOT_SUPPORTED] No network configuration found for this target.
2626
#else
2727

@@ -61,7 +61,13 @@ void drop_bad_packets(UDPSocket &sock, int orig_timeout)
6161
}
6262
static void _ifup()
6363
{
64+
#if MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE == WIFI
65+
WiFiInterface * net = WiFiInterface::get_default_instance();
66+
net->set_credentials(MBED_GREENTEA_WIFI_SECURE_SSID, MBED_GREENTEA_WIFI_SECURE_PASSWORD);
67+
#else
6468
NetworkInterface *net = NetworkInterface::get_default_instance();
69+
#endif
70+
6571
TEST_ASSERT_NOT_NULL_MESSAGE(net, "No NetworkInterface configured");
6672
nsapi_error_t err = net->connect();
6773

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

0 commit comments

Comments
 (0)