-
Notifications
You must be signed in to change notification settings - Fork 3k
Bring static pinmap extension to master #11892
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
Bring static pinmap extension to master #11892
Conversation
@mprse, thank you for your changes. |
cc @kjbracey-arm |
Before I start reviewing it, is the merge commit ok in a PR? @ARMmbed/mbed-os-maintainers |
As this is targeting feature release, it would be. But simple rebase on the branch should remove it. @mprse Can you rebase your branch and it should be nice linear log |
@mprse Is this targeting 5.15 ? Or 6.0? |
5.15 if it can :P |
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 skimmed the files only. LGTM
@kjbracey-arm
We shall finalize reviews here today, please go ahead! I'll do mine soon |
3927aae
to
cd3989e
Compare
Fixed |
CI started |
@mprse Can you not remove Release notes section (please add it back) ? |
Fixed |
Test run: FAILEDSummary: 1 of 12 test jobs failed Failed test jobs:
|
A lot of tests have failed. I'm not sure if these failures are related to the changes. I haven't seen such failures while working on feature branch. If this requires further investigation I will continue when I will be back from sick-leave (Thursday). Meanwhile can we repeat the test run? |
The storage fix landed, as I can see this needs now one more change. Once done, let us know to start CI asap |
cd3989e
to
2e79384
Compare
Rebased and added the fix for STM QSPI driver. @0xc0170 Can we run CI again? |
CI started |
Test run: FAILEDSummary: 1 of 12 test jobs failed Failed test jobs:
|
Failed prior restart, all fine here. |
It looks like all passed. The result is |
Description
In modern MCUs peripherals often can be mapped to different pins and each pin can have multiple functions. Mbed supports dynamic pin mapping, meaning that pins can be reconfigured at run time to be used by a different driver. That provides great flexibility, but it's not free. There's non-trivial ROM cost to maintain the pinmap tables and infrastructure to parse it. In some use cases, this flexibility is worth the cost. Quite often pin configuration is frozen at hw design stage and doesn't require runtime modification. Shifting this configuration to compile-time will allow us free memory associated with the dynamic approach.
Summary of change
HAL APIs making use of pins take these pins in their constructor and use those pins to lookup which peripheral/function to use. The process of looking up the peripheral/function requires there to be a pinmap table that maps pins to peripherals/functions. This pinmap table takes up ROM which could be saved if the pinmap wasn't used. The goal is to provide additional HAL API/constructors which takes pinmap as a parameter where pin/peripheral/function is specified statically and there is no need to use the pinmap tables. Also, add the constant expression utility functions to find pin mappings in compile time. This extension should give the following savings:
hal\mbed_pinmap_common
library (required for pin lookup mechanism),More information can be found in the design document.
Documentation
Design doc:
https://github.com/ARMmbed/mbed-os/blob/feature-hal-spec-explicit-pinmap/docs/design-documents/hal/0003-static-pinmap-extension.md
Porting guide:
ARMmbed/mbed-os-5-docs#1156
Pull request type
Test results (required)
Reviewers
@ARMmbed/mbed-os-hal
Release Notes
Summary of changes
PWM
,AnalogIn
,AnalogOut
,SPI
,I2C
,UART
,QSPI
,CAN
).xxx_init_direct(xxx_t *obj, static_pinmap_t *)
functions to HAL API (these functions will not use pinmap tables).xxx_init_direct(xxx_t *obj, static_pinmap_t*)
HAL functions.xxx_init_direct(static_pinmap_t *)
functions. These functions will call standardxxx_init(xxx_t *obj, PinName, ...)
function (backward compatibility for targets which do not support static pinmap mechanism).constexpr
utility functions to lookup for pin mapping in compile time (requires C++14).hal\mbed_pinmap_common library
is not needed and can be removed.xxx_init_direct(xxx_t *obj, static_pinmap_t*)
APIs.