Skip to content

STM32WL variants incorrectly define HAL_DAC_MODULE_ENABLED causing DAC-related build warnings #2989

Description

@anwfeb

Describe the bug

STM32WL variants define HAL_DAC_MODULE_ENABLED even though STM32WL devices do not provide a DAC peripheral.

As a result, DAC-related code paths in wiring_analog.c and wiring_digital.c are compiled, causing the following warnings during build:

warning: implicit declaration of function 'dac_write_value'
warning: implicit declaration of function 'dac_stop'

The warnings originate from:

dac_write_value(...)
dac_stop(...)

which are compiled because HAL_DAC_MODULE_ENABLED is defined in STM32WL variant files.


To Reproduce

Create a minimal Arduino project for STM32WL55.

platformio.ini

[env:wl55]
platform = ststm32
board = nucleo_wl55jc
framework = arduino

src/main.cpp

#include <Arduino.h>

void setup() {}
void loop() {}

Build the project.

Build output contains warnings similar to:

wiring_digital.c:40:9: warning: implicit declaration of function 'dac_stop'
wiring_analog.c:225:7: warning: implicit declaration of function 'dac_write_value'

Expected behavior

STM32WL devices do not have a DAC peripheral, therefore DAC support should not be enabled for STM32WL variants and the project should build without DAC-related warnings.


Desktop

  • OS: macOS
  • PlatformIO Core: latest
  • STM32 core version: 2.12.0
  • Toolchain: GCC 12.3.1
  • Upload method: ST-Link

Board

  • Name: NUCLEO-WL55JC1
  • MCU: STM32WL55JC

Additional context

The issue appears to come from STM32WL variant definitions enabling DAC support:

Examples:

variants/STM32WLxx/WL54JCI_WL55JCI_WLE4J(8-B-C)I_WLE5J(8-B-C)I/variant_generic.h
#define HAL_DAC_MODULE_ENABLED

variants/STM32WLxx/WL54JCI_WL55JCI_WLE4J(8-B-C)I_WLE5J(8-B-C)I/variant_NUCLEO_WL55JC1.h
#define HAL_DAC_MODULE_ENABLED

I verified that commenting out:

#define HAL_DAC_MODULE_ENABLED

in the STM32WL variant file removes the DAC-related warnings completely and the project builds cleanly.

Since STM32WL devices do not include a DAC peripheral, it seems that HAL_DAC_MODULE_ENABLED should not be defined for STM32WL variants.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions