Skip to content

Commit 5887f9e

Browse files
author
Jamie Smith
authored
Loads of general and MIMXRT-specific test fixes (ARMmbed#412)
* Update MIMXRT105x linker script to use memory banks * Disable SRAM for now :/ * Add split heap support * Loads of general and MIMXRT-specific test fixes * Style fix * Remove include guard from mbed_config.tmpl so that it can be re-included by the build system * Oops left that line there
1 parent d255e11 commit 5887f9e

File tree

20 files changed

+57
-77
lines changed

20 files changed

+57
-77
lines changed

TESTS/configs/greentea_full.json5

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
"platform.all-stats-enabled": 1,
55

66
// Enable auto reboot on error, required for crash reporting test
7-
"platform.fatal-error-auto-reboot-enabled": true
7+
"platform.fatal-error-auto-reboot-enabled": true,
8+
9+
// Allow lots of reboots so that we don't get in a situation where the MCU refuses to boot
10+
// after crashing and being reflashed (since some MCUs/flash tools don't reset the
11+
// crash data RAM)
12+
"platform.error-reboot-max": 99999
813
}
914
}

connectivity/netsocket/tests/TESTS/netsocket/README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ Configure the firewall to allow this traffic to access the test server.
6060

6161
These services are available on many operating systems, and installing them is out of scope of this document. Below is an example of how to install these services into a Debian/Ubuntu based Linux distribution using standard Inet Daemon:
6262

63-
```.sh
63+
```shell
6464
$ sudo apt install inetutils-inetd
65-
$ nano /etc/inetd.conf
65+
$ sudo nano /etc/inetd.conf
6666
```
6767

6868
Enable following services from /etc/inetd.conf:
@@ -79,6 +79,13 @@ daytime stream tcp6 nowait root internal
7979
time stream tcp6 nowait root internal
8080
```
8181

82+
Then run:
83+
84+
```shell
85+
$ sudo systemctl enable inetutils-inetd.service
86+
$ sudo systemctl start inetutils-inetd.service
87+
```
88+
8289
Below is an example of how to install these services in TLS version into a Debian/Ubuntu based Linux distribution using Stunnel4 Daemon:
8390

