diff --git a/cpu/atmega_common/Kconfig b/cpu/atmega_common/Kconfig index 386916f5bd..3748434b00 100644 --- a/cpu/atmega_common/Kconfig +++ b/cpu/atmega_common/Kconfig @@ -17,6 +17,7 @@ config CPU_COMMON_ATMEGA bool select CPU_CORE_AVR select HAS_ATMEGA_PCINT0 + select HAS_CPP select HAS_PERIPH_CPUID select HAS_PERIPH_EEPROM select HAS_PERIPH_GPIO diff --git a/cpu/atmega_common/Makefile b/cpu/atmega_common/Makefile index 41d51c7b31..d945090d16 100644 --- a/cpu/atmega_common/Makefile +++ b/cpu/atmega_common/Makefile @@ -4,4 +4,8 @@ MODULE = atmega_common # add a list of subdirectories, that should also be build DIRS = periph avr_libc_extra +ifneq (,$(filter cpu_atmega_common_cxx,$(USEMODULE))) + DIRS += cxx +endif + include $(RIOTBASE)/Makefile.base diff --git a/cpu/atmega_common/Makefile.dep b/cpu/atmega_common/Makefile.dep index 33fa82c5cf..cafee551b8 100644 --- a/cpu/atmega_common/Makefile.dep +++ b/cpu/atmega_common/Makefile.dep @@ -34,3 +34,8 @@ endif ifneq (,$(filter atmega_pcint3,$(USEMODULE))) FEATURES_REQUIRED += atmega_pcint3 endif + +# static C++ constructors need guards for thread safe initialization +ifneq (,$(filter cpp,$(FEATURES_USED))) + USEMODULE += cxx_ctor_guards +endif diff --git a/cpu/atmega_common/Makefile.features b/cpu/atmega_common/Makefile.features index eb49bcd72f..489c684bf3 100644 --- a/cpu/atmega_common/Makefile.features +++ b/cpu/atmega_common/Makefile.features @@ -1,6 +1,7 @@ FEATURES_PROVIDED += arch_8bit FEATURES_PROVIDED += arch_avr8 FEATURES_PROVIDED += atmega_pcint0 +FEATURES_PROVIDED += cpp FEATURES_PROVIDED += periph_cpuid FEATURES_PROVIDED += periph_eeprom FEATURES_PROVIDED += periph_gpio periph_gpio_irq