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( \
|
||||
"svc %0\n" \
|
||||
"bx r14" : : "I" (number) : "r0" \
|
||||
"bx r14" : : "I" ((uint32_t)number) : "r0" \
|
||||
); \
|
||||
}
|
||||
#elif defined (__ICCARM__)
|
||||
|
|
|
@ -22,11 +22,13 @@ int main() {
|
|||
|
||||
Serial pc(TXPIN, RXPIN);
|
||||
pc.baud(115200);
|
||||
|
||||
pc.puts("{{");
|
||||
pc.puts(TEST_ENV_START); // Host test is expecting preamble
|
||||
pc.puts("}}");
|
||||
|
||||
while (1) {
|
||||
pc.gets(buf, 256);
|
||||
|
||||
pc.printf("%s", buf);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "mbed.h"
|
||||
#include "test_env.h"
|
||||
#include "EthernetInterface.h"
|
||||
|
||||
struct s_ip_address
|
||||
|
@ -11,6 +12,7 @@ struct s_ip_address
|
|||
|
||||
#define MAX_ECHO_LOOPS 100
|
||||
|
||||
|
||||
int main() {
|
||||
char buffer[256] = {0};
|
||||
char out_buffer[] = "Hello World\n";
|
||||
|
@ -36,7 +38,7 @@ int main() {
|
|||
wait(1);
|
||||
}
|
||||
|
||||
// Test loop for multiple client conenctions
|
||||
// Test loop for multiple client connections
|
||||
bool result = true;
|
||||
int count_error = 0;
|
||||
for (int i = 0; i < MAX_ECHO_LOOPS; i++) {
|
||||
|
|
|
@ -5,8 +5,10 @@
|
|||
namespace {
|
||||
const char *HTTP_SERVER_NAME = "utcnist.colorado.edu";
|
||||
const int HTTP_SERVER_PORT = 37;
|
||||
const float YEARS_TO_PASS = 114.0;
|
||||
}
|
||||
|
||||
|
||||
int main() {
|
||||
bool result = false;
|
||||
EthernetInterface eth;
|
||||
|
@ -30,14 +32,14 @@ int main() {
|
|||
|
||||
const int n = sock.receiveFrom(nist, in_buffer_tab, sizeof(in_buffer_tab));
|
||||
if (n > 0) {
|
||||
result = true;
|
||||
const unsigned int timeRes = ntohl(in_buffer_uint);
|
||||
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: %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]");
|
||||
result = true;
|
||||
printf("UDP: %.2f years since 01/01/1900 00:00 GMT ... %s\r\n", years, timeRes > YEARS_TO_PASS ? "[OK]" : "[FAIL]");
|
||||
|
||||
if (years < 114.0) {
|
||||
if (years < YEARS_TO_PASS) {
|
||||
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 %}
|
||||
LIBRARIES = {% for lib in libraries %}-l{{lib}} {% endfor %}
|
||||
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
|
||||
|
@ -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_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
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
|
@ -32,7 +32,7 @@ else
|
|||
CC_FLAGS += -DNDEBUG -Os
|
||||
endif
|
||||
|
||||
all: $(PROJECT).hex merge
|
||||
all: $(PROJECT).hex
|
||||
|
||||
clean:
|
||||
rm -f $(PROJECT).hex $(PROJECT).elf $(OBJECTS)
|
||||
|
@ -54,4 +54,4 @@ $(PROJECT).hex: $(PROJECT).elf
|
|||
$(OBJCOPY) -O ihex $< $@
|
||||
|
||||
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 %}
|
||||
LIBRARIES = {% for lib in libraries %}-l{{lib}} {% endfor %}
|
||||
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
|
||||
|
@ -32,7 +32,7 @@ else
|
|||
CC_FLAGS += -DNDEBUG -Os
|
||||
endif
|
||||
|
||||
all: $(PROJECT).hex merge
|
||||
all: $(PROJECT).hex
|
||||
|
||||
clean:
|
||||
rm -f $(PROJECT).hex $(PROJECT).elf $(OBJECTS)
|
||||
|
@ -54,4 +54,4 @@ $(PROJECT).hex: $(PROJECT).elf
|
|||
$(OBJCOPY) -O ihex $< $@
|
||||
|
||||
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.
|
||||
"""
|
||||
import uuid
|
||||
from sys import stdout
|
||||
from host_test import Test
|
||||
|
||||
|
||||
|
@ -26,10 +27,20 @@ class EchoTest(Test):
|
|||
|
||||
def test(self):
|
||||
# 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:
|
||||
self.print_result("ioerr_serial")
|
||||
return
|
||||
print c
|
||||
stdout.flush()
|
||||
|
||||
if self.mbed.serial_timeout(1) is None:
|
||||
self.print_result("ioerr_serial")
|
||||
return
|
||||
|
||||
self.mbed.flush()
|
||||
self.notify("Starting the ECHO test")
|
||||
|
|
|
@ -28,6 +28,7 @@ class HelloTest(DefaultTest):
|
|||
self.print_result("ioerr_serial")
|
||||
return
|
||||
print "Read %d bytes"% len(c)
|
||||
print c
|
||||
stdout.flush()
|
||||
result = True
|
||||
# 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"
|
||||
print "Got RTC time: " + c[:-1] + " ... " + result_msg
|
||||
stdout.flush()
|
||||
else:
|
||||
test_result = False
|
||||
break
|
||||
|
||||
if test_result: # All numbers are the same
|
||||
self.print_result('success')
|
||||
|
|
|
@ -29,10 +29,20 @@ class StdioTest(DefaultTest):
|
|||
test_result = True
|
||||
|
||||
# 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:
|
||||
self.print_result("ioerr_serial")
|
||||
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):
|
||||
random_integer = random.randint(-99999, 99999)
|
||||
|
@ -60,7 +70,7 @@ class StdioTest(DefaultTest):
|
|||
stdout.flush()
|
||||
break
|
||||
else:
|
||||
print "Error: No IP and port information sent from server"
|
||||
print "Error: No data from MUT sent"
|
||||
self.print_result('error')
|
||||
exit(-2)
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ from SocketServer import BaseRequestHandler, TCPServer
|
|||
import socket
|
||||
from host_test import Test
|
||||
from sys import stdout
|
||||
from time import sleep
|
||||
|
||||
SERVER_IP = str(socket.gethostbyname(socket.getfqdn()))
|
||||
SERVER_PORT = 7
|
||||
|
@ -31,7 +32,25 @@ class TCPEchoClientTest(Test):
|
|||
def send_server_ip_port(self, ip_address, port_no):
|
||||
print "Resetting target..."
|
||||
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..."
|
||||
stdout.flush()
|
||||
connection_str = ip_address + ":" + str(port_no) + "\n"
|
||||
self.mbed.serial_write(connection_str)
|
||||
|
||||
|
|
|
@ -30,6 +30,23 @@ class UDPEchoClientTest(Test):
|
|||
def send_server_ip_port(self, ip_address, port_no):
|
||||
print "Resetting target..."
|
||||
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..."
|
||||
connection_str = ip_address + ":" + str(port_no) + "\n"
|
||||
self.mbed.serial_write(connection_str)
|
||||
|
|
|
@ -799,6 +799,7 @@ class SingleTestRunner(object):
|
|||
|
||||
if verbose:
|
||||
print "Executing '" + " ".join(cmd) + "'"
|
||||
print "Test::Output::Start"
|
||||
|
||||
proc = Popen(cmd, stdout=PIPE, cwd=HOST_TESTS)
|
||||
obs = ProcessObserver(proc)
|
||||
|
@ -813,7 +814,8 @@ class SingleTestRunner(object):
|
|||
|
||||
if c:
|
||||
output.append(c)
|
||||
sys.stdout.write(c)
|
||||
if verbose:
|
||||
sys.stdout.write(c)
|
||||
# Give the mbed under test a way to communicate the end of the test
|
||||
if c in ['\n', '\r']:
|
||||
if '{end}' in line:
|
||||
|
@ -829,16 +831,14 @@ class SingleTestRunner(object):
|
|||
|
||||
if c:
|
||||
output.append(c)
|
||||
sys.stdout.write(c)
|
||||
if verbose:
|
||||
sys.stdout.write(c)
|
||||
|
||||
if verbose:
|
||||
print "Test::Output::Finish"
|
||||
# Stop test process
|
||||
obs.stop()
|
||||
|
||||
# Handle verbose mode
|
||||
if verbose:
|
||||
print "Test::Output::Start"
|
||||
print "".join(output)
|
||||
print "Test::Output::Finish"
|
||||
|
||||
# Parse test 'output' data
|
||||
result = self.TEST_RESULT_TIMEOUT
|
||||
for line in "".join(output).splitlines():
|
||||
|
|
|
@ -727,7 +727,7 @@ TESTS = [
|
|||
{
|
||||
"id": "NET_13", "description": "TCP client echo 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,
|
||||
"duration": 15,
|
||||
"host_test": "tcpecho_client_auto",
|
||||
|
|
Loading…
Reference in New Issue