diff --git a/TESTS/configs/baremetal.json b/TESTS/configs/baremetal.json index d4ec3c96620..09993926f18 100644 --- a/TESTS/configs/baremetal.json +++ b/TESTS/configs/baremetal.json @@ -1,12 +1,12 @@ -{ - "requires": [ - "bare-metal", +{ + "requires": [ + "bare-metal", "rtos-api", - "greentea-client", - "utest", + "greentea-client", + "utest", "unity", "psa", - "mbed-crypto", + "mbed-crypto", "mbedtls", "psa-compliance-framework", "filesystem", @@ -37,7 +37,6 @@ ], "target_overrides": { "*": { - "target.device_has_remove": ["EMAC", "USBDEVICE"], "mbed-trace.fea-ipv6": false } } diff --git a/TESTS/integration/COMMON/common_defines_fs_test.h b/TESTS/integration/COMMON/common_defines_fs_test.h index e0db35150ef..0deba95028f 100644 --- a/TESTS/integration/COMMON/common_defines_fs_test.h +++ b/TESTS/integration/COMMON/common_defines_fs_test.h @@ -16,9 +16,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "mbed_trace.h" - -#define TRACE_GROUP "GRNT" #define FS_FAT 1 #define FS_LFS 2 diff --git a/TESTS/integration/COMMON/download_test.cpp b/TESTS/integration/COMMON/download_test.cpp index cde62f51a9c..12037fa17d9 100644 --- a/TESTS/integration/COMMON/download_test.cpp +++ b/TESTS/integration/COMMON/download_test.cpp @@ -27,7 +27,7 @@ #include "unity/unity.h" #include "greentea-client/test_env.h" #include -#include "common_defines_test.h" +#include "download_test.h" #define MAX_THREADS 5 diff --git a/TESTS/integration/COMMON/download_test.h b/TESTS/integration/COMMON/download_test.h index d755b2c9e85..4e951657350 100644 --- a/TESTS/integration/COMMON/download_test.h +++ b/TESTS/integration/COMMON/download_test.h @@ -20,5 +20,9 @@ /* * Based on mbed-stress-test by Marcus Chang @ Arm Mbed - http://github.com/ARMmbed/mbed-stress-test */ + +#include "mbed_trace.h" + +#define TRACE_GROUP "GRNT" size_t download_test(NetworkInterface *interface, const unsigned char *data, size_t data_length, size_t buff_size, uint32_t thread_id = 0); diff --git a/TESTS/integration/COMMON/file_test.cpp b/TESTS/integration/COMMON/file_test.cpp index 27c4b5394d0..ad9debd8d8d 100644 --- a/TESTS/integration/COMMON/file_test.cpp +++ b/TESTS/integration/COMMON/file_test.cpp @@ -24,7 +24,7 @@ #include "mbed.h" #include "unity/unity.h" -#include "common_defines_test.h" +#include "file_test.h" void file_test_write(const char *file, size_t offset, const unsigned char *data, size_t data_length, size_t block_size) { diff --git a/TESTS/integration/COMMON/file_test.h b/TESTS/integration/COMMON/file_test.h index bde36948134..3db755e22fb 100644 --- a/TESTS/integration/COMMON/file_test.h +++ b/TESTS/integration/COMMON/file_test.h @@ -20,6 +20,10 @@ /* * Based on mbed-stress-test by Marcus Chang @ Arm Mbed - http://github.com/ARMmbed/mbed-stress-test */ +#include "mbed_trace.h" + +#define TRACE_GROUP "GRNT" + void file_test_write(const char *file, size_t offset, const unsigned char *data, size_t data_length, size_t block_size); void file_test_read(const char *file, size_t offset, const unsigned char *data, size_t data_length, size_t block_size); diff --git a/components/storage/blockdevice/COMPONENT_SD/SDBlockDevice.cpp b/components/storage/blockdevice/COMPONENT_SD/SDBlockDevice.cpp index 769fcfbbe36..76f4b4534b9 100644 --- a/components/storage/blockdevice/COMPONENT_SD/SDBlockDevice.cpp +++ b/components/storage/blockdevice/COMPONENT_SD/SDBlockDevice.cpp @@ -271,6 +271,28 @@ SDBlockDevice::SDBlockDevice(PinName mosi, PinName miso, PinName sclk, PinName c _erase_size = BLOCK_SIZE_HC; } +#if MBED_CONF_SD_CRC_ENABLED +SDBlockDevice::SDBlockDevice(const spi_pinmap_t &spi_pinmap, PinName cs, uint64_t hz, bool crc_on) + : _sectors(0), _spi(spi_pinmap), _cs(cs), _is_initialized(0), + _init_ref_count(0), _crc_on(crc_on) +#else +SDBlockDevice::SDBlockDevice(const spi_pinmap_t &spi_pinmap, PinName cs, uint64_t hz, bool crc_on) + : _sectors(0), _spi(spi_pinmap), _cs(cs), _is_initialized(0), + _init_ref_count(0) +#endif +{ + _cs = 1; + _card_type = SDCARD_NONE; + + // Set default to 100kHz for initialisation and 1MHz for data transfer + MBED_STATIC_ASSERT(((MBED_CONF_SD_INIT_FREQUENCY >= 100000) && (MBED_CONF_SD_INIT_FREQUENCY <= 400000)), + "Initialization frequency should be between 100KHz to 400KHz"); + _init_sck = MBED_CONF_SD_INIT_FREQUENCY; + _transfer_sck = hz; + + _erase_size = BLOCK_SIZE_HC; +} + SDBlockDevice::~SDBlockDevice() { if (_is_initialized) { diff --git a/components/storage/blockdevice/COMPONENT_SD/SDBlockDevice.h b/components/storage/blockdevice/COMPONENT_SD/SDBlockDevice.h index 08caa4fea7f..bffdb389990 100644 --- a/components/storage/blockdevice/COMPONENT_SD/SDBlockDevice.h +++ b/components/storage/blockdevice/COMPONENT_SD/SDBlockDevice.h @@ -27,6 +27,7 @@ #include "drivers/DigitalOut.h" #include "platform/platform.h" #include "platform/PlatformMutex.h" +#include "hal/static_pinmap.h" /** SDBlockDevice class * @@ -34,7 +35,7 @@ */ class SDBlockDevice : public mbed::BlockDevice { public: - /** Creates an SDBlockDevice on a SPI bus specified by pins + /** Creates an SDBlockDevice on a SPI bus specified by pins (using dynamic pin-map) * * @param mosi SPI master out, slave in pin * @param miso SPI master in, slave out pin @@ -44,6 +45,15 @@ class SDBlockDevice : public mbed::BlockDevice { * @param crc_on Enable cyclic redundancy check (defaults to disabled) */ SDBlockDevice(PinName mosi, PinName miso, PinName sclk, PinName cs, uint64_t hz = 1000000, bool crc_on = 0); + + /** Creates an SDBlockDevice on a SPI bus specified by pins (using static pin-map) + * + * @param spi_pinmap Static SPI pin-map + * @param hz Clock speed of the SPI bus (defaults to 1MHz) + * @param crc_on Enable cyclic redundancy check (defaults to disabled) + */ + SDBlockDevice(const spi_pinmap_t &spi_pinmap, PinName cs, uint64_t hz = 1000000, bool crc_on = 0); + virtual ~SDBlockDevice(); /** Initialize a block device diff --git a/drivers/SerialBase.h b/drivers/SerialBase.h index 831807785f7..3f02c4ec82b 100644 --- a/drivers/SerialBase.h +++ b/drivers/SerialBase.h @@ -330,6 +330,9 @@ class SerialBase : private NonCopyable { /** Initialize serial port */ void _init(); + void _init_direct(); + /* Pointer to serial init function */ + void (SerialBase::*_init_func)(); /** Deinitialize serial port */ @@ -345,18 +348,22 @@ class SerialBase : private NonCopyable { bool _rx_asynch_set = false; #endif - serial_t _serial {}; - Callback _irq[IrqCnt]; - int _baud; - bool _rx_enabled = true; - bool _tx_enabled = true; - const PinName _tx_pin; - const PinName _rx_pin; + serial_t _serial {}; + Callback _irq[IrqCnt]; + int _baud; + bool _rx_enabled = true; + bool _tx_enabled = true; + const PinName _tx_pin; + const PinName _rx_pin; + const serial_pinmap_t *_static_pinmap = NULL; + void (SerialBase::*_set_flow_control_dp_func)(Flow, PinName, PinName) = NULL; #if DEVICE_SERIAL_FC - Flow _flow_type = Disabled; - PinName _flow1 = NC; - PinName _flow2 = NC; + Flow _flow_type = Disabled; + PinName _flow1 = NC; + PinName _flow2 = NC; + const serial_fc_pinmap_t *_static_pinmap_fc = NULL; + void (SerialBase::*_set_flow_control_sp_func)(Flow, const serial_fc_pinmap_t &) = NULL; #endif #endif diff --git a/drivers/source/SerialBase.cpp b/drivers/source/SerialBase.cpp index be4e62ea4e7..824785139b8 100644 --- a/drivers/source/SerialBase.cpp +++ b/drivers/source/SerialBase.cpp @@ -29,7 +29,8 @@ SerialBase::SerialBase(PinName tx, PinName rx, int baud) : #endif _baud(baud), _tx_pin(tx), - _rx_pin(rx) + _rx_pin(rx), + _init_func(&SerialBase::_init) { // No lock needed in the constructor @@ -37,7 +38,7 @@ SerialBase::SerialBase(PinName tx, PinName rx, int baud) : _irq[i] = NULL; } - _init(); + (this->*_init_func)(); } SerialBase::SerialBase(const serial_pinmap_t &static_pinmap, int baud) : @@ -50,7 +51,9 @@ SerialBase::SerialBase(const serial_pinmap_t &static_pinmap, int baud) : _serial(), _baud(baud), _tx_pin(static_pinmap.tx_pin), - _rx_pin(static_pinmap.rx_pin) + _rx_pin(static_pinmap.rx_pin), + _static_pinmap(&static_pinmap), + _init_func(&SerialBase::_init_direct) { // No lock needed in the constructor @@ -58,9 +61,7 @@ SerialBase::SerialBase(const serial_pinmap_t &static_pinmap, int baud) : _irq[i] = NULL; } - serial_init_direct(&_serial, &static_pinmap); - serial_baud(&_serial, _baud); - serial_irq_handler(&_serial, SerialBase::_irq_handler, (uint32_t)this); + (this->*_init_func)(); } void SerialBase::baud(int baudrate) @@ -150,7 +151,21 @@ void SerialBase::_init() { serial_init(&_serial, _tx_pin, _rx_pin); #if DEVICE_SERIAL_FC - set_flow_control(_flow_type, _flow1, _flow2); + if (_set_flow_control_dp_func) { + (this->*_set_flow_control_dp_func)(_flow_type, _flow1, _flow2); + } +#endif + serial_baud(&_serial, _baud); + serial_irq_handler(&_serial, SerialBase::_irq_handler, (uint32_t)this); +} + +void SerialBase::_init_direct() +{ + serial_init_direct(&_serial, _static_pinmap); +#if DEVICE_SERIAL_FC + if (_static_pinmap_fc && _set_flow_control_dp_func) { + (this->*_set_flow_control_sp_func)(_flow_type, *_static_pinmap_fc); + } #endif serial_baud(&_serial, _baud); serial_irq_handler(&_serial, SerialBase::_irq_handler, (uint32_t)this); @@ -166,7 +181,7 @@ void SerialBase::enable_input(bool enable) lock(); if (_rx_enabled != enable) { if (enable && !_tx_enabled) { - _init(); + (this->*_init_func)(); } core_util_critical_section_enter(); @@ -203,7 +218,7 @@ void SerialBase::enable_output(bool enable) lock(); if (_tx_enabled != enable) { if (enable && !_rx_enabled) { - _init(); + (this->*_init_func)(); } core_util_critical_section_enter(); @@ -289,6 +304,8 @@ SerialBase::~SerialBase() #if DEVICE_SERIAL_FC void SerialBase::set_flow_control(Flow type, PinName flow1, PinName flow2) { + MBED_ASSERT(_static_pinmap == NULL); // this function must be used when serial object has been created using dynamic pin-map constructor + _set_flow_control_dp_func = &SerialBase::set_flow_control; lock(); _flow_type = type; @@ -318,9 +335,13 @@ void SerialBase::set_flow_control(Flow type, PinName flow1, PinName flow2) void SerialBase::set_flow_control(Flow type, const serial_fc_pinmap_t &static_pinmap) { + MBED_ASSERT(_static_pinmap != NULL); // this function must be used when serial object has been created using static pin-map constructor + _set_flow_control_sp_func = &SerialBase::set_flow_control; lock(); + _static_pinmap_fc = &static_pinmap; + _flow_type = type; FlowControl flow_type = (FlowControl)type; - serial_set_flow_control_direct(&_serial, flow_type, &static_pinmap); + serial_set_flow_control_direct(&_serial, flow_type, _static_pinmap_fc); unlock(); } #endif diff --git a/features/netsocket/emac-drivers/TARGET_STM/TARGET_STM32F4/TARGET_MODULE_UBLOX_ODIN_W2/wifi_emac/wifi_emac.cpp b/features/netsocket/emac-drivers/TARGET_STM/TARGET_STM32F4/TARGET_MODULE_UBLOX_ODIN_W2/wifi_emac/wifi_emac.cpp index 2f44f9b3be8..91265aeded5 100644 --- a/features/netsocket/emac-drivers/TARGET_STM/TARGET_STM32F4/TARGET_MODULE_UBLOX_ODIN_W2/wifi_emac/wifi_emac.cpp +++ b/features/netsocket/emac-drivers/TARGET_STM/TARGET_STM32F4/TARGET_MODULE_UBLOX_ODIN_W2/wifi_emac/wifi_emac.cpp @@ -39,7 +39,7 @@ cb_uint32 handleWlanTargetGetDataFrameSize(cbWLANTARGET_dataFrame* frame); cb_uint8 handleWlanTargetGetDataFrameTID(cbWLANTARGET_dataFrame* frame); void handleWlanStatusIndication(void *dummy, cbWLAN_StatusIndicationInfo status, void *data); void handleWlanPacketIndication(void *dummy, cbWLAN_PacketIndicationInfo *packetInfo); -void send_wlan_packet(void *buf); +void send_wlan_packet(OdinWiFiEMAC *ptr, void *buf); static const cbWLANTARGET_Callback _wlanTargetCallback = { @@ -202,9 +202,19 @@ OdinWiFiEMAC::OdinWiFiEMAC() cbWLANTARGET_registerCallbacks((cbWLANTARGET_Callback*)&_wlanTargetCallback); } -void send_wlan_packet(void *buf) +cbWLAN_Handle OdinWiFiEMAC::get_wifi_emac_handle() { - cbWLAN_sendPacket(cbWLAN_DEFAULT_HANDLE, buf); + return this->handle; +} + +void OdinWiFiEMAC::set_wifi_emac_handle(cbWLAN_Handle _handle) +{ + this->handle = _handle; +} + +void send_wlan_packet(OdinWiFiEMAC *ptr, void *buf) +{ + cbWLAN_sendPacket(ptr->handle, buf); } bool OdinWiFiEMAC::link_out(emac_mem_buf_t *buf) @@ -215,7 +225,7 @@ bool OdinWiFiEMAC::link_out(emac_mem_buf_t *buf) emac_mem_buf_t *new_buf = mem->alloc_pool(mem->get_total_len(buf), 0); if (new_buf != NULL) { mem->copy(new_buf, buf); - int id = cbMAIN_getEventQueue()->call(send_wlan_packet, new_buf); + int id = cbMAIN_getEventQueue()->call(send_wlan_packet, this, new_buf); if (id != 0) { cbMAIN_dispatchEventQueue(); } else { @@ -262,9 +272,8 @@ void OdinWiFiEMAC::set_hwaddr(const uint8_t *addr) void OdinWiFiEMAC::set_link_input_cb(emac_link_input_cb_t input_cb) { emac_link_input_cb = input_cb; - cbMAIN_driverLock(); - cbWLAN_registerPacketIndicationCallback(cbWLAN_DEFAULT_HANDLE, handleWlanPacketIndication, NULL); + cbWLAN_registerPacketIndicationCallback(get_wifi_emac_handle(), handleWlanPacketIndication, NULL); cbMAIN_driverUnlock(); } diff --git a/features/netsocket/emac-drivers/TARGET_STM/TARGET_STM32F4/TARGET_MODULE_UBLOX_ODIN_W2/wifi_emac/wifi_emac.h b/features/netsocket/emac-drivers/TARGET_STM/TARGET_STM32F4/TARGET_MODULE_UBLOX_ODIN_W2/wifi_emac/wifi_emac.h index 22e68baa27a..f8fe5ceebbb 100644 --- a/features/netsocket/emac-drivers/TARGET_STM/TARGET_STM32F4/TARGET_MODULE_UBLOX_ODIN_W2/wifi_emac/wifi_emac.h +++ b/features/netsocket/emac-drivers/TARGET_STM/TARGET_STM32F4/TARGET_MODULE_UBLOX_ODIN_W2/wifi_emac/wifi_emac.h @@ -124,8 +124,13 @@ class OdinWiFiEMAC : public EMAC { virtual void remove_multicast_group(const uint8_t *address); virtual void set_all_multicast(bool all); + cbWLAN_Handle get_wifi_emac_handle(); + void set_wifi_emac_handle(cbWLAN_Handle _handle); + private: + cbWLAN_Handle handle = cbWLAN_DEFAULT_HANDLE; + emac_link_input_cb_t emac_link_input_cb; /**< Callback for incoming data */ emac_link_state_change_cb_t emac_link_state_cb; /**< Link state change callback */ EMACMemoryManager *memory_manager; @@ -138,7 +143,7 @@ class OdinWiFiEMAC : public EMAC { friend void handleWlanStatusIndication(void *dummy, cbWLAN_StatusIndicationInfo status, void *data); friend void handleWlanPacketIndication(void *dummy, cbWLAN_PacketIndicationInfo *packetInfo); - friend void send_wlan_packet(void *buf); + friend void send_wlan_packet(OdinWiFiEMAC *ptr, void *buf); }; #endif /* WIFI_EMAC_H_ */ diff --git a/features/storage/kvstore/conf/kv_config.cpp b/features/storage/kvstore/conf/kv_config.cpp index 84e21e6985f..4f68173a753 100644 --- a/features/storage/kvstore/conf/kv_config.cpp +++ b/features/storage/kvstore/conf/kv_config.cpp @@ -49,6 +49,10 @@ #if COMPONENT_SD #include "components/storage/blockdevice/COMPONENT_SD/SDBlockDevice.h" + +#if (STATIC_PINMAP_READY) +constexpr spi_pinmap_t static_spi_pinmap = get_spi_pinmap(MBED_CONF_SD_SPI_MOSI, MBED_CONF_SD_SPI_MISO, MBED_CONF_SD_SPI_CLK, NC); +#endif #endif /** @@ -564,12 +568,19 @@ BlockDevice *_get_blockdevice_SD(bd_addr_t start_address, bd_size_t size) bd_addr_t aligned_end_address; bd_addr_t aligned_start_address; +#if (STATIC_PINMAP_READY) + static SDBlockDevice bd( + static_spi_pinmap, + MBED_CONF_SD_SPI_CS + ); +#else static SDBlockDevice bd( MBED_CONF_SD_SPI_MOSI, MBED_CONF_SD_SPI_MISO, MBED_CONF_SD_SPI_CLK, MBED_CONF_SD_SPI_CS ); +#endif if (bd.init() != MBED_SUCCESS) { tr_error("KV Config: SDBlockDevice init fail"); diff --git a/features/storage/system_storage/SystemStorage.cpp b/features/storage/system_storage/SystemStorage.cpp index 695197c7e4c..49adaf3a256 100644 --- a/features/storage/system_storage/SystemStorage.cpp +++ b/features/storage/system_storage/SystemStorage.cpp @@ -39,6 +39,10 @@ #if COMPONENT_SD #include "components/storage/blockdevice/COMPONENT_SD/SDBlockDevice.h" + +#if (STATIC_PINMAP_READY) +constexpr spi_pinmap_t static_spi_pinmap = get_spi_pinmap(MBED_CONF_SD_SPI_MOSI, MBED_CONF_SD_SPI_MISO, MBED_CONF_SD_SPI_CLK, NC); +#endif #endif #if COMPONENT_FLASHIAP @@ -136,12 +140,19 @@ MBED_WEAK BlockDevice *BlockDevice::get_default_instance() #elif COMPONENT_SD +#if (STATIC_PINMAP_READY) + static SDBlockDevice default_bd( + static_spi_pinmap, + MBED_CONF_SD_SPI_CS + ); +#else static SDBlockDevice default_bd( MBED_CONF_SD_SPI_MOSI, MBED_CONF_SD_SPI_MISO, MBED_CONF_SD_SPI_CLK, MBED_CONF_SD_SPI_CS ); +#endif return &default_bd; diff --git a/platform/mbed_interface.h b/platform/mbed_interface.h index 279eca727d9..cb90c95e3bf 100644 --- a/platform/mbed_interface.h +++ b/platform/mbed_interface.h @@ -168,7 +168,7 @@ void mbed_error_vprintf(const char *format, va_list arg) MBED_PRINTF(1, 0); * FileHandle::write of the stderr device is. The default * serial console is safe, either buffered or not. If the * console has not previously been initialized, an attempt - * to use this from interrupt may during console initialization. + * to use this from interrupt may crash during console initialization. * Special handling of `mbed_error` relaxes various system traps * to increase the chance of initialization working. * diff --git a/platform/source/TARGET_CORTEX_M/mbed_fault_handler.c b/platform/source/TARGET_CORTEX_M/mbed_fault_handler.c index 615842fc6f7..293742fd89e 100644 --- a/platform/source/TARGET_CORTEX_M/mbed_fault_handler.c +++ b/platform/source/TARGET_CORTEX_M/mbed_fault_handler.c @@ -21,6 +21,7 @@ #include #include "device.h" +#include "mbed_atomic.h" #include "mbed_error.h" #include "mbed_interface.h" #include "mbed_crash_data_offsets.h" @@ -39,41 +40,49 @@ mbed_fault_context_t fault_context; mbed_fault_context_t *const mbed_fault_context = &fault_context; #endif +extern bool mbed_error_in_progress; + //This is a handler function called from Fault handler to print the error information out. //This runs in fault context and uses special functions(defined in mbed_rtx_fault_handler.c) to print the information without using C-lib support. void mbed_fault_handler(uint32_t fault_type, const mbed_fault_context_t *mbed_fault_context_in) { mbed_error_status_t faultStatus = MBED_SUCCESS; - mbed_error_printf("\n++ MbedOS Fault Handler ++\n\nFaultType: "); - - switch (fault_type) { - case MEMMANAGE_FAULT_EXCEPTION: - mbed_error_printf("MemManageFault"); - faultStatus = MBED_ERROR_MEMMANAGE_EXCEPTION; - break; - - case BUS_FAULT_EXCEPTION: - mbed_error_printf("BusFault"); - faultStatus = MBED_ERROR_BUSFAULT_EXCEPTION; - break; - - case USAGE_FAULT_EXCEPTION: - mbed_error_printf("UsageFault"); - faultStatus = MBED_ERROR_USAGEFAULT_EXCEPTION; - break; - - //There is no way we can hit this code without getting an exception, so we have the default treated like hardfault - case HARD_FAULT_EXCEPTION: - default: - mbed_error_printf("HardFault"); - faultStatus = MBED_ERROR_HARDFAULT_EXCEPTION; - break; - } - mbed_error_printf("\n\nContext:"); - print_context_info(); + /* Need to set the flag to ensure prints do not trigger a "mutex in ISR" trap + * if they're first prints since boot and we have to init the I/O system. + */ + if (!core_util_atomic_exchange_bool(&mbed_error_in_progress, true)) { + mbed_error_printf("\n++ MbedOS Fault Handler ++\n\nFaultType: "); + + switch (fault_type) { + case MEMMANAGE_FAULT_EXCEPTION: + mbed_error_printf("MemManageFault"); + faultStatus = MBED_ERROR_MEMMANAGE_EXCEPTION; + break; + + case BUS_FAULT_EXCEPTION: + mbed_error_printf("BusFault"); + faultStatus = MBED_ERROR_BUSFAULT_EXCEPTION; + break; + + case USAGE_FAULT_EXCEPTION: + mbed_error_printf("UsageFault"); + faultStatus = MBED_ERROR_USAGEFAULT_EXCEPTION; + break; + + //There is no way we can hit this code without getting an exception, so we have the default treated like hardfault + case HARD_FAULT_EXCEPTION: + default: + mbed_error_printf("HardFault"); + faultStatus = MBED_ERROR_HARDFAULT_EXCEPTION; + break; + } + mbed_error_printf("\n\nContext:"); + print_context_info(); - mbed_error_printf("\n\n-- MbedOS Fault Handler --\n\n"); + mbed_error_printf("\n\n-- MbedOS Fault Handler --\n\n"); + core_util_atomic_store_bool(&mbed_error_in_progress, false); + } //Now call mbed_error, to log the error and halt the system mbed_error(faultStatus, "Fault exception", (unsigned int)mbed_fault_context_in, NULL, 0); diff --git a/platform/source/mbed_error.c b/platform/source/mbed_error.c index bc16a3d8ed9..25d64160c3e 100644 --- a/platform/source/mbed_error.c +++ b/platform/source/mbed_error.c @@ -51,7 +51,7 @@ static void print_error_report(const mbed_error_ctx *ctx, const char *, const ch #define ERROR_REPORT(ctx, error_msg, error_filename, error_line) ((void) 0) #endif -static bool error_in_progress; +bool mbed_error_in_progress; static core_util_atomic_flag halt_in_progress = CORE_UTIL_ATOMIC_FLAG_INIT; static int error_count = 0; static mbed_error_ctx first_error_ctx = {0}; @@ -121,7 +121,7 @@ static MBED_NORETURN void mbed_halt_system(void) WEAK MBED_NORETURN void error(const char *format, ...) { // Prevent recursion if error is called again during store+print attempt - if (!core_util_atomic_exchange_bool(&error_in_progress, true)) { + if (!core_util_atomic_exchange_bool(&mbed_error_in_progress, true)) { handle_error(MBED_ERROR_UNKNOWN, 0, NULL, 0, MBED_CALLER_ADDR()); ERROR_REPORT(&last_error_ctx, "Fatal Run-time error", NULL, 0); @@ -298,7 +298,7 @@ int mbed_get_error_count(void) //Reads the fatal error occurred" flag bool mbed_get_error_in_progress(void) { - return core_util_atomic_load_bool(&error_in_progress); + return core_util_atomic_load_bool(&mbed_error_in_progress); } //Sets a non-fatal error @@ -311,7 +311,7 @@ mbed_error_status_t mbed_warning(mbed_error_status_t error_status, const char *e WEAK MBED_NORETURN mbed_error_status_t mbed_error(mbed_error_status_t error_status, const char *error_msg, unsigned int error_value, const char *filename, int line_number) { // Prevent recursion if error is called again during store+print attempt - if (!core_util_atomic_exchange_bool(&error_in_progress, true)) { + if (!core_util_atomic_exchange_bool(&mbed_error_in_progress, true)) { //set the error reported (void) handle_error(error_status, error_value, filename, line_number, MBED_CALLER_ADDR()); diff --git a/targets/TARGET_ARM_SSG/TARGET_MUSCA_A1/TARGET_MUSCA_A1_NS/prebuilt/crypto_access_control.bin b/targets/TARGET_ARM_SSG/TARGET_MUSCA_A1/TARGET_MUSCA_A1_NS/prebuilt/crypto_access_control.bin index 67c4dd01c58..8d528d5eb2b 100644 Binary files a/targets/TARGET_ARM_SSG/TARGET_MUSCA_A1/TARGET_MUSCA_A1_NS/prebuilt/crypto_access_control.bin and b/targets/TARGET_ARM_SSG/TARGET_MUSCA_A1/TARGET_MUSCA_A1_NS/prebuilt/crypto_access_control.bin differ diff --git a/targets/TARGET_ARM_SSG/TARGET_MUSCA_A1/TARGET_MUSCA_A1_NS/prebuilt/spm_client.bin b/targets/TARGET_ARM_SSG/TARGET_MUSCA_A1/TARGET_MUSCA_A1_NS/prebuilt/spm_client.bin index 9c95b6585be..acd8e47d8a0 100644 Binary files a/targets/TARGET_ARM_SSG/TARGET_MUSCA_A1/TARGET_MUSCA_A1_NS/prebuilt/spm_client.bin and b/targets/TARGET_ARM_SSG/TARGET_MUSCA_A1/TARGET_MUSCA_A1_NS/prebuilt/spm_client.bin differ diff --git a/targets/TARGET_ARM_SSG/TARGET_MUSCA_A1/TARGET_MUSCA_A1_NS/prebuilt/spm_server.bin b/targets/TARGET_ARM_SSG/TARGET_MUSCA_A1/TARGET_MUSCA_A1_NS/prebuilt/spm_server.bin index 5efe29339a5..a3bbf007617 100644 Binary files a/targets/TARGET_ARM_SSG/TARGET_MUSCA_A1/TARGET_MUSCA_A1_NS/prebuilt/spm_server.bin and b/targets/TARGET_ARM_SSG/TARGET_MUSCA_A1/TARGET_MUSCA_A1_NS/prebuilt/spm_server.bin differ diff --git a/targets/TARGET_ARM_SSG/TARGET_MUSCA_A1/TARGET_MUSCA_A1_NS/prebuilt/spm_smoke.bin b/targets/TARGET_ARM_SSG/TARGET_MUSCA_A1/TARGET_MUSCA_A1_NS/prebuilt/spm_smoke.bin index e8473bd4a46..d431731fbe9 100644 Binary files a/targets/TARGET_ARM_SSG/TARGET_MUSCA_A1/TARGET_MUSCA_A1_NS/prebuilt/spm_smoke.bin and b/targets/TARGET_ARM_SSG/TARGET_MUSCA_A1/TARGET_MUSCA_A1_NS/prebuilt/spm_smoke.bin differ diff --git a/targets/TARGET_ARM_SSG/TARGET_MUSCA_A1/TARGET_MUSCA_A1_NS/prebuilt/tfm.bin b/targets/TARGET_ARM_SSG/TARGET_MUSCA_A1/TARGET_MUSCA_A1_NS/prebuilt/tfm.bin index 86a8d7216b1..4a1831ad2c2 100644 Binary files a/targets/TARGET_ARM_SSG/TARGET_MUSCA_A1/TARGET_MUSCA_A1_NS/prebuilt/tfm.bin and b/targets/TARGET_ARM_SSG/TARGET_MUSCA_A1/TARGET_MUSCA_A1_NS/prebuilt/tfm.bin differ diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/COMPONENT_WHD/generated_mac_address.txt b/targets/TARGET_Cypress/TARGET_PSOC6/COMPONENT_WHD/generated_mac_address.txt index 496c5d7579e..346168bc33f 100644 --- a/targets/TARGET_Cypress/TARGET_PSOC6/COMPONENT_WHD/generated_mac_address.txt +++ b/targets/TARGET_Cypress/TARGET_PSOC6/COMPONENT_WHD/generated_mac_address.txt @@ -6,4 +6,4 @@ * MAC address is printed during WHD power up */ -#define NVRAM_GENERATED_MAC_ADDRESS "macaddr=00:A0:50:d6:93:82" +#define NVRAM_GENERATED_MAC_ADDRESS "macaddr=00:A0:50:2f:32:99" diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/COMPONENT_WHD/inc/whd_version.h b/targets/TARGET_Cypress/TARGET_PSOC6/COMPONENT_WHD/inc/whd_version.h index d54eb02eba8..e89e05efbae 100644 --- a/targets/TARGET_Cypress/TARGET_PSOC6/COMPONENT_WHD/inc/whd_version.h +++ b/targets/TARGET_Cypress/TARGET_PSOC6/COMPONENT_WHD/inc/whd_version.h @@ -1,3 +1,3 @@ -#define WHD_VERSION "v1.60.0-rc1" -#define WHD_BRANCH "v1.60.0-rc1" -#define WHD_DATE "2019-11-13 21:27:38 -0600" +#define WHD_VERSION "v1.70.0" +#define WHD_BRANCH "v1.70.0" +#define WHD_DATE "2019-12-02 04:14:53 -0600" diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/COMPONENT_WHD/src/include/whd_events_int.h b/targets/TARGET_Cypress/TARGET_PSOC6/COMPONENT_WHD/src/include/whd_events_int.h index 72a2d4b220c..205c912d115 100644 --- a/targets/TARGET_Cypress/TARGET_PSOC6/COMPONENT_WHD/src/include/whd_events_int.h +++ b/targets/TARGET_Cypress/TARGET_PSOC6/COMPONENT_WHD/src/include/whd_events_int.h @@ -166,9 +166,10 @@ typedef enum WLC_E_PFN_SCAN_COMPLETE = 138, /* PFN completed scan of network list */ WLC_E_RMC_EVENT = 139, /* RMC Event */ WLC_E_DPSTA_INTF_IND = 140, /* DPSTA interface indication */ - WLC_E_RRM = 141, /* RRM Event */ - WLC_E_ULP = 146, /* ULP entry event */ - WLC_E_LAST = 147, /** highest val + 1 for range checking */ + WLC_E_RRM = 141, /* RRM Event */ + WLC_E_ULP = 146, /* ULP entry event */ + WLC_E_TKO = 151, /* TCP Keep Alive Offload Event */ + WLC_E_LAST = 152, /* highest val + 1 for range checking */ } whd_event_num_t; #define WLC_SUP_STATUS_OFFSET (256) diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/COMPONENT_WHD/src/whd_ap.c b/targets/TARGET_Cypress/TARGET_PSOC6/COMPONENT_WHD/src/whd_ap.c index d49dd48a25a..8d901c38ea4 100644 --- a/targets/TARGET_Cypress/TARGET_PSOC6/COMPONENT_WHD/src/whd_ap.c +++ b/targets/TARGET_Cypress/TARGET_PSOC6/COMPONENT_WHD/src/whd_ap.c @@ -746,12 +746,14 @@ uint32_t whd_wifi_stop_ap(whd_interface_t ifp) return result2; } - /* Disable AP mode */ - data = (uint32_t *)whd_cdc_get_ioctl_buffer(whd_driver, &buffer, (uint16_t)4); - CHECK_IOCTL_BUFFER_WITH_SEMAPHORE(data, &ap->whd_wifi_sleep_flag); - *data = 0; /* Turn off AP */ - CHECK_RETURN_WITH_SEMAPHORE(whd_cdc_send_ioctl(ifp, CDC_SET, WLC_SET_AP, buffer, 0), - &ap->whd_wifi_sleep_flag); + /* Disable AP mode only if AP is on primary interface */ + if (prim_ifp == ifp) + { + data = (uint32_t *)whd_cdc_get_ioctl_buffer(whd_driver, &buffer, (uint16_t)4); + CHECK_IOCTL_BUFFER(data); + *data = 0; + CHECK_RETURN(whd_cdc_send_ioctl(ifp, CDC_SET, WLC_SET_AP, buffer, 0) ); + } CHECK_RETURN(whd_wifi_deregister_event_handler(ifp, ifp->event_reg_list[WHD_AP_EVENT_ENTRY]) ); ifp->event_reg_list[WHD_AP_EVENT_ENTRY] = WHD_EVENT_NOT_REGISTERED; diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_WHD/resources/firmware/TARGET_43438/resources.h b/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_WHD/resources/firmware/TARGET_43438/resources.h deleted file mode 100644 index 2f6e626b332..00000000000 --- a/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_WHD/resources/firmware/TARGET_43438/resources.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2019, Cypress Semiconductor Corporation, All Rights Reserved - * SPDX-License-Identifier: LicenseRef-PBL - * - * This file and the related binary are licensed under the - * Permissive Binary License, Version 1.0 (the "License"); - * you may not use these files except in compliance with the License. - * - * You may obtain a copy of the License here: - * LICENSE-permissive-binary-license-1.0.txt and at - * https://www.mbed.com/licenses/PBL-1.0 - * - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* Automatically generated file - this comment ensures resources.h file creation */ -/* Auto-generated header file. Do not edit */ -#ifndef INCLUDED_RESOURCES_H_ -#define INCLUDED_RESOURCES_H_ -#include "wiced_resource.h" - -extern const resource_hnd_t wifi_firmware_image; -extern const resource_hnd_t wifi_firmware_clm_blob; -extern const unsigned char wifi_firmware_image_data[420690]; -extern const unsigned char wifi_firmware_clm_blob_image_data[7222]; - -#endif /* ifndef INCLUDED_RESOURCES_H_ */ - diff --git a/targets/TARGET_NUVOTON/TARGET_NANO100/device/TOOLCHAIN_IAR/NANO130.icf b/targets/TARGET_NUVOTON/TARGET_NANO100/device/TOOLCHAIN_IAR/NANO130.icf index ea871f3a96c..e87a2a7851a 100644 --- a/targets/TARGET_NUVOTON/TARGET_NANO100/device/TOOLCHAIN_IAR/NANO130.icf +++ b/targets/TARGET_NUVOTON/TARGET_NANO100/device/TOOLCHAIN_IAR/NANO130.icf @@ -11,7 +11,7 @@ define symbol __ICFEDIT_region_IRAM_start__ = 0x20000000; define symbol __ICFEDIT_region_IRAM_end__ = 0x20004000 - 1; /*-Sizes-*/ define symbol __ICFEDIT_size_cstack__ = MBED_BOOT_STACK_SIZE; -define symbol __ICFEDIT_size_heap__ = 0xC00; +define symbol __ICFEDIT_size_heap__ = 0xB00; /**** End of ICF editor section. ###ICF###*/ @@ -24,7 +24,7 @@ define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; -initialize by copy { readwrite }; +initialize by copy with packing = none { readwrite }; do not initialize { section .noinit }; place at address mem:__ICFEDIT_intvec_start__ { block ROMVEC }; diff --git a/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC/serial_api.c b/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC/serial_api.c index c0a811ad79d..fe570da53ce 100644 --- a/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC/serial_api.c +++ b/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC/serial_api.c @@ -424,8 +424,10 @@ static void _serial_set_flow_control_direct(serial_t *obj, FlowControl type, con case FlowControlCTS: /* Do not use RTS, configure pin to GPIO input */ - gpio_init(&gpio, pinmap->rx_flow_pin); - gpio_dir(&gpio, PIN_INPUT); + if (pinmap->rx_flow_pin != NC) { + gpio_init(&gpio, pinmap->rx_flow_pin); + gpio_dir(&gpio, PIN_INPUT); + } pin_function(pinmap->tx_flow_pin, pinmap->tx_flow_function); pin_mode(pinmap->tx_flow_pin, PullNone); @@ -442,8 +444,10 @@ static void _serial_set_flow_control_direct(serial_t *obj, FlowControl type, con case FlowControlNone: /* Do not use RTS, configure pin to GPIO input */ - gpio_init(&gpio, pinmap->rx_flow_pin); - gpio_dir(&gpio, PIN_INPUT); + if (pinmap->rx_flow_pin != NC) { + gpio_init(&gpio, pinmap->rx_flow_pin); + gpio_dir(&gpio, PIN_INPUT); + } uart_addrs[obj->index]->CFG &= ~USART_CFG_CTSEN_MASK; break; diff --git a/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/crypto_access_control.bin b/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/crypto_access_control.bin index ea4e352701a..3edb621f15a 100644 Binary files a/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/crypto_access_control.bin and b/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/crypto_access_control.bin differ diff --git a/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/spm_client.bin b/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/spm_client.bin index 28fed81a9a1..cf2cc7c7d29 100644 Binary files a/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/spm_client.bin and b/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/spm_client.bin differ diff --git a/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/spm_server.bin b/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/spm_server.bin index a0aeb0b5932..2d16387b347 100644 Binary files a/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/spm_server.bin and b/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/spm_server.bin differ diff --git a/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/spm_smoke.bin b/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/spm_smoke.bin index f32857fff24..3072e059eeb 100644 Binary files a/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/spm_smoke.bin and b/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/spm_smoke.bin differ diff --git a/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/tfm.bin b/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/tfm.bin index 5dfdcb7f546..49029f59c78 100644 Binary files a/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/tfm.bin and b/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/tfm.bin differ diff --git a/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_MODULE_UBLOX_ODIN_W2/sdk/TOOLCHAIN_ARM/libublox-odin-w2-driver.ar b/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_MODULE_UBLOX_ODIN_W2/sdk/TOOLCHAIN_ARM/libublox-odin-w2-driver.ar index b60db717886..8390fe50e39 100644 Binary files a/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_MODULE_UBLOX_ODIN_W2/sdk/TOOLCHAIN_ARM/libublox-odin-w2-driver.ar and b/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_MODULE_UBLOX_ODIN_W2/sdk/TOOLCHAIN_ARM/libublox-odin-w2-driver.ar differ diff --git a/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_MODULE_UBLOX_ODIN_W2/sdk/TOOLCHAIN_GCC_ARM/libublox-odin-w2-driver.a b/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_MODULE_UBLOX_ODIN_W2/sdk/TOOLCHAIN_GCC_ARM/libublox-odin-w2-driver.a index b2e4128a9e7..7923dfc2d6e 100644 Binary files a/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_MODULE_UBLOX_ODIN_W2/sdk/TOOLCHAIN_GCC_ARM/libublox-odin-w2-driver.a and b/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_MODULE_UBLOX_ODIN_W2/sdk/TOOLCHAIN_GCC_ARM/libublox-odin-w2-driver.a differ diff --git a/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_MODULE_UBLOX_ODIN_W2/sdk/TOOLCHAIN_IAR/libublox-odin-w2-driver.a b/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_MODULE_UBLOX_ODIN_W2/sdk/TOOLCHAIN_IAR/libublox-odin-w2-driver.a index dfa52355581..a7e547190d6 100644 Binary files a/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_MODULE_UBLOX_ODIN_W2/sdk/TOOLCHAIN_IAR/libublox-odin-w2-driver.a and b/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_MODULE_UBLOX_ODIN_W2/sdk/TOOLCHAIN_IAR/libublox-odin-w2-driver.a differ diff --git a/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_MODULE_UBLOX_ODIN_W2/sdk/ublox-odin-w2-drivers/OdinWiFiInterface.cpp b/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_MODULE_UBLOX_ODIN_W2/sdk/ublox-odin-w2-drivers/OdinWiFiInterface.cpp index 4ebdd6683a9..81bd32a7b8f 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_MODULE_UBLOX_ODIN_W2/sdk/ublox-odin-w2-drivers/OdinWiFiInterface.cpp +++ b/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_MODULE_UBLOX_ODIN_W2/sdk/ublox-odin-w2-drivers/OdinWiFiInterface.cpp @@ -158,15 +158,15 @@ struct wlan_callb_s { bool OdinWiFiInterface::_wlan_initialized = false; int32_t OdinWiFiInterface::_target_id = cbMAIN_TARGET_INVALID_ID; -OdinWiFiInterface::OdinWiFiInterface(OdinWiFiEMAC &emac , OnboardNetworkStack &stack) : - EMACInterface(emac, stack), +OdinWiFiInterface::OdinWiFiInterface(OdinWiFiEMAC &emac_obj, OnboardNetworkStack &stack) : + EMACInterface(emac_obj, stack), _thread(osPriorityNormal, 4096) { init(false); } -OdinWiFiInterface::OdinWiFiInterface(bool debug, OdinWiFiEMAC &emac, OnboardNetworkStack &stack) : - EMACInterface(emac, stack), +OdinWiFiInterface::OdinWiFiInterface(bool debug, OdinWiFiEMAC &emac_obj, OnboardNetworkStack &stack) : + EMACInterface(emac_obj, stack), _thread(osPriorityNormal, 4096) { init(debug); @@ -386,7 +386,7 @@ nsapi_error_t OdinWiFiInterface::connect( return NSAPI_ERROR_PARAMETER; } - if((security == NSAPI_SECURITY_EAP_TLS) && (cert_handle->client_cert == NULL)) { + if((security == NSAPI_SECURITY_EAP_TLS) && (cert_handle->client_cert == NULL || cert_handle->client_prvt_key == NULL)) { return NSAPI_ERROR_PARAMETER; } @@ -757,7 +757,7 @@ OdinWiFiInterface::OdinWifiState OdinWiFiInterface::entry_connect_fail_wait_disc cbRTSL_Status error_code; cbMAIN_driverLock(); - error_code = cbWLAN_disconnect(handle); + error_code = cbWLAN_disconnect(_wlan_status_connected_info.handle); cbMAIN_driverUnlock(); MBED_ASSERT(error_code == cbSTATUS_OK); @@ -778,7 +778,7 @@ OdinWiFiInterface::OdinWifiState OdinWiFiInterface::entry_wait_disconnect() cbRTSL_Status error_code; cbMAIN_driverLock(); - error_code = cbWLAN_disconnect(handle); + error_code = cbWLAN_disconnect(_wlan_status_disconnected_info.handle); cbMAIN_driverUnlock(); MBED_ASSERT(error_code == cbSTATUS_OK); @@ -802,7 +802,7 @@ OdinWiFiInterface::OdinWifiState OdinWiFiInterface::entry_ap_started() OdinWiFiInterface::OdinWifiState OdinWiFiInterface::entry_ap_wait_stop() { cbMAIN_driverLock(); - cbRTSL_Status status = cbWLAN_apStop(handle); + cbRTSL_Status status = cbWLAN_apStop(_ap.handle); cbMAIN_driverUnlock(); MBED_ASSERT(status == cbSTATUS_OK); @@ -813,7 +813,7 @@ OdinWiFiInterface::OdinWifiState OdinWiFiInterface::entry_ap_wait_stop() OdinWiFiInterface::OdinWifiState OdinWiFiInterface::entry_ap_fail_wait_stop() { cbMAIN_driverLock(); - cbRTSL_Status status = cbWLAN_apStop(handle); + cbRTSL_Status status = cbWLAN_apStop(_ap.handle); cbMAIN_driverUnlock(); MBED_ASSERT(status == cbSTATUS_OK); @@ -917,7 +917,9 @@ void OdinWiFiInterface::handle_in_msg(void) break; case cbWLAN_STATUS_CONNECTED: + flush_drvr_ind_pkts = true; handle_wlan_status_connected(&(msg->data.wlan_status_connected)); + flush_drvr_ind_pkts = false; break; case cbWLAN_SCAN_INDICATION: @@ -1024,11 +1026,6 @@ void OdinWiFiInterface::handle_user_connect(user_connect_s *user_connect) } if(error_code == NSAPI_ERROR_OK) { - memset(&_wlan_status_connected_info, 0, sizeof(cbWLAN_StatusConnectedInfo)); - memset(&_wlan_status_disconnected_info, 0, sizeof(cbWLAN_StatusDisconnectedInfo)); - _wlan_status_disconnected_info.handle = cbWLAN_DEFAULT_HANDLE; - _wlan_status_connected_info.handle = cbWLAN_DEFAULT_HANDLE; - _state_sta = entry_wait_connect(); } else @@ -1045,6 +1042,7 @@ void OdinWiFiInterface::handle_user_disconnect(void) switch(_state_sta) { case S_STA_CONNECTED: case S_STA_DISCONNECTED_WAIT_CONNECT: + emac.set_wifi_emac_handle(_wlan_status_disconnected_info.handle); _state_sta = entry_wait_disconnect(); break; @@ -1123,6 +1121,7 @@ void OdinWiFiInterface::handle_user_connect_timeout() } _timer.stop(); + emac.set_wifi_emac_handle(_wlan_status_connected_info.handle); _state_sta = entry_connect_fail_wait_disconnect(); } } @@ -1314,9 +1313,10 @@ void OdinWiFiInterface::handle_wlan_status_connected(wlan_status_connected_s *wl _gateway[0] ? _gateway : 0, DEFAULT_STACK); + memcpy(&_wlan_status_connected_info, &(wlan_connect->info), sizeof(cbWLAN_StatusConnectedInfo)); + emac.set_wifi_emac_handle(_wlan_status_connected_info.handle); if (error_code == NSAPI_ERROR_OK || error_code == NSAPI_ERROR_IS_CONNECTED) { - memcpy(&_wlan_status_connected_info, &(wlan_connect->info), sizeof(cbWLAN_StatusConnectedInfo)); if(_state_sta != S_STA_CONNECTED){ _state_sta = S_STA_CONNECTED; send_user_response_msg(ODIN_WIFI_MSG_USER_CONNECT, NSAPI_ERROR_OK); @@ -1351,6 +1351,7 @@ void OdinWiFiInterface::handle_wlan_status_connection_failure(wlan_status_connec } memcpy(&_wlan_status_disconnected_info, &(connect_failure->info), sizeof(cbWLAN_StatusDisconnectedInfo)); + emac.set_wifi_emac_handle(_wlan_status_disconnected_info.handle); switch(_state_sta) { case S_STA_WAIT_CONNECT: @@ -1383,7 +1384,7 @@ void OdinWiFiInterface::handle_wlan_status_connection_failure(wlan_status_connec void OdinWiFiInterface::handle_wlan_status_disconnected(void) { - nsapi_error_t error_code; + nsapi_error_t error_code = NSAPI_ERROR_OK; if(_debug) { printf("WLAN STATUS DISCONNECTED\r\n"); @@ -1404,24 +1405,19 @@ void OdinWiFiInterface::handle_wlan_status_disconnected(void) case S_STA_CONNECTION_FAIL_WAIT_DISCONNECT: _state_sta = S_STA_IDLE; - if(_wlan_status_disconnected_info.handle == cbWLAN_DEFAULT_HANDLE){ - switch(_wlan_status_disconnected_info.reason) { - error_code = NSAPI_ERROR_NO_SSID; - break; - - case cbWLAN_STATUS_DISCONNECTED_AUTH_FAILURE: - case cbWLAN_STATUS_DISCONNECTED_ASSOC_FAILURE: - case cbWLAN_STATUS_DISCONNECTED_MIC_FAILURE: - error_code = NSAPI_ERROR_AUTH_FAILURE; - break; - case cbWLAN_STATUS_DISCONNECTED_NO_BSSID_FOUND: - case cbWLAN_STATUS_DISCONNECTED_UNKNOWN: - error_code = NSAPI_ERROR_NO_CONNECTION; - break; - default: - error_code = NSAPI_ERROR_DEVICE_ERROR; - break; - } + switch(_wlan_status_disconnected_info.reason) { + case cbWLAN_STATUS_DISCONNECTED_AUTH_FAILURE: + case cbWLAN_STATUS_DISCONNECTED_ASSOC_FAILURE: + case cbWLAN_STATUS_DISCONNECTED_MIC_FAILURE: + error_code = NSAPI_ERROR_AUTH_FAILURE; + break; + case cbWLAN_STATUS_DISCONNECTED_NO_BSSID_FOUND: + case cbWLAN_STATUS_DISCONNECTED_UNKNOWN: + error_code = NSAPI_ERROR_NO_CONNECTION; + break; + default: + error_code = NSAPI_ERROR_DEVICE_ERROR; + break; } send_user_response_msg(ODIN_WIFI_MSG_USER_CONNECT, error_code); break; @@ -1564,6 +1560,9 @@ void OdinWiFiInterface::init(bool debug = false) memset(_mac_addr_str, 0, ODIN_WIFI_MAX_MAC_ADDR_STR); memset(&_wlan_status_connected_info, 0, sizeof(cbWLAN_StatusConnectedInfo)); memset(&_wlan_status_disconnected_info, 0, sizeof(cbWLAN_StatusDisconnectedInfo)); + _wlan_status_connected_info.handle = cbWLAN_DEFAULT_HANDLE; + _wlan_status_disconnected_info.handle = cbWLAN_DEFAULT_HANDLE; + _ap.handle = cbWLAN_DEFAULT_HANDLE; _msg_pool = new MemoryPool(); @@ -1655,6 +1654,7 @@ nsapi_error_t OdinWiFiInterface::wlan_connect( cbRTSL_Status status = cbSTATUS_OK; cbWLAN_CommonConnectParameters connect_params; cbWLAN_EnterpriseConnectParameters enterpriseParams; + static cbWLAN_Handle handle = cbWLAN_DEFAULT_HANDLE; memset(&enterpriseParams, 0, sizeof(cbWLAN_EnterpriseConnectParameters)); memset(&connect_params, 0, sizeof(cbWLAN_CommonConnectParameters)); @@ -1739,6 +1739,8 @@ nsapi_error_t OdinWiFiInterface::wlan_ap_start( cbWLAN_CommonApParameters params; cbWLAN_WPAPSKApParameters wpa_params; + static cbWLAN_Handle handle = cbWLAN_DEFAULT_HANDLE; + char temp_passphrase[cbWLAN_MAX_PASSPHRASE_LENGTH]; memset(¶ms, 0, sizeof(cbWLAN_CommonApParameters)); @@ -1793,7 +1795,7 @@ nsapi_error_t OdinWiFiInterface::wlan_ap_start( error_code = NSAPI_ERROR_UNSUPPORTED; } } - + _ap.handle = handle; return error_code; } @@ -1832,14 +1834,16 @@ void OdinWiFiInterface::wlan_scan_indication(cbWLAN_ScanIndicationInfo *scan_inf void OdinWiFiInterface::wlan_status_indication(cbWLAN_StatusIndicationInfo status, void *data) { - struct odin_wifi_msg_s* msg = _msg_pool->alloc(); - MBED_ASSERT(msg != NULL); + if (!flush_drvr_ind_pkts) { + struct odin_wifi_msg_s* msg = _msg_pool->alloc(); + MBED_ASSERT(msg != NULL); - msg->type = status; - memcpy(&(msg->data), data, sizeof(odin_wifi_msg_s::data_t)); + msg->type = status; + memcpy(&(msg->data), data, sizeof(odin_wifi_msg_s::data_t)); - osStatus ok = _in_queue.put(msg, 0); - MBED_ASSERT(ok == osOK); + osStatus ok = _in_queue.put(msg, 0); + MBED_ASSERT(ok == osOK); + } } static nsapi_security_t convertToNSAPI_security(cbWLAN_AuthenticationSuite authSuit) diff --git a/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_MODULE_UBLOX_ODIN_W2/sdk/ublox-odin-w2-drivers/OdinWiFiInterface.h b/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_MODULE_UBLOX_ODIN_W2/sdk/ublox-odin-w2-drivers/OdinWiFiInterface.h index 8a0c1d3bd7a..f747134fdde 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_MODULE_UBLOX_ODIN_W2/sdk/ublox-odin-w2-drivers/OdinWiFiInterface.h +++ b/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_MODULE_UBLOX_ODIN_W2/sdk/ublox-odin-w2-drivers/OdinWiFiInterface.h @@ -65,9 +65,9 @@ class OdinWiFiInterface : public WiFiInterface, public EMACInterface public: /** OdinWiFiInterface lifetime */ - OdinWiFiInterface(OdinWiFiEMAC &emac = OdinWiFiEMAC::get_instance(), OnboardNetworkStack &stack = OnboardNetworkStack::get_default_instance()); + OdinWiFiInterface(OdinWiFiEMAC &emac_obj = OdinWiFiEMAC::get_instance(), OnboardNetworkStack &stack = OnboardNetworkStack::get_default_instance()); - OdinWiFiInterface(bool debug, OdinWiFiEMAC &emac = OdinWiFiEMAC::get_instance(), OnboardNetworkStack &stack = OnboardNetworkStack::get_default_instance()); + OdinWiFiInterface(bool debug, OdinWiFiEMAC &emac_obj = OdinWiFiEMAC::get_instance(), OnboardNetworkStack &stack = OnboardNetworkStack::get_default_instance()); ~OdinWiFiInterface(); @@ -340,6 +340,8 @@ class OdinWiFiInterface : public WiFiInterface, public EMACInterface nsapi_error_t error_code; uint16_t beacon_interval; + + cbWLAN_Handle handle; }; struct scan_cache_s { @@ -348,7 +350,6 @@ class OdinWiFiInterface : public WiFiInterface, public EMACInterface cbWLAN_MACAddress bssid[ODIN_WIFI_SCAN_CACHE_SIZE]; }; - cbWLAN_Handle handle = cbWLAN_INVALID_HANDLE; OdinWifiState entry_connect_fail_wait_disconnect(); OdinWifiState entry_wait_connect(); OdinWifiState entry_wait_disconnect(); @@ -442,6 +443,11 @@ class OdinWiFiInterface : public WiFiInterface, public EMACInterface bool _debug; int _dbg_timeout; + + OdinWiFiEMAC &emac = OdinWiFiEMAC::get_instance(); + + // This flag is added to flush the packets that were coming in between while the status was connected hence causing message pool overflow + bool flush_drvr_ind_pkts = false; }; #endif diff --git a/targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F746xG/device/TOOLCHAIN_IAR/stm32f746xg.icf b/targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F746xG/device/TOOLCHAIN_IAR/stm32f746xg.icf index e7292de12d1..75f36e19946 100644 --- a/targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F746xG/device/TOOLCHAIN_IAR/stm32f746xg.icf +++ b/targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F746xG/device/TOOLCHAIN_IAR/stm32f746xg.icf @@ -26,7 +26,7 @@ ITCM-RAM: 16K (0x3FFF) @0x00000000 if (!isdefinedsymbol(MBED_ROM_START)) { define symbol MBED_ROM_START = 0x8000000; } if (!isdefinedsymbol(MBED_ROM_SIZE)) { define symbol MBED_ROM_SIZE = 0x200000; } if (!isdefinedsymbol(MBED_RAM_START)) { define symbol MBED_RAM_START = 0x20010000; } -if (!isdefinedsymbol(MBED_RAM_START)) { define symbol MBED_RAM_SIZE = 0x40000; } +if (!isdefinedsymbol(MBED_RAM_SIZE)) { define symbol MBED_RAM_SIZE = 0x40000; } if (!isdefinedsymbol(MBED_RAM1_START)) { define symbol MBED_RAM1_START = 0x20000000; } if (!isdefinedsymbol(MBED_RAM1_SIZE)) { define symbol MBED_RAM1_SIZE = 0x10000; } diff --git a/targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F756xG/device/TOOLCHAIN_IAR/stm32f756xg.icf b/targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F756xG/device/TOOLCHAIN_IAR/stm32f756xg.icf index 57d4931f203..da7d15e558f 100644 --- a/targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F756xG/device/TOOLCHAIN_IAR/stm32f756xg.icf +++ b/targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F756xG/device/TOOLCHAIN_IAR/stm32f756xg.icf @@ -26,7 +26,7 @@ ITCM-RAM: 16K (0x3FFF) @0x00000000 if (!isdefinedsymbol(MBED_ROM_START)) { define symbol MBED_ROM_START = 0x8000000; } if (!isdefinedsymbol(MBED_ROM_SIZE)) { define symbol MBED_ROM_SIZE = 0x200000; } if (!isdefinedsymbol(MBED_RAM_START)) { define symbol MBED_RAM_START = 0x20010000; } -if (!isdefinedsymbol(MBED_RAM_START)) { define symbol MBED_RAM_SIZE = 0x40000; } +if (!isdefinedsymbol(MBED_RAM_SIZE)) { define symbol MBED_RAM_SIZE = 0x40000; } if (!isdefinedsymbol(MBED_RAM1_START)) { define symbol MBED_RAM1_START = 0x20000000; } if (!isdefinedsymbol(MBED_RAM1_SIZE)) { define symbol MBED_RAM1_SIZE = 0x10000; } diff --git a/targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F767xI/device/TOOLCHAIN_IAR/stm32f767xi.icf b/targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F767xI/device/TOOLCHAIN_IAR/stm32f767xi.icf index e313c6f835a..1b000627282 100644 --- a/targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F767xI/device/TOOLCHAIN_IAR/stm32f767xi.icf +++ b/targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F767xI/device/TOOLCHAIN_IAR/stm32f767xi.icf @@ -26,7 +26,7 @@ ITCM-RAM: 16K (0x3FFF) @0x00000000 if (!isdefinedsymbol(MBED_ROM_START)) { define symbol MBED_ROM_START = 0x8000000; } if (!isdefinedsymbol(MBED_ROM_SIZE)) { define symbol MBED_ROM_SIZE = 0x200000; } if (!isdefinedsymbol(MBED_RAM_START)) { define symbol MBED_RAM_START = 0x20020000; } -if (!isdefinedsymbol(MBED_RAM_START)) { define symbol MBED_RAM_SIZE = 0x60000; } +if (!isdefinedsymbol(MBED_RAM_SIZE)) { define symbol MBED_RAM_SIZE = 0x60000; } if (!isdefinedsymbol(MBED_RAM1_START)) { define symbol MBED_RAM1_START = 0x20000000; } if (!isdefinedsymbol(MBED_RAM1_SIZE)) { define symbol MBED_RAM1_SIZE = 0x20000; } diff --git a/targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F769xI/device/TOOLCHAIN_IAR/stm32f769xi.icf b/targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F769xI/device/TOOLCHAIN_IAR/stm32f769xi.icf index 6a7d9b9badf..fae99e64d4a 100644 --- a/targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F769xI/device/TOOLCHAIN_IAR/stm32f769xi.icf +++ b/targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F769xI/device/TOOLCHAIN_IAR/stm32f769xi.icf @@ -26,7 +26,7 @@ ITCM-RAM: 16K (0x3FFF) @0x00000000 if (!isdefinedsymbol(MBED_ROM_START)) { define symbol MBED_ROM_START = 0x8000000; } if (!isdefinedsymbol(MBED_ROM_SIZE)) { define symbol MBED_ROM_SIZE = 0x200000; } if (!isdefinedsymbol(MBED_RAM_START)) { define symbol MBED_RAM_START = 0x20020000; } -if (!isdefinedsymbol(MBED_RAM_START)) { define symbol MBED_RAM_SIZE = 0x60000; } +if (!isdefinedsymbol(MBED_RAM_SIZE)) { define symbol MBED_RAM_SIZE = 0x60000; } if (!isdefinedsymbol(MBED_RAM1_START)) { define symbol MBED_RAM1_START = 0x20000000; } if (!isdefinedsymbol(MBED_RAM1_SIZE)) { define symbol MBED_RAM1_SIZE = 0x20000; } diff --git a/targets/targets.json b/targets/targets.json index b6303af56fe..2674ec17217 100644 --- a/targets/targets.json +++ b/targets/targets.json @@ -5882,7 +5882,7 @@ "device_has_add": ["USBDEVICE", "EMAC", "FLASH", "LPTICKER"], "release_versions": ["2", "5"], "device_name": "R7S72100", - "bootloader_supported": true + "bootloader_supported": false }, "VK_RZ_A1H": { "inherits": ["RZ_A1XX"], @@ -5899,7 +5899,7 @@ "device_has_remove": ["ETHERNET"], "release_versions": ["2", "5"], "device_name": "R7S72103", - "bootloader_supported": true, + "bootloader_supported": false, "overrides": { "network-default-interface-type": null } @@ -6757,7 +6757,8 @@ }, "overrides": { "network-default-interface-type": "MESH" - } + }, + "bootloader_supported": false }, "EFM32PG12B500F1024GL125": { "inherits": ["EFM32"], @@ -8485,7 +8486,7 @@ "MPU" ], "release_versions": ["2", "5"], - "bootloader_supported": true + "bootloader_supported": false }, "NUCLEO_WB55RG": { "inherits": ["FAMILY_STM32"], @@ -8519,7 +8520,7 @@ ], "features": ["BLE"], "release_versions": ["2", "5"], - "bootloader_supported": true + "bootloader_supported": false }, "VBLUNO52": { "supported_form_factors": ["ARDUINO"], @@ -9191,7 +9192,7 @@ "post_binary_hook": { "function": "PSOC6Code.complete" }, - "bootloader_supported": true, + "bootloader_supported": false, "sectors": [[268435456, 512]], "overrides": { "network-default-interface-type": "WIFI" @@ -9204,7 +9205,7 @@ "post_binary_hook": { "function": "PSOC6Code.complete" }, - "bootloader_supported": true, + "bootloader_supported": false, "sectors": [[268435456, 512]] }, "CY8CPROTO_062S3_4343W": { @@ -9236,7 +9237,7 @@ "function": "PSOC6Code.complete" }, "sectors": [[268443648, 512]], - "bootloader_supported": true + "bootloader_supported": false }, "CY8CPROTO_063_BLE": { "inherits": ["MCU_PSOC6_M4"], @@ -9252,7 +9253,7 @@ "function": "PSOC6Code.complete" }, "sectors": [[268443648, 512]], - "bootloader_supported": true + "bootloader_supported": false }, "CY8CPROTO_064_SB": { "inherits": ["MCU_PSOC6_M4"], @@ -9286,7 +9287,7 @@ "post_binary_hook": { "function": "PSOC6Code.complete" }, - "bootloader_supported": true, + "bootloader_supported": false, "sectors": [[268435456, 512]], "overrides": { "network-default-interface-type": "WIFI" @@ -9468,15 +9469,10 @@ "inherits": ["RDA5981X"], "detect_code": ["8001"], "components_add": ["FLASHIAP"], - "bootloader_supported": true, - "mbed_ram_start": "0x00100080", - "mbed_ram_size": "0x1ff80", - "mbed_rom_start": "0x18001000", - "mbed_rom_size": "0x1F4000", - "sectors": [[0,4096]], "overrides": { "network-default-interface-type" : "WIFI" - } + }, + "bootloader_supported": false }, "GD32_Target": { "inherits": ["Target"], diff --git a/tools/toolchains/mbed_toolchain.py b/tools/toolchains/mbed_toolchain.py index 9b5dbdd9db7..bf2718428fe 100755 --- a/tools/toolchains/mbed_toolchain.py +++ b/tools/toolchains/mbed_toolchain.py @@ -894,63 +894,56 @@ def _add_all_regions(self, region_list, active_region_name): def add_regions(self): """Add regions to the build profile, if there are any. """ + + if not getattr(self.target, "bootloader_supported", False): + return + if self.config.has_regions: - try: - regions = list(self.config.regions) - regions.sort(key=lambda x: x.start) - self.notify.info("Using ROM region%s %s in this build." % ( - "s" if len(regions) > 1 else "", - ", ".join(r.name for r in regions) - )) - self._add_all_regions(regions, "MBED_APP") - except ConfigException: - pass + regions = list(self.config.regions) + regions.sort(key=lambda x: x.start) + self.notify.info("Using ROM region%s %s in this build." % ( + "s" if len(regions) > 1 else "", + ", ".join(r.name for r in regions) + )) + self._add_all_regions(regions, "MBED_APP") if self.config.has_ram_regions: - try: - regions = list(self.config.ram_regions) - self.notify.info("Using RAM region%s %s in this build." % ( - "s" if len(regions) > 1 else "", - ", ".join(r.name for r in regions) - )) - self._add_all_regions(regions, None) - except ConfigException: - pass + regions = list(self.config.ram_regions) + self.notify.info("Using RAM region%s %s in this build." % ( + "s" if len(regions) > 1 else "", + ", ".join(r.name for r in regions) + )) + self._add_all_regions(regions, None) Region = namedtuple("Region", "name start size") - try: - # Add all available ROM regions to build profile - if not getattr(self.target, "static_memory_defines", False): - raise ConfigException() - rom_available_regions = self.config.get_all_active_memories( - ROM_ALL_MEMORIES + + # Add all available ROM regions to build profile + if not getattr(self.target, "static_memory_defines", False): + raise ConfigException() + rom_available_regions = self.config.get_all_active_memories( + ROM_ALL_MEMORIES + ) + for key, value in rom_available_regions.items(): + rom_start, rom_size = value + self._add_defines_from_region( + Region("MBED_" + key, rom_start, rom_size), + True, + suffixes=["_START", "_SIZE"] ) - for key, value in rom_available_regions.items(): - rom_start, rom_size = value - self._add_defines_from_region( - Region("MBED_" + key, rom_start, rom_size), - True, - suffixes=["_START", "_SIZE"] - ) - except ConfigException: - pass - try: - # Add all available RAM regions to build profile - if not getattr(self.target, "static_memory_defines", False): - raise ConfigException() - ram_available_regions = self.config.get_all_active_memories( - RAM_ALL_MEMORIES + # Add all available RAM regions to build profile + if not getattr(self.target, "static_memory_defines", False): + raise ConfigException() + ram_available_regions = self.config.get_all_active_memories( + RAM_ALL_MEMORIES + ) + for key, value in ram_available_regions.items(): + ram_start, ram_size = value + self._add_defines_from_region( + Region("MBED_" + key, ram_start, ram_size), + True, + suffixes=["_START", "_SIZE"] ) - for key, value in ram_available_regions.items(): - ram_start, ram_size = value - self._add_defines_from_region( - Region("MBED_" + key, ram_start, ram_size), - True, - suffixes=["_START", "_SIZE"] - ) - except ConfigException: - pass STACK_PARAM = "target.boot-stack-size" TFM_LVL_PARAM = "tfm.level"