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

blackpill-f4: #define PLATFORM_HAS_POWER_SWITCH leads to error: implicit declaration of function 'adc_start_conversion_direct' #1644

Closed
lenvm opened this issue Oct 16, 2023 · 4 comments · Fixed by #1648
Labels
Bug Confirmed bug Foreign Host Board Non Native hardware to runing Black Magic firmware on

Comments

@lenvm
Copy link
Contributor

lenvm commented Oct 16, 2023

Using 9fe5889, adding #define PLATFORM_HAS_POWER_SWITCH to blackpill-f4.h and compiling using the command make PROBE_HOST=blackpill-f401cc leads to the following error.

  CC      platforms/common/stm32/timing_stm32.c
platforms/common/stm32/timing_stm32.c: In function 'sys_tick_handler':
platforms/common/stm32/timing_stm32.c:110:25: error: implicit declaration of function 'adc_start_conversion_direct'; did you mean 'adc_start_conversion_injected'? [-Werror=implicit-function-declaration]
  110 |                         adc_start_conversion_direct(ADC1);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                         adc_start_conversion_injected
cc1: all warnings being treated as errors
make[1]: *** [timing_stm32.o] Error 1
make: *** [all] Error 2

This error was not present a couple months ago when compiling in the same way.

@dragonmux dragonmux added Bug Confirmed bug Foreign Host Board Non Native hardware to runing Black Magic firmware on labels Oct 16, 2023
@dragonmux
Copy link
Member

Ah, that's our bad. PR #1434 wasn't really careful enough to define the tpwr monitoring code only for native or make sure we'd done it in a way that's compatible with all MCUs that make use of that SysTick handler.

Looks like the F4's have different ADC routines and interfaces.. We've got two options here - one is to change the #ifdef guard to check not only that PLATFORM_HAS_POWER_SWITCH is defined but that the platform is at least targeting a STM32F1; the other is to refactor the ADC aspect of this into the platform code properly and then implement it for the F4 platforms too.

@lenvm
Copy link
Contributor Author

lenvm commented Oct 17, 2023

Hi @dragonmux, thanks for your quick reply!

Of course, the ideal solution would be to refactor the code properly and to implement the feature for the F4 platforms as well. I would however already be happy if the #ifdef was changed as a remedial action, until there is time to do the refactoring.

@lenvm lenvm closed this as completed Oct 17, 2023
@lenvm lenvm reopened this Oct 17, 2023
@dragonmux
Copy link
Member

Before we go and open a PR with an attempted fix then.. could you change the offending #ifdef to: #if defined(PLATFORM_HAS_POWER_SWITCH) && define(STM32F1) and confirm for us that it does in fact fix the issue?

@lenvm
Copy link
Contributor Author

lenvm commented Oct 18, 2023

Hi @dragonmux, I have implemented the changes necessary to fix the immediate issue. This does indeed fix the issue. I have committed the changes and created pull request #1648.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Confirmed bug Foreign Host Board Non Native hardware to runing Black Magic firmware on
Projects
None yet
2 participants