Skip to content

Commit 7a7f6a5

Browse files
authored
Merge pull request #13768 from jeromecoutant/PR_FPGA_PRINT
COMPONENT_FPGA_CI_TEST_SHIELD: better debug print
2 parents 450afa8 + 88282c2 commit 7a7f6a5

File tree

2 files changed

+35
-29
lines changed

2 files changed

+35
-29
lines changed

features/frameworks/COMPONENT_FPGA_CI_TEST_SHIELD/include/fpga_ci_test_shield/test_utils.h

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,6 @@ void find_ports(std::list<PortType> &matched_ports, std::list<PortType> &not_mat
115115
PortType port;
116116

117117
if (FormFactorType::pins()->pins[j] == NC) {
118-
utest_printf("Skipping (NC pin) %s pin %s (%i)\r\n", pin_type,
119-
FormFactorType::pin_to_string(port.pins[i]), port.pins[i]);
120118
continue;
121119
}
122120

@@ -143,7 +141,7 @@ void find_ports(std::list<PortType> &matched_ports, std::list<PortType> &not_mat
143141
#if DEVICE_SERIAL
144142
if (!strcmp(PortType::PinMap::name, UART_NAME) || !strcmp(PortType::PinMap::name, UARTNOFC_NAME)) {
145143
if (pinmap_list_has_peripheral(pinmap_uart_restricted_peripherals(), port.peripheral)) {
146-
utest_printf("Skipping (restricted uart peripheral) %s peripheral %i with pin %s (%i)\r\n", pin_type,
144+
utest_printf("Skipping (restricted uart peripheral) %s peripheral 0x%x with pin %s (%x)\r\n", pin_type,
147145
port.peripheral, FormFactorType::pin_to_string(port.pins[i]), port.pins[i]);
148146
continue;
149147
}
@@ -178,31 +176,35 @@ void test_all_ports(std::list<PortType> &matched_ports, std::list<PortType> &not
178176
}
179177

180178
for (uint32_t i = 0; i < ff_pins->count; i++) {
181-
for (Iter it = matched_ports.begin(); it != matched_ports.end(); ++it) {
182-
PortType &port = *it;
183-
for (uint32_t j = 0; j < PortType::pin_count; j++) {
184-
if (ff_pins->pins[i] == port.pins[j]) {
185-
utest_printf("%3s - %s pin tested on port: %s...", FormFactorType::pin_to_string(ff_pins->pins[i]),
186-
PortType::PinMap::pin_type_names[j], port.str());
187-
if (port.status == PortType::StatusNotTested) {
188-
call(port);
189-
port.status = PortType::StatusPass;
179+
if (ff_pins->pins[i] != NC) {
180+
for (Iter it = matched_ports.begin(); it != matched_ports.end(); ++it) {
181+
PortType &port = *it;
182+
for (uint32_t j = 0; j < PortType::pin_count; j++) {
183+
if (ff_pins->pins[i] == port.pins[j]) {
184+
utest_printf("%3s - %s pin tested on port: %s...", FormFactorType::pin_to_string(ff_pins->pins[i]),
185+
PortType::PinMap::pin_type_names[j], port.str());
186+
if (port.status == PortType::StatusNotTested) {
187+
call(port);
188+
port.status = PortType::StatusPass;
189+
} else {
190+
utest_printf("test already done...");
191+
}
192+
utest_printf("%s\n", port.status == PortType::StatusPass ? "succeeded" : "failed");
193+
goto end_port_iteration;
190194
}
191-
utest_printf("%s\n", port.status == PortType::StatusPass ? "succeeded" : "failed");
192-
goto end_port_iteration;
193195
}
194196
}
195-
}
196-
for (Iter it = not_matched_ports.begin(); it != not_matched_ports.end(); ++it) {
197-
PortType &port = *it;
198-
for (uint32_t j = 0; j < PortType::pin_count; j++) {
199-
if (ff_pins->pins[i] == port.pins[j]) {
200-
utest_printf("%3s - Could not find pins to test %s pin %s (%d)\n",
201-
FormFactorType::pin_to_string(ff_pins->pins[i]),
202-
PortType::PinMap::pin_type_names[j],
203-
FormFactorType::pin_to_string(ff_pins->pins[i]),
204-
ff_pins->pins[i]);
205-
goto end_port_iteration;
197+
for (Iter it = not_matched_ports.begin(); it != not_matched_ports.end(); ++it) {
198+
PortType &port = *it;
199+
for (uint32_t j = 0; j < PortType::pin_count; j++) {
200+
if (ff_pins->pins[i] == port.pins[j]) {
201+
utest_printf("%3s - Could not find pins to test %s pin %s (%d)\n",
202+
FormFactorType::pin_to_string(ff_pins->pins[i]),
203+
PortType::PinMap::pin_type_names[j],
204+
FormFactorType::pin_to_string(ff_pins->pins[i]),
205+
ff_pins->pins[i]);
206+
goto end_port_iteration;
207+
}
206208
}
207209
}
208210
}
@@ -215,9 +217,11 @@ template<typename PortType, typename FunctionType, FunctionType f>
215217
void test_peripheral(PortType &port)
216218
{
217219
if (port.empty()) {
218-
utest_printf("%d - Could not find pins to test peripheral\n", port.peripheral);
220+
if (port.peripheral != NC) {
221+
utest_printf("0x%x - Could not find pins to test peripheral\n", port.peripheral);
222+
}
219223
} else {
220-
utest_printf("%d - peripheral tested on port: %s...", port.peripheral, port.str());
224+
utest_printf("0x%x - peripheral tested on port: %s...", port.peripheral, port.str());
221225
if (port.status == PortType::StatusNotTested) {
222226
FunctionCaller<PortType, FunctionType, f> call;
223227
call(port); // run test
@@ -403,7 +407,7 @@ class Port {
403407
{
404408
static char port_str[128];
405409
char pin_str[32];
406-
sprintf(port_str, "peripheral=(%d) ", peripheral);
410+
sprintf(port_str, "peripheral=(0x%x) ", peripheral);
407411
for (uint32_t i = 0; i < N; i++) {
408412
sprintf(pin_str, "%s=(%s) ", PinMap::pin_type_names[i], FormFactorType::pin_to_string(pins[i]));
409413
strcat(port_str, pin_str);
@@ -582,7 +586,7 @@ struct UARTMaps {
582586
static const char *const name;
583587
};
584588
const PinMap *UARTMaps::maps[] = { serial_tx_pinmap(), serial_rx_pinmap(), serial_cts_pinmap(), serial_rts_pinmap() };
585-
const char *const UARTMaps::pin_type_names[] = { "TX", "RX", "CLS", "RTS" };
589+
const char *const UARTMaps::pin_type_names[] = { "TX", "RX", "CTS", "RTS" };
586590
const char *const UARTMaps::name = UART_NAME;
587591
typedef Port<4, UARTMaps, DefaultFormFactor, TF4> UARTPort;
588592
#endif

features/frameworks/COMPONENT_FPGA_CI_TEST_SHIELD/source/MbedTester.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "platform/mbed_wait_api.h"
2323
#include "platform/mbed_error.h"
2424
#include "drivers/MbedCRC.h"
25+
#include "utest/utest_print.h"
2526

2627
#define mbed_tester_printf(...)
2728

@@ -948,6 +949,7 @@ void MbedTester::pin_map_set(PinName physical, LogicalPin logical)
948949
error("Invalid logical pin %i", logical);
949950
return;
950951
}
952+
utest_printf("(FPGA %u)...", index);
951953
pin_map_index(index, logical);
952954
}
953955

0 commit comments

Comments
 (0)