aboutsummaryrefslogtreecommitdiffstats
path: root/demos/STM32/RT-STM32F429-DISCOVERY-TRIBUF
diff options
context:
space:
mode:
authorNicolas Reinecke <nr@das-labor.org>2016-05-01 01:38:31 +0200
committerNicolas Reinecke <nr@das-labor.org>2016-05-01 03:28:30 +0200
commit367bc6bcce15d90b49b040d865c3a8f69321b80e (patch)
tree2e148b46b925b84387c4d2101e80b34e906150f5 /demos/STM32/RT-STM32F429-DISCOVERY-TRIBUF
parent1a6aba5009bf8ba1672adddb5b24fd7fe1f2c973 (diff)
downloadChibiOS-Contrib-367bc6bcce15d90b49b040d865c3a8f69321b80e.tar.gz
ChibiOS-Contrib-367bc6bcce15d90b49b040d865c3a8f69321b80e.tar.bz2
ChibiOS-Contrib-367bc6bcce15d90b49b040d865c3a8f69321b80e.zip
update stm32 demo and testhal projects to upstream chibios
Diffstat (limited to 'demos/STM32/RT-STM32F429-DISCOVERY-TRIBUF')
-rw-r--r--demos/STM32/RT-STM32F429-DISCOVERY-TRIBUF/Makefile29
-rw-r--r--demos/STM32/RT-STM32F429-DISCOVERY-TRIBUF/chconf.h53
-rw-r--r--demos/STM32/RT-STM32F429-DISCOVERY-TRIBUF/halconf.h52
-rw-r--r--demos/STM32/RT-STM32F429-DISCOVERY-TRIBUF/main.c65
-rw-r--r--demos/STM32/RT-STM32F429-DISCOVERY-TRIBUF/mcuconf.h28
5 files changed, 127 insertions, 100 deletions
diff --git a/demos/STM32/RT-STM32F429-DISCOVERY-TRIBUF/Makefile b/demos/STM32/RT-STM32F429-DISCOVERY-TRIBUF/Makefile
index d502e66..68fe855 100644
--- a/demos/STM32/RT-STM32F429-DISCOVERY-TRIBUF/Makefile
+++ b/demos/STM32/RT-STM32F429-DISCOVERY-TRIBUF/Makefile
@@ -69,7 +69,7 @@ ifeq ($(USE_EXCEPTIONS_STACKSIZE),)
USE_EXCEPTIONS_STACKSIZE = 0x400
endif
-# Enables the use of FPU on Cortex-M4 (no, softfp, hard).
+# Enables the use of FPU (no, softfp, hard).
ifeq ($(USE_FPU),)
USE_FPU = no
endif
@@ -89,7 +89,7 @@ PROJECT = ch
CHIBIOS = ../../../../ChibiOS-RT
CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib
# Startup files.
-include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_stm32f4xx.mk
+include $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32f4xx.mk
# HAL-OSAL files (optional).
include $(CHIBIOS_CONTRIB)/os/hal/hal.mk
include $(CHIBIOS_CONTRIB)/os/hal/ports/STM32/STM32F4xx/platform.mk
@@ -97,9 +97,11 @@ include $(CHIBIOS)/os/hal/boards/ST_STM32F429I_DISCOVERY/board.mk
include $(CHIBIOS)/os/hal/osal/rt/osal.mk
# RTOS files (optional).
include $(CHIBIOS)/os/rt/rt.mk
-include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
+include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
# Other files (optional).
include $(CHIBIOS)/test/rt/test.mk
+include $(CHIBIOS)/os/hal/lib/streams/streams.mk
+include $(CHIBIOS)/os/various/shell/shell.mk
# Define linker script file here
LDSCRIPT = $(STARTUPLD)/STM32F429xI.ld
@@ -114,13 +116,11 @@ CSRC = $(STARTUPSRC) \
$(PLATFORMSRC) \
$(BOARDSRC) \
$(TESTSRC) \
- $(CHIBIOS)/os/various/shell.c \
- $(CHIBIOS)/os/hal/lib/streams/memstreams.c \
- $(CHIBIOS)/os/hal/lib/streams/chprintf.c \
+ $(STREAMSSRC) \
+ $(SHELLSRC) \
$(CHIBIOS_CONTRIB)/os/various/tribuf.c \
- ./usbcfg.c \
- ./main.c \
- # eol
+ usbcfg.c \
+ main.c
# C++ sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
@@ -153,10 +153,9 @@ ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM)
INCDIR = $(CHIBIOS)/os/license \
$(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \
$(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \
+ $(STREAMSINC) $(SHELLINC) \
$(CHIBIOS)/os/various \
- $(CHIBIOS)/os/hal/lib/streams \
- $(CHIBIOS_CONTRIB)/os/various \
- # eol
+ $(CHIBIOS_CONTRIB)/os/various
#
# Project, sources and paths
@@ -192,10 +191,10 @@ AOPT =
TOPT = -mthumb -DTHUMB
# Define C warning options here
-CWARN = -Wall -Wextra -Wstrict-prototypes
+CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes
# Define C++ warning options here
-CPPWARN = -Wall -Wextra
+CPPWARN = -Wall -Wextra -Wundef
#
# Compiler settings
@@ -224,5 +223,5 @@ ULIBS =
# End of user defines
##############################################################################
-RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC
+RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC
include $(RULESPATH)/rules.mk
diff --git a/demos/STM32/RT-STM32F429-DISCOVERY-TRIBUF/chconf.h b/demos/STM32/RT-STM32F429-DISCOVERY-TRIBUF/chconf.h
index ebc01e2..9a33ce5 100644
--- a/demos/STM32/RT-STM32F429-DISCOVERY-TRIBUF/chconf.h
+++ b/demos/STM32/RT-STM32F429-DISCOVERY-TRIBUF/chconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -25,8 +25,10 @@
* @{
*/
-#ifndef _CHCONF_H_
-#define _CHCONF_H_
+#ifndef CHCONF_H
+#define CHCONF_H
+
+#define _CHIBIOS_RT_CONF_
/*===========================================================================*/
/**
@@ -349,12 +351,18 @@
/**
* @brief Debug option, trace buffer.
- * @details If enabled then the context switch circular trace buffer is
- * activated.
+ * @details If enabled then the trace buffer is activated.
*
- * @note The default is @p FALSE.
+ * @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
+ */
+#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL
+
+/**
+ * @brief Trace buffer entries.
+ * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
+ * different from @p CH_DBG_TRACE_MASK_DISABLED.
*/
-#define CH_DBG_ENABLE_TRACE TRUE
+#define CH_DBG_TRACE_BUFFER_SIZE 128
/**
* @brief Debug option, stack checks.
@@ -419,10 +427,6 @@
/**
* @brief Threads finalization hook.
* @details User finalization code added to the @p chThdExit() API.
- *
- * @note It is inserted into lock zone.
- * @note It is also invoked when the threads simply return in order to
- * terminate.
*/
#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
/* Add threads finalization code here.*/ \
@@ -437,12 +441,27 @@
}
/**
+ * @brief ISR enter hook.
+ */
+#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
+ /* IRQ prologue code here.*/ \
+}
+
+/**
+ * @brief ISR exit hook.
+ */
+#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
+ /* IRQ epilogue code here.*/ \
+}
+
+/**
* @brief Idle thread enter hook.
* @note This hook is invoked within a critical zone, no OS functions
* should be invoked from here.
* @note This macro can be used to activate a power saving mode.
*/
#define CH_CFG_IDLE_ENTER_HOOK() { \
+ /* Idle-enter code here.*/ \
}
/**
@@ -452,6 +471,7 @@
* @note This macro can be used to deactivate a power saving mode.
*/
#define CH_CFG_IDLE_LEAVE_HOOK() { \
+ /* Idle-leave code here.*/ \
}
/**
@@ -480,6 +500,15 @@
/* System halt code here.*/ \
}
+/**
+ * @brief Trace hook.
+ * @details This hook is invoked each time a new record is written in the
+ * trace buffer.
+ */
+#define CH_CFG_TRACE_HOOK(tep) { \
+ /* Trace code here.*/ \
+}
+
/** @} */
/*===========================================================================*/
@@ -488,6 +517,6 @@
#define TRIBUF_USE_WAIT TRUE
-#endif /* _CHCONF_H_ */
+#endif /* CHCONF_H */
/** @} */
diff --git a/demos/STM32/RT-STM32F429-DISCOVERY-TRIBUF/halconf.h b/demos/STM32/RT-STM32F429-DISCOVERY-TRIBUF/halconf.h
index bec24bd..ebe3af9 100644
--- a/demos/STM32/RT-STM32F429-DISCOVERY-TRIBUF/halconf.h
+++ b/demos/STM32/RT-STM32F429-DISCOVERY-TRIBUF/halconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -25,8 +25,8 @@
* @{
*/
-#ifndef _HALCONF_H_
-#define _HALCONF_H_
+#ifndef HALCONF_H
+#define HALCONF_H
#include "mcuconf.h"
@@ -294,7 +294,7 @@
* @brief Serial buffers size.
* @details Configuration parameter, you can change the depth of the queue
* buffers depending on the requirements of your application.
- * @note The default is 64 bytes for both the transmission and receive
+ * @note The default is 16 bytes for both the transmission and receive
* buffers.
*/
#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
@@ -309,13 +309,21 @@
* @brief Serial over USB buffers size.
* @details Configuration parameter, the buffer size must be a multiple of
* the USB data endpoint maximum packet size.
- * @note The default is 64 bytes for both the transmission and receive
+ * @note The default is 256 bytes for both the transmission and receive
* buffers.
*/
#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
#define SERIAL_USB_BUFFERS_SIZE 256
#endif
+/**
+ * @brief Serial over USB number of buffers.
+ * @note The default is 2 buffers.
+ */
+#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__)
+#define SERIAL_USB_BUFFERS_NUMBER 2
+#endif
+
/*===========================================================================*/
/* SPI driver related settings. */
/*===========================================================================*/
@@ -337,11 +345,43 @@
#endif
/*===========================================================================*/
+/* UART driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables synchronous APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__)
+#define UART_USE_WAIT FALSE
+#endif
+
+/**
+ * @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
+#define UART_USE_MUTUAL_EXCLUSION FALSE
+#endif
+
+/*===========================================================================*/
+/* USB driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables synchronous APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(USB_USE_WAIT) || defined(__DOXYGEN__)
+#define USB_USE_WAIT FALSE
+#endif
+
+/*===========================================================================*/
/* Community drivers' includes */
/*===========================================================================*/
#include "halconf_community.h"
-#endif /* _HALCONF_H_ */
+#endif /* HALCONF_H */
/** @} */
diff --git a/demos/STM32/RT-STM32F429-DISCOVERY-TRIBUF/main.c b/demos/STM32/RT-STM32F429-DISCOVERY-TRIBUF/main.c
index 25ffd87..a7a33f6 100644
--- a/demos/STM32/RT-STM32F429-DISCOVERY-TRIBUF/main.c
+++ b/demos/STM32/RT-STM32F429-DISCOVERY-TRIBUF/main.c
@@ -16,7 +16,6 @@
#include "ch.h"
#include "hal.h"
-#include "test.h"
#include "chprintf.h"
#include "shell.h"
@@ -197,63 +196,6 @@ static THD_FUNCTION(writer_thread, arg) {
#define SHELL_WA_SIZE THD_WORKING_AREA_SIZE(2048)
#define TEST_WA_SIZE THD_WORKING_AREA_SIZE(256)
-static void cmd_mem(BaseSequentialStream *chp, int argc, char *argv[]) {
-
- size_t n, size;
- (void)argv;
-
- if (argc > 0) {
- chprintf(chp, "Usage: mem\r\n");
- return;
- }
-
- n = chHeapStatus(NULL, &size);
- chprintf(chp, "core free memory : %u bytes\r\n", chCoreGetStatusX());
- chprintf(chp, "heap fragments : %u\r\n", n);
- chprintf(chp, "heap free total : %u bytes\r\n", size);
-}
-
-static void cmd_threads(BaseSequentialStream *chp, int argc, char *argv[]) {
-
- static const char *states[] = {CH_STATE_NAMES};
- thread_t *tp;
- (void)argv;
-
- if (argc > 0) {
- chprintf(chp, "Usage: threads\r\n");
- return;
- }
-
- chprintf(chp, " addr stack prio refs state name\r\n");
- tp = chRegFirstThread();
- do {
- chprintf(chp, "%08lx %08lx %4lu %4lu %9s %s\r\n",
- (uint32_t)tp, (uint32_t)tp->p_ctx.r13,
- (uint32_t)tp->p_prio, (uint32_t)(tp->p_refs - 1),
- states[tp->p_state], tp->p_name);
- tp = chRegNextThread(tp);
- } while (tp != NULL);
-}
-
-static void cmd_test(BaseSequentialStream *chp, int argc, char *argv[]) {
-
- thread_t *tp;
- (void)argv;
-
- if (argc > 0) {
- chprintf(chp, "Usage: test\r\n");
- return;
- }
-
- tp = chThdCreateFromHeap(NULL, TEST_WA_SIZE, chThdGetPriorityX(),
- TestThread, chp);
- if (tp == NULL) {
- chprintf(chp, "out of memory\r\n");
- return;
- }
- chThdWait(tp);
-}
-
static void cmd_reset(BaseSequentialStream *chp, int argc, char *argv[]) {
(void)argv;
@@ -444,9 +386,6 @@ static void cmd_params(BaseSequentialStream *chp, int argc, char *argv[]) {
}
static const ShellCommand commands[] = {
- {"mem", cmd_mem},
- {"threads", cmd_threads},
- {"test", cmd_test},
{"reset", cmd_reset},
{"run", cmd_run},
{"stop", cmd_stop},
@@ -530,10 +469,10 @@ int main(void) {
#if (HAL_USE_SERIAL_USB == TRUE)
if (SDU1.config->usbp->state == USB_ACTIVE) {
/* Spawns a new shell.*/
- shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
+ shelltp = chThdCreateFromHeap(NULL, SHELL_WA_SIZE, "shell", NORMALPRIO, shellThread, (void *) &shell_cfg1);
}
#else
- shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
+ shelltp = chThdCreateFromHeap(NULL, SHELL_WA_SIZE, "shell", NORMALPRIO, shellThread, (void *) &shell_cfg1);
#endif
}
else {
diff --git a/demos/STM32/RT-STM32F429-DISCOVERY-TRIBUF/mcuconf.h b/demos/STM32/RT-STM32F429-DISCOVERY-TRIBUF/mcuconf.h
index 0438c01..ec65ff7 100644
--- a/demos/STM32/RT-STM32F429-DISCOVERY-TRIBUF/mcuconf.h
+++ b/demos/STM32/RT-STM32F429-DISCOVERY-TRIBUF/mcuconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -14,8 +14,8 @@
limitations under the License.
*/
-#ifndef _MCUCONF_H_
-#define _MCUCONF_H_
+#ifndef MCUCONF_H
+#define MCUCONF_H
/*
* STM32F4xx drivers configuration.
@@ -176,6 +176,21 @@
#define STM32_I2C_DMA_ERROR_HOOK(i2cp) osalSysHalt("DMA failure")
/*
+ * I2S driver system settings.
+ */
+#define STM32_I2S_USE_SPI2 FALSE
+#define STM32_I2S_USE_SPI3 FALSE
+#define STM32_I2S_SPI2_IRQ_PRIORITY 10
+#define STM32_I2S_SPI3_IRQ_PRIORITY 10
+#define STM32_I2S_SPI2_DMA_PRIORITY 1
+#define STM32_I2S_SPI3_DMA_PRIORITY 1
+#define STM32_I2S_SPI2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
+#define STM32_I2S_SPI2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
+#define STM32_I2S_SPI3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0)
+#define STM32_I2S_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
+#define STM32_I2S_DMA_ERROR_HOOK(i2sp) osalSysHalt("DMA failure")
+
+/*
* ICU driver system settings.
*/
#define STM32_ICU_USE_TIM1 FALSE
@@ -340,8 +355,13 @@
#define STM32_USB_OTGFIFO_FILL_BASEPRI 0
/*
+ * WDG driver system settings.
+ */
+#define STM32_WDG_USE_IWDG FALSE
+
+/*
* Header for community drivers.
*/
#include "mcuconf_community.h"
-#endif /* _MCUCONF_H_ */
+#endif /* MCUCONF_H */