Skip to content

Release candidate for mbed-os-5.9.4 #7631

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 132 commits into from
Jul 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
132 commits
Select commit Hold shift + click to select a range
a8d99d6
NVStore tests: Tune memory consumption; stop threads greafully
Jun 5, 2018
f86bb29
Add EFM32GG11_STK3701 support
stevew817 May 29, 2018
43c81de
Add EFM32GG11 Ethernet driver
stevew817 May 29, 2018
20387d4
Unity: Add macros for test skipping.
Jul 9, 2018
0ac5f32
Show Mbed 2 support in compile -S
theotherjimmy Jul 2, 2018
949c330
Add one new target M2351, regard as M0+ with some V8M CPU control at …
cyliangtw Jun 30, 2017
d67d32d
Sync SDH_CardDetection type to avoid GCC compiler error
cyliangtw Jul 4, 2017
db10dc0
Support GCC & IAR toolchain
cyliangtw Jul 4, 2017
e1a9492
Support __vector_table instead of __vector_handlers in IAR
cyliangtw Jul 4, 2017
7208455
remove progen, not used any more
cyliangtw Jul 5, 2017
a05d449
Remove mbed_sdk_init_forced 1. mbed_sdk_init is called before C++ glo…
cyliangtw Jul 12, 2017
9845764
Add partition header file for CMSE feature
cyliangtw Aug 10, 2017
a7723c4
Modify Nuvoton common files to avoid conflicting with master
cyliangtw Aug 15, 2017
eff7974
Revise nu_bitutil.h for M23
cyliangtw Aug 18, 2017
5876114
Use Cortex M23 specific header files and interrupts
Aug 11, 2017
0468bf2
Added xx_ticker_fire_interrupt function for M2351 device
Aug 17, 2017
f1336c9
Set SAU Region present flag for M2351 device and include security hea…
Sep 11, 2017
42b713c
Removed device name, till device patch is added to IAR/Keil
Sep 12, 2017
0be7de0
ARMC6 compiler related changes
Sep 14, 2017
bcfe934
Update GCC linker for NSC Veneer
cyliangtw Sep 15, 2017
cee23da
Linker files support both of secure & non-secure domain
cyliangtw Sep 19, 2017
16a6012
IAR linker file support both of secure & non-secure domain
cyliangtw Sep 19, 2017
2bf79ca
Fix GCC linker file 'cannot move location counter backwards' issue
cyliangtw Sep 20, 2017
d7964f4
Corrected preprocess define usage in toolchain specific linker files
Sep 27, 2017
e674eda
Support secure loader invoke non-secure Mbed OS
cyliangtw Sep 27, 2017
625bfa8
Link register base with partition file & correct heap size in linker …
cyliangtw Sep 29, 2017
a70e6f5
Corrected Vector table address in scatter file
Sep 29, 2017
ea72d5e
Add non-secure reset handler address
Oct 10, 2017
7a48a74
Support TrustZone in port_read/port_write
Oct 17, 2017
f3afbf2
Migrate for MP chip version, build sucessfully
cyliangtw Jan 23, 2018
2bd15ea
Remove redundant GetPC
cyliangtw Jan 24, 2018
602aac8
Sync IRQ arrangement to fulfill MP version
cyliangtw Jan 24, 2018
1f891fc
Resolve reset halt issue in MP chip A version
cyliangtw Jan 24, 2018
6e799ec
Set 48KB SRAM and UART0 as non-secure
cyliangtw Jan 25, 2018
4561c86
Set secure SRAM size as 24KB in SAU & SCU
cyliangtw Jan 25, 2018
db4048d
Add gpio_is_connected
cyliangtw Feb 7, 2018
d710ee0
Disabled fault handler support
Feb 16, 2018
f861923
To fulfill _rtc_localtime one more argument
cyliangtw Feb 22, 2018
f5029ff
Fix target configuration
ccli8 Mar 14, 2018
dbaf7ea
Fix STDIO UART
ccli8 Feb 14, 2018
e51be32
Configure most modules to non-secure
ccli8 Mar 14, 2018
07548bd
Unify secure/non-secure peripheral base based on partition file
ccli8 Feb 9, 2018
001aa01
Add secure BSP driver function
ccli8 Mar 2, 2018
7f0e35f
Fix HCLK clock source
ccli8 Mar 5, 2018
160c268
Fix SystemCoreClockUpdate isn't called in non-secure domain
ccli8 Feb 27, 2018
3f4da61
Fix GPIO to be TrustZone-aware
ccli8 Feb 26, 2018
a1c8803
Rework RTC
ccli8 Feb 9, 2018
7cf3501
Remove peripheral sleep management from hal_sleep/hal_deepsleep
ccli8 Feb 26, 2018
2cd825d
Rework us_ticker and lp_ticker
cyliangtw Jan 25, 2018
61a021c
Support PDMA
ccli8 Feb 2, 2018
a8ed3ff
Refine UART code
ccli8 Mar 8, 2018
ffe1e23
Support SPI
ccli8 Feb 2, 2018
c7ed684
Support I2C
ccli8 Mar 9, 2018
c34d8ae
Trim HIRC48 to 48M against LXT
ccli8 Mar 19, 2018
68b8db1
Add missing delay in lp_ticker
ccli8 Mar 16, 2018
3ac5e48
Support flash IAP
ccli8 Feb 12, 2018
d2f5548
Fix page size in flash IAP
ccli8 Mar 22, 2018
1e7b6ee
Upgrade partition format
ccli8 Mar 28, 2018
3950b12
Change NSC location
ccli8 Mar 28, 2018
b86c957
Centralize size configuration for secure flash, secure SRAM, NSC, and…
ccli8 Mar 28, 2018
bce2b64
Support TRNG
ccli8 Apr 2, 2018
6b811af
Support analog-in
ccli8 Mar 6, 2018
b1b57d2
Support PWM out
ccli8 Mar 6, 2018
d611a3c
Add GPIO debounce configuration in targets.json
ccli8 Apr 2, 2018
5839431
Remove dead code with '#if 0' in SPI
ccli8 Apr 10, 2018
f6642cb
Add consistency check for CRYPTO/CRPT's secure attribute and TRNG/Mbe…
ccli8 Apr 10, 2018
ad5772a
Fix part number in IAR export
ccli8 Apr 16, 2018
07b21b4
Support TrustZone and bootloader for IAR
ccli8 Apr 16, 2018
0e6a76f
Replace __attribute__((cmse_nonsecure_entry)) with compiler agnostic …
ccli8 Apr 13, 2018
754589b
Default MBED_TZ_DEFAULT_ACCESS to 1 to control secure SYS/CLK regions…
ccli8 Apr 24, 2018
c91f71b
Add SD pinmap
ccli8 Apr 27, 2018
18ce2e1
Add secure gateway functions SYS_LockReg_S/SYS_UnlockReg_S
ccli8 Apr 27, 2018
543f72d
Meet new us_ticker HAL spec (Mbed OS 5.9)
ccli8 May 28, 2018
d5d8c23
Meet new lp_ticker HAL spec (Mbed OS 5.9)
ccli8 May 28, 2018
9fac970
Meet new RTC HAL spec (Mbed OS 5.9)
ccli8 May 28, 2018
f268b12
Change secure/non-secure stack/heap size
ccli8 May 3, 2018
ae64129
Change secure flash/SRAM to 256KB/32KB as default
ccli8 Jun 8, 2018
e9a7d88
Change pinout to meet NuMaker-PFM-M2351 V1.1
ccli8 Jun 19, 2018
4bb1f28
Upgrade chip version to B from A
ccli8 Jun 19, 2018
974c52b
Fix Greentea test code with Cortex-M23/M33
ccli8 Mar 5, 2018
5eb07dc
Allow non-secure main thread to call secure functions
ccli8 May 22, 2018
aea8f61
Remove NUMAKER_PFM_M2351_S/_NS targets
ccli8 Jun 29, 2018
23ba1da
Remove special handling for dummy interrupt in lp_ticker
ccli8 Jul 2, 2018
e1a6d9f
Synchronize lp_ticker code to us_ticker
ccli8 Jul 2, 2018
0f28bca
Fix include file name error on case-sensitive system
ccli8 Jul 3, 2018
f22d164
Add `Mxx_NS` core-based labels
theotherjimmy Jul 3, 2018
b3c47a1
Place default secure binary/library
ccli8 Jul 9, 2018
b195594
Support configurable for partitioning flash/SRAM
ccli8 Jun 8, 2018
256d94b
Update compiler check to allow only v6 for OS 5
theotherjimmy Jul 11, 2018
480a2fe
Fix binary-compatible across compilers in secure functions
ccli8 Jul 12, 2018
ee0806d
Remove M2351KIAAEES from iar_definitions.json
ccli8 Jul 13, 2018
0c304f0
Adding missing ENDP for ARM
Jul 13, 2018
69a6729
Support only ARMC6 toolchain
Jul 13, 2018
3924c77
Allow ARMC6 only mbed 5 releases
theotherjimmy Jul 16, 2018
decdc93
Correct uvision exporter support check
theotherjimmy Jul 16, 2018
0cf7b7e
Disable make_armc6 on v8m
theotherjimmy Jul 17, 2018
094268e
Remove LoRaWAN license from top-level directory
geky Jul 10, 2018
87aa896
Fix linker script for NRF52832/IAR
Jul 17, 2018
71a2a39
Fix ITM on NRF52 series
Jun 29, 2018
48fa58b
Improved formatting for preprocessor conditionals.
TacoGrandeTX Jul 12, 2018
d7c925d
Removed extra ARMc6 instance in unique mapping
Jul 18, 2018
a4c40fd
Add implementation for CRC API
stevew817 Jul 11, 2018
5da9794
LoRaWAN: Wrong return code for JoinRequest retry
Jul 16, 2018
2551055
Fix some targets fail to pass ticker overflow test
ccli8 Jul 19, 2018
48378cf
STM32F2/F4/F7 : LL API is now available
jeromecoutant Jul 18, 2018
d5adad5
EFM32 Make PeripheralPins.c configuration tables weakly defined to be…
steinerphilipp Jul 12, 2018
20a0e8f
Make PeripheralPins.c configuration tables weakly defined to be overr…
steinerphilipp Jul 16, 2018
9b3f321
Replace __attribute__((weak)) with MBED_WEAK
steinerphilipp Jul 16, 2018
fdbd676
Added missing include.
steinerphilipp Jul 16, 2018
72869a2
Place "MBED_WEAK" for IAR-Toolchain before the type.
steinerphilipp Jul 17, 2018
967ab1b
Fix spelling in error message in fault handler
SenRamakri Jul 19, 2018
83d95ad
Added Support for Toshiba TMPM3H6
Jul 18, 2018
82ce7c8
Resolved conflict in targets/targets.json
Jul 19, 2018
87ac96e
Add MTS Dragonfly bootloader back after accidental removal from pr #7131
Jul 11, 2018
822bf98
Improve GPIO IRQ edge detection when waking from deepsleep
mattbrown015 Jul 13, 2018
5c29ed8
add GPIO Pad Type Define & fix typo
Jul 16, 2018
6345835
fix GPIO bug & typo initialization bug
Jul 16, 2018
a1e2910
add Systick configuration function in Init function
Jul 16, 2018
ead552f
fix timer Interrupt callback function bug
Jul 16, 2018
6064af0
Systimer test : compilation error with MBED_TICKLESS
jeromecoutant Jul 17, 2018
becdc31
STM32L496: fix RAM size in ARM scatter file
bcostm Jul 19, 2018
d829066
enable HAL FLASH API on Fast Models MPS2 targets
Jul 19, 2018
73fedec
Revise heap and stack size for Ethernet of GR-PEACH
TomoYamanaka Jul 19, 2018
ad7cb65
realtek rtl8195am remove DEVICE_EMAC
M-ichae-l Jul 19, 2018
9334082
realtek rtl8195am remove DEVICE_EMAC
M-ichae-l Jul 19, 2018
101cade
Improved logic in wait_us to avoid division operation in sub-millisec…
SenRamakri Jul 23, 2018
5e8fa8b
Makes Greentea TCP test cases to timeout less in connection errors
Jul 23, 2018
f0c4e94
Replace __wrap__sbrk with overriding _sbrk
ccli8 Jul 26, 2018
6de34fb
Make location meaningful in print_error_report
bremoran Jul 26, 2018
2dc2225
WICED based WiFi devices still need FEATURE_LWIP
Jul 25, 2018
d581e40
Update Mbed version block
Jul 28, 2018
6974f23
Fixed LWIP/EMAC issue for additional targets
Jul 28, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
25 changes: 0 additions & 25 deletions LICENSE-BSD-3-Clause

