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

STM32 STDIO pins number are now configurable #5795

Merged
merged 10 commits into from Jan 16, 2018

Conversation

Projects
None yet
5 participants
@jeromecoutant
Contributor

jeromecoutant commented Jan 5, 2018

Description

With that pull request, default configuration is not changed.

There are 2 goals for this PR:

  • Help user when he wrongly defines an alternate UART pins from the same UART instance as the one configured for STDIO
    Now the failure becomes blocking, and an error message is printed.

  • Help user to define his own STDIO pins (for a custom board for ex or if ST-Link is removed), only a json configuration update is needed.
    A good example could be the UBLOX board:

    "UBLOX_EVK_ODIN_W2": {
    "config": {
    "stdio_uart_tx": {
    "help": "Value: D8(default) or D1",
    "value": "D8"
    },
    "stdio_uart_rx": {
    "help": "Value: D2(default) or D0",
    "value": "D2"
    }
    }

@andreaslarssonublox

Status

READY

STM32: update init procedure
- STDIO_UART define is no more used
- configuring a new serial with the same UART as STDIO is no more allowed

@cmonr cmonr added the needs: review label Jan 5, 2018

@@ -1801,57 +1801,42 @@
"supported_form_factors": ["ARDUINO"],
"release_versions": ["5"],
"config": {
"usb_tx": {
"stdio_uart_tx": {

This comment has been minimized.

@0xc0170

0xc0170 Jan 8, 2018

Member

If the old name is used, this breaks it. Shouldn't this be done backward compatible, and then cleaned up for the minor where it can be documented how to update the application?

This change could be as is, but the target code should handle both cases (thus target override in the app would work if it overrides usb_tx there)

This comment has been minimized.

@jeromecoutant

jeromecoutant Jan 8, 2018

Contributor

Yes, I agree.
I will update code.

@jeromecoutant jeromecoutant force-pushed the jeromecoutant:PR_USER_DEFINED_STDIO branch from ddd03ff to 9c6e7c0 Jan 8, 2018

@jeromecoutant

This comment has been minimized.

Contributor

jeromecoutant commented Jan 9, 2018

@0xc0170
Change done, see last commit 9c6e7c0

"macro_name": "STDIO_UART"
}
}
"release_versions": ["5"]

This comment has been minimized.

@0xc0170

0xc0170 Jan 9, 2018

Member

bad rebase ? these pins should be redefined here?

This comment has been minimized.

@jeromecoutant

jeromecoutant Jan 9, 2018

Contributor

No, as there is no "user choice" for this target, the default configuration in the PinName.h file should be sufficient ?
No need to overload the json file.

This comment has been minimized.

@0xc0170

0xc0170 Jan 9, 2018

Member

I was wondering how this is different than from Odin target (line 1818 changes it to a new name) but here you remove it here, thus I asked.

Not clear the line 1831 removal of stdio_uart for odin also?

This comment has been minimized.

@jeromecoutant

jeromecoutant Jan 9, 2018

Contributor

Yes, STDIO_UART is not used any more in serial_api.c file

@jeromecoutant

This comment has been minimized.

Contributor

jeromecoutant commented Jan 10, 2018

Here is a wiki page to help user : https://os.mbed.com/teams/ST/wiki/STDIO

@0xc0170 0xc0170 added needs: CI and removed needs: review labels Jan 12, 2018

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Jan 12, 2018

/morph build

@mbed-ci

This comment has been minimized.

mbed-ci commented Jan 12, 2018

Build : SUCCESS

Build number : 855
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/5795/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build

@mbed-ci

This comment has been minimized.

@mbed-ci

This comment has been minimized.

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Jan 15, 2018

@jeromecoutant Please can you review the failures

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Jan 15, 2018

/morph test

@mbed-ci

This comment has been minimized.

@0xc0170 0xc0170 added ready for merge and removed needs: CI labels Jan 16, 2018

@cmonr cmonr merged commit f01fbde into ARMmbed:master Jan 16, 2018

19 checks passed

ARM mbed CI Verification build successful.
Details
AWS-CI uVisor Build & Test Success
Details
ci-morph-build build completed
Details
ci-morph-exporter build completed
Details
ci-morph-test test completed
Details
continuous-integration/jenkins/pr-head This commit looks good
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
travis-ci/docs Local docs testing has passed
Details
travis-ci/events Local events testing has passed
Details
travis-ci/littlefs Local littlefs testing has passed
Details
travis-ci/mbed2-ATMEL Local mbed2-ATMEL testing has passed
Details
travis-ci/mbed2-MAXIM Local mbed2-MAXIM testing has passed
Details
travis-ci/mbed2-NORDIC Local mbed2-NORDIC testing has passed
Details
travis-ci/mbed2-NUVOTON Local mbed2-NUVOTON testing has passed
Details
travis-ci/mbed2-NXP Local mbed2-NXP testing has passed
Details
travis-ci/mbed2-RENESAS Local mbed2-RENESAS testing has passed
Details
travis-ci/mbed2-SILICON_LABS Local mbed2-SILICON_LABS testing has passed
Details
travis-ci/mbed2-STM Local mbed2-STM testing has passed
Details
travis-ci/tools Local tools testing has passed
Details

@jeromecoutant jeromecoutant deleted the jeromecoutant:PR_USER_DEFINED_STDIO branch Jan 17, 2018

jeromecoutant added a commit to jeromecoutant/mbed that referenced this pull request Jan 26, 2018

STM32 NUCLEO F413ZH and L433RC : STDIO configuration
ARMmbed#5795 patches are missing for these 2 targets
STDIO_UART_TX and STDIO_UART_RX can be now user defined
@atoy40

This comment has been minimized.

atoy40 commented Feb 6, 2018

@jeromecoutant I'm testing 5.7.4 and this feature with a L073RZ board and there is an issue.
As stdio_uart_tx/rx are not defined into the target file, you cannot use in your config :

"target_overrides": {
        "NUCLEO_L073RZ": {
             "target.stdio_uart_tx": "tx pin name",
             "target.stdio_uart_rx": "rx pin name",
        }
    }

It is ignored and does not generate macro into mbed_config.h.
As you've used MBED_CONF_TARGET_STDIO_UART_* as macro name in PinNames.h, you cannot write :

"config": {
          "stdio_uart_tx": {
              "value": "tx pin name"
          },
          "stdio_uart_rx": {
              "value": "rx pin name"
          }
      }

because config variables are prefixed with MBED_CONF_APP_

The workarround is to force macro name :

"config": {
        "stdio_uart_tx": {
            "value": "tx pin name",
            "macro_name": "MBED_CONF_TARGET_STDIO_UART_TX"
        },
        "stdio_uart_rx": {
            "value": "rx pin name",
            "macro_name": "MBED_CONF_TARGET_STDIO_UART_RX"
        }
    },

but is it expected ? I imagine the first code sample is the one to use ?

thanks
Anthony.

@jeromecoutant

This comment has been minimized.

Contributor

jeromecoutant commented Feb 6, 2018

Hi

As indicated in https://os.mbed.com/teams/ST/wiki/STDIO

Here is how I checked it with a mbed_app.json :

{
"config": {
"stdio_uart_tx": {
"value": "PA_2"
},
"stdio_uart_rx": {
"value": "PA_3"
}
}
}

It is true it is not specific to NUCLEO_L073RZ in this case...

@atoy40

This comment has been minimized.

atoy40 commented Feb 6, 2018

@jeromecoutant as I said, if you use that, your two macros will be named : MBED_CONF_APP_XXX and not MBED_CONF_TARGET_XXX as it is expected in the code (PinNames.h).

@jeromecoutant

This comment has been minimized.

Contributor

jeromecoutant commented Feb 6, 2018

Mmmm

Maybe I should add an empty config in the FAMILY_STM32 in targets.json ?

    "config": {
        "lse_available": { ... }
        "stdio_uart_tx": {
            "help": "xxx"
        }
        "stdio_uart_rx": {
            "help": "xxx"
        }
    },

Let's try

@atoy40

This comment has been minimized.

atoy40 commented Feb 6, 2018

Yes this is what you have to do to allow target_overrides. And why do not put default board value in the target file ? instead of putting it into PinNames.h ?

@jeromecoutant

This comment has been minimized.

Contributor

jeromecoutant commented Feb 8, 2018

why do not put default board value in the target file ?

Because I don't want to make this huge rework... :-)
I am going to send a PR with the above proposition

adbridge added a commit that referenced this pull request Feb 9, 2018

STM32 NUCLEO F413ZH and L433RC : STDIO configuration
#5795 patches are missing for these 2 targets
STDIO_UART_TX and STDIO_UART_RX can be now user defined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment