From 88282c2868b4425493c04326b86fe3cadbf3e2c3 Mon Sep 17 00:00:00 2001 From: jeromecoutant Date: Tue, 13 Oct 2020 10:11:45 +0200 Subject: [PATCH] COMPONENT_FPGA_CI_TEST_SHIELD: better debug print --- .../include/fpga_ci_test_shield/test_utils.h | 62 ++++++++++--------- .../source/MbedTester.cpp | 2 + 2 files changed, 35 insertions(+), 29 deletions(-) diff --git a/features/frameworks/COMPONENT_FPGA_CI_TEST_SHIELD/include/fpga_ci_test_shield/test_utils.h b/features/frameworks/COMPONENT_FPGA_CI_TEST_SHIELD/include/fpga_ci_test_shield/test_utils.h index e624373c11..9406be007f 100644 --- a/features/frameworks/COMPONENT_FPGA_CI_TEST_SHIELD/include/fpga_ci_test_shield/test_utils.h +++ b/features/frameworks/COMPONENT_FPGA_CI_TEST_SHIELD/include/fpga_ci_test_shield/test_utils.h @@ -115,8 +115,6 @@ void find_ports(std::list &matched_ports, std::list ¬_mat PortType port; if (FormFactorType::pins()->pins[j] == NC) { - utest_printf("Skipping (NC pin) %s pin %s (%i)\r\n", pin_type, - FormFactorType::pin_to_string(port.pins[i]), port.pins[i]); continue; } @@ -143,7 +141,7 @@ void find_ports(std::list &matched_ports, std::list ¬_mat #if DEVICE_SERIAL if (!strcmp(PortType::PinMap::name, UART_NAME) || !strcmp(PortType::PinMap::name, UARTNOFC_NAME)) { if (pinmap_list_has_peripheral(pinmap_uart_restricted_peripherals(), port.peripheral)) { - utest_printf("Skipping (restricted uart peripheral) %s peripheral %i with pin %s (%i)\r\n", pin_type, + utest_printf("Skipping (restricted uart peripheral) %s peripheral 0x%x with pin %s (%x)\r\n", pin_type, port.peripheral, FormFactorType::pin_to_string(port.pins[i]), port.pins[i]); continue; } @@ -178,31 +176,35 @@ void test_all_ports(std::list &matched_ports, std::list ¬ } for (uint32_t i = 0; i < ff_pins->count; i++) { - for (Iter it = matched_ports.begin(); it != matched_ports.end(); ++it) { - PortType &port = *it; - for (uint32_t j = 0; j < PortType::pin_count; j++) { - if (ff_pins->pins[i] == port.pins[j]) { - utest_printf("%3s - %s pin tested on port: %s...", FormFactorType::pin_to_string(ff_pins->pins[i]), - PortType::PinMap::pin_type_names[j], port.str()); - if (port.status == PortType::StatusNotTested) { - call(port); - port.status = PortType::StatusPass; + if (ff_pins->pins[i] != NC) { + for (Iter it = matched_ports.begin(); it != matched_ports.end(); ++it) { + PortType &port = *it; + for (uint32_t j = 0; j < PortType::pin_count; j++) { + if (ff_pins->pins[i] == port.pins[j]) { + utest_printf("%3s - %s pin tested on port: %s...", FormFactorType::pin_to_string(ff_pins->pins[i]), + PortType::PinMap::pin_type_names[j], port.str()); + if (port.status == PortType::StatusNotTested) { + call(port); + port.status = PortType::StatusPass; + } else { + utest_printf("test already done..."); + } + utest_printf("%s\n", port.status == PortType::StatusPass ? "succeeded" : "failed"); + goto end_port_iteration; } - utest_printf("%s\n", port.status == PortType::StatusPass ? "succeeded" : "failed"); - goto end_port_iteration; } } - } - for (Iter it = not_matched_ports.begin(); it != not_matched_ports.end(); ++it) { - PortType &port = *it; - for (uint32_t j = 0; j < PortType::pin_count; j++) { - if (ff_pins->pins[i] == port.pins[j]) { - utest_printf("%3s - Could not find pins to test %s pin %s (%d)\n", - FormFactorType::pin_to_string(ff_pins->pins[i]), - PortType::PinMap::pin_type_names[j], - FormFactorType::pin_to_string(ff_pins->pins[i]), - ff_pins->pins[i]); - goto end_port_iteration; + for (Iter it = not_matched_ports.begin(); it != not_matched_ports.end(); ++it) { + PortType &port = *it; + for (uint32_t j = 0; j < PortType::pin_count; j++) { + if (ff_pins->pins[i] == port.pins[j]) { + utest_printf("%3s - Could not find pins to test %s pin %s (%d)\n", + FormFactorType::pin_to_string(ff_pins->pins[i]), + PortType::PinMap::pin_type_names[j], + FormFactorType::pin_to_string(ff_pins->pins[i]), + ff_pins->pins[i]); + goto end_port_iteration; + } } } } @@ -215,9 +217,11 @@ template void test_peripheral(PortType &port) { if (port.empty()) { - utest_printf("%d - Could not find pins to test peripheral\n", port.peripheral); + if (port.peripheral != NC) { + utest_printf("0x%x - Could not find pins to test peripheral\n", port.peripheral); + } } else { - utest_printf("%d - peripheral tested on port: %s...", port.peripheral, port.str()); + utest_printf("0x%x - peripheral tested on port: %s...", port.peripheral, port.str()); if (port.status == PortType::StatusNotTested) { FunctionCaller call; call(port); // run test @@ -403,7 +407,7 @@ public: { static char port_str[128]; char pin_str[32]; - sprintf(port_str, "peripheral=(%d) ", peripheral); + sprintf(port_str, "peripheral=(0x%x) ", peripheral); for (uint32_t i = 0; i < N; i++) { sprintf(pin_str, "%s=(%s) ", PinMap::pin_type_names[i], FormFactorType::pin_to_string(pins[i])); strcat(port_str, pin_str); @@ -582,7 +586,7 @@ struct UARTMaps { static const char *const name; }; const PinMap *UARTMaps::maps[] = { serial_tx_pinmap(), serial_rx_pinmap(), serial_cts_pinmap(), serial_rts_pinmap() }; -const char *const UARTMaps::pin_type_names[] = { "TX", "RX", "CLS", "RTS" }; +const char *const UARTMaps::pin_type_names[] = { "TX", "RX", "CTS", "RTS" }; const char *const UARTMaps::name = UART_NAME; typedef Port<4, UARTMaps, DefaultFormFactor, TF4> UARTPort; #endif diff --git a/features/frameworks/COMPONENT_FPGA_CI_TEST_SHIELD/source/MbedTester.cpp b/features/frameworks/COMPONENT_FPGA_CI_TEST_SHIELD/source/MbedTester.cpp index 308c452c91..2cf26a4ef1 100644 --- a/features/frameworks/COMPONENT_FPGA_CI_TEST_SHIELD/source/MbedTester.cpp +++ b/features/frameworks/COMPONENT_FPGA_CI_TEST_SHIELD/source/MbedTester.cpp @@ -22,6 +22,7 @@ #include "platform/mbed_wait_api.h" #include "platform/mbed_error.h" #include "drivers/MbedCRC.h" +#include "utest/utest_print.h" #define mbed_tester_printf(...) @@ -948,6 +949,7 @@ void MbedTester::pin_map_set(PinName physical, LogicalPin logical) error("Invalid logical pin %i", logical); return; } + utest_printf("(FPGA %u)...", index); pin_map_index(index, logical); }