This file was deleted.

32 changes: 24 additions & 8 deletions TESTS/mbed_hal/common_tickers/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@
#define TICKER_INT_VAL 500
#define TICKER_DELTA 10

#define LP_TICKER_OVERFLOW_DELTA 0 // this will allow to detect that ticker counter rollovers to 0
#define US_TICKER_OVERFLOW_DELTA 50
#define LP_TICKER_OVERFLOW_DELTA1 0 // this will allow to detect that ticker counter rollovers to 0
#define LP_TICKER_OVERFLOW_DELTA2 0
#define US_TICKER_OVERFLOW_DELTA1 50
#define US_TICKER_OVERFLOW_DELTA2 60

#define TICKER_100_TICKS 100

Expand All @@ -48,7 +50,18 @@ using namespace utest::v1;
volatile int intFlag = 0;
const ticker_interface_t* intf;
ticker_irq_handler_type prev_irq_handler;
unsigned int ticker_overflow_delta;
/* Some targets might fail overflow test uncertainly due to getting trapped in busy
* intf->read() loop. In the loop, some ticker values wouldn't get caught in time
* because of:
* 1. Lower CPU clock
* 2. Compiled code with worse performance
* 3. Interrupt at that time
*
* We fix it by checking small ticker value range rather than one exact ticker point
* in near overflow check.
*/
unsigned int ticker_overflow_delta1;
unsigned int ticker_overflow_delta2;

/* Auxiliary function to count ticker ticks elapsed during execution of N cycles of empty while loop.
* Parameter <step> is used to disable compiler optimisation. */
Expand Down Expand Up @@ -293,12 +306,13 @@ void ticker_overflow_test(void)
intFlag = 0;

/* Wait for max count. */
while (intf->read() != (max_count - ticker_overflow_delta)) {
while (intf->read() >= (max_count - ticker_overflow_delta2) &&
intf->read() <= (max_count - ticker_overflow_delta1)) {
/* Just wait. */
}

/* Now we are near/at the overflow point. Detect rollover. */
while (intf->read() > ticker_overflow_delta);
while (intf->read() > ticker_overflow_delta1);

const uint32_t after_overflow = intf->read();

Expand All @@ -310,7 +324,7 @@ void ticker_overflow_test(void)
const uint32_t next_after_overflow = intf->read();

/* Check that after the overflow ticker continue count. */
TEST_ASSERT(after_overflow <= ticker_overflow_delta);
TEST_ASSERT(after_overflow <= ticker_overflow_delta1);
TEST_ASSERT(next_after_overflow >= TICKER_100_TICKS);
TEST_ASSERT_EQUAL(0, intFlag);

Expand Down Expand Up @@ -465,7 +479,8 @@ utest::v1::status_t us_ticker_setup(const Case *const source, const size_t index

prev_irq_handler = set_us_ticker_irq_handler(ticker_event_handler_stub);

ticker_overflow_delta = US_TICKER_OVERFLOW_DELTA;
ticker_overflow_delta1 = US_TICKER_OVERFLOW_DELTA1;
ticker_overflow_delta2 = US_TICKER_OVERFLOW_DELTA2;

return greentea_case_setup_handler(source, index_of_case);
}
Expand Down Expand Up @@ -493,7 +508,8 @@ utest::v1::status_t lp_ticker_setup(const Case *const source, const size_t index

prev_irq_handler = set_lp_ticker_irq_handler(ticker_event_handler_stub);

ticker_overflow_delta = LP_TICKER_OVERFLOW_DELTA;
ticker_overflow_delta1 = LP_TICKER_OVERFLOW_DELTA1;
ticker_overflow_delta2 = LP_TICKER_OVERFLOW_DELTA2;

return greentea_case_setup_handler(source, index_of_case);
}
Expand Down
4 changes: 4 additions & 0 deletions TESTS/mbedmicro-rtos-mbed/basic/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@

using utest::v1::Case;

#if defined(__CORTEX_M23) || defined(__CORTEX_M33)
#define TEST_STACK_SIZE 512
#else
#define TEST_STACK_SIZE 256
#endif
#define ONE_MILLI_SEC 1000

volatile uint32_t elapsed_time_ms = 0;
Expand Down
4 changes: 4 additions & 0 deletions TESTS/mbedmicro-rtos-mbed/event_flags/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ using utest::v1::Case;
#error [NOT_SUPPORTED] test not supported
#endif

#if defined(__CORTEX_M23) || defined(__CORTEX_M33)
#define THREAD_STACK_SIZE 512
#else
#define THREAD_STACK_SIZE 320 /* 512B stack on GCC_ARM compiler cause out of memory on some 16kB RAM boards e.g. NUCLEO_F070RB */
#endif

#define MAX_FLAG_POS 30
#define PROHIBITED_FLAG_POS 31
Expand Down
4 changes: 4 additions & 0 deletions TESTS/mbedmicro-rtos-mbed/mail/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@

using namespace utest::v1;

#if defined(__CORTEX_M23) || defined(__CORTEX_M33)
#define THREAD_STACK_SIZE 512
#else
#define THREAD_STACK_SIZE 320 /* larger stack cause out of heap memory on some 16kB RAM boards in multi thread test*/
#endif
#define QUEUE_SIZE 16
#define THREAD_1_ID 1
#define THREAD_2_ID 2
Expand Down
2 changes: 2 additions & 0 deletions TESTS/mbedmicro-rtos-mbed/malloc/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ volatile bool thread_should_continue = true;

#if defined(__CORTEX_A9)
#define THREAD_STACK_SIZE 512
#elif defined(__CORTEX_M23) || defined(__CORTEX_M33)
#define THREAD_STACK_SIZE 512
#else
#define THREAD_STACK_SIZE 256
#endif
Expand Down
4 changes: 4 additions & 0 deletions TESTS/mbedmicro-rtos-mbed/mutex/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@

using namespace utest::v1;

#if defined(__CORTEX_M23) || defined(__CORTEX_M33)
#define TEST_STACK_SIZE 768
#else
#define TEST_STACK_SIZE 512
#endif

#define TEST_LONG_DELAY 20
#define TEST_DELAY 10
Expand Down
2 changes: 1 addition & 1 deletion TESTS/mbedmicro-rtos-mbed/systimer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !MBED_TICKLESS
#ifndef MBED_TICKLESS
#error [NOT_SUPPORTED] Tickless mode not supported for this target.
#endif

Expand Down
2 changes: 2 additions & 0 deletions TESTS/mbedmicro-rtos-mbed/threads/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
#define THREAD_STACK_SIZE 512
#if defined(__CORTEX_A9)
#define PARALLEL_THREAD_STACK_SIZE 512
#elif defined(__CORTEX_M23) || defined(__CORTEX_M33)
#define PARALLEL_THREAD_STACK_SIZE 512
#else
#define PARALLEL_THREAD_STACK_SIZE 384
#endif
Expand Down
30 changes: 23 additions & 7 deletions TESTS/netsocket/tcp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ using namespace utest::v1;
namespace
{
NetworkInterface* net;
Timer tc_bucket; // Timer to limit a test cases run time
}

char tcp_global::rx_buffer[RX_BUFF_SIZE];
Expand Down Expand Up @@ -66,24 +67,32 @@ static void _ifdown() {
printf("MBED: ifdown\n");
}

void tcpsocket_connect_to_echo_srv(TCPSocket& sock) {
nsapi_error_t tcpsocket_connect_to_echo_srv(TCPSocket& sock) {
SocketAddress tcp_addr;

get_interface()->gethostbyname(MBED_CONF_APP_ECHO_SERVER_ADDR, &tcp_addr);
tcp_addr.set_port(MBED_CONF_APP_ECHO_SERVER_PORT);

TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.open(get_interface()));
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.connect(tcp_addr));
nsapi_error_t err = sock.open(get_interface());
if (err != NSAPI_ERROR_OK) {
return err;
}

return sock.connect(tcp_addr);
}

