From 9e4be5e49449b6eb65fb607459ff178de05ae840 Mon Sep 17 00:00:00 2001 From: Kyle Kearney Date: Mon, 13 Jul 2020 12:56:35 -0700 Subject: [PATCH 01/12] Call HAL free functions from C++ destructors Add missing calls to HAL free to the following drivers - AnalogIn - QSPI - SerialBase --- drivers/AnalogIn.h | 4 +++- drivers/QSPI.h | 3 +++ drivers/source/SerialBase.cpp | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/AnalogIn.h b/drivers/AnalogIn.h index 38c1fc130d..dd5d067a2f 100644 --- a/drivers/AnalogIn.h +++ b/drivers/AnalogIn.h @@ -151,7 +151,9 @@ public: virtual ~AnalogIn() { - // Do nothing + lock(); + analogin_free(&_adc); + unlock(); } protected: diff --git a/drivers/QSPI.h b/drivers/QSPI.h index 1ef8df2396..f98fb45ed5 100644 --- a/drivers/QSPI.h +++ b/drivers/QSPI.h @@ -117,6 +117,9 @@ public: virtual ~QSPI() { + lock(); + qspi_free(&_qspi); + unlock(); } /** Configure the data transmission format diff --git a/drivers/source/SerialBase.cpp b/drivers/source/SerialBase.cpp index b335f695fb..40bf7d0b61 100644 --- a/drivers/source/SerialBase.cpp +++ b/drivers/source/SerialBase.cpp @@ -287,6 +287,10 @@ SerialBase::~SerialBase() for (int irq = 0; irq < IrqCnt; irq++) { attach(nullptr, (IrqType)irq); } + + if (_rx_enabled || _tx_enabled) { + serial_free(&_serial); + } } #if DEVICE_SERIAL_FC From 53a75c83cb0f550c325a12f677ec5ad40b01a3f9 Mon Sep 17 00:00:00 2001 From: Leon Lindenfelser Date: Fri, 24 Jul 2020 14:13:35 -0500 Subject: [PATCH 02/12] Fix MTS_DRAGONFLY_F413RH drag and drop failure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When manually flashing an application binary to the MULTITECH drive, a FAIL.TXT file is produced with the following info: “The application file format is unknown and cannot be parsed and/or processed”. --- targets/targets.json | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/targets/targets.json b/targets/targets.json index 3dfc49a5c0..4667ead2c2 100644 --- a/targets/targets.json +++ b/targets/targets.json @@ -1709,11 +1709,7 @@ "components_add": [ "SPIF" ], - "device_name": "STM32F413RHTx", - "mbed_rom_start": "0x08000000", - "mbed_rom_size": "0x180000", - "mbed_ram_start": "0x200001D8", - "mbed_ram_size": "0x50000" + "device_name": "STM32F413RHTx" }, "DISCO_F413ZH": { "inherits": [ From 76f37fb2bccb510ad697940550235c9aca342533 Mon Sep 17 00:00:00 2001 From: George Psimenos Date: Wed, 24 Jun 2020 08:29:26 +0100 Subject: [PATCH 03/12] Restructure events directory & move tests --- .astyleignore | 1 + .travis.yml | 7 ++--- TESTS/usb_device/basic/USBEndpointTester.cpp | 2 +- TESTS/usb_device/basic/USBEndpointTester.h | 2 +- TESTS/usb_device/basic/USBTester.cpp | 2 +- TESTS/usb_device/basic/USBTester.h | 2 +- UNITTESTS/CMakeLists.txt | 8 +++--- UNITTESTS/events/equeue/unittest.cmake | 27 ------------------- UNITTESTS/stubs/equeue_stub.c | 2 +- .../framework/device/CellularDevice.cpp | 2 +- .../COMPONENT_LAN91C111/fvp_emac.cpp | 2 +- .../COMPONENT_SMSC9220/smsc9220_emac.cpp | 2 +- .../COMPONENT_SCL/interface/scl_emac.cpp | 2 +- .../COMPONENT_WHD/interface/whd_emac.cpp | 2 +- .../TARGET_Freescale_EMAC/kinetis_emac.cpp | 2 +- .../emac/TARGET_GD_EMAC/gd32xx_emac.cpp | 2 +- .../emac/TARGET_NUVOTON_EMAC/numaker_emac.cpp | 2 +- .../TARGET_NXP_EMAC/TARGET_IMX/imx_emac.cpp | 2 +- .../TARGET_MCU_LPC546XX/lpc546xx_emac.cpp | 2 +- .../emac/TARGET_RDA_EMAC/rda5981x_emac.cpp | 2 +- .../emac/TARGET_RZ_A1_EMAC/rza1_emac.cpp | 2 +- .../drivers/emac/TARGET_STM/stm32xx_emac.cpp | 2 +- .../libraries/ppp/source/ppp_service.cpp | 4 +-- .../libraries/ppp/source/ppp_service_if.cpp | 2 +- .../netsocket/source/NetworkStack.cpp | 2 +- connectivity/netsocket/source/nsapi_dns.cpp | 2 +- .../netsocket/IfaceDnsSocket/moduletest.cpp | 2 +- drivers/USBCDC_ECM.h | 2 +- events/{ => include/events}/Event.h | 0 events/{ => include/events}/EventQueue.h | 0 .../{ => include/events}/UserAllocatedEvent.h | 0 events/{ => include/events}/equeue.h | 0 .../events}/internal/equeue_platform.h | 0 events/{ => include/events}/mbed_events.h | 0 .../{ => include/events}/mbed_shared_queues.h | 0 events/source/.mbedignore | 1 - events/tests/.mbedignore | 2 ++ .../tests/TESTS}/events/equeue/main.cpp | 2 +- .../tests/TESTS}/events/queue/main.cpp | 0 .../tests/TESTS}/events/timing/main.cpp | 0 .../tests/UNITTESTS}/equeue/test_equeue.cpp | 2 +- events/tests/UNITTESTS/equeue/unittest.cmake | 27 +++++++++++++++++++ .../tests/UNITTESTS}/stubs/EqueuePosix_stub.c | 0 .../target_h}/equeue/equeue_platform.h | 0 .../tests/UNITTESTS/target_h}/mbed_events.h | 0 events/{source => tests/unit}/Makefile | 16 +++++------ events/{source/tests => tests/unit}/prof.c | 0 events/{source/tests => tests/unit}/tests.c | 0 .../arm_hal_fhss_timer.cpp | 4 +-- .../ns_event_loop_mbed.cpp | 2 +- 50 files changed, 76 insertions(+), 73 deletions(-) delete mode 100644 UNITTESTS/events/equeue/unittest.cmake rename events/{ => include/events}/Event.h (100%) rename events/{ => include/events}/EventQueue.h (100%) rename events/{ => include/events}/UserAllocatedEvent.h (100%) rename events/{ => include/events}/equeue.h (100%) rename events/{ => include/events}/internal/equeue_platform.h (100%) rename events/{ => include/events}/mbed_events.h (100%) rename events/{ => include/events}/mbed_shared_queues.h (100%) delete mode 100644 events/source/.mbedignore create mode 100644 events/tests/.mbedignore rename {TESTS => events/tests/TESTS}/events/equeue/main.cpp (99%) rename {TESTS => events/tests/TESTS}/events/queue/main.cpp (100%) rename {TESTS => events/tests/TESTS}/events/timing/main.cpp (100%) rename {UNITTESTS/events => events/tests/UNITTESTS}/equeue/test_equeue.cpp (99%) create mode 100644 events/tests/UNITTESTS/equeue/unittest.cmake rename {UNITTESTS => events/tests/UNITTESTS}/stubs/EqueuePosix_stub.c (100%) rename {UNITTESTS/target_h/events => events/tests/UNITTESTS/target_h}/equeue/equeue_platform.h (100%) rename {UNITTESTS/target_h/events => events/tests/UNITTESTS/target_h}/mbed_events.h (100%) rename events/{source => tests/unit}/Makefile (69%) rename events/{source/tests => tests/unit}/prof.c (100%) rename events/{source/tests => tests/unit}/tests.c (100%) diff --git a/.astyleignore b/.astyleignore index 9fdbee232b..589f5d9752 100644 --- a/.astyleignore +++ b/.astyleignore @@ -19,6 +19,7 @@ ^features/unsupported/ ^hal/storage_abstraction ^platform/cxxsupport +^events/tests/UNITTESTS ^rtos/source/TARGET_CORTEX/rtx4 ^rtos/source/TARGET_CORTEX/rtx5 ^targets diff --git a/.travis.yml b/.travis.yml index e1e6995baf..2b0963e01d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -100,7 +100,8 @@ matrix: - | ! git grep '^#include\s["'"']mbed.h['"'"]$' -- '*.c' '*.h' '*.cpp' '*.hpp' \ ':!*platform_mbed.h' ':!*TESTS/*' ':!TEST_APPS/' ':!UNITTESTS/' \ - ':!*tests/*' ':!*targets/*' ':!*TARGET_*' ':!*unsupported/*' + ':!*tests/*' ':!*targets/*' ':!*TARGET_*' ':!*unsupported/*' \ + ':!*events/tests/*' ### Docs Tests ### @@ -253,9 +254,9 @@ matrix: features/frameworks/utest features/frameworks/unity components BUILD - python tools/make.py -t GCC_ARM -m NUCLEO_F103RB --source=. --build=BUILD/NUCLEO_F103RB/GCC_ARM -j0 # Run local equeue tests - - make -C ${EVENTS}/source test + - make -C ${EVENTS}/test/unit test # Run profiling tests - - make -C ${EVENTS}/source prof | tee prof + - make -C ${EVENTS}/test/unit prof | tee prof after_success: # Update status, comparing with master if possible. - | diff --git a/TESTS/usb_device/basic/USBEndpointTester.cpp b/TESTS/usb_device/basic/USBEndpointTester.cpp index c26bbbbb77..4b48e94bd6 100644 --- a/TESTS/usb_device/basic/USBEndpointTester.cpp +++ b/TESTS/usb_device/basic/USBEndpointTester.cpp @@ -20,7 +20,7 @@ #include "stdint.h" #include "stdlib.h" #include "USBEndpointTester.h" -#include "mbed_shared_queues.h" +#include "events/mbed_shared_queues.h" #include "EndpointResolver.h" #define DEFAULT_CONFIGURATION (1) diff --git a/TESTS/usb_device/basic/USBEndpointTester.h b/TESTS/usb_device/basic/USBEndpointTester.h index a1d02ea185..cf649dd4da 100644 --- a/TESTS/usb_device/basic/USBEndpointTester.h +++ b/TESTS/usb_device/basic/USBEndpointTester.h @@ -21,7 +21,7 @@ /* These headers are included for child class. */ #include "USBDescriptor.h" #include "USBDevice_Types.h" -#include "EventQueue.h" +#include "events/EventQueue.h" #include "EventFlags.h" #include "platform/NonCopyable.h" diff --git a/TESTS/usb_device/basic/USBTester.cpp b/TESTS/usb_device/basic/USBTester.cpp index 004d03ca8c..743f217225 100644 --- a/TESTS/usb_device/basic/USBTester.cpp +++ b/TESTS/usb_device/basic/USBTester.cpp @@ -19,7 +19,7 @@ #include "stdint.h" #include "USBTester.h" -#include "mbed_shared_queues.h" +#include "events/mbed_shared_queues.h" #include "EndpointResolver.h" #define DEFAULT_CONFIGURATION (1) diff --git a/TESTS/usb_device/basic/USBTester.h b/TESTS/usb_device/basic/USBTester.h index afe1dfa92e..d131ab39c3 100644 --- a/TESTS/usb_device/basic/USBTester.h +++ b/TESTS/usb_device/basic/USBTester.h @@ -21,7 +21,7 @@ /* These headers are included for child class. */ #include "USBDescriptor.h" #include "USBDevice_Types.h" -#include "EventQueue.h" +#include "events/EventQueue.h" #include "EventFlags.h" #include "platform/NonCopyable.h" diff --git a/UNITTESTS/CMakeLists.txt b/UNITTESTS/CMakeLists.txt index 39a3e181b2..6f9dbd2844 100644 --- a/UNITTESTS/CMakeLists.txt +++ b/UNITTESTS/CMakeLists.txt @@ -103,8 +103,8 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUNITTEST") # Set include dirs. set(unittest-includes-base "${PROJECT_SOURCE_DIR}/target_h" - "${PROJECT_SOURCE_DIR}/target_h/events" - "${PROJECT_SOURCE_DIR}/target_h/events/equeue" + "${PROJECT_SOURCE_DIR}/../events/tests/UNITTESTS/target_h" + "${PROJECT_SOURCE_DIR}/../events/tests/UNITTESTS/target_h/equeue" "${PROJECT_SOURCE_DIR}/target_h/platform" "${PROJECT_SOURCE_DIR}/target_h/platform/cxxsupport" "${PROJECT_SOURCE_DIR}/target_h/drivers" @@ -122,9 +122,9 @@ set(unittest-includes-base "${PROJECT_SOURCE_DIR}/../storage/kvstore/kv_config/include" "${PROJECT_SOURCE_DIR}/../drivers" "${PROJECT_SOURCE_DIR}/../hal" - "${PROJECT_SOURCE_DIR}/../events" + "${PROJECT_SOURCE_DIR}/../events/include" + "${PROJECT_SOURCE_DIR}/../events/include/events/internal" "${PROJECT_SOURCE_DIR}/../events/source" - "${PROJECT_SOURCE_DIR}/../events/internal" "${PROJECT_SOURCE_DIR}/../rtos/include" "${PROJECT_SOURCE_DIR}/../features/frameworks" "${PROJECT_SOURCE_DIR}/../features/frameworks/mbed-trace" diff --git a/UNITTESTS/events/equeue/unittest.cmake b/UNITTESTS/events/equeue/unittest.cmake deleted file mode 100644 index b685b9108c..0000000000 --- a/UNITTESTS/events/equeue/unittest.cmake +++ /dev/null @@ -1,27 +0,0 @@ - -#################### -# UNIT TESTS -#################### - -list(REMOVE_ITEM unittest-includes ${PROJECT_SOURCE_DIR}/target_h/events ${PROJECT_SOURCE_DIR}/target_h/events/equeue) - -set(unittest-includes ${unittest-includes} - ../events/source - ../events - ../events/internal -) - -set(unittest-sources - ../events/source/equeue.c -) - -set(unittest-test-sources - events/equeue/test_equeue.cpp - stubs/EqueuePosix_stub.c -) - -set(unittest-test-flags - -pthread - -DEQUEUE_PLATFORM_POSIX -) - diff --git a/UNITTESTS/stubs/equeue_stub.c b/UNITTESTS/stubs/equeue_stub.c index 8ae5ab484d..125e57ce1e 100644 --- a/UNITTESTS/stubs/equeue_stub.c +++ b/UNITTESTS/stubs/equeue_stub.c @@ -15,7 +15,7 @@ * limitations under the License. */ -#include "equeue.h" +#include "events/equeue.h" #include #include "equeue_stub.h" diff --git a/connectivity/cellular/source/framework/device/CellularDevice.cpp b/connectivity/cellular/source/framework/device/CellularDevice.cpp index 266822c262..50d900e14a 100644 --- a/connectivity/cellular/source/framework/device/CellularDevice.cpp +++ b/connectivity/cellular/source/framework/device/CellularDevice.cpp @@ -20,7 +20,7 @@ #include "CellularUtil.h" #include "CellularLog.h" #include "events/EventQueue.h" -#include "mbed_shared_queues.h" +#include "events/mbed_shared_queues.h" namespace mbed { diff --git a/connectivity/drivers/emac/TARGET_ARM_FM/COMPONENT_LAN91C111/fvp_emac.cpp b/connectivity/drivers/emac/TARGET_ARM_FM/COMPONENT_LAN91C111/fvp_emac.cpp index 95ec2bf34f..c5a6378244 100644 --- a/connectivity/drivers/emac/TARGET_ARM_FM/COMPONENT_LAN91C111/fvp_emac.cpp +++ b/connectivity/drivers/emac/TARGET_ARM_FM/COMPONENT_LAN91C111/fvp_emac.cpp @@ -24,7 +24,7 @@ #include "mbed_interface.h" #include "mbed_assert.h" #include "netsocket/nsapi_types.h" -#include "mbed_shared_queues.h" +#include "events/mbed_shared_queues.h" using namespace std::chrono; diff --git a/connectivity/drivers/emac/TARGET_ARM_SSG/COMPONENT_SMSC9220/smsc9220_emac.cpp b/connectivity/drivers/emac/TARGET_ARM_SSG/COMPONENT_SMSC9220/smsc9220_emac.cpp index ca97bc6a8d..126fb4f904 100644 --- a/connectivity/drivers/emac/TARGET_ARM_SSG/COMPONENT_SMSC9220/smsc9220_emac.cpp +++ b/connectivity/drivers/emac/TARGET_ARM_SSG/COMPONENT_SMSC9220/smsc9220_emac.cpp @@ -23,7 +23,7 @@ #include "mbed_wait_api.h" #include "mbed_assert.h" #include "netsocket/nsapi_types.h" -#include "mbed_shared_queues.h" +#include "events/mbed_shared_queues.h" #include "smsc9220_emac.h" #include "smsc9220_eth_drv.h" diff --git a/connectivity/drivers/emac/TARGET_Cypress/COMPONENT_SCL/interface/scl_emac.cpp b/connectivity/drivers/emac/TARGET_Cypress/COMPONENT_SCL/interface/scl_emac.cpp index 24c340821d..9515016a75 100644 --- a/connectivity/drivers/emac/TARGET_Cypress/COMPONENT_SCL/interface/scl_emac.cpp +++ b/connectivity/drivers/emac/TARGET_Cypress/COMPONENT_SCL/interface/scl_emac.cpp @@ -24,7 +24,7 @@ #include "scl_emac.h" #include "lwip/etharp.h" #include "lwip/ethip6.h" -#include "mbed_shared_queues.h" +#include "events/mbed_shared_queues.h" #include "scl_buffer_api.h" #include "cy_result.h" #include "cy_pdl.h" diff --git a/connectivity/drivers/emac/TARGET_Cypress/COMPONENT_WHD/interface/whd_emac.cpp b/connectivity/drivers/emac/TARGET_Cypress/COMPONENT_WHD/interface/whd_emac.cpp index 138bd8b79e..63b67bdea3 100644 --- a/connectivity/drivers/emac/TARGET_Cypress/COMPONENT_WHD/interface/whd_emac.cpp +++ b/connectivity/drivers/emac/TARGET_Cypress/COMPONENT_WHD/interface/whd_emac.cpp @@ -24,7 +24,7 @@ #include "whd_emac.h" #include "lwip/etharp.h" #include "lwip/ethip6.h" -#include "mbed_shared_queues.h" +#include "events/mbed_shared_queues.h" #include "whd_wlioctl.h" #include "whd_buffer_api.h" #include "cybsp_wifi.h" diff --git a/connectivity/drivers/emac/TARGET_Freescale_EMAC/kinetis_emac.cpp b/connectivity/drivers/emac/TARGET_Freescale_EMAC/kinetis_emac.cpp index 7485284d9f..d7868f1171 100644 --- a/connectivity/drivers/emac/TARGET_Freescale_EMAC/kinetis_emac.cpp +++ b/connectivity/drivers/emac/TARGET_Freescale_EMAC/kinetis_emac.cpp @@ -40,7 +40,7 @@ #include "mbed_interface.h" #include "mbed_assert.h" #include "netsocket/nsapi_types.h" -#include "mbed_shared_queues.h" +#include "events/mbed_shared_queues.h" #include "fsl_phy.h" diff --git a/connectivity/drivers/emac/TARGET_GD_EMAC/gd32xx_emac.cpp b/connectivity/drivers/emac/TARGET_GD_EMAC/gd32xx_emac.cpp index f08c041005..5816bcdc05 100644 --- a/connectivity/drivers/emac/TARGET_GD_EMAC/gd32xx_emac.cpp +++ b/connectivity/drivers/emac/TARGET_GD_EMAC/gd32xx_emac.cpp @@ -22,7 +22,7 @@ #include "mbed_interface.h" #include "mbed_assert.h" -#include "mbed_shared_queues.h" +#include "events/mbed_shared_queues.h" #include "netsocket/nsapi_types.h" #include "gd32xx_emac.h" diff --git a/connectivity/drivers/emac/TARGET_NUVOTON_EMAC/numaker_emac.cpp b/connectivity/drivers/emac/TARGET_NUVOTON_EMAC/numaker_emac.cpp index 945583e65b..48a1dfe681 100644 --- a/connectivity/drivers/emac/TARGET_NUVOTON_EMAC/numaker_emac.cpp +++ b/connectivity/drivers/emac/TARGET_NUVOTON_EMAC/numaker_emac.cpp @@ -28,7 +28,7 @@ #include "mbed_interface.h" #include "mbed_assert.h" #include "netsocket/nsapi_types.h" -#include "mbed_shared_queues.h" +#include "events/mbed_shared_queues.h" //#define NU_TRACE diff --git a/connectivity/drivers/emac/TARGET_NXP_EMAC/TARGET_IMX/imx_emac.cpp b/connectivity/drivers/emac/TARGET_NXP_EMAC/TARGET_IMX/imx_emac.cpp index f69d524d32..8fba334038 100644 --- a/connectivity/drivers/emac/TARGET_NXP_EMAC/TARGET_IMX/imx_emac.cpp +++ b/connectivity/drivers/emac/TARGET_NXP_EMAC/TARGET_IMX/imx_emac.cpp @@ -40,7 +40,7 @@ #include "mbed_interface.h" #include "mbed_assert.h" #include "netsocket/nsapi_types.h" -#include "mbed_shared_queues.h" +#include "events/mbed_shared_queues.h" #include "fsl_phy.h" diff --git a/connectivity/drivers/emac/TARGET_NXP_EMAC/TARGET_MCU_LPC546XX/lpc546xx_emac.cpp b/connectivity/drivers/emac/TARGET_NXP_EMAC/TARGET_MCU_LPC546XX/lpc546xx_emac.cpp index 9b0b9df870..b8c1414d58 100644 --- a/connectivity/drivers/emac/TARGET_NXP_EMAC/TARGET_MCU_LPC546XX/lpc546xx_emac.cpp +++ b/connectivity/drivers/emac/TARGET_NXP_EMAC/TARGET_MCU_LPC546XX/lpc546xx_emac.cpp @@ -24,7 +24,7 @@ #include "mbed_interface.h" #include "mbed_assert.h" #include "netsocket/nsapi_types.h" -#include "mbed_shared_queues.h" +#include "events/mbed_shared_queues.h" #include "fsl_phy.h" diff --git a/connectivity/drivers/emac/TARGET_RDA_EMAC/rda5981x_emac.cpp b/connectivity/drivers/emac/TARGET_RDA_EMAC/rda5981x_emac.cpp index 9ab35571e1..4b32206307 100644 --- a/connectivity/drivers/emac/TARGET_RDA_EMAC/rda5981x_emac.cpp +++ b/connectivity/drivers/emac/TARGET_RDA_EMAC/rda5981x_emac.cpp @@ -18,7 +18,7 @@ #include "cmsis_os.h" #include "mbed_interface.h" #include "mbed_assert.h" -#include "mbed_shared_queues.h" +#include "events/mbed_shared_queues.h" #include "netsocket/nsapi_types.h" #include "lwip/arch.h" #include "lwip/pbuf.h" diff --git a/connectivity/drivers/emac/TARGET_RZ_A1_EMAC/rza1_emac.cpp b/connectivity/drivers/emac/TARGET_RZ_A1_EMAC/rza1_emac.cpp index 6484f53f69..9355041d13 100644 --- a/connectivity/drivers/emac/TARGET_RZ_A1_EMAC/rza1_emac.cpp +++ b/connectivity/drivers/emac/TARGET_RZ_A1_EMAC/rza1_emac.cpp @@ -16,7 +16,7 @@ #include "cmsis_os.h" #include "rtos/ThisThread.h" #include "netsocket/nsapi_types.h" -#include "mbed_shared_queues.h" +#include "events/mbed_shared_queues.h" #include "rza1_eth.h" #include "rza1_eth_ext.h" #include "rza1_emac.h" diff --git a/connectivity/drivers/emac/TARGET_STM/stm32xx_emac.cpp b/connectivity/drivers/emac/TARGET_STM/stm32xx_emac.cpp index 7ae8276cf6..9068ac697e 100644 --- a/connectivity/drivers/emac/TARGET_STM/stm32xx_emac.cpp +++ b/connectivity/drivers/emac/TARGET_STM/stm32xx_emac.cpp @@ -24,7 +24,7 @@ #include "mbed.h" #include "mbed_interface.h" #include "mbed_assert.h" -#include "mbed_shared_queues.h" +#include "events/mbed_shared_queues.h" #include "netsocket/nsapi_types.h" #include "stm32xx_emac_config.h" diff --git a/connectivity/libraries/ppp/source/ppp_service.cpp b/connectivity/libraries/ppp/source/ppp_service.cpp index 58c2470b0b..374bf52e89 100644 --- a/connectivity/libraries/ppp/source/ppp_service.cpp +++ b/connectivity/libraries/ppp/source/ppp_service.cpp @@ -22,10 +22,10 @@ #include "netsocket/nsapi_types.h" #if PPP_MBED_EVENT_QUEUE -#include "mbed_shared_queues.h" +#include "events/mbed_shared_queues.h" #else #include "Thread.h" -#include "EventQueue.h" +#include "events/EventQueue.h" #endif #include "mbed_poll.h" diff --git a/connectivity/libraries/ppp/source/ppp_service_if.cpp b/connectivity/libraries/ppp/source/ppp_service_if.cpp index 7b983e2840..72b6d7980a 100644 --- a/connectivity/libraries/ppp/source/ppp_service_if.cpp +++ b/connectivity/libraries/ppp/source/ppp_service_if.cpp @@ -20,7 +20,7 @@ #include "mbed_interface.h" #include "mbed_trace.h" #include "netsocket/nsapi_types.h" -#include "mbed_shared_queues.h" +#include "events/mbed_shared_queues.h" #include "mbed_poll.h" #include "ip4string.h" #include "ip6string.h" diff --git a/connectivity/netsocket/source/NetworkStack.cpp b/connectivity/netsocket/source/NetworkStack.cpp index f9d0c203be..be582a93fe 100644 --- a/connectivity/netsocket/source/NetworkStack.cpp +++ b/connectivity/netsocket/source/NetworkStack.cpp @@ -19,7 +19,7 @@ #include "stddef.h" #include #include "events/EventQueue.h" -#include "mbed_shared_queues.h" +#include "events/mbed_shared_queues.h" #include "platform/mbed_error.h" // Default NetworkStack operations diff --git a/connectivity/netsocket/source/nsapi_dns.cpp b/connectivity/netsocket/source/nsapi_dns.cpp index 4b639bcb46..dacce85b6c 100644 --- a/connectivity/netsocket/source/nsapi_dns.cpp +++ b/connectivity/netsocket/source/nsapi_dns.cpp @@ -24,7 +24,7 @@ #include #include #include -#include "mbed_shared_queues.h" +#include "events/mbed_shared_queues.h" #include "events/EventQueue.h" #include "netsocket/OnboardNetworkStack.h" #include "rtos/Kernel.h" diff --git a/connectivity/netsocket/tests/UNITTESTS/netsocket/IfaceDnsSocket/moduletest.cpp b/connectivity/netsocket/tests/UNITTESTS/netsocket/IfaceDnsSocket/moduletest.cpp index e0c3680038..db0b981c40 100644 --- a/connectivity/netsocket/tests/UNITTESTS/netsocket/IfaceDnsSocket/moduletest.cpp +++ b/connectivity/netsocket/tests/UNITTESTS/netsocket/IfaceDnsSocket/moduletest.cpp @@ -22,7 +22,7 @@ #include "netsocket/SocketAddress.h" #include "EMAC_mock.h" #include "OnboardNetworkStack_mock.h" -#include "EventQueue.h" +#include "events/EventQueue.h" #include #include #include diff --git a/drivers/USBCDC_ECM.h b/drivers/USBCDC_ECM.h index b29e05110a..70ddb9a94b 100644 --- a/drivers/USBCDC_ECM.h +++ b/drivers/USBCDC_ECM.h @@ -24,7 +24,7 @@ #include "ByteBuffer.h" #include "Mutex.h" #include "EventFlags.h" -#include "EventQueue.h" +#include "events/EventQueue.h" #include "Thread.h" #include "Callback.h" diff --git a/events/Event.h b/events/include/events/Event.h similarity index 100% rename from events/Event.h rename to events/include/events/Event.h diff --git a/events/EventQueue.h b/events/include/events/EventQueue.h similarity index 100% rename from events/EventQueue.h rename to events/include/events/EventQueue.h diff --git a/events/UserAllocatedEvent.h b/events/include/events/UserAllocatedEvent.h similarity index 100% rename from events/UserAllocatedEvent.h rename to events/include/events/UserAllocatedEvent.h diff --git a/events/equeue.h b/events/include/events/equeue.h similarity index 100% rename from events/equeue.h rename to events/include/events/equeue.h diff --git a/events/internal/equeue_platform.h b/events/include/events/internal/equeue_platform.h similarity index 100% rename from events/internal/equeue_platform.h rename to events/include/events/internal/equeue_platform.h diff --git a/events/mbed_events.h b/events/include/events/mbed_events.h similarity index 100% rename from events/mbed_events.h rename to events/include/events/mbed_events.h diff --git a/events/mbed_shared_queues.h b/events/include/events/mbed_shared_queues.h similarity index 100% rename from events/mbed_shared_queues.h rename to events/include/events/mbed_shared_queues.h diff --git a/events/source/.mbedignore b/events/source/.mbedignore deleted file mode 100644 index e7e1fb04f4..0000000000 --- a/events/source/.mbedignore +++ /dev/null @@ -1 +0,0 @@ -tests/* diff --git a/events/tests/.mbedignore b/events/tests/.mbedignore new file mode 100644 index 0000000000..3700faa1a6 --- /dev/null +++ b/events/tests/.mbedignore @@ -0,0 +1,2 @@ +UNITTESTS/* +unit/ \ No newline at end of file diff --git a/TESTS/events/equeue/main.cpp b/events/tests/TESTS/events/equeue/main.cpp similarity index 99% rename from TESTS/events/equeue/main.cpp rename to events/tests/TESTS/events/equeue/main.cpp index 061b2d9e41..96c18d646c 100644 --- a/TESTS/events/equeue/main.cpp +++ b/events/tests/TESTS/events/equeue/main.cpp @@ -23,7 +23,7 @@ #include "unity/unity.h" #include "greentea-client/test_env.h" -#include "equeue.h" +#include "events/equeue.h" #include "mbed.h" using namespace utest::v1; diff --git a/TESTS/events/queue/main.cpp b/events/tests/TESTS/events/queue/main.cpp similarity index 100% rename from TESTS/events/queue/main.cpp rename to events/tests/TESTS/events/queue/main.cpp diff --git a/TESTS/events/timing/main.cpp b/events/tests/TESTS/events/timing/main.cpp similarity index 100% rename from TESTS/events/timing/main.cpp rename to events/tests/TESTS/events/timing/main.cpp diff --git a/UNITTESTS/events/equeue/test_equeue.cpp b/events/tests/UNITTESTS/equeue/test_equeue.cpp similarity index 99% rename from UNITTESTS/events/equeue/test_equeue.cpp rename to events/tests/UNITTESTS/equeue/test_equeue.cpp index 5d90023fda..ae017cb014 100644 --- a/UNITTESTS/events/equeue/test_equeue.cpp +++ b/events/tests/UNITTESTS/equeue/test_equeue.cpp @@ -15,7 +15,7 @@ * limitations under the License. */ #include "gtest/gtest.h" -#include "equeue.h" +#include "events/equeue.h" #include "mbed.h" #include #include diff --git a/events/tests/UNITTESTS/equeue/unittest.cmake b/events/tests/UNITTESTS/equeue/unittest.cmake new file mode 100644 index 0000000000..fe0f05a871 --- /dev/null +++ b/events/tests/UNITTESTS/equeue/unittest.cmake @@ -0,0 +1,27 @@ + +#################### +# UNIT TESTS +#################### + +list(REMOVE_ITEM unittest-includes ${PROJECT_SOURCE_DIR}/../events/tests/UNITTESTS/target_h ${PROJECT_SOURCE_DIR}/../events/test/UNITTESTS/target_h/equeue) + +set(unittest-includes ${unittest-includes} + ../events/source + ../events/include/events + ../events/include/events/internal +) + +set(unittest-sources + ../events/source/equeue.c +) + +set(unittest-test-sources + ../events/tests/UNITTESTS/equeue/test_equeue.cpp + ../events/tests/UNITTESTS/stubs/EqueuePosix_stub.c +) + +set(unittest-test-flags + -pthread + -DEQUEUE_PLATFORM_POSIX +) + diff --git a/UNITTESTS/stubs/EqueuePosix_stub.c b/events/tests/UNITTESTS/stubs/EqueuePosix_stub.c similarity index 100% rename from UNITTESTS/stubs/EqueuePosix_stub.c rename to events/tests/UNITTESTS/stubs/EqueuePosix_stub.c diff --git a/UNITTESTS/target_h/events/equeue/equeue_platform.h b/events/tests/UNITTESTS/target_h/equeue/equeue_platform.h similarity index 100% rename from UNITTESTS/target_h/events/equeue/equeue_platform.h rename to events/tests/UNITTESTS/target_h/equeue/equeue_platform.h diff --git a/UNITTESTS/target_h/events/mbed_events.h b/events/tests/UNITTESTS/target_h/mbed_events.h similarity index 100% rename from UNITTESTS/target_h/events/mbed_events.h rename to events/tests/UNITTESTS/target_h/mbed_events.h diff --git a/events/source/Makefile b/events/tests/unit/Makefile similarity index 69% rename from events/source/Makefile rename to events/tests/unit/Makefile index 6e636bc87b..e056091131 100644 --- a/events/source/Makefile +++ b/events/tests/unit/Makefile @@ -27,13 +27,13 @@ LFLAGS += -pthread all: $(TARGET) -test: tests/tests.o $(OBJ) - $(CC) $(CFLAGS) $^ $(LFLAGS) -o tests/tests - tests/tests +test: tests.o $(OBJ) + $(CC) $(CFLAGS) $^ $(LFLAGS) -o tests + tests -prof: tests/prof.o $(OBJ) - $(CC) $(CFLAGS) $^ $(LFLAGS) -o tests/prof - tests/prof +prof: prof.o $(OBJ) + $(CC) $(CFLAGS) $^ $(LFLAGS) -o prof + prof asm: $(ASM) @@ -53,8 +53,8 @@ size: $(OBJ) clean: rm -f $(TARGET) - rm -f tests/tests tests/tests.o tests/tests.d - rm -f tests/prof tests/prof.o tests/prof.d + rm -f tests tests.o tests.d + rm -f prof prof.o prof.d rm -f $(OBJ) rm -f $(DEP) rm -f $(ASM) diff --git a/events/source/tests/prof.c b/events/tests/unit/prof.c similarity index 100% rename from events/source/tests/prof.c rename to events/tests/unit/prof.c diff --git a/events/source/tests/tests.c b/events/tests/unit/tests.c similarity index 100% rename from events/source/tests/tests.c rename to events/tests/unit/tests.c diff --git a/features/nanostack/nanostack-hal-mbed-cmsis-rtos/arm_hal_fhss_timer.cpp b/features/nanostack/nanostack-hal-mbed-cmsis-rtos/arm_hal_fhss_timer.cpp index 783405d4bd..1a86b7d64a 100644 --- a/features/nanostack/nanostack-hal-mbed-cmsis-rtos/arm_hal_fhss_timer.cpp +++ b/features/nanostack/nanostack-hal-mbed-cmsis-rtos/arm_hal_fhss_timer.cpp @@ -24,9 +24,9 @@ #include "platform/SingletonPtr.h" #include "platform/arm_hal_interrupt.h" #include "platform/mbed_power_mgmt.h" -#include "equeue.h" +#include "events/equeue.h" #include "events/EventQueue.h" -#include "mbed_shared_queues.h" +#include "events/mbed_shared_queues.h" #include "Timeout.h" #define TRACE_GROUP "fhdr" diff --git a/features/nanostack/nanostack-hal-mbed-cmsis-rtos/ns_event_loop_mbed.cpp b/features/nanostack/nanostack-hal-mbed-cmsis-rtos/ns_event_loop_mbed.cpp index 7921e5b197..dc274db2c4 100644 --- a/features/nanostack/nanostack-hal-mbed-cmsis-rtos/ns_event_loop_mbed.cpp +++ b/features/nanostack/nanostack-hal-mbed-cmsis-rtos/ns_event_loop_mbed.cpp @@ -27,7 +27,7 @@ #include "eventOS_scheduler.h" #include "mbed_error.h" -#include "mbed_shared_queues.h" +#include "events/mbed_shared_queues.h" #include "events/Event.h" #include "ns_event_loop_mutex.h" #include "ns_event_loop.h" From d480fab08bade6d4a149bc93a2077f53b210b87b Mon Sep 17 00:00:00 2001 From: George Psimenos Date: Tue, 21 Jul 2020 14:38:46 +0100 Subject: [PATCH 04/12] CI & local unit test fixes --- .travis.yml | 4 ++-- events/tests/unit/Makefile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2b0963e01d..d99954efea 100644 --- a/.travis.yml +++ b/.travis.yml @@ -254,9 +254,9 @@ matrix: features/frameworks/utest features/frameworks/unity components BUILD - python tools/make.py -t GCC_ARM -m NUCLEO_F103RB --source=. --build=BUILD/NUCLEO_F103RB/GCC_ARM -j0 # Run local equeue tests - - make -C ${EVENTS}/test/unit test + - make -C ${EVENTS}/tests/unit test # Run profiling tests - - make -C ${EVENTS}/test/unit prof | tee prof + - make -C ${EVENTS}/tests/unit prof | tee prof after_success: # Update status, comparing with master if possible. - | diff --git a/events/tests/unit/Makefile b/events/tests/unit/Makefile index e056091131..e8bb50328f 100644 --- a/events/tests/unit/Makefile +++ b/events/tests/unit/Makefile @@ -17,7 +17,7 @@ endif ifdef WORD CFLAGS += -m$(WORD) endif -CFLAGS += -I. -I.. -I../.. +CFLAGS += -I. -I../../include CFLAGS += -std=c99 CFLAGS += -Wall CFLAGS += -D_XOPEN_SOURCE=600 From fe7ae8a50f49149a648b5b52ad11afb3e250ded7 Mon Sep 17 00:00:00 2001 From: George Psimenos Date: Mon, 27 Jul 2020 08:49:59 +0100 Subject: [PATCH 05/12] Remove deprecated local unit tests --- .travis.yml | 2 - events/tests/unit/Makefile | 9 +- events/tests/unit/tests.c | 902 ------------------------------------- 3 files changed, 2 insertions(+), 911 deletions(-) delete mode 100644 events/tests/unit/tests.c diff --git a/.travis.yml b/.travis.yml index d99954efea..ab261ba351 100644 --- a/.travis.yml +++ b/.travis.yml @@ -253,8 +253,6 @@ matrix: connectivity/libraries/ppp connectivity/netsocket features/nanostack features/lwipstack features/frameworks/greentea-client \ features/frameworks/utest features/frameworks/unity components BUILD - python tools/make.py -t GCC_ARM -m NUCLEO_F103RB --source=. --build=BUILD/NUCLEO_F103RB/GCC_ARM -j0 - # Run local equeue tests - - make -C ${EVENTS}/tests/unit test # Run profiling tests - make -C ${EVENTS}/tests/unit prof | tee prof after_success: diff --git a/events/tests/unit/Makefile b/events/tests/unit/Makefile index e8bb50328f..777d315a58 100644 --- a/events/tests/unit/Makefile +++ b/events/tests/unit/Makefile @@ -4,7 +4,7 @@ CC = gcc AR = ar SIZE = size -SRC += $(wildcard *.c) +SRC += $(wildcard ../../source/*.c) OBJ := $(SRC:.c=.o) DEP := $(SRC:.c=.d) ASM := $(SRC:.c=.s) @@ -27,13 +27,9 @@ LFLAGS += -pthread all: $(TARGET) -test: tests.o $(OBJ) - $(CC) $(CFLAGS) $^ $(LFLAGS) -o tests - tests - prof: prof.o $(OBJ) $(CC) $(CFLAGS) $^ $(LFLAGS) -o prof - prof + ./prof asm: $(ASM) @@ -53,7 +49,6 @@ size: $(OBJ) clean: rm -f $(TARGET) - rm -f tests tests.o tests.d rm -f prof prof.o prof.d rm -f $(OBJ) rm -f $(DEP) diff --git a/events/tests/unit/tests.c b/events/tests/unit/tests.c deleted file mode 100644 index efbf7f43be..0000000000 --- a/events/tests/unit/tests.c +++ /dev/null @@ -1,902 +0,0 @@ -/* - * Testing framework for the events library - * - * Copyright (c) 2016 ARM Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "events/equeue.h" -#include -#include -#include -#include -#include -#include - - -// Testing setup -static jmp_buf test_buf; -static int test_line; -static int test_failure; - -#define test_assert(test) ({ \ - if (!(test)) { \ - test_line = __LINE__; \ - longjmp(test_buf, 1); \ - } \ -}) - -#define test_run(func, ...) ({ \ - printf("%s: ...", #func); \ - fflush(stdout); \ - \ - if (!setjmp(test_buf)) { \ - func(__VA_ARGS__); \ - printf("\r%s: \e[32mpassed\e[0m\n", #func); \ - } else { \ - printf("\r%s: \e[31mfailed\e[0m at line %d\n", #func, test_line); \ - test_failure = true; \ - } \ -}) - - -// Test functions -void pass_func(void *eh) -{ -} - -void simple_func(void *p) -{ - (*(int *)p)++; -} - -void sloth_func(void *p) -{ - usleep(10000); - (*(int *)p)++; -} - -struct indirect { - int *touched; - uint8_t buffer[7]; -}; - -void indirect_func(void *p) -{ - struct indirect *i = (struct indirect *)p; - (*i->touched)++; -} - -struct timing { - unsigned tick; - unsigned delay; -}; - -void timing_func(void *p) -{ - struct timing *timing = (struct timing *)p; - unsigned tick = equeue_tick(); - - unsigned t1 = timing->delay; - unsigned t2 = tick - timing->tick; - test_assert(t1 > t2 - 10 && t1 < t2 + 10); - - timing->tick = tick; -} - -struct fragment { - equeue_t *q; - size_t size; - struct timing timing; -}; - -void fragment_func(void *p) -{ - struct fragment *fragment = (struct fragment *)p; - timing_func(&fragment->timing); - - struct fragment *nfragment = equeue_alloc(fragment->q, fragment->size); - test_assert(nfragment); - - *nfragment = *fragment; - equeue_event_delay(nfragment, fragment->timing.delay); - - int id = equeue_post(nfragment->q, fragment_func, nfragment); - test_assert(id); -} - -struct cancel { - equeue_t *q; - int id; -}; - -void cancel_func(void *p) -{ - struct cancel *cancel = (struct cancel *)p; - equeue_cancel(cancel->q, cancel->id); -} - -struct nest { - equeue_t *q; - void (*cb)(void *); - void *data; -}; - -void nest_func(void *p) -{ - struct nest *nest = (struct nest *)p; - equeue_call(nest->q, nest->cb, nest->data); - - usleep(10000); -} - - -// Simple call tests -void simple_call_test(void) -{ - equeue_t q; - int err = equeue_create(&q, 2048); - test_assert(!err); - - bool touched = false; - equeue_call(&q, simple_func, &touched); - equeue_dispatch(&q, 0); - test_assert(touched); - - equeue_destroy(&q); -} - -void simple_call_in_test(void) -{ - equeue_t q; - int err = equeue_create(&q, 2048); - test_assert(!err); - - bool touched = false; - int id = equeue_call_in(&q, 10, simple_func, &touched); - test_assert(id); - - equeue_dispatch(&q, 15); - test_assert(touched); - - equeue_destroy(&q); -} - -void simple_call_every_test(void) -{ - equeue_t q; - int err = equeue_create(&q, 2048); - test_assert(!err); - - bool touched = false; - int id = equeue_call_every(&q, 10, simple_func, &touched); - test_assert(id); - - equeue_dispatch(&q, 15); - test_assert(touched); - - equeue_destroy(&q); -} - -void simple_post_test(void) -{ - equeue_t q; - int err = equeue_create(&q, 2048); - test_assert(!err); - - int touched = false; - struct indirect *i = equeue_alloc(&q, sizeof(struct indirect)); - test_assert(i); - - i->touched = &touched; - int id = equeue_post(&q, indirect_func, i); - test_assert(id); - - equeue_dispatch(&q, 0); - test_assert(*i->touched); - - equeue_destroy(&q); -} - -// Misc tests -void destructor_test(void) -{ - equeue_t q; - int err = equeue_create(&q, 2048); - test_assert(!err); - - int touched; - struct indirect *e; - int ids[3]; - - touched = 0; - for (int i = 0; i < 3; i++) { - e = equeue_alloc(&q, sizeof(struct indirect)); - test_assert(e); - - e->touched = &touched; - equeue_event_dtor(e, indirect_func); - int id = equeue_post(&q, pass_func, e); - test_assert(id); - } - - equeue_dispatch(&q, 0); - test_assert(touched == 3); - - touched = 0; - for (int i = 0; i < 3; i++) { - e = equeue_alloc(&q, sizeof(struct indirect)); - test_assert(e); - - e->touched = &touched; - equeue_event_dtor(e, indirect_func); - ids[i] = equeue_post(&q, pass_func, e); - test_assert(ids[i]); - } - - for (int i = 0; i < 3; i++) { - equeue_cancel(&q, ids[i]); - } - - equeue_dispatch(&q, 0); - test_assert(touched == 3); - - touched = 0; - for (int i = 0; i < 3; i++) { - e = equeue_alloc(&q, sizeof(struct indirect)); - test_assert(e); - - e->touched = &touched; - equeue_event_dtor(e, indirect_func); - int id = equeue_post(&q, pass_func, e); - test_assert(id); - } - - equeue_destroy(&q); - test_assert(touched == 3); -} - -void allocation_failure_test(void) -{ - equeue_t q; - int err = equeue_create(&q, 2048); - test_assert(!err); - - void *p = equeue_alloc(&q, 4096); - test_assert(!p); - - for (int i = 0; i < 100; i++) { - p = equeue_alloc(&q, 0); - } - test_assert(!p); - - equeue_destroy(&q); -} - -void cancel_test(int N) -{ - equeue_t q; - int err = equeue_create(&q, 2048); - test_assert(!err); - - bool touched = false; - int *ids = malloc(N * sizeof(int)); - - for (int i = 0; i < N; i++) { - ids[i] = equeue_call(&q, simple_func, &touched); - } - - for (int i = N - 1; i >= 0; i--) { - test_assert(equeue_cancel(&q, ids[i])); - } - - free(ids); - - equeue_dispatch(&q, 0); - test_assert(!touched); - - equeue_destroy(&q); -} - -void cancel_inflight_test(void) -{ - equeue_t q; - int err = equeue_create(&q, 2048); - test_assert(!err); - - bool touched = false; - - int id = equeue_call(&q, simple_func, &touched); - test_assert(equeue_cancel(&q, id)); - - equeue_dispatch(&q, 0); - test_assert(!touched); - - id = equeue_call(&q, simple_func, &touched); - test_assert(equeue_cancel(&q, id)); - - equeue_dispatch(&q, 0); - test_assert(!touched); - - struct cancel *cancel = equeue_alloc(&q, sizeof(struct cancel)); - test_assert(cancel); - cancel->q = &q; - cancel->id = 0; - - id = equeue_post(&q, cancel_func, cancel); - test_assert(id); - - cancel->id = equeue_call(&q, simple_func, &touched); - - equeue_dispatch(&q, 0); - test_assert(!touched); - - equeue_destroy(&q); -} - -void cancel_unnecessarily_test(void) -{ - equeue_t q; - int err = equeue_create(&q, 2048); - test_assert(!err); - - int id = equeue_call(&q, pass_func, 0); - for (int i = 0; i < 5; i++) { - test_assert(equeue_cancel(&q, id) == (i == 0)); - } - - id = equeue_call(&q, pass_func, 0); - equeue_dispatch(&q, 0); - for (int i = 0; i < 5; i++) { - test_assert(!equeue_cancel(&q, id)); - } - - bool touched = false; - equeue_call(&q, simple_func, &touched); - for (int i = 0; i < 5; i++) { - test_assert(!equeue_cancel(&q, id)); - } - - equeue_dispatch(&q, 0); - test_assert(touched); - - equeue_destroy(&q); -} - -void loop_protect_test(void) -{ - equeue_t q; - int err = equeue_create(&q, 2048); - test_assert(!err); - - bool touched = false; - equeue_call_every(&q, 0, simple_func, &touched); - - equeue_dispatch(&q, 0); - test_assert(touched); - - touched = false; - equeue_call_every(&q, 1, simple_func, &touched); - - equeue_dispatch(&q, 0); - test_assert(touched); - - equeue_destroy(&q); -} - -void break_test(void) -{ - equeue_t q; - int err = equeue_create(&q, 2048); - test_assert(!err); - - bool touched = false; - equeue_call_every(&q, 0, simple_func, &touched); - - equeue_break(&q); - equeue_dispatch(&q, -1); - test_assert(touched); - - equeue_destroy(&q); -} - -void break_no_windup_test(void) -{ - equeue_t q; - int err = equeue_create(&q, 2048); - test_assert(!err); - - int count = 0; - equeue_call_every(&q, 0, simple_func, &count); - - equeue_break(&q); - equeue_break(&q); - equeue_dispatch(&q, -1); - test_assert(count == 1); - - count = 0; - equeue_dispatch(&q, 55); - test_assert(count > 1); - - equeue_destroy(&q); -} - -void period_test(void) -{ - equeue_t q; - int err = equeue_create(&q, 2048); - test_assert(!err); - - int count = 0; - equeue_call_every(&q, 10, simple_func, &count); - - equeue_dispatch(&q, 55); - test_assert(count == 5); - - equeue_destroy(&q); -} - -void nested_test(void) -{ - equeue_t q; - int err = equeue_create(&q, 2048); - test_assert(!err); - - int touched = 0; - struct nest *nest = equeue_alloc(&q, sizeof(struct nest)); - test_assert(nest); - nest->q = &q; - nest->cb = simple_func; - nest->data = &touched; - - int id = equeue_post(&q, nest_func, nest); - test_assert(id); - - equeue_dispatch(&q, 5); - test_assert(touched == 0); - - equeue_dispatch(&q, 5); - test_assert(touched == 1); - - touched = 0; - nest = equeue_alloc(&q, sizeof(struct nest)); - test_assert(nest); - nest->q = &q; - nest->cb = simple_func; - nest->data = &touched; - - id = equeue_post(&q, nest_func, nest); - test_assert(id); - - equeue_dispatch(&q, 20); - test_assert(touched == 1); - - equeue_destroy(&q); -} - -void sloth_test(void) -{ - equeue_t q; - int err = equeue_create(&q, 2048); - test_assert(!err); - - int touched = 0; - int id = equeue_call(&q, sloth_func, &touched); - test_assert(id); - - id = equeue_call_in(&q, 5, simple_func, &touched); - test_assert(id); - - id = equeue_call_in(&q, 15, simple_func, &touched); - test_assert(id); - - equeue_dispatch(&q, 20); - test_assert(touched == 3); - - equeue_destroy(&q); -} - -void *multithread_thread(void *p) -{ - equeue_t *q = (equeue_t *)p; - equeue_dispatch(q, -1); - return 0; -} - -void multithread_test(void) -{ - equeue_t q; - int err = equeue_create(&q, 2048); - test_assert(!err); - - int touched = 0; - equeue_call_every(&q, 1, simple_func, &touched); - - pthread_t thread; - err = pthread_create(&thread, 0, multithread_thread, &q); - test_assert(!err); - - usleep(10000); - equeue_break(&q); - err = pthread_join(thread, 0); - test_assert(!err); - - test_assert(touched); - - equeue_destroy(&q); -} - -void background_func(void *p, int ms) -{ - *(unsigned *)p = ms; -} - -void background_test(void) -{ - equeue_t q; - int err = equeue_create(&q, 2048); - test_assert(!err); - - int id = equeue_call_in(&q, 20, pass_func, 0); - test_assert(id); - - unsigned ms; - equeue_background(&q, background_func, &ms); - test_assert(ms == 20); - - id = equeue_call_in(&q, 10, pass_func, 0); - test_assert(id); - test_assert(ms == 10); - - id = equeue_call(&q, pass_func, 0); - test_assert(id); - test_assert(ms == 0); - - equeue_dispatch(&q, 0); - test_assert(ms == 10); - - equeue_destroy(&q); - test_assert(ms == -1); -} - -void chain_test(void) -{ - equeue_t q1; - int err = equeue_create(&q1, 2048); - test_assert(!err); - - equeue_t q2; - err = equeue_create(&q2, 2048); - test_assert(!err); - - equeue_chain(&q2, &q1); - - int touched = 0; - - int id1 = equeue_call_in(&q1, 20, simple_func, &touched); - int id2 = equeue_call_in(&q2, 20, simple_func, &touched); - test_assert(id1 && id2); - - id1 = equeue_call(&q1, simple_func, &touched); - id2 = equeue_call(&q2, simple_func, &touched); - test_assert(id1 && id2); - - id1 = equeue_call_in(&q1, 5, simple_func, &touched); - id2 = equeue_call_in(&q2, 5, simple_func, &touched); - test_assert(id1 && id2); - - test_assert(equeue_cancel(&q1, id1)); - test_assert(equeue_cancel(&q2, id2)); - - id1 = equeue_call_in(&q1, 10, simple_func, &touched); - id2 = equeue_call_in(&q2, 10, simple_func, &touched); - test_assert(id1 && id2); - - equeue_dispatch(&q1, 30); - - test_assert(touched == 6); - - equeue_destroy(&q2); - equeue_destroy(&q1); -} - -void unchain_test(void) -{ - equeue_t q1; - int err = equeue_create(&q1, 2048); - test_assert(!err); - - equeue_t q2; - err = equeue_create(&q2, 2048); - test_assert(!err); - - equeue_chain(&q2, &q1); - - int touched = 0; - int id1 = equeue_call(&q1, simple_func, &touched); - int id2 = equeue_call(&q2, simple_func, &touched); - test_assert(id1 && id2); - - equeue_dispatch(&q1, 0); - test_assert(touched == 2); - - equeue_chain(&q2, 0); - equeue_chain(&q1, &q2); - - id1 = equeue_call(&q1, simple_func, &touched); - id2 = equeue_call(&q2, simple_func, &touched); - test_assert(id1 && id2); - - equeue_dispatch(&q2, 0); - test_assert(touched == 4); - - equeue_destroy(&q1); - equeue_destroy(&q2); -} - -// Barrage tests -void simple_barrage_test(int N) -{ - equeue_t q; - int err = equeue_create(&q, N * (EQUEUE_EVENT_SIZE + sizeof(struct timing))); - test_assert(!err); - - for (int i = 0; i < N; i++) { - struct timing *timing = equeue_alloc(&q, sizeof(struct timing)); - test_assert(timing); - - timing->tick = equeue_tick(); - timing->delay = (i + 1) * 100; - equeue_event_delay(timing, timing->delay); - equeue_event_period(timing, timing->delay); - - int id = equeue_post(&q, timing_func, timing); - test_assert(id); - } - - equeue_dispatch(&q, N * 100); - - equeue_destroy(&q); -} - -void fragmenting_barrage_test(int N) -{ - equeue_t q; - int err = equeue_create(&q, - 2 * N * (EQUEUE_EVENT_SIZE + sizeof(struct fragment) + N * sizeof(int))); - test_assert(!err); - - for (int i = 0; i < N; i++) { - size_t size = sizeof(struct fragment) + i * sizeof(int); - struct fragment *fragment = equeue_alloc(&q, size); - test_assert(fragment); - - fragment->q = &q; - fragment->size = size; - fragment->timing.tick = equeue_tick(); - fragment->timing.delay = (i + 1) * 100; - equeue_event_delay(fragment, fragment->timing.delay); - - int id = equeue_post(&q, fragment_func, fragment); - test_assert(id); - } - - equeue_dispatch(&q, N * 100); - - equeue_destroy(&q); -} - -struct ethread { - pthread_t thread; - equeue_t *q; - int ms; -}; - -static void *ethread_dispatch(void *p) -{ - struct ethread *t = (struct ethread *)p; - equeue_dispatch(t->q, t->ms); - return 0; -} - -void multithreaded_barrage_test(int N) -{ - equeue_t q; - int err = equeue_create(&q, N * (EQUEUE_EVENT_SIZE + sizeof(struct timing))); - test_assert(!err); - - struct ethread t; - t.q = &q; - t.ms = N * 100; - err = pthread_create(&t.thread, 0, ethread_dispatch, &t); - test_assert(!err); - - for (int i = 0; i < N; i++) { - struct timing *timing = equeue_alloc(&q, sizeof(struct timing)); - test_assert(timing); - - timing->tick = equeue_tick(); - timing->delay = (i + 1) * 100; - equeue_event_delay(timing, timing->delay); - equeue_event_period(timing, timing->delay); - - int id = equeue_post(&q, timing_func, timing); - test_assert(id); - } - - err = pthread_join(t.thread, 0); - test_assert(!err); - - equeue_destroy(&q); -} - -struct count_and_queue { - int p; - equeue_t *q; -}; - -void simple_breaker(void *p) -{ - struct count_and_queue *caq = (struct count_and_queue *)p; - equeue_break(caq->q); - usleep(10000); - caq->p++; -} - -void break_request_cleared_on_timeout(void) -{ - equeue_t q; - int err = equeue_create(&q, 2048); - test_assert(!err); - - struct count_and_queue pq; - pq.p = 0; - pq.q = &q; - - int id = equeue_call_every(&q, 10, simple_breaker, &pq); - - equeue_dispatch(&q, 10); - test_assert(pq.p == 1); - - test_assert(equeue_cancel(&q, id)); - - int count = 0; - equeue_call_every(&q, 10, simple_func, &count); - - equeue_dispatch(&q, 55); - test_assert(count > 1); - - equeue_destroy(&q); -} - -void sibling_test(void) -{ - equeue_t q; - int err = equeue_create(&q, 1024); - test_assert(!err); - - int id0 = equeue_call_in(&q, 1, pass_func, 0); - int id1 = equeue_call_in(&q, 1, pass_func, 0); - int id2 = equeue_call_in(&q, 1, pass_func, 0); - - struct equeue_event *e = q.queue; - - for (; e; e = e->next) { - for (struct equeue_event *s = e->sibling; s; s = s->sibling) { - test_assert(!s->next); - } - } - test_assert(equeue_cancel(&q, id0)); - test_assert(equeue_cancel(&q, id1)); - test_assert(equeue_cancel(&q, id2)); - equeue_destroy(&q); -} - -struct user_allocated_event { - struct equeue_event e; - bool touched; -}; - -void user_allocated_event_test() -{ - equeue_t q; - int err = equeue_create(&q, EQUEUE_EVENT_SIZE); - test_assert(!err); - - bool touched = false; - struct user_allocated_event e1 = { { 0, 0, 0, NULL, NULL, NULL, 0, -1, NULL, NULL }, 0 }; - struct user_allocated_event e2 = { { 0, 0, 0, NULL, NULL, NULL, 1, -1, NULL, NULL }, 0 }; - struct user_allocated_event e3 = { { 0, 0, 0, NULL, NULL, NULL, 1, -1, NULL, NULL }, 0 }; - struct user_allocated_event e4 = { { 0, 0, 0, NULL, NULL, NULL, 1, -1, NULL, NULL }, 0 }; - struct user_allocated_event e5 = { { 0, 0, 0, NULL, NULL, NULL, 0, -1, NULL, NULL }, 0 }; - - test_assert(0 != equeue_call(&q, simple_func, &touched)); - test_assert(0 == equeue_call(&q, simple_func, &touched)); - test_assert(0 == equeue_call(&q, simple_func, &touched)); - - equeue_post_user_allocated(&q, simple_func, &e1.e); - equeue_post_user_allocated(&q, simple_func, &e2.e); - equeue_post_user_allocated(&q, simple_func, &e3.e); - equeue_post_user_allocated(&q, simple_func, &e4.e); - equeue_post_user_allocated(&q, simple_func, &e5.e); - test_assert(equeue_cancel_user_allocated(&q, &e3.e)); - - equeue_dispatch(&q, 1); - - test_assert(true == touched); - test_assert(true == e1.touched); - test_assert(true == e2.touched); - test_assert(false == e3.touched); - test_assert(true == e4.touched); - test_assert(true == e5.touched); - - equeue_dispatch(&q, 10); - - test_assert(true == touched); - test_assert(true == e1.touched); - test_assert(true == e2.touched); - test_assert(false == e3.touched); - test_assert(true == e4.touched); - test_assert(true == e5.touched); - - equeue_destroy(&q); -} - -void id_cycle() -{ - equeue_t q; - int err = equeue_create(&q, 10000000); - test_assert(!err); - - for (int i = 0; i < 300; i++) { - int id = equeue_call(&q, pass_func, 0); - test_assert(id != 0); - test_assert(equeue_cancel(&q, id)); - } - - equeue_destroy(&q); -} - -int main() -{ - printf("beginning tests...\n"); - - test_run(simple_call_test); - test_run(simple_call_in_test); - test_run(simple_call_every_test); - test_run(simple_post_test); - test_run(destructor_test); - test_run(allocation_failure_test); - test_run(cancel_test, 20); - test_run(cancel_inflight_test); - test_run(cancel_unnecessarily_test); - test_run(loop_protect_test); - test_run(break_test); - test_run(break_no_windup_test); - test_run(period_test); - test_run(nested_test); - test_run(sloth_test); - test_run(background_test); - test_run(chain_test); - test_run(unchain_test); - test_run(multithread_test); - test_run(simple_barrage_test, 20); - test_run(fragmenting_barrage_test, 20); - test_run(multithreaded_barrage_test, 20); - test_run(break_request_cleared_on_timeout); - test_run(sibling_test); - test_run(user_allocated_event_test); - test_run(id_cycle); - printf("done!\n"); - return test_failure; -} From 0bacd5b8e1daa2c0e721d4f956b4b667258dd717 Mon Sep 17 00:00:00 2001 From: Qinghao Shi Date: Tue, 28 Jul 2020 14:15:51 +0100 Subject: [PATCH 06/12] TESTS: update test with explicit skip message --- TESTS/mbed_hal/common_tickers_freq/main.cpp | 10 +++++++--- rtos/tests/TESTS/mbedmicro-rtos-mbed/basic/main.cpp | 8 ++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/TESTS/mbed_hal/common_tickers_freq/main.cpp b/TESTS/mbed_hal/common_tickers_freq/main.cpp index 28fa61d67f..fb4a88652f 100644 --- a/TESTS/mbed_hal/common_tickers_freq/main.cpp +++ b/TESTS/mbed_hal/common_tickers_freq/main.cpp @@ -29,10 +29,14 @@ #include "hal/lp_ticker_api.h" #include "hal/mbed_lp_ticker_wrapper.h" -#if defined(SKIP_TIME_DRIFT_TESTS) || !DEVICE_USTICKER -#error [NOT_SUPPORTED] test not supported +#if !DEVICE_USTICKER +#error [NOT_SUPPORTED] UsTicker need to be enabled for this test #else +#if defined(SKIP_TIME_DRIFT_TESTS) +#error [NOT_SUPPORTED] timing accuracy tests skipped +#endif // defined(SKIP_TIME_DRIFT_TESTS) + #define US_PER_S 1000000 using namespace utest::v1; @@ -208,4 +212,4 @@ int main() Harness::run(specification); } -#endif // defined(SKIP_TIME_DRIFT_TESTS) || !DEVICE_USTICKER +#endif // !DEVICE_USTICKER diff --git a/rtos/tests/TESTS/mbedmicro-rtos-mbed/basic/main.cpp b/rtos/tests/TESTS/mbedmicro-rtos-mbed/basic/main.cpp index a405ca7011..48839f0e4a 100644 --- a/rtos/tests/TESTS/mbedmicro-rtos-mbed/basic/main.cpp +++ b/rtos/tests/TESTS/mbedmicro-rtos-mbed/basic/main.cpp @@ -23,10 +23,14 @@ #include "utest/utest.h" #include "unity/unity.h" -#if defined(SKIP_TIME_DRIFT_TESTS) || !DEVICE_USTICKER +#if !DEVICE_USTICKER #error [NOT_SUPPORTED] UsTicker need to be enabled for this test. #else +#if defined(SKIP_TIME_DRIFT_TESTS) +#error [NOT_SUPPORTED] timing accuracy tests skipped +#endif // defined(SKIP_TIME_DRIFT_TESTS + using utest::v1::Case; using std::milli; using std::micro; @@ -122,5 +126,5 @@ int main() utest::v1::Harness::run(specification); } -#endif // defined(SKIP_TIME_DRIFT_TESTS) || !DEVICE_USTICKER +#endif // !DEVICE_USTICKER #endif // defined(MBED_RTOS_SINGLE_THREAD) || !defined(MBED_CONF_RTOS_PRESENT) From fe8e51fde2cd2c263c6681ee8cf3c9d80416175c Mon Sep 17 00:00:00 2001 From: Qinghao Shi Date: Tue, 28 Jul 2020 14:16:56 +0100 Subject: [PATCH 07/12] TESTS: fix timing drift test in rtos folder --- .../TESTS/host_tests/timing_drift_auto.py | 136 ++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 rtos/tests/TESTS/host_tests/timing_drift_auto.py diff --git a/rtos/tests/TESTS/host_tests/timing_drift_auto.py b/rtos/tests/TESTS/host_tests/timing_drift_auto.py new file mode 100644 index 0000000000..65ac90a160 --- /dev/null +++ b/rtos/tests/TESTS/host_tests/timing_drift_auto.py @@ -0,0 +1,136 @@ +""" +mbed SDK +Copyright (c) 2011-2013 ARM Limited +SPDX-License-Identifier: Apache-2.0 + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + +from mbed_host_tests import BaseHostTest +import time + + +class TimingDriftSync(BaseHostTest): + """ + This works as master-slave fashion + 1) Device says its booted up and ready to run the test, wait for host to respond + 2) Host sends the message to get the device current time i.e base time + + # + # * + # * | + #<---* DUT<- base_time | - round_trip_base_time ------ + # * | | + # * - | + # - | + # | | + # | | + # | - measurement_stretch | - nominal_time + # | | + # | | + # - | + # * - | + # * | | + #<---* DUT <-final_time | - round_trip_final_time------ + # * | + # * - + # + # + # As we increase the measurement_stretch, the error because of transport delay diminishes. + # The values of measurement_stretch is propotional to round_trip_base_time(transport delays) + # by factor time_measurement_multiplier.This multiplier is used is 80 to tolerate 2 sec of + # transport delay and test time ~ 180 secs + # + # Failure in timing can occur if we are ticking too fast or we are ticking too slow, hence we have + # min_range and max_range. if we cross on either side tests would be marked fail. The range is a function of + # tolerance/acceptable drift currently its 5%. + # + + """ + __result = None + mega = 1000000.0 + max_measurement_time = 180 + + # this value is obtained for measurements when there is 0 transport delay and we want accurancy of 5% + time_measurement_multiplier = 80 + + def _callback_timing_drift_check_start(self, key, value, timestamp): + self.round_trip_base_start = timestamp + self.send_kv("base_time", 0) + + def _callback_base_time(self, key, value, timestamp): + self.round_trip_base_end = timestamp + self.device_time_base = float(value) + self.round_trip_base_time = self.round_trip_base_end - self.round_trip_base_start + + self.log("Device base time {}".format(value)) + measurement_stretch = (self.round_trip_base_time * self.time_measurement_multiplier) + 5 + + if measurement_stretch > self.max_measurement_time: + self.log("Time required {} to determine device timer is too high due to transport delay, skipping".format(measurement_stretch)) + else: + self.log("sleeping for {} to measure drift accurately".format(measurement_stretch)) + time.sleep(measurement_stretch) + self.round_trip_final_start = time.time() + self.send_kv("final_time", 0) + + def _callback_final_time(self, key, value, timestamp): + self.round_trip_final_end = timestamp + self.device_time_final = float(value) + self.round_trip_final_time = self.round_trip_final_end - self.round_trip_final_start + self.log("Device final time {} ".format(value)) + + # compute the test results and send to device + results = "pass" if self.compute_parameter() else "fail" + self.send_kv(results, "0") + + def setup(self): + self.register_callback('timing_drift_check_start', self._callback_timing_drift_check_start) + self.register_callback('base_time', self._callback_base_time) + self.register_callback('final_time', self._callback_final_time) + + def compute_parameter(self, failure_criteria=0.05): + t_max = self.round_trip_final_end - self.round_trip_base_start + t_min = self.round_trip_final_start - self.round_trip_base_end + t_max_hi = t_max * (1 + failure_criteria) + t_max_lo = t_max * (1 - failure_criteria) + t_min_hi = t_min * (1 + failure_criteria) + t_min_lo = t_min * (1 - failure_criteria) + device_time = (self.device_time_final - self.device_time_base) / self.mega + + self.log("Compute host events") + self.log("Transport delay 0: {}".format(self.round_trip_base_time)) + self.log("Transport delay 1: {}".format(self.round_trip_final_time)) + self.log("DUT base time : {}".format(self.device_time_base)) + self.log("DUT end time : {}".format(self.device_time_final)) + + self.log("min_pass : {} , max_pass : {} for {}%%".format(t_max_lo, t_min_hi, failure_criteria * 100)) + self.log("min_inconclusive : {} , max_inconclusive : {}".format(t_min_lo, t_max_hi)) + self.log("Time reported by device: {}".format(device_time)) + + if t_max_lo <= device_time <= t_min_hi: + self.log("Test passed !!!") + self.__result = True + elif t_min_lo <= device_time <= t_max_hi: + self.log("Test inconclusive due to transport delay, retrying") + self.__result = False + else: + self.log("Time outside of passing range. Timing drift seems to be present !!!") + self.__result = False + return self.__result + + def result(self): + return self.__result + + def teardown(self): + pass From b7c0e89eb99f2b35999390c4ffdd326abcd9b0da Mon Sep 17 00:00:00 2001 From: Matthew Macovsky Date: Tue, 28 Jul 2020 11:35:35 -0700 Subject: [PATCH 08/12] Fix IAR assembler errors on except.S Fixes two errors produced on except.S by the IAR assembler (as seen in issue #13200). The first: "'ALIGN' is illegal. Use directive ALIGNROM or ALIGNRAM (the first parameter is raised to the power of 2, the second is a 32-bit fill value)." Fixed by changing ALIGN to ALIGNROM 2 to align to a 4-byte boundary (mirroring what ALIGN does in the ARM except.S). The second (on THUMB): "Must be placed inside a section" Fixed by moving THUMB after the SECTION directive so that it affects that section. --- platform/source/TARGET_CORTEX_M/TOOLCHAIN_IAR/except.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/source/TARGET_CORTEX_M/TOOLCHAIN_IAR/except.S b/platform/source/TARGET_CORTEX_M/TOOLCHAIN_IAR/except.S index 8455ec75e9..dfa5a2f1cc 100644 --- a/platform/source/TARGET_CORTEX_M/TOOLCHAIN_IAR/except.S +++ b/platform/source/TARGET_CORTEX_M/TOOLCHAIN_IAR/except.S @@ -36,9 +36,9 @@ FAULT_TYPE_BUS_FAULT EQU 0x30 FAULT_TYPE_USAGE_FAULT EQU 0x40 PRESERVE8 - THUMB SECTION .text:CODE:NOROOT(2) + THUMB HardFault_Handler EXPORT HardFault_Handler @@ -111,7 +111,7 @@ Fault_Handler_Continue2 #else B . #endif - ALIGN + ALIGNROM 2 #endif END From f026f0d54f9b5bd35a16c31694aaa2d8e4ba1f2b Mon Sep 17 00:00:00 2001 From: Rajkumar Kanagaraj Date: Thu, 30 Jul 2020 03:47:52 -0700 Subject: [PATCH 09/12] Move nanostack rf driver from features/nanostack/nanostack-interface into connectivity/drivers/802.15.4_RF --- .../TARGET_Freescale/TARGET_KW41Z/NanostackRfPhyKw41z.cpp | 0 .../TARGET_Freescale/TARGET_KW41Z/NanostackRfPhyKw41z.h | 0 .../802.15.4_RF/TARGET_Freescale/TARGET_KW41Z/mbed_lib.json | 3 +++ .../TARGET_Silicon_Labs/TARGET_SL_RAIL/NanostackRfPhyEfr32.cpp | 0 .../TARGET_Silicon_Labs/TARGET_SL_RAIL/NanostackRfPhyEfr32.h | 0 .../TARGET_Silicon_Labs/TARGET_SL_RAIL/mbed_lib.json | 3 +++ 6 files changed, 6 insertions(+) rename {features/nanostack/nanostack-interface/targets => connectivity/drivers/802.15.4_RF}/TARGET_Freescale/TARGET_KW41Z/NanostackRfPhyKw41z.cpp (100%) rename {features/nanostack/nanostack-interface/targets => connectivity/drivers/802.15.4_RF}/TARGET_Freescale/TARGET_KW41Z/NanostackRfPhyKw41z.h (100%) create mode 100644 connectivity/drivers/802.15.4_RF/TARGET_Freescale/TARGET_KW41Z/mbed_lib.json rename {features/nanostack/nanostack-interface/targets => connectivity/drivers/802.15.4_RF}/TARGET_Silicon_Labs/TARGET_SL_RAIL/NanostackRfPhyEfr32.cpp (100%) rename {features/nanostack/nanostack-interface/targets => connectivity/drivers/802.15.4_RF}/TARGET_Silicon_Labs/TARGET_SL_RAIL/NanostackRfPhyEfr32.h (100%) create mode 100644 connectivity/drivers/802.15.4_RF/TARGET_Silicon_Labs/TARGET_SL_RAIL/mbed_lib.json diff --git a/features/nanostack/nanostack-interface/targets/TARGET_Freescale/TARGET_KW41Z/NanostackRfPhyKw41z.cpp b/connectivity/drivers/802.15.4_RF/TARGET_Freescale/TARGET_KW41Z/NanostackRfPhyKw41z.cpp similarity index 100% rename from features/nanostack/nanostack-interface/targets/TARGET_Freescale/TARGET_KW41Z/NanostackRfPhyKw41z.cpp rename to connectivity/drivers/802.15.4_RF/TARGET_Freescale/TARGET_KW41Z/NanostackRfPhyKw41z.cpp diff --git a/features/nanostack/nanostack-interface/targets/TARGET_Freescale/TARGET_KW41Z/NanostackRfPhyKw41z.h b/connectivity/drivers/802.15.4_RF/TARGET_Freescale/TARGET_KW41Z/NanostackRfPhyKw41z.h similarity index 100% rename from features/nanostack/nanostack-interface/targets/TARGET_Freescale/TARGET_KW41Z/NanostackRfPhyKw41z.h rename to connectivity/drivers/802.15.4_RF/TARGET_Freescale/TARGET_KW41Z/NanostackRfPhyKw41z.h diff --git a/connectivity/drivers/802.15.4_RF/TARGET_Freescale/TARGET_KW41Z/mbed_lib.json b/connectivity/drivers/802.15.4_RF/TARGET_Freescale/TARGET_KW41Z/mbed_lib.json new file mode 100644 index 0000000000..ce3d225924 --- /dev/null +++ b/connectivity/drivers/802.15.4_RF/TARGET_Freescale/TARGET_KW41Z/mbed_lib.json @@ -0,0 +1,3 @@ +{ + "name": "ns-kw41z-rf" +} diff --git a/features/nanostack/nanostack-interface/targets/TARGET_Silicon_Labs/TARGET_SL_RAIL/NanostackRfPhyEfr32.cpp b/connectivity/drivers/802.15.4_RF/TARGET_Silicon_Labs/TARGET_SL_RAIL/NanostackRfPhyEfr32.cpp similarity index 100% rename from features/nanostack/nanostack-interface/targets/TARGET_Silicon_Labs/TARGET_SL_RAIL/NanostackRfPhyEfr32.cpp rename to connectivity/drivers/802.15.4_RF/TARGET_Silicon_Labs/TARGET_SL_RAIL/NanostackRfPhyEfr32.cpp diff --git a/features/nanostack/nanostack-interface/targets/TARGET_Silicon_Labs/TARGET_SL_RAIL/NanostackRfPhyEfr32.h b/connectivity/drivers/802.15.4_RF/TARGET_Silicon_Labs/TARGET_SL_RAIL/NanostackRfPhyEfr32.h similarity index 100% rename from features/nanostack/nanostack-interface/targets/TARGET_Silicon_Labs/TARGET_SL_RAIL/NanostackRfPhyEfr32.h rename to connectivity/drivers/802.15.4_RF/TARGET_Silicon_Labs/TARGET_SL_RAIL/NanostackRfPhyEfr32.h diff --git a/connectivity/drivers/802.15.4_RF/TARGET_Silicon_Labs/TARGET_SL_RAIL/mbed_lib.json b/connectivity/drivers/802.15.4_RF/TARGET_Silicon_Labs/TARGET_SL_RAIL/mbed_lib.json new file mode 100644 index 0000000000..4547bda3cf --- /dev/null +++ b/connectivity/drivers/802.15.4_RF/TARGET_Silicon_Labs/TARGET_SL_RAIL/mbed_lib.json @@ -0,0 +1,3 @@ +{ + "name": "ns-efr32-rf" +} From 6167d46b912f7e530f9421d619efe095317e2a86 Mon Sep 17 00:00:00 2001 From: Qinghao Shi Date: Mon, 13 Jul 2020 10:52:44 +0100 Subject: [PATCH 10/12] TESTS: removed mbed OS 6 unsupported target in examples test --- tools/test/examples/examples.json | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tools/test/examples/examples.json b/tools/test/examples/examples.json index 8ca728a397..902a85b60a 100644 --- a/tools/test/examples/examples.json +++ b/tools/test/examples/examples.json @@ -339,7 +339,7 @@ "sub-repo-example": false, "subs": [], "features" : [], - "targets" : ["ARM_MUSCA_A1", "ARM_MUSCA_B1", "K64F", "CY8CKIT_064S2_4343W"], + "targets" : ["ARM_MUSCA_B1", "K64F"], "toolchains" : ["GCC_ARM", "ARM"], "exporters": [], "compile" : true, @@ -441,11 +441,7 @@ "sub-repo-example": false, "subs": [], "features" : [], - "targets" : ["CY8CKIT_062_WIFI_BT_PSA", - "K66F", - "NUCLEO_F429ZI", - "LPC55S69_NS" - ], + "targets" : [ "K66F", "NUCLEO_F429ZI" ], "toolchains" : [], "exporters": [], "compile" : true, From c4c120b390a9ef9d5af745ed6923d0d97f9b65e4 Mon Sep 17 00:00:00 2001 From: Qinghao Shi Date: Tue, 14 Jul 2020 15:39:14 +0100 Subject: [PATCH 11/12] TESTS: add new psa targets --- tools/test/examples/examples.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/test/examples/examples.json b/tools/test/examples/examples.json index 902a85b60a..4fa8c6ec88 100644 --- a/tools/test/examples/examples.json +++ b/tools/test/examples/examples.json @@ -345,7 +345,7 @@ "compile" : true, "export": true, "test" : true, - "baud_rate": 115200, + "baud_rate": 9600, "compare_log": ["mbed-os-example-psa/tests/psa.log"], "auto-update" : true }, @@ -441,7 +441,7 @@ "sub-repo-example": false, "subs": [], "features" : [], - "targets" : [ "K66F", "NUCLEO_F429ZI" ], + "targets" : [ "K66F", "NUCLEO_F429ZI", "ARM_MUSCA_B1"], "toolchains" : [], "exporters": [], "compile" : true, From 49924b8a0b3f2f060f847271d9e1e50a0c48c714 Mon Sep 17 00:00:00 2001 From: Rajkumar Kanagaraj Date: Thu, 30 Jul 2020 10:24:58 -0700 Subject: [PATCH 12/12] Add mbed_lib.json config to avoid emac drivers source includes by default --- .../emac/TARGET_ARM_FM/COMPONENT_LAN91C111/mbed_lib.json | 3 +++ connectivity/drivers/emac/TARGET_Cypress/mbed_lib.json | 3 +++ connectivity/drivers/emac/TARGET_GD_EMAC/mbed_lib.json | 3 +++ connectivity/drivers/emac/TARGET_NUVOTON_EMAC/mbed_lib.json | 3 +++ .../emac/TARGET_NXP_EMAC/TARGET_LPCTarget/mbed_lib.json | 3 +++ .../emac/TARGET_NXP_EMAC/TARGET_MCU_LPC546XX/mbed_lib.json | 3 +++ connectivity/drivers/emac/TARGET_RDA_EMAC/mbed_lib.json | 3 +++ connectivity/drivers/emac/TARGET_RZ_A1_EMAC/mbed_lib.json | 3 +++ 8 files changed, 24 insertions(+) create mode 100644 connectivity/drivers/emac/TARGET_ARM_FM/COMPONENT_LAN91C111/mbed_lib.json create mode 100644 connectivity/drivers/emac/TARGET_Cypress/mbed_lib.json create mode 100644 connectivity/drivers/emac/TARGET_GD_EMAC/mbed_lib.json create mode 100644 connectivity/drivers/emac/TARGET_NUVOTON_EMAC/mbed_lib.json create mode 100644 connectivity/drivers/emac/TARGET_NXP_EMAC/TARGET_LPCTarget/mbed_lib.json create mode 100644 connectivity/drivers/emac/TARGET_NXP_EMAC/TARGET_MCU_LPC546XX/mbed_lib.json create mode 100644 connectivity/drivers/emac/TARGET_RDA_EMAC/mbed_lib.json create mode 100644 connectivity/drivers/emac/TARGET_RZ_A1_EMAC/mbed_lib.json diff --git a/connectivity/drivers/emac/TARGET_ARM_FM/COMPONENT_LAN91C111/mbed_lib.json b/connectivity/drivers/emac/TARGET_ARM_FM/COMPONENT_LAN91C111/mbed_lib.json new file mode 100644 index 0000000000..f9757b47c4 --- /dev/null +++ b/connectivity/drivers/emac/TARGET_ARM_FM/COMPONENT_LAN91C111/mbed_lib.json @@ -0,0 +1,3 @@ +{ + "name": "lan91c111-emac" +} diff --git a/connectivity/drivers/emac/TARGET_Cypress/mbed_lib.json b/connectivity/drivers/emac/TARGET_Cypress/mbed_lib.json new file mode 100644 index 0000000000..e8680a3b33 --- /dev/null +++ b/connectivity/drivers/emac/TARGET_Cypress/mbed_lib.json @@ -0,0 +1,3 @@ +{ + "name": "cypress-emac" +} diff --git a/connectivity/drivers/emac/TARGET_GD_EMAC/mbed_lib.json b/connectivity/drivers/emac/TARGET_GD_EMAC/mbed_lib.json new file mode 100644 index 0000000000..0f890c37cf --- /dev/null +++ b/connectivity/drivers/emac/TARGET_GD_EMAC/mbed_lib.json @@ -0,0 +1,3 @@ +{ + "name": "gd-emac" +} diff --git a/connectivity/drivers/emac/TARGET_NUVOTON_EMAC/mbed_lib.json b/connectivity/drivers/emac/TARGET_NUVOTON_EMAC/mbed_lib.json new file mode 100644 index 0000000000..bad3b6857d --- /dev/null +++ b/connectivity/drivers/emac/TARGET_NUVOTON_EMAC/mbed_lib.json @@ -0,0 +1,3 @@ +{ + "name": "nuvoton-emac" +} diff --git a/connectivity/drivers/emac/TARGET_NXP_EMAC/TARGET_LPCTarget/mbed_lib.json b/connectivity/drivers/emac/TARGET_NXP_EMAC/TARGET_LPCTarget/mbed_lib.json new file mode 100644 index 0000000000..39fa8c23c3 --- /dev/null +++ b/connectivity/drivers/emac/TARGET_NXP_EMAC/TARGET_LPCTarget/mbed_lib.json @@ -0,0 +1,3 @@ +{ + "name": "lpc17-emac" +} diff --git a/connectivity/drivers/emac/TARGET_NXP_EMAC/TARGET_MCU_LPC546XX/mbed_lib.json b/connectivity/drivers/emac/TARGET_NXP_EMAC/TARGET_MCU_LPC546XX/mbed_lib.json new file mode 100644 index 0000000000..233284cab7 --- /dev/null +++ b/connectivity/drivers/emac/TARGET_NXP_EMAC/TARGET_MCU_LPC546XX/mbed_lib.json @@ -0,0 +1,3 @@ +{ + "name": "lpc546xx-emac" +} diff --git a/connectivity/drivers/emac/TARGET_RDA_EMAC/mbed_lib.json b/connectivity/drivers/emac/TARGET_RDA_EMAC/mbed_lib.json new file mode 100644 index 0000000000..a0fbd3bfb2 --- /dev/null +++ b/connectivity/drivers/emac/TARGET_RDA_EMAC/mbed_lib.json @@ -0,0 +1,3 @@ +{ + "name": "rda5981x-emac" +} diff --git a/connectivity/drivers/emac/TARGET_RZ_A1_EMAC/mbed_lib.json b/connectivity/drivers/emac/TARGET_RZ_A1_EMAC/mbed_lib.json new file mode 100644 index 0000000000..6521e891b5 --- /dev/null +++ b/connectivity/drivers/emac/TARGET_RZ_A1_EMAC/mbed_lib.json @@ -0,0 +1,3 @@ +{ + "name": "rza1-emac" +}