A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/stm32duino/Arduino_Core_STM32/wiki/HAL-configuration below:

HAL configuration · stm32duino/Arduino_Core_STM32 Wiki · GitHub

Since core version greater than 1.5.0, a default STM32 HAL configuration is provided per STM32 series. As those files were almost the same for the same series, a default one per series avoid to add one for each variant.

Each required STM32 HAL configuration file is in system/STM32YYxx/ (where YY is the MCU series).

It allows to wrap to the correct HAL configurations. Example for a STM32F2: stm32f2xx_hal_conf.h

/* STM32F2xx specific HAL configuration options. */
#if __has_include("hal_conf_custom.h")
#include "hal_conf_custom.h"
#else
#if __has_include("hal_conf_extra.h")
#include "hal_conf_extra.h"
#endif
#include "stm32f2xx_hal_conf_default.h"
#endif

Each stm32yyxx_hal_conf_default.h file disabled all HAL modules and include the same stm32yyxx_hal_conf.h file available here: cores/arduino/stm32/stm32yyxx_hal_conf.h

This file handles:

Customize HAL or variant definition

Extra HAL configuration can be enabled/disabled in variant.h (if required) or in a file named (at sketch level):

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

HAL modules configuration Mandatory HAL module enabled by default HAL module enabled by default which can be disabled HAL modules not defined by default HAL modules not defined, handled thanks Arduino menu List of HAL_*_MODULE_DISABLED definition

Tip

Disable unused features can reduce significantly FLASH and RAM usage.

Example of Blink.ino for Nucleo-L031K6 with 32768 bytes of Flash and 8192 bytes of RAM: Core 2.0.0 Flash Size(%) RAM Size(%) Default (Serial enabled) 11796 (35%) 876 (10%) HAL disabled* 5340 (16%) 60 (0%) diff size(%) -6456 (-19%) -716 (-9%)

*With all HAL_*_MODULE_DISABLED defined in hal_conf_extra.h and Serial disabled

Important

Below HAL configurations are listed for convenience but may not be up to date. Refer to the required default STM32 HAL configuration file stm32yyxx_hal_conf_default.h in system/STM32YYxx/ (where YY is the MCU series) to make sure having up to date values.

Oscillator Values adaptation

Hereafter, list of possible oscillator values which can be redefined:

Hereafter, list of possible HAL system configuration values which can be redefined:

STM32 peripherals have many powerful features. Some of them are used by default by the Arduino API: I2C, SPI, TIM, U(S)ART, ... and take over IRQ Handlers (ex: TIMx_IRQHandler) and other HAL weaked functions (ex: HAL_XXX_MspInit()). For advanced user applications, it could be useful to take control of those IRQ handlers.

Since core version greater than 1.7.0, it is possible to disable the use of the HAL modules by the Arduino API.

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:

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 the HAL module.

Note

Required core version higher than 2.7.1.

HAL and LL include assertions which can be enabled by defining USE_FULL_ASSERT in build_opt.h.

By default, assert_failed(uint8_t *file, uint32_t line) will print the assertion location (file and line) and loop forever. Print rely on _Error_Handler(const char *msg, int val) so it is available only when debug is enabled anyway end user can redefine it as it is a WEAK function.

extern "C" void assert_failed(uint8_t *file, uint32_t line) {
  // Custom code
  printf("Assert failed: %s (%lu)\n", (char *)file, line);
}

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  assert_param(LED_BUILTIN == 0);
  pinMode(LED_BUILTIN, OUTPUT);
}
HAL FDCAN for STM32G0xx series

Note

Required core version higher or equal to 2.8.0.

STM23G0xx series shared an irq with the HardwareTimer but the default irq handler did not managed the FDCAN one as the core does not support it.

Since https://github.com/stm32duino/Arduino_Core_STM32/pull/2301 the handler properly forward to the correct handler.

Anyway, application have to declare the phfdcan1 and phfdcan2 handles.

Example:

FDCAN_HandleTypeDef myhfdcan1;
FDCAN_HandleTypeDef *phfdcan1 = &myhfdcan1;
#if defined(FDCAN2_BASE)
FDCAN_HandleTypeDef *phfdcan2 = NULL;
#endif

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4