void tcpsocket_connect_to_discard_srv(TCPSocket& sock) {
nsapi_error_t tcpsocket_connect_to_discard_srv(TCPSocket& sock) {
SocketAddress tcp_addr;

get_interface()->gethostbyname(MBED_CONF_APP_ECHO_SERVER_ADDR, &tcp_addr);
tcp_addr.set_port(9);

TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.open(get_interface()));
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.connect(tcp_addr));
nsapi_error_t err = sock.open(get_interface());
if (err != NSAPI_ERROR_OK) {
return err;
}

return sock.connect(tcp_addr);
}

void fill_tx_buffer_ascii(char *buff, size_t len)
Expand All @@ -93,16 +102,23 @@ void fill_tx_buffer_ascii(char *buff, size_t len)
}
}

int split2half_rmng_tcp_test_time()
{
return (tcp_global::TESTS_TIMEOUT-tc_bucket.read())/2;
}

// Test setup
utest::v1::status_t greentea_setup(const size_t number_of_cases)
{
GREENTEA_SETUP(480, "default_auto");
GREENTEA_SETUP(tcp_global::TESTS_TIMEOUT, "default_auto");
_ifup();
tc_bucket.start();
return greentea_test_setup_handler(number_of_cases);
}

void greentea_teardown(const size_t passed, const size_t failed, const failure_t failure)
{
tc_bucket.stop();
_ifdown();
return greentea_test_teardown_handler(passed, failed, failure);
}
Expand Down
10 changes: 8 additions & 2 deletions TESTS/netsocket/tcp/tcp_tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,17 @@
NetworkInterface* get_interface();
void drop_bad_packets(TCPSocket& sock, int orig_timeout);
void fill_tx_buffer_ascii(char *buff, size_t len);
void tcpsocket_connect_to_echo_srv(TCPSocket& sock);
void tcpsocket_connect_to_discard_srv(TCPSocket& sock);
nsapi_error_t tcpsocket_connect_to_echo_srv(TCPSocket& sock);
nsapi_error_t tcpsocket_connect_to_discard_srv(TCPSocket& sock);

