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

cpu/stm32/include/periph/f7: add missing ADC_DEVS [backport 2022.04] #17926

Conversation

fabian18
Copy link
Contributor

Backport of #17923

Contribution description

#define ADC_DEVS was missing for stm32f7xxxx. All have 3 ADC units.

Testing procedure

BOARD=nucleo-f767zi make -C tests/pkg_mbedtls flash term crashes on master branch.

ADC3 is used in periph_conf.h.

static const adc_conf_t adc_config[] = {
    {GPIO_PIN(PORT_A, 3), 2, 3},
    {GPIO_PIN(PORT_C, 0), 2, 10},
    {GPIO_PIN(PORT_C, 3), 2, 13},
    {GPIO_PIN(PORT_F, 3), 2, 9},
    {GPIO_PIN(PORT_F, 5), 2, 15},
    {GPIO_PIN(PORT_F, 10), 2, 8},
    {GPIO_UNDEF, 0, 18}, /* VBAT */
};

Locks for every ADCx are defined in adc_f4_f7.c.

static mutex_t locks[] = {
#if ADC_DEVS > 1
    MUTEX_INIT,
#endif
#if ADC_DEVS > 2
    MUTEX_INIT,
#endif
    MUTEX_INIT
};

When prep() in adc_f4_f7.c tries to lock the mutex at locks[2], illegal memory is accessed.

Using this PR, it runs successful. (tests/pkg_mbedtls uses ADC noise as entropy source.)

Welcome to pyterm!
Type '/exit' to exit.
s
2022-04-12 22:36:42,424 # START
2022-04-12 22:36:42,429 # main(): This is RIOT! (Version: 2022.07-devel-3-gc89f6b)
2022-04-12 22:36:42,430 # mbedtls test
2022-04-12 22:36:42,430 # 
2022-04-12 22:36:42,433 #   SHA-224 test #1: passed
2022-04-12 22:36:42,435 #   SHA-224 test #2: passed
2022-04-12 22:36:43,137 #   SHA-224 test #3: passed
2022-04-12 22:36:43,139 #   SHA-256 test #1: passed
2022-04-12 22:36:43,142 #   SHA-256 test #2: passed
2022-04-12 22:36:43,844 #   SHA-256 test #3: passed
2022-04-12 22:36:43,845 # 
2022-04-12 22:36:43,847 # adc_noise_single_entropy: 0
2022-04-12 22:36:43,855 #   ENTROPY test: passed
2022-04-12 22:36:43,856 # 
2022-04-12 22:36:43,943 # { "threads": [{ "name": "main", "stack_size": 2048, "stack_used": 1536 }]}

Issues/PRs references

@fabian18 fabian18 added Area: cpu Area: CPU/MCU ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: ARM Platform: This PR/issue effects ARM-based platforms Process: release backport Integration Process: The PR is a release backport of a change previously provided to master Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) labels Apr 13, 2022
@kfessel kfessel removed the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Apr 13, 2022
@kfessel
Copy link
Contributor

kfessel commented Apr 13, 2022

@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Apr 14, 2022
@benpicco benpicco enabled auto-merge April 14, 2022 12:57
Copy link
Contributor

@benpicco benpicco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a rebase because of the branch protection

@benpicco benpicco requested a review from OlegHahm April 28, 2022 09:25
@maribu
Copy link
Member

maribu commented Jul 4, 2022

ping :)

@benpicco
Copy link
Contributor

With the next release just around the corner, I guess this does not matter much anymore

@chrysn
Copy link
Member

chrysn commented Aug 8, 2022

Closing as it was apparently not merged into the 2022.04 branch and has become obsolete.

@chrysn chrysn closed this Aug 8, 2022
auto-merge was automatically disabled August 8, 2022 15:01

Pull request was closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: cpu Area: CPU/MCU ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: ARM Platform: This PR/issue effects ARM-based platforms Process: release backport Integration Process: The PR is a release backport of a change previously provided to master Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants