Skip to content
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

Add CONFIG_UART_DYNAMIC_SETTINGS option #16231

Closed
erwango opened this issue May 17, 2019 · 2 comments · Fixed by #35697
Closed

Add CONFIG_UART_DYNAMIC_SETTINGS option #16231

erwango opened this issue May 17, 2019 · 2 comments · Fixed by #35697
Assignees
Labels
area: API Changes to public APIs area: UART Universal Asynchronous Receiver-Transmitter Enhancement Changes/Updates/Additions to existing features

Comments

@erwango
Copy link
Member

erwango commented May 17, 2019

Is your enhancement proposal related to a problem? Please describe.
Add an option to disable dynamic settings in uart.h (uart_configure, and uart_configure_get).
This saves around 500 bytes of flash per UART device (seen on STM32)

Describe the solution you'd like
Add a config UART_DYNAMIC_SETTINGS which would be conditional for uart settings related apis:

  • uart_configure
  • uart_configure_get
    When disabled, they would not be available, and settings values would be the ones set at startup either from device tree or HW default values.

Default choice for this new value could be either n or y.
I'd propose n.

@erwango erwango added Enhancement Changes/Updates/Additions to existing features area: UART Universal Asynchronous Receiver-Transmitter area: API Changes to public APIs labels May 17, 2019
@erwango
Copy link
Member Author

erwango commented Feb 5, 2021

@dcpleung I'm adding you as assignee. Feel free to close if you think this is not something we want.

@dcpleung
Copy link
Member

dcpleung commented Feb 5, 2021

Maybe something more like CONFIG_UART_SUPPORT_RUNTIME_CONFIGURE? I just looked at a couple drivers and they call configure() during init(), and uart_apbuart doesn't configure the port during init (... possibly relying on runtime config). So I think in general this doesn't save us much in code size on other platforms.

Is it something you can do in the STM32 driver? If you set .configure and .config_get to null in API struct, and ifdef the functions, it would archive some code saving. Calling to API would simply return -ENOTSUP in this case.

@dcpleung dcpleung added area: API Changes to public APIs and removed area: API Changes to public APIs labels May 26, 2021
dcpleung added a commit to dcpleung/zephyr that referenced this issue May 27, 2021
This kconfig option enables runtime configuration of UART
controllers. This allows application to call uart_configure()
to configure the UART controllers and calling uart_config_get()
to retrieve configuration. If this is disabled, UART controllers
rely on UART driver's initialization function to properly
configure the controller. The main use of this option is mainly
code size reduction.

Fixes zephyrproject-rtos#16231

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
carlescufi pushed a commit that referenced this issue Jun 7, 2021
This kconfig option enables runtime configuration of UART
controllers. This allows application to call uart_configure()
to configure the UART controllers and calling uart_config_get()
to retrieve configuration. If this is disabled, UART controllers
rely on UART driver's initialization function to properly
configure the controller. The main use of this option is mainly
code size reduction.

Fixes #16231

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: API Changes to public APIs area: UART Universal Asynchronous Receiver-Transmitter Enhancement Changes/Updates/Additions to existing features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants