-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
STM32L4: Fix the UART RX & TX data reg bitmasks #12341
Conversation
@fkjagodzinski, thank you for your changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that only the 3rd patch (STM32L4: Fix the UART RX & TX data reg bitmasks) looks good to me and should be pushed in a separate dedicated pull requests.
I would prefer that you look for better alternatives to the 2 other patches.
@@ -52,6 +52,94 @@ | |||
#include "PinNamesTypes.h" | |||
#include <mstd_cstddef> | |||
|
|||
//*** GPIO *** | |||
|
|||
MSTD_CONSTEXPR_OBJ_11 PinMap PinMap_GPIO[] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is only for testing I would that this code only exists for tests ... as of now this table seems to be unconditionally compiled. Also we want to be able to test any platform with FPGA test shield and I would like to avoid that we have to add such a dummy table to all our Targets ... all in all I am not in favor of this change, I hope that can be a better alternative
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've just confirmed that the PinMap_GPIO
symbol is discarded at link time if not used (by building a blinky example). When building tests-mbed_hal_fpga_ci_test_shield-gpio
the elf does contain it, as expected.
There is no need to add this to other targets if they pass the FPGA GPIO test. A default, weak implementation is used (https://github.com/Armmbed/mbed-os/blob/master/hal/mbed_gpio.c#L77). We're overriding the PinMap_GPIO
only if there is a HW limitation (like a pull-up) for any pins.
targets/TARGET_STM/pinmap.cpp
Outdated
/** | ||
* List of peripherals excluded from testing | ||
*/ | ||
const PeripheralList *pinmap_restricted_peripherals() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here: I'd prefer not to impact the generic source code for tests purposed.
There is already a generic definition of the stdio_uart object that is used at platform level:
platform/source/mbed_retarget.cpp:extern serial_t stdio_uart;
Couldn't this be used for excluding stdio_uart from the test suite without changing the target code ?
Moreover there is no other cpp files in the HAL, I feel like we're losing some consistency here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand you don't like the .c -> .cpp
change. The use of pinmap_peripheral()
was my idea for covering a wider range of targets than those that define STDIO_UART
peripheral.
I think that skipping the tests for
mbed-os/platform/source/mbed_retarget.cpp
Line 148 in 236c336
extern serial_t stdio_uart; |
pinmap_restricted_peripherals()
for this purpose in FPGA tests.
@mprse will pick this PR next week. I'll let him decide how to update this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
serial_t stdio_uart
can not be used to initialize peripherals[]
because it is not constant .
@fkjagodzinski thanks for your proposed changes. I have made comments as I think this proposal should better be split into several separate ones so that the UART fix can be accepted while other changes can be further discussed ... |
targets/TARGET_STM/pinmap.cpp
Outdated
const PeripheralList *pinmap_restricted_peripherals() | ||
{ | ||
#if DEVICE_SERIAL | ||
static const int stdio_uart = pinmap_peripheral(STDIO_UART_TX, PinMap_UART_TX); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi
It should be easier to comment the lines in the PinMap table ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing to consider except whether the linker can deal with the change is user perception. I think explicitly calling it as a test object/feature avoid some confusion and doesn't tempt people into using it.
@fkjagodzinski |
I discussed the issues reported here with @maciejbocianski and we have the following thoughts.
The proposition is to remove related changes from this PR and add restricted STDIO UART peripheral for all targets here: mbed-os/hal/mbed_pinmap_default.c Lines 80 to 88 in b140fd0
Substantiation for this is that the STDIO UART peripheral is used by Mbed, so it should never be tested. While looking into this we also found a potential problem. Currently, we have a one The proposition is to use different functions for each interface: mbed-os/components/testing/COMPONENT_FPGA_CI_TEST_SHIELD/test_utils.h Lines 118 to 121 in b140fd0
@jeromecoutant @LMESTM @bulislaw @jamesbeyond @jamesbeyond
I understand that you don't like dummy pin-map which is required for testing only in your STM files, but this is our common approach in this case. This is required because of target limitations, so we need to add such a table per target. Unfortunately, I can't see a better place to put this, then together with other pin-map tables. What I can suggest is that we can add a comment that this is the pin-map table for testing purposes only. Additionally, this table contains pieces of information that can be valuable for the user (pins that have limited GPIO functionalities are listed with the note). @jeromecoutant @LMESTM @bulislaw @jamesbeyond |
9d45c00
to
707f1da
Compare
Provided the following changes (proposed above):
Please review. |
Please make 1 Pull Request for FPGA part, 1 for NUVUTON, 1 for ST, 1 for..... ? |
The existing logic was insufficient to properly handle odd and even parity setting, e.g. serial_getc() returned 9-bit data for 8O1 transmission format.
707f1da
to
ae635d5
Compare
Provided the following changes:
|
@0xc0170 Can you rename the PR: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx for this fix !
I applied the patch to other STM32 families: fkjagodzinski#4 |
Done |
CI started |
I don't see it merged into that PR, |
Pull request has been modified.
Hi @jeromecoutant, Filip is off this week, I just got your PR merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, Thanks for the update @jeromecoutant @mprse @fkjagodzinski
Test run: SUCCESSSummary: 11 of 11 test jobs passed |
CI restarted due to merge of fkjagodzinski#4 |
Test run: SUCCESSSummary: 11 of 11 test jobs passed |
Thank you @jeromecoutant 👍 |
Summary of changes
Update the STM HAL to pass the tests that make use of the FPGA CI test shield:
<- this is fixed by Add STDIO UART as restricted for FPGA testing for all targets and support for restricting GPIO #12379tests-mbed_hal_fpga_ci_test_shield-uart
for:DISCO_L475VG_IOT01A
,NUCLEO_F303RE
,tests-mbed_hal_fpga_ci_test_shield-gpio
for:<- this is moved to DISCO_L475VG_IOT01A: Add a list of restricted GPIO pins for testing #12380DISCO_L475VG_IOT01A
Impact of changes
Migration actions required
Documentation
None
Pull request type
Test results
Reviewers
@ARMmbed/team-st-mcd, @jamesbeyond, @mprse, @maciejbocianski