Skip to content

Commit d53849f

Browse files
Mbed CE support for FF_LPC546XX (#452)
* Mbed CE support for FF_LPC546XX * Remove dataflash component, it isn't supported in hardware :( * Remove (for now) mismapped SPI pins * Fix build * Oops don't enable dataflash debug * Oops, didn't mean to commit that
1 parent 4f8361e commit d53849f

File tree

31 files changed

+694
-403
lines changed

31 files changed

+694
-403
lines changed

TESTS/configs/greentea_full.json5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// Allow lots of reboots so that we don't get in a situation where the MCU refuses to boot
1010
// after crashing and being reflashed (since some MCUs/flash tools don't reset the
1111
// crash data RAM)
12-
"platform.error-reboot-max": 2147483648,
12+
"platform.error-reboot-max": 2147483647,
1313

1414
// Emit a KV pair when an assert fail or hardfault occurs
1515
"platform.mbed-error-emit-greentea-kv": true,

drivers/include/drivers/SerialBase.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,22 @@ class SerialBase : private NonCopyable<SerialBase> {
6969

7070
enum Flow {
7171
Disabled = 0,
72+
73+
/// RS-232-E RTS flow control. This is used to prevent the other end of the connection from sending more
74+
/// bytes than the Mbed MCU can process.
75+
/// When this flow control is active, the RTS signal will normally be asserted (low),
76+
/// but will go deasserted (high) if the Mbed MCU might not have Rx buffer space to store another byte.
77+
/// Note that in this configuration the RTS signal actually operates as a "ready to receive" (RTR) output,
78+
/// not a true RTS.
7279
RTS,
80+
81+
/// RS-232 CTS flow control. This is used to prevent the Mbed MCU from sending more bytes than the
82+
/// other end of the connection can process.
83+
/// When this flow control is active, the CTS pin will be sampled after transmitting each byte, and if
84+
/// if is deasserted (high), transmission will pause until it becomes asserted (low) again.
7385
CTS,
86+
87+
/// Combination of RTS and CTS flow control as previously defined.
7488
RTSCTS
7589
};
7690

hal/include/hal/pinmap.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ uint32_t pinmap_find_function(PinName pin, const PinMap *map);
7474
* {
7575
* int per = spi_master_cs_pinmap()->peripheral;
7676
* const PinList *pins_ff = pinmap_ff_default_pins();
77-
* const PinList *pins_avoid = pinmap_restricted_pins();
7877
* PinName mosi = NC;
7978
* PinName miso = NC;
8079
* PinName sclk = NC;
@@ -138,22 +137,6 @@ bool pinmap_list_has_pin(const PinList *list, PinName pin);
138137
*/
139138
bool pinmap_list_has_peripheral(const PeripheralList *list, int peripheral);
140139

141-
/**
142-
* Get the pin list of pins to avoid during testing
143-
*
144-
* The restricted pin list is used to indicate to testing
145-
* that a pin should be skipped due to some caveat about it.
146-
* For example, using CONSOLE_RX and CONSOLE_TX during tests will interfere
147-
* with the test runner and should be avoided.
148-
*
149-
* Targets should override the weak implementation of this
150-
* function if they have additional pins which should be
151-
* skipped during testing.
152-
*
153-
* @return Pointer to a pin list of pins to avoid
154-
*/
155-
const PinList *pinmap_restricted_pins(void);
156-
157140
/**
158141
* Get the pin list of peripherals per interface to avoid during testing
159142
*

hal/source/mbed_pinmap_default.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,6 @@ const char *pinmap_ff_arduino_uno_pin_to_string(PinName pin)
6666

6767
#endif // defined (TARGET_FF_ARDUINO) || (TARGET_FF_ARDUINO_UNO)
6868

69-
//*** Default restricted pins ***
70-
MBED_WEAK const PinList *pinmap_restricted_pins()
71-
{
72-
static const PinName pins[] = {
73-
CONSOLE_TX, CONSOLE_RX
74-
};
75-
static const PinList pin_list = {
76-
sizeof(pins) / sizeof(pins[0]),
77-
pins
78-
};
79-
return &pin_list;
80-
}
81-
8269
//*** Default restricted gpio pins ***
8370
// GPIO pins are special case because there are no pin-maps for GPIO
8471
MBED_WEAK const PinList *pinmap_gpio_restricted_pins()

hal/source/mpu/mbed_mpu_v7m.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ void mbed_mpu_init()
5959
MBED_ASSERT(regions >= 4);
6060
#endif
6161

62-
// Disable the MCU
62+
// Disable the MPU
6363
MPU->CTRL = 0;
6464

6565
// Reset all mapping

platform/mbed_lib.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,9 @@
253253
},
254254
"MIMXRT105X": {
255255
"crash-capture-enabled": true
256+
},
257+
"MCU_LPC546XX": {
258+
"crash-capture-enabled": true
256259
}
257260
}
258261
}

platform/tests/TESTS/host_tests/crash_reporting.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ def __init__(self):
4040
def setup(self):
4141
self.register_callback(MSG_KEY_DEVICE_READY, self.cb_device_ready)
4242

43+
# Disable the default behavior of ending the test when the target experiences a fatal error.
44+
# In this test, we intentionally generate a fatal error!
45+
self.register_callback("mbed_error", lambda key, value, timestamp: None)
46+
4347
def cb_device_ready(self, key, value, timestamp):
4448
"""Acknowledge device rebooted correctly and feed the test execution
4549
"""
@@ -68,7 +72,7 @@ def test_steps(self):
6872

6973
system_reset = yield
7074
if self.reset == False:
71-
raise RuntimeError('Platform did not auto-reboot as expected.')
75+
raise RuntimeError('Platform did not auto-reboot as expected. This is likely due to failing to auto-reboot after a reset, or failing to preserve the contents of crash data RAM across resets.')
7276

7377
# The sequence is correct -- test passed.
7478
yield True

storage/blockdevice/COMPONENT_DATAFLASH/source/DataFlashBlockDevice.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ using namespace mbed;
2626
#define DATAFLASH_READ_SIZE 1
2727
#define DATAFLASH_PROG_SIZE 1
2828
#define DATAFLASH_TIMEOUT 10000
29-
#define DATAFLASH_ID_MATCH 0x1F20
29+
#define DATAFLASH_ID_MASK 0xFFE0 // Matches Manufacturer ID and Family Code
30+
#define DATAFLASH_ID_MATCH 0x1F20 // Matches Adesto/Renesas AT45Dxxx family
3031
#define DATAFLASH_ID_DENSITY_MASK 0x001F
3132
#define DATAFLASH_PAGE_SIZE_256 0x0100
3233
#define DATAFLASH_PAGE_SIZE_264 0x0108
@@ -186,13 +187,13 @@ int DataFlashBlockDevice::init()
186187
/* read ID register to validate model and set dimensions */
187188
uint16_t id = _get_register(DATAFLASH_OP_ID);
188189

189-
DEBUG_PRINTF("id: %04X\r\n", id & DATAFLASH_ID_MATCH);
190+
DEBUG_PRINTF("id: %04X\r\n", id);
190191

191192
/* get status register to verify the page size mode */
192193
uint16_t status = _get_register(DATAFLASH_OP_STATUS);
193194

194195
/* manufacture ID match */
195-
if ((id & DATAFLASH_ID_MATCH) == DATAFLASH_ID_MATCH) {
196+
if ((id & DATAFLASH_ID_MASK) == DATAFLASH_ID_MATCH) {
196197

197198
/* calculate density */
198199
_device_size = 0x8000 << (id & DATAFLASH_ID_DENSITY_MASK);
@@ -656,7 +657,7 @@ int DataFlashBlockDevice::_sync(void)
656657
/* wait the typical write period before trying again */
657658
} else {
658659
DEBUG_PRINTF("sleep_for: %d\r\n", DATAFLASH_TIMING_ERASE_PROGRAM_PAGE);
659-
rtos::ThisThread::sleep_for(DATAFLASH_TIMING_ERASE_PROGRAM_PAGE);
660+
rtos::ThisThread::sleep_for(std::chrono::milliseconds(DATAFLASH_TIMING_ERASE_PROGRAM_PAGE));
660661
}
661662
}
662663

storage/blockdevice/COMPONENT_SPIF/mbed_lib.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"SPI_CS": "PB_12",
5151
"SPI_FREQ": "20000000"
5252
},
53-
"UHURU_RAVEN": {
53+
"UHURU_RAVEN": {
5454
"SPI_MOSI": "PE_14",
5555
"SPI_MISO": "PE_13",
5656
"SPI_CLK": "PE_12",
@@ -68,8 +68,8 @@
6868
"SPI_CLK": "SPI3_SCK",
6969
"SPI_CS": "SPI_CS1"
7070
},
71-
"ARDUINO_NICLA_SENSE_ME": {
71+
"ARDUINO_NICLA_SENSE_ME": {
7272
"SPI_CS": "CS_FLASH"
73-
}
73+
}
7474
}
7575
}

targets/TARGET_NUVOTON/TARGET_M460/pinmap.c

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -84,27 +84,6 @@ void pin_mode(PinName pin, PinMode mode)
8484
*/
8585
}
8686

87-
/* List of pins excluded from testing */
88-
const PinList *pinmap_restricted_pins()
89-
{
90-
static const PinName pins[] = {
91-
CONSOLE_TX, CONSOLE_RX, // Dedicated to USB VCOM
92-
#if MBED_CONF_TARGET_EXCLUDE_UNO_SPI_FROM_FPGA_CI_TEST_SHIELD_TEST
93-
ARDUINO_UNO_D8, // Dedicated to on-board SPI flash
94-
ARDUINO_UNO_D9,
95-
ARDUINO_UNO_D10,
96-
ARDUINO_UNO_D11,
97-
ARDUINO_UNO_D12,
98-
ARDUINO_UNO_D13,
99-
#endif
100-
};
101-
static const PinList pin_list = {
102-
sizeof(pins) / sizeof(pins[0]),
103-
pins
104-
};
105-
return &pin_list;
106-
}
107-
10887
/* List of UART peripherals excluded from testing */
10988
#if DEVICE_SERIAL
11089
const PeripheralList *pinmap_uart_restricted_peripherals()

0 commit comments

Comments
 (0)