8491
```.sh

drivers/tests/TESTS/mbed_drivers/reset_reason/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@ if(NOT "DEVICE_RESET_REASON=1" IN_LIST MBED_TARGET_DEFINITIONS)
55
set(TEST_SKIPPED "Reset Reason is not supported for this target")
66
endif()
77

8-
if("TARGET_MIMXRT105X" IN_LIST MBED_TARGET_DEFINITIONS)
9-
# This test causes this target to die. See https://github.com/mbed-ce/mbed-os/issues/83
10-
set(TEST_SKIPPED "Temporarily disabled for this target, see #83")
11-
endif()
12-
138
mbed_greentea_add_test(
149
TEST_NAME
1510
mbed-drivers-reset-reason

drivers/tests/TESTS/mbed_drivers/watchdog_reset/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@ if(NOT "DEVICE_WATCHDOG=1" IN_LIST MBED_TARGET_DEFINITIONS)
55
set(TEST_SKIPPED "Watchdog is not supported for this target")
66
endif()
77

8-
if("TARGET_MIMXRT105X" IN_LIST MBED_TARGET_DEFINITIONS)
9-
# This test causes this target to die. See https://github.com/mbed-ce/mbed-os/issues/83
10-
set(TEST_SKIPPED "Temporarily disabled for this target, see #83")
11-
endif()
12-
138
mbed_greentea_add_test(
149
TEST_NAME
1510
mbed-drivers-watchdog-reset

drivers/usb/tests/TESTS/host_tests/usb_device_hid.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import uuid
2323
import sys
2424
import mbed_host_tests
25+
import hid
2526
import usb.core
2627
from usb.util import (
2728
CTRL_IN,
@@ -42,13 +43,6 @@
4243
# Use a default backend on other platforms.
4344
USB_BACKEND = None
4445

45-
try:
46-
import hid
47-
except ImportError:
48-
CYTHON_HIDAPI_PRESENT = False
49-
else:
50-
CYTHON_HIDAPI_PRESENT = True
51-
5246
# USB device -- device classes
5347
USB_CLASS_HID = 0x03
5448

@@ -112,8 +106,6 @@ def build_get_desc_value(desc_type, desc_index):
112106

113107
def usb_hid_path(serial_number):
114108
"""Get a USB HID device system path based on the serial number."""
115-
if not CYTHON_HIDAPI_PRESENT:
116-
return None
117109
for device_info in hid.enumerate(): # pylint: disable=no-member
118110
if device_info.get('serial_number') == serial_number: # pylint: disable=not-callable
119111
return device_info['path']
@@ -563,9 +555,6 @@ def start_bg_task(self, **thread_kwargs):
563555

564556
def cb_test_raw_io(self, key, value, timestamp):
565557
"""Receive HID reports and send them back to the device."""
566-
if not CYTHON_HIDAPI_PRESENT:
567-
self.send_kv(MSG_KEY_HOST_READY, MSG_VALUE_NOT_SUPPORTED)
568-
return
569558
try:
570559
# The size of input and output reports used in test.
571560
report_size = int(value)

features/frameworks/utest/source/utest_harness.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,11 @@ bool Harness::run(const Specification& specification)
165165
void Harness::raise_failure(const failure_reason_t reason)
166166
{
167167
UTEST_LOG_FUNCTION();
168-
// ignore a failure, if the Harness has not been initialized.
169-
// this allows using unity assertion macros without setting up utest.
170-
if (test_cases == NULL) return;
168+
169+
// If not currently in a test case and code does a unity assertion that fails, it will end up
170+
// at this assert. This will stop execution of the program.
171+
// This allows using unity assertion macros without setting up utest.
172+
assert(test_cases != nullptr);
171173

172174
utest::v1::status_t fail_status = STATUS_ABORT;
173175
if (handlers->test_failure) handlers->test_failure(failure_t(reason, location));

hal/tests/TESTS/mbed_hal/reset_reason/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@ if(NOT "DEVICE_RESET_REASON=1" IN_LIST MBED_TARGET_DEFINITIONS)
55
set(TEST_SKIPPED "Reset Reason is not supported for this target")
66
endif()
77

8-
if("TARGET_MIMXRT105X" IN_LIST MBED_TARGET_DEFINITIONS)
9-
# This test causes this target to die. See https://github.com/mbed-ce/mbed-os/issues/83
10-
set(TEST_SKIPPED "Temporarily disabled for this target, see #83")
11-
endif()
12-
138
mbed_greentea_add_test(
149
TEST_NAME
1510
mbed-hal-reset-reason

hal/tests/TESTS/mbed_hal/rtc_reset/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@ if(NOT "DEVICE_RTC=1" IN_LIST MBED_TARGET_DEFINITIONS)
55
set(TEST_SKIPPED "RTC is not supported for this target")
66
endif()
77

8-
if("TARGET_MIMXRT105X" IN_LIST MBED_TARGET_DEFINITIONS)
9-
# This test causes this target to die. See https://github.com/mbed-ce/mbed-os/issues/83
10-
set(TEST_SKIPPED "Temporarily disabled for this target, see #83")
11-
endif()
12-
138
mbed_greentea_add_test(
149
TEST_NAME
1510
mbed-hal-rtc-reset

platform/tests/TESTS/mbed_platform/crash_reporting/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
if(NOT "MBED_CONF_PLATFORM_CRASH_CAPTURE_ENABLED=1" IN_LIST MBED_CONFIG_DEFINITIONS)
5-
set(TEST_SKIPPED "CRC is not supported for this target")
5+
set(TEST_SKIPPED "MBED_CONF_PLATFORM_CRASH_CAPTURE_ENABLED is not enabled for this target")
66
endif()
77

88
mbed_greentea_add_test(

platform/tests/TESTS/mbed_platform/crash_reporting/main.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ static mbed_error_ctx saved_error_ctx = {0};
3535

3636
void mbed_error_reboot_callback(mbed_error_ctx *error_context)
3737
{
38-
39-
TEST_ASSERT_EQUAL_PTR(error_context, &MBED_CRASH_DATA);
4038
memcpy(&saved_error_ctx, error_context, sizeof(mbed_error_ctx));
4139
mbed_reset_reboot_error_info();
4240

rtos/tests/TESTS/mbed_rtos/heap_and_stack/main.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <stdio.h>
2323
#include <stdlib.h>
2424
#include <string.h>
25+
#include <cinttypes>
2526

2627
#include "mbed.h"
2728
#include "cmsis.h"
@@ -107,12 +108,16 @@ static bool rangeinrange(uint32_t addr, uint32_t size, uint32_t start, uint32_t
107108
*/
108109
static bool valid_fill(uint8_t *data, uint32_t size, uint8_t fill)
109110
{
111+
bool valid = true;
110112
for (uint32_t i = 0; i < size; i++) {
111113
if (data[i] != fill) {
112-
return false;
114+
printf("Address 0x%" PRIx32 ": expected value 0x%" PRIx8 ", got 0x%" PRIx8,
115+
reinterpret_cast<uint32_t>(&data[i]), fill, data[i]);
116+
valid = false;
117+
wait_us(1000);
113118
}
114119
}
115-
return true;
120+
return valid;
116121
}
117122

118123
static void allocate_and_fill_heap(linked_list *&head)
@@ -158,17 +163,20 @@ static void check_and_free_heap(linked_list *head, uint32_t &max_allocation_size
158163
uint32_t total_size = 0;
159164
linked_list *current = head;
160165

166+
bool success = true;
167+
161168
while (current != NULL) {
162169
total_size += sizeof(linked_list);
163-
bool result = valid_fill(current->data, sizeof(current->data), MALLOC_FILL);
164170

165-
TEST_ASSERT_TRUE_MESSAGE(result, "Memory fill check failed");
171+
success = success && valid_fill(current->data, sizeof(current->data), MALLOC_FILL);
166172

167173
linked_list *next = current->next;
168174
free(current);
169175
current = next;
170176
}
171177

178+
TEST_ASSERT_TRUE_MESSAGE(success, "Memory fill check failed");
179+
172180
max_allocation_size = total_size;
173181
}
174182

targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_MIMXRT105x/TARGET_EVK/PinNames.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,8 @@ typedef enum {
206206
NC = (int)0xFFFFFFFF
207207
} PinName;
208208

209-
// Standardized LED and button names
210-
#define LED1 GPIO_AD_B0_09 // USER LED (green)
211-
#define USER_LED LED1
209+
// MIMXRT EVKs do not have a usable LED, because the LED shares important pins with the
210+
// debugging interface, so trying to use the LED can interrupt flashing and debugging code!
212211

213212
typedef enum {
214213
PullNone = 0,

targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_MIMXRT105x/TARGET_EVK/TARGET_1060_EVK/xip/evkbmimxrt1060_flexspi_nor_config.c

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -38,28 +38,11 @@ const flexspi_nor_config_t qspiflash_config = {
3838
.sflashA1Size = MBED_ROM_BANK_EXT_FLASH_SIZE,
3939
.lookupTable =
4040
{
41-
// Read LUTs
41+
// Read LUT. Always index 0.
42+
// All that the bootrom needs to know is how to read the flash. The rest of the
43+
// flash configuration is stored in flash_defines.h.
4244
[0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB, RADDR_SDR, FLEXSPI_4PAD, 0x18),
43-
[1] = FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 0x06, READ_SDR, FLEXSPI_4PAD, 0x04),
44-
45-
// Read Status LUTs
46-
[4 * 1 + 0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05, READ_SDR, FLEXSPI_1PAD, 0x04),
47-
48-
// Write Enable LUTs
49-
[4 * 3 + 0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06, STOP, FLEXSPI_1PAD, 0x0),
50-
51-
// Erase Sector LUTs
52-
[4 * 5 + 0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x20, RADDR_SDR, FLEXSPI_1PAD, 0x18),
53-
54-
// Erase Block LUTs
55-
[4 * 8 + 0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xD8, RADDR_SDR, FLEXSPI_1PAD, 0x18),
56-
57-
// Pape Program LUTs
58-
[4 * 9 + 0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x02, RADDR_SDR, FLEXSPI_1PAD, 0x18),
59-
[4 * 9 + 1] = FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_1PAD, 0x04, STOP, FLEXSPI_1PAD, 0x0),
60-
61-
// Erase Chip LUTs
62-
[4 * 11 + 0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x60, STOP, FLEXSPI_1PAD, 0x0),
45+
[1] = FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 0x06, READ_SDR, FLEXSPI_4PAD, 0x04)
6346
},
6447
},
6548
.pageSize = 256u,

targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_MIMXRT105x/mbed_overrides.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,9 @@ void mbed_sdk_init()
188188
BOARD_ClockFullSpeed();
189189
#endif
190190

191+
// Enable non-HardFault exceptions
192+
SCB->SHCSR |= SCB_SHCSR_USGFAULTENA_Msk | SCB_SHCSR_BUSFAULTENA_Msk | SCB_SHCSR_MEMFAULTENA_Msk;
193+
191194
// Switch to using an application-owned flexspi config instead of what the bootloader sets up
192195
#if DEVICE_FLASH
193196
mimxrt_flash_setup();

targets/upload_method_cfg/MIMXRT1050_EVK.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
# To change any of these parameters from their default values, set them in your build script between where you
33
# include app.cmake and where you add mbed os as a subdirectory.
44

5+
# 1. Most debuggers cannot connect to this CPU after it does an NVIC system reset. See Mbed CE bug #83.
6+
# However, a workaround has been implemented for PyOCD.
7+
58
# General config parameters
69
# -------------------------------------------------------------
710
set(UPLOAD_METHOD_DEFAULT MBED)
@@ -16,6 +19,7 @@ set(MBED_RESET_BAUDRATE 115200)
1619
set(PYOCD_UPLOAD_ENABLED TRUE)
1720
set(PYOCD_TARGET_NAME mimxrt1050_hyperflash) # Note: change to "mimxrt1050_quadspi" if onboard QSPI flash is used
1821
set(PYOCD_CLOCK_SPEED 4000k)
22+
set(PYOCD_EXTRA_OPTIONS -Oconnect_mode=pre-reset)
1923

2024
# Config options for LINKSERVER
2125
# -------------------------------------------------------------

targets/upload_method_cfg/MIMXRT1060_EVK.cmake

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
# connecting an external J-Link probe. See here for conversion instructions: https://www.segger.com/products/debug-probes/j-link/models/other-j-links/lpc-link-2/
88
# Also, a relatively new version of the J-Link software is needed (7.82 confirmed working), so try updating
99
# it if you get any errors.
10-
# 2. pyocd seems glitchy for this device. Sometimes it works great, sometimes you get 'no ACK received.'
11-
# Might be related to pyOCD#861?
10+
# 2. Most debuggers cannot connect to this CPU after it does an NVIC system reset. See Mbed CE bug #83.
11+
# However, a workaround has been implemented for PyOCD.
12+
#
1213

1314
# General config parameters
1415
# -------------------------------------------------------------
@@ -26,6 +27,7 @@ set(JLINK_CLOCK_SPEED 4000)
2627
set(PYOCD_UPLOAD_ENABLED TRUE)
2728
set(PYOCD_TARGET_NAME mimxrt1060) # Note: This seems to use QSPI. There does not seem to be a pyocd equivalent for hyperflash.
2829
set(PYOCD_CLOCK_SPEED 4000k)
30+
set(PYOCD_EXTRA_OPTIONS -Oconnect_mode=pre-reset)
2931

3032
# Config options for LINKSERVER
3133
# -------------------------------------------------------------

tools/cmake/upload_methods/UploadMethodPYOCD.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# This method needs the following parameters:
66
# PYOCD_TARGET_NAME - Name of your processor as passed to the -t option of pyOCD. This is usually the full or partial model number.
77
# PYOCD_CLOCK_SPEED - Clock speed of the JTAG or SWD connection. Default is in Hz, but can use k and M suffixes for MHz and GHz
8+
# PYOCD_EXTRA_OPTIONS - Extra options to pass to the pyocd 'flash' and 'gdbserver' commands.
89

910
set(UPLOAD_SUPPORTS_DEBUG TRUE)
1011

@@ -32,6 +33,7 @@ function(gen_upload_target TARGET_NAME BINARY_FILE)
3233
-t ${PYOCD_TARGET_NAME}
3334
${PYOCD_PROBE_ARGS}
3435
--base-address ${MBED_UPLOAD_BASE_ADDR}
36+
${PYOCD_EXTRA_OPTIONS}
3537
${BINARY_FILE})
3638

3739
endfunction(gen_upload_target)
@@ -45,7 +47,8 @@ set(UPLOAD_GDBSERVER_DEBUG_COMMAND
4547
-t ${PYOCD_TARGET_NAME}
4648
${PYOCD_PROBE_ARGS}
4749
-f ${PYOCD_CLOCK_SPEED}
48-
-p ${MBED_GDB_PORT})
50+
-p ${MBED_GDB_PORT}
51+
${PYOCD_EXTRA_OPTIONS})
4952

5053
# Reference: https://github.com/Marus/cortex-debug/blob/056c03f01e008828e6527c571ef5c9adaf64083f/src/pyocd.ts#L40
5154
set(UPLOAD_LAUNCH_COMMANDS

tools/python/mbed_os_tools/test/host_tests_logger/ht_logger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
class HtrunLogger(object):
2323
"""! Yet another logger flavour """
2424
def __init__(self, name):
25-
logging.basicConfig(stream=sys.stdout,format='[%(created).2f][%(name)s]%(message)s', level=logging.DEBUG)
25+
logging.basicConfig(stream=sys.stdout,format='[+%(relativeCreated)dms][%(name)s]%(message)s', level=logging.DEBUG)
2626
self.logger = logging.getLogger(name)
2727
self.format_str = '[%(logger_level)s] %(message)s'
2828

tools/python/mbed_tools/build/_internal/config/assemble_build_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def make_relative_if_possible(path: Path):
5959
except ValueError:
6060
return path
6161

62-
config.json_sources = [make_relative_if_possible(program.root) for json_source in config.json_sources]
62+
config.json_sources = [make_relative_if_possible(json_source) for json_source in config.json_sources]
6363

6464
return config
6565

tools/python/mbed_tools/build/_internal/templates/mbed_config.tmpl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
# Automatically generated configuration file.
55
# DO NOT EDIT. Content may be overwritten.
66

7-
include_guard(GLOBAL)
8-
97
set(MBED_TOOLCHAIN "{{toolchain_name}}")
108
set(MBED_CPU_CORE "{{core}}")
119
set(MBED_C_LIB "{{c_lib}}")
@@ -69,7 +67,6 @@ set(MBED_TARGET_DEFINITIONS{% for component in components %}
6967

7068
# config
7169
set(MBED_CONFIG_DEFINITIONS
72-
7370
# Config settings
7471
{% for setting in config %}
7572
{%- if setting.macro_name -%}

0 commit comments

Comments
 (0)