diff --git a/connectivity/drivers/wifi/COMPONENT_WHD/minimal-cyhal/CMakeLists.txt b/connectivity/drivers/wifi/COMPONENT_WHD/minimal-cyhal/CMakeLists.txt index d93dffad41d..96a009a5c27 100644 --- a/connectivity/drivers/wifi/COMPONENT_WHD/minimal-cyhal/CMakeLists.txt +++ b/connectivity/drivers/wifi/COMPONENT_WHD/minimal-cyhal/CMakeLists.txt @@ -16,7 +16,7 @@ add_library(mbed-minimal-cyhal STATIC target_include_directories(mbed-minimal-cyhal PUBLIC .) target_link_libraries(mbed-minimal-cyhal PUBLIC mbed-core-flags - mbed-cy-rtos-abstraction) + mbed-rtos-flags) # This is needed in order to make cybsp_wifi.h include cycfg.h target_compile_definitions(mbed-minimal-cyhal PUBLIC COMPONENT_CUSTOM_DESIGN_MODUS) diff --git a/connectivity/drivers/wifi/COMPONENT_WHD/minimal-cyhal/TARGET_STM32H7/TARGET_STM32H747_ARDUINO/wiced_filesystem_setup.cpp b/connectivity/drivers/wifi/COMPONENT_WHD/minimal-cyhal/TARGET_STM32H7/TARGET_STM32H747_ARDUINO/wiced_filesystem_setup.cpp index 2105cd368b7..067462d3673 100644 --- a/connectivity/drivers/wifi/COMPONENT_WHD/minimal-cyhal/TARGET_STM32H7/TARGET_STM32H747_ARDUINO/wiced_filesystem_setup.cpp +++ b/connectivity/drivers/wifi/COMPONENT_WHD/minimal-cyhal/TARGET_STM32H7/TARGET_STM32H747_ARDUINO/wiced_filesystem_setup.cpp @@ -58,6 +58,8 @@ MBED_WEAK wiced_result_t whd_firmware_check_hook(const char *mounted_name, int m return WICED_ERROR; } +wiced_filesystem_t resource_fs_handle = 0; + wiced_result_t wiced_filesystem_setup() { static QSPIFBlockDevice *qspi_bd = nullptr; @@ -82,6 +84,7 @@ wiced_result_t wiced_filesystem_setup() mbr_bd = new mbed::MBRBlockDevice(qspi_bd, WIFI_DEFAULT_PARTITION); if(mbr_bd->init() != mbed::BD_ERROR_OK) { + whd_firmware_check_hook(WIFI_DEFAULT_MOUNT_NAME, true); delete mbr_bd; mbr_bd = nullptr; return WICED_ERROR; diff --git a/connectivity/drivers/wifi/COMPONENT_WHD/minimal-cyhal/cyhal_gpio.cpp b/connectivity/drivers/wifi/COMPONENT_WHD/minimal-cyhal/cyhal_gpio.cpp index bdaec7df42c..1ea82d2e123 100644 --- a/connectivity/drivers/wifi/COMPONENT_WHD/minimal-cyhal/cyhal_gpio.cpp +++ b/connectivity/drivers/wifi/COMPONENT_WHD/minimal-cyhal/cyhal_gpio.cpp @@ -22,7 +22,7 @@ #include #include "cyhal.h" #include "cybsp.h" -#include "drivers/DigitalIn.h" +#include "drivers/DigitalOut.h" #include "drivers/InterruptIn.h" #include diff --git a/connectivity/drivers/wifi/COMPONENT_WHD/minimal-cyhal/wiced_filesystem.h b/connectivity/drivers/wifi/COMPONENT_WHD/minimal-cyhal/wiced_filesystem.h index 436e36701f1..b110ab43fdf 100644 --- a/connectivity/drivers/wifi/COMPONENT_WHD/minimal-cyhal/wiced_filesystem.h +++ b/connectivity/drivers/wifi/COMPONENT_WHD/minimal-cyhal/wiced_filesystem.h @@ -76,9 +76,9 @@ typedef int wiced_file_t; */ typedef int wiced_filesystem_handle_type_t; -// Global "FS handle" object. Just here to match the WHD driver's expectations, we have one global +// Global "FS handle" object. Just here to match the WHD driver's expectations, we in fact have one global // filesystem object. -static wiced_filesystem_t resource_fs_handle = 0; +extern wiced_filesystem_t resource_fs_handle; /** * @brief Sets up the file system where the wifi module resources will be loaded from. diff --git a/connectivity/drivers/wifi/COMPONENT_WHD/wifi-host-driver/resources/firmware/COMPONENT_4343W_FS/4343WA1_bin.c b/connectivity/drivers/wifi/COMPONENT_WHD/wifi-host-driver/resources/firmware/COMPONENT_4343W_FS/4343WA1_bin.c index ddaf0f7188f..08d3805da7d 100644 --- a/connectivity/drivers/wifi/COMPONENT_WHD/wifi-host-driver/resources/firmware/COMPONENT_4343W_FS/4343WA1_bin.c +++ b/connectivity/drivers/wifi/COMPONENT_WHD/wifi-host-driver/resources/firmware/COMPONENT_4343W_FS/4343WA1_bin.c @@ -14,6 +14,7 @@ * limitations under the License. */ #include "wiced_resource.h" +#include "mbed-target-config.h" #if defined(CY_STORAGE_WIFI_DATA) CY_SECTION_WHD(CY_STORAGE_WIFI_DATA) __attribute__((used)) @@ -25489,5 +25490,9 @@ const unsigned char wifi_firmware_image_data[421098] = { 49, 45, 53, 97, 102, 99, 56, 99, 49, 101, 0, 254, 0, 68, 86, 73, 68, 32, 48, 49, 45, 101, 100, 48, 100, 55, 97, 53, 54 }; -resource_hnd_t wifi_firmware_image = { RESOURCE_IN_EXTERNAL_STORAGE, 421098, {.fs = { 0, "/wlan/4343WA1.BIN" }}}; +#if MBED_CONF_TARGET_WIFI_DRIVER_IN_QSPI_FLASH +resource_hnd_t wifi_firmware_image = { RESOURCE_IN_EXTERNAL_STORAGE, 421098, {.fs = { 0, "/wlan/4343WA1.BIN" }}}; +#else +const resource_hnd_t wifi_firmware_image = { RESOURCE_IN_MEMORY, 421098, {.mem = { (const char *) wifi_firmware_image_data }}}; +#endif diff --git a/connectivity/netsocket/tests/TESTS/CMakeLists.txt b/connectivity/netsocket/tests/TESTS/CMakeLists.txt index 1d260efa47a..80de4a94d34 100644 --- a/connectivity/netsocket/tests/TESTS/CMakeLists.txt +++ b/connectivity/netsocket/tests/TESTS/CMakeLists.txt @@ -5,5 +5,19 @@ if(DEFAULT_IFC_IDX EQUAL -1) set(TEST_SKIPPED "No default network interface on this target") endif() +# Set up variables for wi-fi SSID and password +if("MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE=WIFI" IN_LIST MBED_CONFIG_DEFINITIONS) + 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") + set(MBED_GREENTEA_WIFI_SECURE_PASSWORD "" CACHE STRING "Password to the network given by MBED_GREENTEA_WIFI_SECURE_SSID") + + if("${MBED_GREENTEA_WIFI_SECURE_SSID}" STREQUAL "" OR "${MBED_GREENTEA_WIFI_SECURE_PASSWORD}" STREQUAL "") + 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") + else() + add_compile_definitions( + "MBED_GREENTEA_WIFI_SECURE_SSID=\"${MBED_GREENTEA_WIFI_SECURE_SSID}\"" + "MBED_GREENTEA_WIFI_SECURE_PASSWORD=\"${MBED_GREENTEA_WIFI_SECURE_PASSWORD}\"") + endif() +endif() + add_subdirectory(netsocket) add_subdirectory(network) \ No newline at end of file diff --git a/connectivity/netsocket/tests/TESTS/netsocket/udp/main.cpp b/connectivity/netsocket/tests/TESTS/netsocket/udp/main.cpp index c496c95d83f..de1a2a04bc1 100644 --- a/connectivity/netsocket/tests/TESTS/netsocket/udp/main.cpp +++ b/connectivity/netsocket/tests/TESTS/netsocket/udp/main.cpp @@ -21,7 +21,7 @@ #define WIFI 2 #if !defined(MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE) || \ - (MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE == WIFI && !defined(MBED_CONF_NSAPI_DEFAULT_WIFI_SSID)) + (MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE == WIFI && !defined(MBED_GREENTEA_WIFI_SECURE_SSID)) #error [NOT_SUPPORTED] No network configuration found for this target. #else @@ -61,7 +61,13 @@ void drop_bad_packets(UDPSocket &sock, int orig_timeout) } static void _ifup() { +#if MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE == WIFI + WiFiInterface * net = WiFiInterface::get_default_instance(); + net->set_credentials(MBED_GREENTEA_WIFI_SECURE_SSID, MBED_GREENTEA_WIFI_SECURE_PASSWORD); +#else NetworkInterface *net = NetworkInterface::get_default_instance(); +#endif + TEST_ASSERT_NOT_NULL_MESSAGE(net, "No NetworkInterface configured"); nsapi_error_t err = net->connect(); diff --git a/drivers/CMakeLists.txt b/drivers/CMakeLists.txt index d74e1eb5937..ebd89bc7904 100644 --- a/drivers/CMakeLists.txt +++ b/drivers/CMakeLists.txt @@ -14,7 +14,7 @@ target_include_directories(mbed-core-flags . ./include ./include/drivers - ./include/drivers/internal + ./include/drivers/interfaces ) target_sources(mbed-core-sources diff --git a/features/frameworks/cy_rtos_rtx_adapter/CMakeLists.txt b/features/frameworks/cy_rtos_rtx_adapter/CMakeLists.txt index 0e61b65b2d4..c6e912759ca 100644 --- a/features/frameworks/cy_rtos_rtx_adapter/CMakeLists.txt +++ b/features/frameworks/cy_rtos_rtx_adapter/CMakeLists.txt @@ -19,6 +19,6 @@ else() # Build as part of the minimal CyHAL if it's enabled if(TARGET mbed-minimal-cyhal) target_sources(mbed-minimal-cyhal PRIVATE ${CY_RTOS_RTX_ADAPTER_SOURCES}) - target_include_directories(mbed-minimal-cyhal INTERFACE ${CY_RTOS_RTX_ADAPTER_INCLUDE_DIRS}) + target_include_directories(mbed-minimal-cyhal PUBLIC ${CY_RTOS_RTX_ADAPTER_INCLUDE_DIRS}) endif() endif() diff --git a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52832/TARGET_ARDUINO_NICLA_SENSE_ME/device.h b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52832/TARGET_ARDUINO_NICLA_SENSE_ME/device.h index ee047587421..4ffd3337994 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52832/TARGET_ARDUINO_NICLA_SENSE_ME/device.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52832/TARGET_ARDUINO_NICLA_SENSE_ME/device.h @@ -1,8 +1,5 @@ /* mbed Microcontroller Library * Copyright (c) 2006-2013 ARM Limited -======= -/* - * Copyright 2024 Arduino SA * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,23 +19,4 @@ #include "objects.h" -#endif -======= -#include "cyhal_system.h" - -#include "mbed_critical.h" - -uint32_t cyhal_system_critical_section_enter(void) -{ - bool were_interrupts_enabled = !core_util_in_critical_section(); - - core_util_critical_section_enter(); - - return were_interrupts_enabled; -} - -void cyhal_system_critical_section_exit(uint32_t old_state) -{ - (void)old_state; - core_util_critical_section_exit(); -} +#endif \ No newline at end of file diff --git a/targets/targets.json5 b/targets/targets.json5 index 1a515f53b46..f06c8668d3f 100644 --- a/targets/targets.json5 +++ b/targets/targets.json5 @@ -3623,6 +3623,10 @@ "usb_speed": { "help": "USE_USB_OTG_FS or USE_USB_OTG_HS or USE_USB_HS_IN_FS", "value": "USE_USB_OTG_HS" + }, + "wifi_driver_in_qspi_flash": { + 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.", + value: false } }, "components_add": [