diff --git a/cpu/stm32/periph/dac.c b/cpu/stm32/periph/dac.c index c043269711..f03d8cf4d5 100644 --- a/cpu/stm32/periph/dac.c +++ b/cpu/stm32/periph/dac.c @@ -33,8 +33,10 @@ #endif /* get RCC bit */ -#ifdef RCC_APB1ENR_DAC1EN +#if defined(RCC_APB1ENR_DAC1EN) #define RCC_BIT (RCC_APB1ENR_DAC1EN) +#elif defined(RCC_APB1ENR1_DAC1EN) +#define RCC_BIT (RCC_APB1ENR1_DAC1EN) #else #define RCC_BIT (RCC_APB1ENR_DACEN) #endif @@ -97,8 +99,24 @@ void dac_poweron(dac_t line) periph_clk_en(APB1, RCC_BIT); #endif +#if VREFBUF_ENABLE && defined(VREFBUF_CSR_ENVR) + /* enable VREFBUF if needed and available (for example if the board doesn't + * have an external reference voltage connected to V_REF+), wait until + * it is ready */ + RCC->APB2ENR |= RCC_APB2ENR_SYSCFGEN; + VREFBUF->CSR &= ~VREFBUF_CSR_HIZ; + VREFBUF->CSR |= VREFBUF_CSR_ENVR; + while (!(VREFBUF->CSR & VREFBUF_CSR_VRR)) { } +#endif + +#ifdef DAC_MCR_MODE1 + /* Normal mode with Buffer enabled and connected to external pin and on-chip + * peripherals */ + dev(line)->MCR |= (DAC_MCR_MODE1_0 << (16 * (dac_config[line].chan & 0x01))); +#endif + /* enable corresponding DAC channel */ - dev(line)->CR |= (1 << (16 * (dac_config[line].chan & 0x01))); + dev(line)->CR |= (DAC_CR_EN1 << (16 * (dac_config[line].chan & 0x01))); } void dac_poweroff(dac_t line) @@ -106,7 +124,7 @@ void dac_poweroff(dac_t line) assert(line < DAC_NUMOF); /* disable corresponding channel */ - dev(line)->CR &= ~(1 << (16 * (dac_config[line].chan & 0x01))); + dev(line)->CR &= ~(DAC_CR_EN1 << (16 * (dac_config[line].chan & 0x01))); /* disable the DAC's clock in case no channel is active anymore */ if (!(dev(line)->CR & EN_MASK)) { diff --git a/doc/doxygen/src/flashing.md b/doc/doxygen/src/flashing.md index 298d4cd50a..297fa62a75 100644 --- a/doc/doxygen/src/flashing.md +++ b/doc/doxygen/src/flashing.md @@ -196,8 +196,8 @@ JTAG. Also JTAG requires more signal lines to be connected compared to SWD and some internal programmers only have the SWD signal lines connected, so that JTAG will not be possible. -`stm32flash` Configuration {#flashing-configuration-stm32flash} --------------------------- +stm32flash Configuration {#flashing-configuration-stm32flash} +------------------------ It is possible to automatically boot the STM32 board into the in-ROM bootloader that `stm32flash` communicates with for flashing by connecting the RST pin to diff --git a/makefiles/app_dirs.inc.mk b/makefiles/app_dirs.inc.mk index ec5611a088..6659b2df1b 100644 --- a/makefiles/app_dirs.inc.mk +++ b/makefiles/app_dirs.inc.mk @@ -17,6 +17,7 @@ APPLICATION_DIRS := \ tests/bench \ tests/build_system \ tests/core \ + tests/cpu \ tests/drivers \ tests/periph \ tests/pkg \ diff --git a/tests/build_system/external_board_dirs/external_board_dir_1/native1 b/tests/build_system/external_board_dirs/external_board_dir_1/native1 index 3b1d2bb906..22eda5866d 120000 --- a/tests/build_system/external_board_dirs/external_board_dir_1/native1 +++ b/tests/build_system/external_board_dirs/external_board_dir_1/native1 @@ -1 +1 @@ -../../../boards/native/ \ No newline at end of file +../../../../boards/native/ \ No newline at end of file diff --git a/tests/build_system/external_board_dirs/external_board_dir_2/native2 b/tests/build_system/external_board_dirs/external_board_dir_2/native2 index 3b1d2bb906..22eda5866d 120000 --- a/tests/build_system/external_board_dirs/external_board_dir_2/native2 +++ b/tests/build_system/external_board_dirs/external_board_dir_2/native2 @@ -1 +1 @@ -../../../boards/native/ \ No newline at end of file +../../../../boards/native/ \ No newline at end of file diff --git a/tests/cpu/Makefile.cpu_common b/tests/cpu/Makefile.cpu_common new file mode 100644 index 0000000000..ecfb7b7d01 --- /dev/null +++ b/tests/cpu/Makefile.cpu_common @@ -0,0 +1,2 @@ +RIOTBASE ?= $(CURDIR)/../../.. +include $(CURDIR)/../../Makefile.tests_common diff --git a/tests/cpu_avr8_xmega_drivers/Makefile b/tests/cpu/avr8_xmega_drivers/Makefile similarity index 84% rename from tests/cpu_avr8_xmega_drivers/Makefile rename to tests/cpu/avr8_xmega_drivers/Makefile index 7ada190093..963377dfd7 100644 --- a/tests/cpu_avr8_xmega_drivers/Makefile +++ b/tests/cpu/avr8_xmega_drivers/Makefile @@ -1,6 +1,6 @@ BOARD ?= atxmega-a1u-xpro -include ../Makefile.tests_common +include ../Makefile.cpu_common # list of ATxmega boards BOARD_WHITELIST = \ diff --git a/tests/cpu_avr8_xmega_drivers/README.md b/tests/cpu/avr8_xmega_drivers/README.md similarity index 100% rename from tests/cpu_avr8_xmega_drivers/README.md rename to tests/cpu/avr8_xmega_drivers/README.md diff --git a/tests/cpu_avr8_xmega_drivers/cpu_tests.h b/tests/cpu/avr8_xmega_drivers/cpu_tests.h similarity index 100% rename from tests/cpu_avr8_xmega_drivers/cpu_tests.h rename to tests/cpu/avr8_xmega_drivers/cpu_tests.h diff --git a/tests/cpu_avr8_xmega_drivers/main.c b/tests/cpu/avr8_xmega_drivers/main.c similarity index 100% rename from tests/cpu_avr8_xmega_drivers/main.c rename to tests/cpu/avr8_xmega_drivers/main.c diff --git a/tests/cpu_avr8_xmega_drivers/test_ebi.c b/tests/cpu/avr8_xmega_drivers/test_ebi.c similarity index 100% rename from tests/cpu_avr8_xmega_drivers/test_ebi.c rename to tests/cpu/avr8_xmega_drivers/test_ebi.c diff --git a/tests/cpu_cortexm_address_check/Makefile b/tests/cpu/cortexm_address_check/Makefile similarity index 80% rename from tests/cpu_cortexm_address_check/Makefile rename to tests/cpu/cortexm_address_check/Makefile index 9915a7a8dc..8f9068f319 100644 --- a/tests/cpu_cortexm_address_check/Makefile +++ b/tests/cpu/cortexm_address_check/Makefile @@ -1,6 +1,6 @@ BOARD ?= samr21-xpro -include ../Makefile.tests_common +include ../Makefile.cpu_common FEATURES_REQUIRED += cpu_check_address diff --git a/tests/cpu_cortexm_address_check/Makefile.ci b/tests/cpu/cortexm_address_check/Makefile.ci similarity index 100% rename from tests/cpu_cortexm_address_check/Makefile.ci rename to tests/cpu/cortexm_address_check/Makefile.ci diff --git a/tests/cpu_cortexm_address_check/README.md b/tests/cpu/cortexm_address_check/README.md similarity index 100% rename from tests/cpu_cortexm_address_check/README.md rename to tests/cpu/cortexm_address_check/README.md diff --git a/tests/cpu_cortexm_address_check/main.c b/tests/cpu/cortexm_address_check/main.c similarity index 100% rename from tests/cpu_cortexm_address_check/main.c rename to tests/cpu/cortexm_address_check/main.c diff --git a/tests/cpu_efm32_drivers/Makefile b/tests/cpu/efm32_drivers/Makefile similarity index 73% rename from tests/cpu_efm32_drivers/Makefile rename to tests/cpu/efm32_drivers/Makefile index 1c43cda421..7b552a5b48 100644 --- a/tests/cpu_efm32_drivers/Makefile +++ b/tests/cpu/efm32_drivers/Makefile @@ -1,5 +1,5 @@ BOARD ?= sltb001a -include ../Makefile.tests_common +include ../Makefile.cpu_common FEATURES_REQUIRED += efm32_coretemp diff --git a/tests/cpu_efm32_drivers/README.md b/tests/cpu/efm32_drivers/README.md similarity index 100% rename from tests/cpu_efm32_drivers/README.md rename to tests/cpu/efm32_drivers/README.md diff --git a/tests/cpu_efm32_drivers/main.c b/tests/cpu/efm32_drivers/main.c similarity index 100% rename from tests/cpu_efm32_drivers/main.c rename to tests/cpu/efm32_drivers/main.c diff --git a/tests/cpu_efm32_features/Makefile b/tests/cpu/efm32_features/Makefile similarity index 92% rename from tests/cpu_efm32_features/Makefile rename to tests/cpu/efm32_features/Makefile index af409343ee..f3143a0baa 100644 --- a/tests/cpu_efm32_features/Makefile +++ b/tests/cpu/efm32_features/Makefile @@ -1,5 +1,5 @@ BOARD ?= sltb001a -include ../Makefile.tests_common +include ../Makefile.cpu_common BOARD_WHITELIST := ikea-tradfri \ slstk3401a \ diff --git a/tests/cpu_efm32_features/README.md b/tests/cpu/efm32_features/README.md similarity index 100% rename from tests/cpu_efm32_features/README.md rename to tests/cpu/efm32_features/README.md diff --git a/tests/cpu_efm32_features/main.c b/tests/cpu/efm32_features/main.c similarity index 100% rename from tests/cpu_efm32_features/main.c rename to tests/cpu/efm32_features/main.c diff --git a/tests/cpu_efm32_features/tests/01-run.py b/tests/cpu/efm32_features/tests/01-run.py similarity index 100% rename from tests/cpu_efm32_features/tests/01-run.py rename to tests/cpu/efm32_features/tests/01-run.py diff --git a/tests/mpu_noexec_ram/Makefile b/tests/cpu/mpu_noexec_ram/Makefile similarity index 73% rename from tests/mpu_noexec_ram/Makefile rename to tests/cpu/mpu_noexec_ram/Makefile index 14893ab0b3..502daac2a3 100644 --- a/tests/mpu_noexec_ram/Makefile +++ b/tests/cpu/mpu_noexec_ram/Makefile @@ -1,6 +1,6 @@ BOARD ?= nucleo-f767zi -include ../Makefile.tests_common +include ../Makefile.cpu_common USEMODULE += mpu_noexec_ram diff --git a/tests/mpu_noexec_ram/README.md b/tests/cpu/mpu_noexec_ram/README.md similarity index 100% rename from tests/mpu_noexec_ram/README.md rename to tests/cpu/mpu_noexec_ram/README.md diff --git a/tests/mpu_noexec_ram/main.c b/tests/cpu/mpu_noexec_ram/main.c similarity index 100% rename from tests/mpu_noexec_ram/main.c rename to tests/cpu/mpu_noexec_ram/main.c diff --git a/tests/mpu_noexec_ram/tests/01-run.py b/tests/cpu/mpu_noexec_ram/tests/01-run.py similarity index 100% rename from tests/mpu_noexec_ram/tests/01-run.py rename to tests/cpu/mpu_noexec_ram/tests/01-run.py diff --git a/tests/mpu_stack_guard/Makefile b/tests/cpu/mpu_stack_guard/Makefile similarity index 82% rename from tests/mpu_stack_guard/Makefile rename to tests/cpu/mpu_stack_guard/Makefile index d7a4875d3f..beb656e1bb 100644 --- a/tests/mpu_stack_guard/Makefile +++ b/tests/cpu/mpu_stack_guard/Makefile @@ -1,6 +1,6 @@ BOARD ?= nucleo-f767zi -include ../Makefile.tests_common +include ../Makefile.cpu_common USEMODULE += mpu_stack_guard diff --git a/tests/mpu_stack_guard/main.c b/tests/cpu/mpu_stack_guard/main.c similarity index 100% rename from tests/mpu_stack_guard/main.c rename to tests/cpu/mpu_stack_guard/main.c diff --git a/tests/mpu_stack_guard/tests/01-run.py b/tests/cpu/mpu_stack_guard/tests/01-run.py similarity index 100% rename from tests/mpu_stack_guard/tests/01-run.py rename to tests/cpu/mpu_stack_guard/tests/01-run.py diff --git a/tests/backtrace/Makefile b/tests/cpu/native_backtrace/Makefile similarity index 72% rename from tests/backtrace/Makefile rename to tests/cpu/native_backtrace/Makefile index b6e6fbbb98..6310e24231 100644 --- a/tests/backtrace/Makefile +++ b/tests/cpu/native_backtrace/Makefile @@ -1,4 +1,4 @@ -include ../Makefile.tests_common +include ../Makefile.cpu_common USEMODULE += backtrace diff --git a/tests/backtrace/main.c b/tests/cpu/native_backtrace/main.c similarity index 100% rename from tests/backtrace/main.c rename to tests/cpu/native_backtrace/main.c diff --git a/tests/backtrace/tests/01-run.py b/tests/cpu/native_backtrace/tests/01-run.py similarity index 100% rename from tests/backtrace/tests/01-run.py rename to tests/cpu/native_backtrace/tests/01-run.py diff --git a/tests/stm32_bootloader/Makefile b/tests/cpu/stm32_bootloader/Makefile similarity index 82% rename from tests/stm32_bootloader/Makefile rename to tests/cpu/stm32_bootloader/Makefile index 7da2e9305d..09c1e71bd2 100644 --- a/tests/stm32_bootloader/Makefile +++ b/tests/cpu/stm32_bootloader/Makefile @@ -1,5 +1,5 @@ BOARD ?= nucleo-f411re -include ../Makefile.tests_common +include ../Makefile.cpu_common FEATURES_REQUIRED = bootloader_stm32 diff --git a/tests/stm32_bootloader/main.c b/tests/cpu/stm32_bootloader/main.c similarity index 100% rename from tests/stm32_bootloader/main.c rename to tests/cpu/stm32_bootloader/main.c