/**
* Single testcase might take only half of the remaining execution time
*/
int split2half_rmng_tcp_test_time(); // [s]

namespace tcp_global
{
static const int TESTS_TIMEOUT = 480;
static const int TCP_OS_STACK_SIZE = 1024;

static const int RX_BUFF_SIZE = 1220;
Expand Down
35 changes: 32 additions & 3 deletions TESTS/netsocket/tcp/tcpsocket_echotest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ namespace
1100,1200};
TCPSocket sock;
Semaphore tx_sem(0, 1);

Timer tc_exec_time;
int time_allotted;
}

static void _sigio_handler(osThreadId id) {
Expand All @@ -45,7 +48,10 @@ static void _sigio_handler(osThreadId id) {

void TCPSOCKET_ECHOTEST()
{
tcpsocket_connect_to_echo_srv(sock);
if (tcpsocket_connect_to_echo_srv(sock) != NSAPI_ERROR_OK) {
TEST_FAIL();
return;
}

int recvd;
int sent;
Expand All @@ -57,6 +63,8 @@ void TCPSOCKET_ECHOTEST()
if (sent < 0) {
printf("[Round#%02d] network error %d\n", x, sent);
TEST_FAIL();
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.close());
return;
}

int bytes2recv = sent;
Expand All @@ -65,6 +73,8 @@ void TCPSOCKET_ECHOTEST()
if (recvd < 0) {
printf("[Round#%02d] network error %d\n", x, recvd);
TEST_FAIL();
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.close());
return;
}
bytes2recv -= recvd;
}
Expand All @@ -80,10 +90,15 @@ void tcpsocket_echotest_nonblock_receiver(void *receive_bytes)
while (bytes2recv) {
recvd = sock.recv(&(tcp_global::rx_buffer[*(int*)receive_bytes-bytes2recv]), bytes2recv);
if (recvd == NSAPI_ERROR_WOULD_BLOCK) {
if (tc_exec_time.read() >= time_allotted) {
TEST_FAIL();
break;
}
wait(1);
continue;
} else if (recvd < 0) {
TEST_FAIL();
break;
}
bytes2recv -= recvd;
}
Expand All @@ -99,6 +114,9 @@ void tcpsocket_echotest_nonblock_receiver(void *receive_bytes)

