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

HAL configuration #518

Merged
merged 15 commits into from
May 15, 2019
Merged

HAL configuration #518

merged 15 commits into from
May 15, 2019

Conversation

fpistm
Copy link
Member

@fpistm fpistm commented May 8, 2019

This PR add some enhancement and flexibility.

  • variant.h is now independent and does not rely on any header.

  • Default STM32 HAL configuration:

    • Before each variants had to include the STM32 HAL configuration file: stm32yyxx_hal_conf.h with yy the STM32 series: f0, f1, f2, f3, f4, g0, f7, h7, l0, l1, l4, wb
      Those files were almost the same for the all series.
      With a default one per series this avoid to add it to the variant folder.
    • Extra HAL module can be enabled in variant.h if required or in a file named (at sketch level): hal_conf_extra.h
    • Custom HAL configuration file can replace the default one by adding a file named (at sketch level):
      hal_conf_custom.h .
    • Some dedicated definitions can be redefined:
      • TICK_INT_PRIORITY
      • PREFETCH_ENABLE
      • INSTRUCTION_CACHE_ENABLE
      • DATA_CACHE_ENABLE
      • USE_SPI_CRC
  • Some HAL modules can now be disabled if user does not use the feature by defining one or more following values (solve Disable HAL feature when not used in the sketch #228):

    • HAL_ADC_MODULE_DISABLED
    • HAL_I2C_MODULE_DISABLED
    • HAL_RTC_MODULE_DISABLED
    • HAL_SPI_MODULE_DISABLED
    • HAL_DAC_MODULE_DISABLED
    • HAL_ETH_MODULE_DISABLED
    • HAL_SD_MODULE_DISABLED
    • HAL_QSPI_MODULE_DISABLED
    • HAL_EXTI_MODULE_DISABLED
    • HAL_TIM_MODULE_DISABLED

Note: HAL_UART_MODULE_ENABLED and HAL_PCD_MODULE_ENABLED are handled thanks Arduino menu.

For example, default Blink sketch for Nucleo L031K6:

  • With default option (Serial is enabled):
Sketch uses 11208 bytes (34%) of program storage space. Maximum is 32768 bytes.
Global variables use 780 bytes (9%) of dynamic memory, leaving 7412 bytes for local variables. Maximum is 8192 bytes.
  • With all HAL_*_MODULE_DISABLED defined in hal_conf_extra.h and Serial disabled:
Sketch uses 4340 bytes (13%) of program storage space. Maximum is 32768 bytes.
Global variables use 52 bytes (0%) of dynamic memory, leaving 8140 bytes for local variables. Maximum is 8192 bytes.

Refer to HAL configuration WiKi page

@fpistm fpistm self-assigned this May 8, 2019
@fpistm fpistm added this to In progress in STM32 core based on ST HAL via automation May 8, 2019
fpistm added a commit to fpistm/STM32SD that referenced this pull request May 9, 2019
Require stm32duino/Arduino_Core_STM32#518

Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
fpistm added a commit to fpistm/STM32Ethernet that referenced this pull request May 10, 2019
variant.h is now included thanks stm32_def.h

See stm32duino/Arduino_Core_STM32#518

Signed-off-by: Frederic.Pillon <frederic.pillon@st.com>
fpistm added a commit to fpistm/STM32Ethernet that referenced this pull request May 11, 2019
variant.h is now included thanks stm32_def.h

See stm32duino/Arduino_Core_STM32#518

Signed-off-by: Frederic.Pillon <frederic.pillon@st.com>
@fpistm fpistm force-pushed the default_HAL_conf branch 3 times, most recently from baa9e86 to 9f6571d Compare May 13, 2019 14:03
@fpistm fpistm added this to the 1.6.0 milestone May 13, 2019
fpistm added 14 commits May 15, 2019 09:16
Signed-off-by: Frederic.Pillon <frederic.pillon@st.com>
Before each variants had to include the STM32 HAL configuration
file: stm32yyxx_hal_conf.h.
Those files were almost the same for the same series.
With a default one per series this avoid to add it to the variant.

Extra HAL module can be enabled in variant.h if required or in a
file named (at sketch level):
  `hal_conf_extra.h`

Custom HAL configuration file can replace the default one by adding
a file named (at sketch level):
  `hal_conf_custom.h` .

Signed-off-by: Frederic.Pillon <frederic.pillon@st.com>
variant.h is now included thanks stm32_def.h

Signed-off-by: Frederic.Pillon <frederic.pillon@st.com>
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
As Wire is a built-in library no need to modify it.

Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
As SPI is a built-in library no need to modify it.

Note: no size change

Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
Note: no size change

Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
Note: no size change

Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
Note: no size change

Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
Note: no size change

Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
Note: Interrupt API does not use the HAL EXTI module
      anyway API is cleaned with HAL_EXTI_MODULE_DISABLED

Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
Signed-off-by: Frederic.Pillon <frederic.pillon@st.com>
Signed-off-by: Frederic.Pillon <frederic.pillon@st.com>
@fpistm fpistm merged commit 89e7ef5 into stm32duino:master May 15, 2019
STM32 core based on ST HAL automation moved this from In progress to Done May 15, 2019
@fpistm fpistm deleted the default_HAL_conf branch May 15, 2019 13:48
@kgamecarter
Copy link
Contributor

Very useful for STM32F030F4P6 16KB flash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants