From e72ef8c943b3a335fe4354e6451be99ab1346081 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sun, 7 Oct 2018 07:58:29 +0000 Subject: STM32 TRNG driver, not tested yet. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12342 110e8d01-0319-4d1e-a829-52ad28d1bb01 --- testhal/STM32/multi/TRNG/.cproject | 5 +- .../multi/TRNG/cfg/stm32l476_discovery/halconf.h | 4 +- .../multi/TRNG/cfg/stm32l476_discovery/mcuconf.h | 7 +- testhal/STM32/multi/TRNG/main.c | 37 -------- .../STM32/multi/TRNG/make/stm32l476_discovery.make | 103 +++++++-------------- 5 files changed, 44 insertions(+), 112 deletions(-) (limited to 'testhal/STM32') diff --git a/testhal/STM32/multi/TRNG/.cproject b/testhal/STM32/multi/TRNG/.cproject index b857ea1a3..14d0bd252 100644 --- a/testhal/STM32/multi/TRNG/.cproject +++ b/testhal/STM32/multi/TRNG/.cproject @@ -78,13 +78,14 @@ + - + - + diff --git a/testhal/STM32/multi/TRNG/cfg/stm32l476_discovery/halconf.h b/testhal/STM32/multi/TRNG/cfg/stm32l476_discovery/halconf.h index 545a6a835..9323c4fe1 100644 --- a/testhal/STM32/multi/TRNG/cfg/stm32l476_discovery/halconf.h +++ b/testhal/STM32/multi/TRNG/cfg/stm32l476_discovery/halconf.h @@ -170,7 +170,7 @@ * @brief Enables the TRNG subsystem. */ #if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__) -#define HAL_USE_TRNG FALSE +#define HAL_USE_TRNG TRUE #endif /** @@ -198,7 +198,7 @@ * @brief Enables the WSPI subsystem. */ #if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__) -#define HAL_USE_WSPI TRUE +#define HAL_USE_WSPI FALSE #endif /*===========================================================================*/ diff --git a/testhal/STM32/multi/TRNG/cfg/stm32l476_discovery/mcuconf.h b/testhal/STM32/multi/TRNG/cfg/stm32l476_discovery/mcuconf.h index 46e69ff34..cd98f46c5 100644 --- a/testhal/STM32/multi/TRNG/cfg/stm32l476_discovery/mcuconf.h +++ b/testhal/STM32/multi/TRNG/cfg/stm32l476_discovery/mcuconf.h @@ -277,6 +277,11 @@ #define STM32_ST_IRQ_PRIORITY 8 #define STM32_ST_USE_TIMER 2 +/* + * TRNG driver system settings. + */ +#define STM32_TRNG_USE_RNG1 TRUE + /* * UART driver system settings. */ @@ -322,7 +327,7 @@ /* * WSPI driver system settings. */ -#define STM32_WSPI_USE_QUADSPI1 TRUE +#define STM32_WSPI_USE_QUADSPI1 FALSE #define STM32_WSPI_QUADSPI1_DMA_STREAM STM32_DMA_STREAM_ID(2, 7) #endif /* MCUCONF_H */ diff --git a/testhal/STM32/multi/TRNG/main.c b/testhal/STM32/multi/TRNG/main.c index 3de5be345..83edb3e63 100644 --- a/testhal/STM32/multi/TRNG/main.c +++ b/testhal/STM32/multi/TRNG/main.c @@ -14,41 +14,11 @@ limitations under the License. */ -#include - #include "ch.h" #include "hal.h" -#include "serial_nor.h" -#include "mfs.h" - -#include "mfs_test_root.h" - #include "portab.h" -/* 16MB device, 2 cycles delay after NCS.*/ -const WSPIConfig WSPIcfg1 = { - .end_cb = NULL, - .dcr = STM32_DCR_FSIZE(24) | STM32_DCR_CSHT(1) -}; - -const SNORConfig snorcfg1 = { - .busp = &WSPID1, - .buscfg = &WSPIcfg1 -}; - -SNORDriver snor1; - -const MFSConfig mfscfg1 = { - .flashp = (BaseFlash *)&snor1, - .erased = 0xFFFFFFFFU, - .bank_size = 4096U, - .bank0_start = 0U, - .bank0_sectors = 1U, - .bank1_start = 1U, - .bank1_sectors = 1U -}; - /* * LED blinker thread, times are in milliseconds. */ @@ -86,18 +56,11 @@ int main(void) { /* Starting a serial port for test report output.*/ sdStart(&PORTAB_SD1, NULL); - /* Initializing and starting snor1 driver.*/ - snorObjectInit(&snor1); - snorStart(&snor1, &snorcfg1); - /* Creates the blinker thread.*/ chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL); /* Normal main() thread activity, in this demo it does nothing.*/ while (true) { - if (palReadLine(PORTAB_LINE_BUTTON) == PORTAB_BUTTON_PRESSED) { - test_execute((BaseSequentialStream *)&PORTAB_SD1, &mfs_test_suite); - } chThdSleepMilliseconds(500); } return 0; diff --git a/testhal/STM32/multi/TRNG/make/stm32l476_discovery.make b/testhal/STM32/multi/TRNG/make/stm32l476_discovery.make index 067ab9f04..a8d43f714 100644 --- a/testhal/STM32/multi/TRNG/make/stm32l476_discovery.make +++ b/testhal/STM32/multi/TRNG/make/stm32l476_discovery.make @@ -18,7 +18,7 @@ ifeq ($(USE_CPPOPT),) USE_CPPOPT = -fno-rtti endif -# Enable this if you want the linker to remove unused code and data +# Enable this if you want the linker to remove unused code and data. ifeq ($(USE_LINK_GC),) USE_LINK_GC = yes endif @@ -28,16 +28,11 @@ ifeq ($(USE_LDOPT),) USE_LDOPT = endif -# Enable this if you want link time optimizations (LTO) +# Enable this if you want link time optimizations (LTO). ifeq ($(USE_LTO),) USE_LTO = yes endif -# If enabled, this option allows to compile the application in THUMB mode. -ifeq ($(USE_THUMB),) - USE_THUMB = yes -endif - # Enable this if you want to see the full log while compiling. ifeq ($(USE_VERBOSE_COMPILE),) USE_VERBOSE_COMPILE = no @@ -76,7 +71,7 @@ endif # FPU-related options. ifeq ($(USE_FPU_OPT),) - USE_FPU_OPT = -mfloat-abi=$(USE_FPU) -mfpu=fpv4-sp-d16 -fsingle-precision-constant + USE_FPU_OPT = -mfloat-abi=$(USE_FPU) -mfpu=fpv4-sp-d16 endif # @@ -84,13 +79,16 @@ endif ############################################################################## ############################################################################## -# Project, sources and paths +# Project, target, sources and paths # # Define project name here PROJECT = ch -# Imported source files and paths +# Target settings. +MCU = cortex-m4 + +# Imported source files and paths. CHIBIOS := ../../../.. CONFDIR := ./cfg/stm32l476_discovery BUILDDIR := ./build/stm32l476_discovery @@ -112,12 +110,10 @@ include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk include $(CHIBIOS)/tools/mk/autobuild.mk # Other files (optional). include $(CHIBIOS)/test/lib/test.mk -include $(CHIBIOS)/test/mfs/mfs_test.mk -include $(CHIBIOS)/os/hal/lib/complex/serial_nor/devices/micron_n25q/flash_device.mk -include $(CHIBIOS)/os/hal/lib/complex/mfs/mfs.mk -include $(CHIBIOS)/os/hal/lib/streams/streams.mk +include $(CHIBIOS)/test/rt/rt_test.mk +include $(CHIBIOS)/test/oslib/oslib_test.mk -# Define linker script file here +# Define linker script file here. LDSCRIPT= $(STARTUPLD)/STM32L476xG.ld # C sources that can be compiled in ARM or THUMB mode depending on the global @@ -131,34 +127,23 @@ CSRC = $(ALLCSRC) \ # setting. CPPSRC = $(ALLCPPSRC) -# C sources to be compiled in ARM mode regardless of the global setting. -# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler -# option that results in lower performance and larger code size. -ACSRC = - -# C++ sources to be compiled in ARM mode regardless of the global setting. -# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler -# option that results in lower performance and larger code size. -ACPPSRC = +# List ASM source files here. +ASMSRC = $(ALLASMSRC) -# C sources to be compiled in THUMB mode regardless of the global setting. -# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler -# option that results in lower performance and larger code size. -TCSRC = +# List ASM with preprocessor source files here. +ASMXSRC = $(ALLXASMSRC) -# C sources to be compiled in THUMB mode regardless of the global setting. -# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler -# option that results in lower performance and larger code size. -TCPPSRC = +# Inclusion directories. +INCDIR = $(CONFDIR) $(ALLINC) $(TESTINC) -# List ASM source files here -ASMSRC = $(ALLASMSRC) -ASMXSRC = $(ALLXASMSRC) +# Define C warning options here. +CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes -INCDIR = $(ALLINC) $(TESTINC) $(CONFDIR) +# Define C++ warning options here. +CPPWARN = -Wall -Wextra -Wundef # -# Project, sources and paths +# Project, target, sources and paths ############################################################################## ############################################################################## @@ -185,43 +170,21 @@ ULIBS = ############################################################################## ############################################################################## -# Compiler settings +# Common rules # -MCU = cortex-m4 +RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk +include $(RULESPATH)/arm-none-eabi.mk +include $(RULESPATH)/rules.mk -#TRGT = arm-elf- -TRGT = arm-none-eabi- -CC = $(TRGT)gcc -CPPC = $(TRGT)g++ -# Enable loading with g++ only if you need C++ runtime support. -# NOTE: You can use C++ even without C++ support if you are careful. C++ -# runtime support makes code size explode. -LD = $(TRGT)gcc -#LD = $(TRGT)g++ -CP = $(TRGT)objcopy -AS = $(TRGT)gcc -x assembler-with-cpp -AR = $(TRGT)ar -OD = $(TRGT)objdump -SZ = $(TRGT)size -HEX = $(CP) -O ihex -BIN = $(CP) -O binary - -# ARM-specific options here -AOPT = - -# THUMB-specific options here -TOPT = -mthumb -DTHUMB - -# Define C warning options here -CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes +# +# Common rules +############################################################################## -# Define C++ warning options here -CPPWARN = -Wall -Wextra -Wundef +############################################################################## +# Custom rules +# # -# Compiler settings +# Custom rules ############################################################################## - -RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk -include $(RULESPATH)/rules.mk -- cgit v1.2.3