void TCPSOCKET_ECHOTEST_NONBLOCK()
{
tc_exec_time.start();
time_allotted = split2half_rmng_tcp_test_time(); // [s]

tcpsocket_connect_to_echo_srv(sock);
sock.set_blocking(false);
sock.sigio(callback(_sigio_handler, Thread::gettid()));
Expand All @@ -124,19 +142,30 @@ void TCPSOCKET_ECHOTEST_NONBLOCK()
while (bytes2send > 0) {
sent = sock.send(&(tcp_global::tx_buffer[pkt_s-bytes2send]), bytes2send);
if (sent == NSAPI_ERROR_WOULD_BLOCK) {
TEST_ASSERT_NOT_EQUAL(osEventTimeout, osSignalWait(SIGNAL_SIGIO, SIGIO_TIMEOUT).status);
if (tc_exec_time.read() >= time_allotted ||
osSignalWait(SIGNAL_SIGIO, SIGIO_TIMEOUT).status == osEventTimeout) {
thread->terminate();
delete thread;
TEST_FAIL();
goto END;
}
continue;
} else if (sent <= 0) {
printf("[Sender#%02d] network error %d\n", s_idx, sent);
thread->terminate();
delete thread;
TEST_FAIL();
goto END;
}
bytes2send -= sent;
}
printf("[Sender#%02d] bytes sent: %d\n", s_idx, pkt_s);
tx_sem.wait();
tx_sem.wait(split2half_rmng_tcp_test_time());
thread->join();
delete thread;
}
END:
tc_exec_time.stop();
free(stack_mem);
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.close());
}
Loading