Skip to content

HAL module only #750

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

Merged
merged 10 commits into from
Nov 28, 2019
Merged

HAL module only #750

merged 10 commits into from
Nov 28, 2019

Conversation

fpistm
Copy link
Member

@fpistm fpistm commented Nov 2, 2019

This PR allow to enable HAL module only

Defining HAL_PPP_MODULE_ONLY in build_opt.h or hal_conf_extra.h allows HAL peripheral (PPP ) module usage without any usage by the core.

Hereafter list of possible definition:

  • HAL_UART_MODULE_ONLY
  • HAL_TIM_MODULE_ONLY
  • HAL_ADC_MODULE_ONLY
  • HAL_DAC_MODULE_ONLY
  • HAL_RTC_MODULE_ONLY
  • HAL_PWR_MODULE_ONLY

I2C and SPI do not required definition as used only thanks built-in library. Do not include Wire.h or SPI.h will allow to use HAL module.

Fixes #697

/CC @geosmall

@fpistm fpistm added the enhancement New feature or request label Nov 2, 2019
@fpistm fpistm added this to the 1.8.0 milestone Nov 2, 2019
@fpistm fpistm changed the title HAL feature only HAL module only Nov 2, 2019
@fpistm fpistm added the waiting feedback Further information is required label Nov 4, 2019
@geosmall
Copy link
Contributor

geosmall commented Nov 18, 2019

Hi,

In my testing of this branch, I've been having trouble clearing the following build error:

In file included from C:\Users\geoma\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.7.0\cores\arduino/stm32/low_power.h:44,
                 from C:\Users\geoma\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.7.0\cores\arduino/board.h:15,
                 from C:\Users\geoma\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.7.0\cores\arduino/wiring.h:41,
                 from C:\Users\geoma\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.7.0\cores\arduino/Arduino.h:32,
                 from C:\Users\geoma\AppData\Local\Temp\arduino_build_17788\sketch\main.c:41:
C:\Users\geoma\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.7.0\cores\arduino/stm32/uart.h:69:3: error: unknown type name 'UART_HandleTypeDef'
   UART_HandleTypeDef handle;
   ^~~~~~~~~~~~~~~~~~

I've tried enabling UART HAL module in my build_opt.h file:

-DHAL_COMP_MODULE_ENABLED
-DHAL_IWDG_MODULE_ENABLED
-DHAL_UART_MODULE_ENABLED
-DHAL_I2C_MODULE_DISABLED
-DHAL_SPI_MODULE_DISABLED
-DHAL_RTC_MODULE_DISABLED
-DUSE_FULL_LL_DRIVER

@fpistm
Copy link
Member Author

fpistm commented Nov 18, 2019

You have to use the definitions I've described in the first post.
HAL_UART_MODULE_ONLY

@fpistm
Copy link
Member Author

fpistm commented Nov 20, 2019

Is it ok @geosmall ?

@geosmall
Copy link
Contributor

geosmall commented Nov 21, 2019

My test application appears to compile but something seems strange. I have a TIM interrupt in a C file as part of my test project. It compiles fine even with no defines in build_opt.h. It appears to me that both are getting compiled and linked but with no errors. I need to boil it down to a small test application to confirm.

I'm not sure I am understanding the default, HAL_NNN_MODULE_ONLY and HAL_NNN_MODULE_ENABLED define behaviors. Could you provide a bit of guidance on how users are supposed to use these options in build_opt.h?

@fpistm
Copy link
Member Author

fpistm commented Nov 26, 2019

Sorry @geosmall didn't see you wait for a guidance.
The goal of HAL_NNN_MODULE_ONLY is to remove all Arduino stuff using the HAL NNN.
So for example if HAL_ADC_MODULE_ENABLED is defined and you define also HAL_ADC_MODULE_ONLY then all Ardunio API related to analog will not be available.
Same for TIM, ...
To sum up this allow to get access to all HAL NNN without any weak redefinition of a HAL API.

Define `HAL_UART_MODULE_ONLY` in `build_opt.h` or `hal_conf_extra.h`
allow HAL UART module usage without any usage by the core.

Fixes stm32duino#697

Signed-off-by: Frederic Pillon <[email protected]>
Allow HAL I2C module usage without any usage by the core.

Fixes stm32duino#697

Signed-off-by: Frederic Pillon <[email protected]>
Allow HAL SPI module usage without any usage by the core.

Fixes stm32duino#697

Signed-off-by: Frederic Pillon <[email protected]>
Define `HAL_TIM_MODULE_ONLY` in `build_opt.h` or `hal_conf_extra.h`
allow HAL TIM module usage without any usage by the core.

Fixes stm32duino#697

Signed-off-by: Frederic Pillon <[email protected]>
Define `HAL_ADC_MODULE_ONLY` in `build_opt.h` or `hal_conf_extra.h`
allow HAL ADC module usage without any usage by the core.

Fixes stm32duino#697

Signed-off-by: Frederic Pillon <[email protected]>
Define `HAL_DAC_MODULE_ONLY` in `build_opt.h` or `hal_conf_extra.h`
allow HAL DAC module usage without any usage by the core.

Fixes stm32duino#697

Signed-off-by: Frederic Pillon <[email protected]>
Define `HAL_RTC_MODULE_ONLY` in `build_opt.h` or `hal_conf_extra.h`
allow HAL RTC module usage without any usage by the core.

Fixes stm32duino#697

Signed-off-by: Frederic Pillon <[email protected]>
Define `HAL_RTC_MODULE_ONLY` in `build_opt.h` or `hal_conf_extra.h`
allow HAL PWR module usage without any usage by the core.

Fixes stm32duino#697

Signed-off-by: Frederic Pillon <[email protected]>
@fpistm
Copy link
Member Author

fpistm commented Nov 27, 2019

@geosmall
is it OK for you?
I would like merge as it is a pain to rebase it. 😭

@geosmall
Copy link
Contributor

It appears to be working as intended. I would go ahead and merge. I will continue testing. Thanks!

@fpistm fpistm merged commit 11857b8 into stm32duino:master Nov 28, 2019
@fpistm fpistm deleted the HAL_Feature_Only branch November 28, 2019 07:47
@fpistm fpistm removed the waiting feedback Further information is required label Nov 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow provision for user defined TIMx_IRQ_Handlers
2 participants