mirror of https://github.com/ARMmbed/mbed-os.git
Merge branch 'master' of https://github.com/mbedmicro/mbed
commit
f9e7f69241
|
@ -16,7 +16,7 @@
|
||||||
{ \
|
{ \
|
||||||
__asm( \
|
__asm( \
|
||||||
"svc %0\n" \
|
"svc %0\n" \
|
||||||
"bx r14" : : "I" (number) : "r0" \
|
"bx r14" : : "I" ((uint32_t)number) : "r0" \
|
||||||
); \
|
); \
|
||||||
}
|
}
|
||||||
#elif defined (__ICCARM__)
|
#elif defined (__ICCARM__)
|
||||||
|
|
|
@ -22,11 +22,13 @@ int main() {
|
||||||
|
|
||||||
Serial pc(TXPIN, RXPIN);
|
Serial pc(TXPIN, RXPIN);
|
||||||
pc.baud(115200);
|
pc.baud(115200);
|
||||||
|
|
||||||
|
pc.puts("{{");
|
||||||
pc.puts(TEST_ENV_START); // Host test is expecting preamble
|
pc.puts(TEST_ENV_START); // Host test is expecting preamble
|
||||||
|
pc.puts("}}");
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
pc.gets(buf, 256);
|
pc.gets(buf, 256);
|
||||||
|
|
||||||
pc.printf("%s", buf);
|
pc.printf("%s", buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "mbed.h"
|
#include "mbed.h"
|
||||||
|
#include "test_env.h"
|
||||||
#include "EthernetInterface.h"
|
#include "EthernetInterface.h"
|
||||||
|
|
||||||
struct s_ip_address
|
struct s_ip_address
|
||||||
|
@ -11,6 +12,7 @@ struct s_ip_address
|
||||||
|
|
||||||
#define MAX_ECHO_LOOPS 100
|
#define MAX_ECHO_LOOPS 100
|
||||||
|
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
char buffer[256] = {0};
|
char buffer[256] = {0};
|
||||||
char out_buffer[] = "Hello World\n";
|
char out_buffer[] = "Hello World\n";
|
||||||
|
@ -36,7 +38,7 @@ int main() {
|
||||||
wait(1);
|
wait(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test loop for multiple client conenctions
|
// Test loop for multiple client connections
|
||||||
bool result = true;
|
bool result = true;
|
||||||
int count_error = 0;
|
int count_error = 0;
|
||||||
for (int i = 0; i < MAX_ECHO_LOOPS; i++) {
|
for (int i = 0; i < MAX_ECHO_LOOPS; i++) {
|
||||||
|
|
|
@ -5,8 +5,10 @@
|
||||||
namespace {
|
namespace {
|
||||||
const char *HTTP_SERVER_NAME = "utcnist.colorado.edu";
|
const char *HTTP_SERVER_NAME = "utcnist.colorado.edu";
|
||||||
const int HTTP_SERVER_PORT = 37;
|
const int HTTP_SERVER_PORT = 37;
|
||||||
|
const float YEARS_TO_PASS = 114.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
bool result = false;
|
bool result = false;
|
||||||
EthernetInterface eth;
|
EthernetInterface eth;
|
||||||
|
@ -30,14 +32,14 @@ int main() {
|
||||||
|
|
||||||
const int n = sock.receiveFrom(nist, in_buffer_tab, sizeof(in_buffer_tab));
|
const int n = sock.receiveFrom(nist, in_buffer_tab, sizeof(in_buffer_tab));
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
|
result = true;
|
||||||
const unsigned int timeRes = ntohl(in_buffer_uint);
|
const unsigned int timeRes = ntohl(in_buffer_uint);
|
||||||
const float years = timeRes / 60.0 / 60.0 / 24.0 / 365;
|
const float years = timeRes / 60.0 / 60.0 / 24.0 / 365;
|
||||||
printf("UDP: Received %d bytes from server %s on port %d\r\n", n, nist.get_address(), nist.get_port());
|
printf("UDP: Received %d bytes from server %s on port %d\r\n", n, nist.get_address(), nist.get_port());
|
||||||
printf("UDP: %u seconds since 01/01/1900 00:00 GMT ... %s\r\n", timeRes, timeRes > 0 ? "[OK]" : "[FAIL]");
|
printf("UDP: %u seconds since 01/01/1900 00:00 GMT ... %s\r\n", timeRes, timeRes > 0 ? "[OK]" : "[FAIL]");
|
||||||
printf("UDP: %.2f years since 01/01/1900 00:00 GMT ... %s\r\n", years, timeRes > 114.0 ? "[OK]" : "[FAIL]");
|
printf("UDP: %.2f years since 01/01/1900 00:00 GMT ... %s\r\n", years, timeRes > YEARS_TO_PASS ? "[OK]" : "[FAIL]");
|
||||||
result = true;
|
|
||||||
|
|
||||||
if (years < 114.0) {
|
if (years < YEARS_TO_PASS) {
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ INCLUDE_PATHS = {% for p in include_paths %}-I{{p}} {% endfor %}
|
||||||
LIBRARY_PATHS = {% for p in library_paths %}-L{{p}} {% endfor %}
|
LIBRARY_PATHS = {% for p in library_paths %}-L{{p}} {% endfor %}
|
||||||
LIBRARIES = {% for lib in libraries %}-l{{lib}} {% endfor %}
|
LIBRARIES = {% for lib in libraries %}-l{{lib}} {% endfor %}
|
||||||
LINKER_SCRIPT = {{linker_script}}
|
LINKER_SCRIPT = {{linker_script}}
|
||||||
SOFTDEVICE = mbed/TARGET_NRF51822/TARGET_NORDIC/TARGET_NRF51822/Lib/s110_nrf51822_6_0_0/s110_nrf51822_6.0.0_softdevice.hex
|
SOFTDEVICE = mbed/TARGET_ARCH_BLE/TARGET_NORDIC/TARGET_MCU_NRF51822/Lib/s110_nrf51822_7_0_0/s110_nrf51822_7.0.0_softdevice.hex
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
AS = $(GCC_BIN)arm-none-eabi-as
|
AS = $(GCC_BIN)arm-none-eabi-as
|
||||||
|
@ -23,7 +23,7 @@ CPU = -mcpu=cortex-m0 -mthumb
|
||||||
CC_FLAGS = $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections
|
CC_FLAGS = $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections
|
||||||
CC_SYMBOLS = {% for s in symbols %}-D{{s}} {% endfor %}
|
CC_SYMBOLS = {% for s in symbols %}-D{{s}} {% endfor %}
|
||||||
|
|
||||||
LD_FLAGS = -mcpu=cortex-m0 -mthumb -Wl,--gc-sections --specs=nano.specs -u _printf_float -u _scanf_float
|
LD_FLAGS = -mcpu=cortex-m0 -mthumb -Wl,--gc-sections -Wl,--wrap=main --specs=nano.specs -u _printf_float -u _scanf_float
|
||||||
LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
|
LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
|
||||||
|
|
||||||
ifeq ($(DEBUG), 1)
|
ifeq ($(DEBUG), 1)
|
||||||
|
@ -32,7 +32,7 @@ else
|
||||||
CC_FLAGS += -DNDEBUG -Os
|
CC_FLAGS += -DNDEBUG -Os
|
||||||
endif
|
endif
|
||||||
|
|
||||||
all: $(PROJECT).hex merge
|
all: $(PROJECT).hex
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(PROJECT).hex $(PROJECT).elf $(OBJECTS)
|
rm -f $(PROJECT).hex $(PROJECT).elf $(OBJECTS)
|
||||||
|
@ -54,4 +54,4 @@ $(PROJECT).hex: $(PROJECT).elf
|
||||||
$(OBJCOPY) -O ihex $< $@
|
$(OBJCOPY) -O ihex $< $@
|
||||||
|
|
||||||
merge:
|
merge:
|
||||||
$(SREC_CAT) $(SOFTDEVICE) -intel $(PROJECT).hex -binary --offset 0x14000 -o combined.hex -intel --line-length=46
|
$(SREC_CAT) $(SOFTDEVICE) -intel $(PROJECT).hex -intel -o combined.hex -intel --line-length=44
|
||||||
|
|
|
@ -9,7 +9,7 @@ INCLUDE_PATHS = {% for p in include_paths %}-I{{p}} {% endfor %}
|
||||||
LIBRARY_PATHS = {% for p in library_paths %}-L{{p}} {% endfor %}
|
LIBRARY_PATHS = {% for p in library_paths %}-L{{p}} {% endfor %}
|
||||||
LIBRARIES = {% for lib in libraries %}-l{{lib}} {% endfor %}
|
LIBRARIES = {% for lib in libraries %}-l{{lib}} {% endfor %}
|
||||||
LINKER_SCRIPT = {{linker_script}}
|
LINKER_SCRIPT = {{linker_script}}
|
||||||
SOFTDEVICE = mbed/TARGET_NRF51822/TARGET_NORDIC/TARGET_NRF51822/Lib/s110_nrf51822_7_0_0/s110_nrf51822_7.0.0_softdevice.hex
|
SOFTDEVICE = mbed/TARGET_NRF51822/TARGET_NORDIC/TARGET_MCU_NRF51822/Lib/s110_nrf51822_7_0_0/s110_nrf51822_7.0.0_softdevice.hex
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
AS = $(GCC_BIN)arm-none-eabi-as
|
AS = $(GCC_BIN)arm-none-eabi-as
|
||||||
|
@ -32,7 +32,7 @@ else
|
||||||
CC_FLAGS += -DNDEBUG -Os
|
CC_FLAGS += -DNDEBUG -Os
|
||||||
endif
|
endif
|
||||||
|
|
||||||
all: $(PROJECT).hex merge
|
all: $(PROJECT).hex
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(PROJECT).hex $(PROJECT).elf $(OBJECTS)
|
rm -f $(PROJECT).hex $(PROJECT).elf $(OBJECTS)
|
||||||
|
@ -54,4 +54,4 @@ $(PROJECT).hex: $(PROJECT).elf
|
||||||
$(OBJCOPY) -O ihex $< $@
|
$(OBJCOPY) -O ihex $< $@
|
||||||
|
|
||||||
merge:
|
merge:
|
||||||
$(SREC_CAT) $(SOFTDEVICE) -intel $(PROJECT).hex -intel --offset 0x16000 -o combined.hex -intel --line-length=46
|
$(SREC_CAT) $(SOFTDEVICE) -intel $(PROJECT).hex -intel -o combined.hex -intel --line-length=44
|
||||||
|
|
|
@ -15,6 +15,7 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
"""
|
"""
|
||||||
import uuid
|
import uuid
|
||||||
|
from sys import stdout
|
||||||
from host_test import Test
|
from host_test import Test
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,10 +27,20 @@ class EchoTest(Test):
|
||||||
|
|
||||||
def test(self):
|
def test(self):
|
||||||
# Let's wait for Mbed to print its readiness, usually "{{start}}"
|
# Let's wait for Mbed to print its readiness, usually "{{start}}"
|
||||||
c = self.mbed.serial_read(16)
|
if self.mbed.serial_timeout(None) is None:
|
||||||
|
self.print_result("ioerr_serial")
|
||||||
|
return
|
||||||
|
|
||||||
|
c = self.mbed.serial_read(len('{{start}}'))
|
||||||
if c is None:
|
if c is None:
|
||||||
self.print_result("ioerr_serial")
|
self.print_result("ioerr_serial")
|
||||||
return
|
return
|
||||||
|
print c
|
||||||
|
stdout.flush()
|
||||||
|
|
||||||
|
if self.mbed.serial_timeout(1) is None:
|
||||||
|
self.print_result("ioerr_serial")
|
||||||
|
return
|
||||||
|
|
||||||
self.mbed.flush()
|
self.mbed.flush()
|
||||||
self.notify("Starting the ECHO test")
|
self.notify("Starting the ECHO test")
|
||||||
|
|
|
@ -28,6 +28,7 @@ class HelloTest(DefaultTest):
|
||||||
self.print_result("ioerr_serial")
|
self.print_result("ioerr_serial")
|
||||||
return
|
return
|
||||||
print "Read %d bytes"% len(c)
|
print "Read %d bytes"% len(c)
|
||||||
|
print c
|
||||||
stdout.flush()
|
stdout.flush()
|
||||||
result = True
|
result = True
|
||||||
# Because we can have targetID here let's try to decode
|
# Because we can have targetID here let's try to decode
|
||||||
|
|
|
@ -44,6 +44,9 @@ class RTCTest(DefaultTest):
|
||||||
result_msg = "OK" if (time_str == correct_time_str) else "FAIL"
|
result_msg = "OK" if (time_str == correct_time_str) else "FAIL"
|
||||||
print "Got RTC time: " + c[:-1] + " ... " + result_msg
|
print "Got RTC time: " + c[:-1] + " ... " + result_msg
|
||||||
stdout.flush()
|
stdout.flush()
|
||||||
|
else:
|
||||||
|
test_result = False
|
||||||
|
break
|
||||||
|
|
||||||
if test_result: # All numbers are the same
|
if test_result: # All numbers are the same
|
||||||
self.print_result('success')
|
self.print_result('success')
|
||||||
|
|
|
@ -29,10 +29,20 @@ class StdioTest(DefaultTest):
|
||||||
test_result = True
|
test_result = True
|
||||||
|
|
||||||
# Let's wait for Mbed to print its readiness, usually "{{start}}"
|
# Let's wait for Mbed to print its readiness, usually "{{start}}"
|
||||||
c = self.mbed.serial_read(16)
|
if self.mbed.serial_timeout(None) is None:
|
||||||
|
self.print_result("ioerr_serial")
|
||||||
|
return
|
||||||
|
|
||||||
|
c = self.mbed.serial_read(len('{{start}}'))
|
||||||
if c is None:
|
if c is None:
|
||||||
self.print_result("ioerr_serial")
|
self.print_result("ioerr_serial")
|
||||||
return
|
return
|
||||||
|
print c
|
||||||
|
stdout.flush()
|
||||||
|
|
||||||
|
if self.mbed.serial_timeout(1) is None:
|
||||||
|
self.print_result("ioerr_serial")
|
||||||
|
return
|
||||||
|
|
||||||
for i in range(1, 5):
|
for i in range(1, 5):
|
||||||
random_integer = random.randint(-99999, 99999)
|
random_integer = random.randint(-99999, 99999)
|
||||||
|
@ -60,7 +70,7 @@ class StdioTest(DefaultTest):
|
||||||
stdout.flush()
|
stdout.flush()
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
print "Error: No IP and port information sent from server"
|
print "Error: No data from MUT sent"
|
||||||
self.print_result('error')
|
self.print_result('error')
|
||||||
exit(-2)
|
exit(-2)
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ from SocketServer import BaseRequestHandler, TCPServer
|
||||||
import socket
|
import socket
|
||||||
from host_test import Test
|
from host_test import Test
|
||||||
from sys import stdout
|
from sys import stdout
|
||||||
|
from time import sleep
|
||||||
|
|
||||||
SERVER_IP = str(socket.gethostbyname(socket.getfqdn()))
|
SERVER_IP = str(socket.gethostbyname(socket.getfqdn()))
|
||||||
SERVER_PORT = 7
|
SERVER_PORT = 7
|
||||||
|
@ -31,7 +32,25 @@ class TCPEchoClientTest(Test):
|
||||||
def send_server_ip_port(self, ip_address, port_no):
|
def send_server_ip_port(self, ip_address, port_no):
|
||||||
print "Resetting target..."
|
print "Resetting target..."
|
||||||
self.mbed.reset()
|
self.mbed.reset()
|
||||||
|
|
||||||
|
# Let's wait for Mbed to print its readiness, usually "{{start}}"
|
||||||
|
if self.mbed.serial_timeout(None) is None:
|
||||||
|
self.print_result("ioerr_serial")
|
||||||
|
return
|
||||||
|
|
||||||
|
c = self.mbed.serial_read(len('TCPCllient waiting for server IP and port...'))
|
||||||
|
if c is None:
|
||||||
|
self.print_result("ioerr_serial")
|
||||||
|
return
|
||||||
|
print c
|
||||||
|
stdout.flush()
|
||||||
|
|
||||||
|
if self.mbed.serial_timeout(1) is None:
|
||||||
|
self.print_result("ioerr_serial")
|
||||||
|
return
|
||||||
|
|
||||||
print "Sending server IP Address to target..."
|
print "Sending server IP Address to target..."
|
||||||
|
stdout.flush()
|
||||||
connection_str = ip_address + ":" + str(port_no) + "\n"
|
connection_str = ip_address + ":" + str(port_no) + "\n"
|
||||||
self.mbed.serial_write(connection_str)
|
self.mbed.serial_write(connection_str)
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,23 @@ class UDPEchoClientTest(Test):
|
||||||
def send_server_ip_port(self, ip_address, port_no):
|
def send_server_ip_port(self, ip_address, port_no):
|
||||||
print "Resetting target..."
|
print "Resetting target..."
|
||||||
self.mbed.reset()
|
self.mbed.reset()
|
||||||
|
|
||||||
|
# Let's wait for Mbed to print its readiness, usually "{{start}}"
|
||||||
|
if self.mbed.serial_timeout(None) is None:
|
||||||
|
self.print_result("ioerr_serial")
|
||||||
|
return
|
||||||
|
|
||||||
|
c = self.mbed.serial_read(len('UDPCllient waiting for server IP and port...'))
|
||||||
|
if c is None:
|
||||||
|
self.print_result("ioerr_serial")
|
||||||
|
return
|
||||||
|
print c
|
||||||
|
stdout.flush()
|
||||||
|
|
||||||
|
if self.mbed.serial_timeout(1) is None:
|
||||||
|
self.print_result("ioerr_serial")
|
||||||
|
return
|
||||||
|
|
||||||
print "Sending server IP Address to target..."
|
print "Sending server IP Address to target..."
|
||||||
connection_str = ip_address + ":" + str(port_no) + "\n"
|
connection_str = ip_address + ":" + str(port_no) + "\n"
|
||||||
self.mbed.serial_write(connection_str)
|
self.mbed.serial_write(connection_str)
|
||||||
|
|
|
@ -799,6 +799,7 @@ class SingleTestRunner(object):
|
||||||
|
|
||||||
if verbose:
|
if verbose:
|
||||||
print "Executing '" + " ".join(cmd) + "'"
|
print "Executing '" + " ".join(cmd) + "'"
|
||||||
|
print "Test::Output::Start"
|
||||||
|
|
||||||
proc = Popen(cmd, stdout=PIPE, cwd=HOST_TESTS)
|
proc = Popen(cmd, stdout=PIPE, cwd=HOST_TESTS)
|
||||||
obs = ProcessObserver(proc)
|
obs = ProcessObserver(proc)
|
||||||
|
@ -813,6 +814,7 @@ class SingleTestRunner(object):
|
||||||
|
|
||||||
if c:
|
if c:
|
||||||
output.append(c)
|
output.append(c)
|
||||||
|
if verbose:
|
||||||
sys.stdout.write(c)
|
sys.stdout.write(c)
|
||||||
# Give the mbed under test a way to communicate the end of the test
|
# Give the mbed under test a way to communicate the end of the test
|
||||||
if c in ['\n', '\r']:
|
if c in ['\n', '\r']:
|
||||||
|
@ -829,16 +831,14 @@ class SingleTestRunner(object):
|
||||||
|
|
||||||
if c:
|
if c:
|
||||||
output.append(c)
|
output.append(c)
|
||||||
|
if verbose:
|
||||||
sys.stdout.write(c)
|
sys.stdout.write(c)
|
||||||
|
|
||||||
|
if verbose:
|
||||||
|
print "Test::Output::Finish"
|
||||||
# Stop test process
|
# Stop test process
|
||||||
obs.stop()
|
obs.stop()
|
||||||
|
|
||||||
# Handle verbose mode
|
|
||||||
if verbose:
|
|
||||||
print "Test::Output::Start"
|
|
||||||
print "".join(output)
|
|
||||||
print "Test::Output::Finish"
|
|
||||||
|
|
||||||
# Parse test 'output' data
|
# Parse test 'output' data
|
||||||
result = self.TEST_RESULT_TIMEOUT
|
result = self.TEST_RESULT_TIMEOUT
|
||||||
for line in "".join(output).splitlines():
|
for line in "".join(output).splitlines():
|
||||||
|
|
|
@ -727,7 +727,7 @@ TESTS = [
|
||||||
{
|
{
|
||||||
"id": "NET_13", "description": "TCP client echo loop",
|
"id": "NET_13", "description": "TCP client echo loop",
|
||||||
"source_dir": join(TEST_DIR, "net", "echo", "tcp_client_loop"),
|
"source_dir": join(TEST_DIR, "net", "echo", "tcp_client_loop"),
|
||||||
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
|
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY, TEST_MBED_LIB],
|
||||||
"automated": True,
|
"automated": True,
|
||||||
"duration": 15,
|
"duration": 15,
|
||||||
"host_test": "tcpecho_client_auto",
|
"host_test": "tcpecho_client_auto",
|
||||||
|
|
Loading…
Reference in New Issue