aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--os/hal/templates/can_lld.c64
-rw-r--r--os/hal/templates/can_lld.h102
-rw-r--r--os/hal/templates/hal_lld.h6
-rw-r--r--os/hal/templates/mcuconf.h29
-rw-r--r--os/hal/templates/platform.mk34
-rw-r--r--testhal/testbuild/Makefile270
-rw-r--r--testhal/testbuild/main.c2
7 files changed, 355 insertions, 152 deletions
diff --git a/os/hal/templates/can_lld.c b/os/hal/templates/can_lld.c
index 152c14489..1496ea172 100644
--- a/os/hal/templates/can_lld.c
+++ b/os/hal/templates/can_lld.c
@@ -39,6 +39,11 @@
/* Driver exported variables. */
/*===========================================================================*/
+/** @brief CAN1 driver identifier.*/
+#if PLATFORM_CAN_USE_CAN1 || defined(__DOXYGEN__)
+CANDriver CAND1;
+#endif
+
/*===========================================================================*/
/* Driver local variables. */
/*===========================================================================*/
@@ -62,6 +67,10 @@
*/
void can_lld_init(void) {
+#if PLATFORM_CAN_USE_CAN1
+ /* Driver initialization.*/
+ canObjectInit(&CAND1);
+#endif
}
/**
@@ -73,6 +82,14 @@ void can_lld_init(void) {
*/
void can_lld_start(CANDriver *canp) {
+ /* Clock activation.*/
+ if (canp->state == CAN_STOP) {
+#if PLATFORM_CAN_USE_CAN1
+ if (&CAND1 == canp) {
+
+ }
+#endif
+ }
}
/**
@@ -90,20 +107,32 @@ void can_lld_stop(CANDriver *canp) {
}
}
-
/**
* @brief Determines whether a frame can be transmitted.
*
* @param[in] canp pointer to the @p CANDriver object
+ * @param[in] mailbox mailbox number, @p CAN_ANY_MAILBOX for any mailbox
+ *
* @return The queue space availability.
* @retval FALSE no space in the transmit queue.
* @retval TRUE transmit slot available.
*
* @notapi
*/
-bool_t can_lld_can_transmit(CANDriver *canp) {
-
- return FALSE;
+bool_t can_lld_is_tx_empty(CANDriver *canp, canmbx_t mailbox) {
+
+ switch (mailbox) {
+ case CAN_ANY_MAILBOX:
+ return FALSE;
+ case 1:
+ return FALSE;
+ case 2:
+ return FALSE;
+ case 3:
+ return FALSE;
+ default:
+ return FALSE;
+ }
}
/**
@@ -111,10 +140,13 @@ bool_t can_lld_can_transmit(CANDriver *canp) {
*
* @param[in] canp pointer to the @p CANDriver object
* @param[in] ctfp pointer to the CAN frame to be transmitted
+ * @param[in] mailbox mailbox number, @p CAN_ANY_MAILBOX for any mailbox
*
* @notapi
*/
-void can_lld_transmit(CANDriver *canp, const CANTxFrame *ctfp) {
+void can_lld_transmit(CANDriver *canp,
+ canmbx_t mailbox,
+ const CANTxFrame *ctfp) {
}
@@ -122,26 +154,40 @@ void can_lld_transmit(CANDriver *canp, const CANTxFrame *ctfp) {
* @brief Determines whether a frame has been received.
*
* @param[in] canp pointer to the @p CANDriver object
+ * @param[in] mailbox mailbox number, @p CAN_ANY_MAILBOX for any mailbox
+ *
* @return The queue space availability.
* @retval FALSE no space in the transmit queue.
* @retval TRUE transmit slot available.
*
* @notapi
*/
-bool_t can_lld_can_receive(CANDriver *canp) {
-
- return FALSE;
+bool_t can_lld_is_rx_nonempty(CANDriver *canp, canmbx_t mailbox) {
+
+ switch (mailbox) {
+ case CAN_ANY_MAILBOX:
+ return FALSE
+ case 1:
+ return FALSE
+ case 2:
+ return FALSE
+ default:
+ return FALSE;
+ }
}
/**
* @brief Receives a frame from the input queue.
*
* @param[in] canp pointer to the @p CANDriver object
+ * @param[in] mailbox mailbox number, @p CAN_ANY_MAILBOX for any mailbox
* @param[out] crfp pointer to the buffer where the CAN frame is copied
*
* @notapi
*/
-void can_lld_receive(CANDriver *canp, CANRxFrame *crfp) {
+void can_lld_receive(CANDriver *canp,
+ canmbx_t mailbox,
+ CANRxFrame *crfp) {
}
diff --git a/os/hal/templates/can_lld.h b/os/hal/templates/can_lld.h
index 91a3ac4b9..c4bf67937 100644
--- a/os/hal/templates/can_lld.h
+++ b/os/hal/templates/can_lld.h
@@ -39,12 +39,34 @@
* @brief This switch defines whether the driver implementation supports
* a low power switch mode with automatic an wakeup feature.
*/
-#define CAN_SUPPORTS_SLEEP TRUE
+#define CAN_SUPPORTS_SLEEP TRUE
+
+/**
+ * @brief This implementation supports three transmit mailboxes.
+ */
+#define CAN_TX_MAILBOXES 3
+
+/**
+ * @brief This implementation supports two receive mailboxes.
+ */
+#define CAN_RX_MAILBOXES 2
/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
+/**
+ * @name Configuration options
+ * @{
+ */
+/**
+ * @brief CAN1 driver enable switch.
+ * @details If set to @p TRUE the support for CAN1 is included.
+ */
+#if !defined(PLATFORM_CAN_USE_CAN1) || defined(__DOXYGEN__)
+#define PLATFORM_CAN_USE_CAN1 FALSE
+#endif
+
/*===========================================================================*/
/* Derived constants and error checks. */
/*===========================================================================*/
@@ -58,15 +80,14 @@
/*===========================================================================*/
/**
- * @brief CAN status flags.
+ * @brief Type of a transmission mailbox index.
*/
-typedef uint32_t canstatus_t;
+typedef uint32_t canmbx_t;
/**
* @brief CAN transmission frame.
- * @note Accessing the frame data as word16 or word32 is not portable
- * because machine data endianness, it can be still useful for a
- * quick filling.
+ * @note Accessing the frame data as word16 or word32 is not portable because
+ * machine data endianness, it can be still useful for a quick filling.
*/
typedef struct {
struct {
@@ -91,9 +112,8 @@ typedef struct {
/**
* @brief CAN received frame.
- * @note Accessing the frame data as word16 or word32 is not portable
- * because machine data endianness, it can be still useful for a
- * quick filling.
+ * @note Accessing the frame data as word16 or word32 is not portable because
+ * machine data endianness, it can be still useful for a quick filling.
*/
typedef struct {
struct {
@@ -123,6 +143,7 @@ typedef struct {
* @note It could not be present on some architectures.
*/
typedef struct {
+ uint32_t dummy;
} CANFilter;
/**
@@ -132,59 +153,62 @@ typedef struct {
* @note It could be empty on some architectures.
*/
typedef struct {
+ uint32_t dummy;
} CANConfig;
/**
* @brief Structure representing an CAN driver.
- * @note Implementations may extend this structure to contain more,
- * architecture dependent, fields.
*/
typedef struct {
/**
- * @brief Driver state.
+ * @brief Driver state.
*/
canstate_t state;
/**
- * @brief Current configuration data.
+ * @brief Current configuration data.
*/
const CANConfig *config;
/**
- * @brief Transmission queue semaphore.
+ * @brief Transmission queue semaphore.
*/
Semaphore txsem;
/**
- * @brief Receive queue semaphore.
+ * @brief Receive queue semaphore.
*/
Semaphore rxsem;
/**
- * @brief One or more frames become available.
- * @note After broadcasting this event it will not be broadcasted again
- * until the received frames queue has been completely emptied. It
- * is <b>not</b> broadcasted for each received frame. It is
- * responsibility of the application to empty the queue by repeatedly
- * invoking @p chReceive() when listening to this event. This behavior
- * minimizes the interrupt served by the system because CAN traffic.
+ * @brief One or more frames become available.
+ * @note After broadcasting this event it will not be broadcasted again
+ * until the received frames queue has been completely emptied. It
+ * is <b>not</b> broadcasted for each received frame. It is
+ * responsibility of the application to empty the queue by
+ * repeatedly invoking @p chReceive() when listening to this event.
+ * This behavior minimizes the interrupt served by the system
+ * because CAN traffic.
+ * @note The flags associated to the listeners will indicate which
+ * receive mailboxes become non-empty.
*/
EventSource rxfull_event;
/**
- * @brief One or more transmission slots become available.
+ * @brief One or more transmission mailbox become available.
+ * @note The flags associated to the listeners will indicate which
+ * transmit mailboxes become empty.
+ *
*/
EventSource txempty_event;
/**
- * @brief A CAN bus error happened.
+ * @brief A CAN bus error happened.
+ * @note The flags associated to the listeners will indicate the
+ * error(s) that have occurred.
*/
EventSource error_event;
- /**
- * @brief Error flags set when an error event is broadcasted.
- */
- canstatus_t status;
#if CAN_USE_SLEEP_MODE || defined (__DOXYGEN__)
/**
- * @brief Entering sleep state event.
+ * @brief Entering sleep state event.
*/
EventSource sleep_event;
/**
- * @brief Exiting sleep state event.
+ * @brief Exiting sleep state event.
*/
EventSource wakeup_event;
#endif /* CAN_USE_SLEEP_MODE */
@@ -199,16 +223,26 @@ typedef struct {
/* External declarations. */
/*===========================================================================*/
+#if PLATFORM_CAN_USE_CAN1 && !defined(__DOXYGEN__)
+extern CANDriver CAND1;
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
void can_lld_init(void);
void can_lld_start(CANDriver *canp);
void can_lld_stop(CANDriver *canp);
- bool_t can_lld_can_transmit(CANDriver *canp);
- void can_lld_transmit(CANDriver *canp, const CANTxFrame *crfp);
- bool_t can_lld_can_receive(CANDriver *canp);
- void can_lld_receive(CANDriver *canp, CANRxFrame *ctfp);
+ bool_t can_lld_is_tx_empty(CANDriver *canp,
+ canmbx_t mailbox);
+ void can_lld_transmit(CANDriver *canp,
+ canmbx_t mailbox,
+ const CANTxFrame *crfp);
+ bool_t can_lld_is_rx_nonempty(CANDriver *canp,
+ canmbx_t mailbox);
+ void can_lld_receive(CANDriver *canp,
+ canmbx_t mailbox,
+ CANRxFrame *ctfp);
#if CAN_USE_SLEEP_MODE
void can_lld_sleep(CANDriver *canp);
void can_lld_wakeup(CANDriver *canp);
diff --git a/os/hal/templates/hal_lld.h b/os/hal/templates/hal_lld.h
index c8c0534c3..957d40099 100644
--- a/os/hal/templates/hal_lld.h
+++ b/os/hal/templates/hal_lld.h
@@ -50,6 +50,12 @@
/*===========================================================================*/
/* Derived constants and error checks. */
/*===========================================================================*/
+/*
+ * Configuration-related checks.
+ */
+#if !defined(PLATFORM_MCUCONF)
+#error "Using a wrong mcuconf.h file, PLATFORM_MCUCONF not defined"
+#endif
/*===========================================================================*/
/* Driver data structures and types. */
diff --git a/os/hal/templates/mcuconf.h b/os/hal/templates/mcuconf.h
new file mode 100644
index 000000000..2b437922f
--- /dev/null
+++ b/os/hal/templates/mcuconf.h
@@ -0,0 +1,29 @@
+/*
+ ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
+ 2011,2012,2013 Giovanni Di Sirio.
+
+ This file is part of ChibiOS/RT.
+
+ ChibiOS/RT is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ ChibiOS/RT is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/*
+ * Platform drivers configuration.
+ * The following settings override the default settings present in
+ * the various device driver implementation headers.
+ * Note that the settings for each driver only have effect if the whole
+ * driver is enabled in halconf.h.
+ */
+
+#define PLATFORM_MCUCONF
diff --git a/os/hal/templates/platform.mk b/os/hal/templates/platform.mk
index 6c81166bb..268082a02 100644
--- a/os/hal/templates/platform.mk
+++ b/os/hal/templates/platform.mk
@@ -1,20 +1,20 @@
# List of all the template platform files.
-PLATFORMSRC = ${CHIBIOS}/os/hal/platforms/templates/hal_lld.c \
- ${CHIBIOS}/os/hal/platforms/templates/adc_lld.c \
- ${CHIBIOS}/os/hal/platforms/templates/can_lld.c \
- ${CHIBIOS}/os/hal/platforms/templates/ext_lld.c \
- ${CHIBIOS}/os/hal/platforms/templates/gpt_lld.c \
- ${CHIBIOS}/os/hal/platforms/templates/i2c_lld.c \
- ${CHIBIOS}/os/hal/platforms/templates/icu_lld.c \
- ${CHIBIOS}/os/hal/platforms/templates/mac_lld.c \
- ${CHIBIOS}/os/hal/platforms/templates/pal_lld.c \
- ${CHIBIOS}/os/hal/platforms/templates/pwm_lld.c \
- ${CHIBIOS}/os/hal/platforms/templates/rtc_lld.c \
- ${CHIBIOS}/os/hal/platforms/templates/sdc_lld.c \
- ${CHIBIOS}/os/hal/platforms/templates/serial_lld.c \
- ${CHIBIOS}/os/hal/platforms/templates/spi_lld.c \
- ${CHIBIOS}/os/hal/platforms/templates/uart_lld.c \
- ${CHIBIOS}/os/hal/platforms/templates/usb_lld.c
+PLATFORMSRC = ${CHIBIOS}/os/hal/templates/hal_lld.c \
+ ${CHIBIOS}/os/hal/templates/adc_lld.c \
+ ${CHIBIOS}/os/hal/templates/can_lld.c \
+ ${CHIBIOS}/os/hal/templates/ext_lld.c \
+ ${CHIBIOS}/os/hal/templates/gpt_lld.c \
+ ${CHIBIOS}/os/hal/templates/i2c_lld.c \
+ ${CHIBIOS}/os/hal/templates/icu_lld.c \
+ ${CHIBIOS}/os/hal/templates/mac_lld.c \
+ ${CHIBIOS}/os/hal/templates/pal_lld.c \
+ ${CHIBIOS}/os/hal/templates/pwm_lld.c \
+ ${CHIBIOS}/os/hal/templates/rtc_lld.c \
+ ${CHIBIOS}/os/hal/templates/sdc_lld.c \
+ ${CHIBIOS}/os/hal/templates/serial_lld.c \
+ ${CHIBIOS}/os/hal/templates/spi_lld.c \
+ ${CHIBIOS}/os/hal/templates/uart_lld.c \
+ ${CHIBIOS}/os/hal/templates/usb_lld.c
# Required include directories
-PLATFORMINC = ${CHIBIOS}/os/hal/platforms/templates
+PLATFORMINC = ${CHIBIOS}/os/hal/templates
diff --git a/testhal/testbuild/Makefile b/testhal/testbuild/Makefile
index 0a581d7a1..a94cf67ac 100644
--- a/testhal/testbuild/Makefile
+++ b/testhal/testbuild/Makefile
@@ -1,133 +1,221 @@
-# This makefile expects the following variables to be externally
-# defined:
-# XOPT - Compiler extra options
-# XDEFS - Extra definitions
-
-##############################################################################################
-# Start of default section
+##############################################################################
+# Build global options
+# NOTE: Can be overridden externally.
#
-TRGT = mingw32-
-CC = $(TRGT)gcc
-AS = $(TRGT)gcc -x assembler-with-cpp
+# Compiler options here.
+ifeq ($(USE_OPT),)
+ USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16
+endif
-# List all default C defines here, like -D_DEBUG=1
-DDEFS = -DSIMULATOR
+# C specific options here (added to USE_OPT).
+ifeq ($(USE_COPT),)
+ USE_COPT =
+endif
-# List all default ASM defines here, like -D_DEBUG=1
-DADEFS =
+# C++ specific options here (added to USE_OPT).
+ifeq ($(USE_CPPOPT),)
+ USE_CPPOPT = -fno-rtti
+endif
-# List all default directories to look for include files here
-DINCDIR =
+# Enable this if you want the linker to remove unused code and data
+ifeq ($(USE_LINK_GC),)
+ USE_LINK_GC = yes
+endif
-# List the default directory to look for the libraries here
-DLIBDIR =
+# If enabled, this option allows to compile the application in THUMB mode.
+ifeq ($(USE_THUMB),)
+ USE_THUMB = yes
+endif
-# List all default libraries here
-DLIBS = -lws2_32
+# Enable this if you want to see the full log while compiling.
+ifeq ($(USE_VERBOSE_COMPILE),)
+ USE_VERBOSE_COMPILE = no
+endif
#
-# End of default section
-##############################################################################################
+# Build global options
+##############################################################################
-##############################################################################################
-# Start of user section
+##############################################################################
+# Architecture or project specific options
#
-# Define project name here
-PROJECT = ch
+# Enables the use of FPU on Cortex-M4.
+# Enable this if you really want to use the STM FWLib.
+ifeq ($(USE_FPU),)
+ USE_FPU = no
+endif
-# Define linker script file here
-LDSCRIPT=
+# Enable this if you really want to use the STM FWLib.
+ifeq ($(USE_FWLIB),)
+ USE_FWLIB = no
+endif
-# List all user C define here, like -D_DEBUG=1
-UDEFS =
+#
+# Architecture or project specific options
+##############################################################################
-# Define ASM defines here
-UADEFS =
+##############################################################################
+# Project, sources and paths
+#
-# Imported source files
+# Define project name here
+PROJECT = ch
+
+# Imported source files and paths
CHIBIOS = ../..
-include $(CHIBIOS)/boards/simulator/board.mk
-include ${CHIBIOS}/os/hal/hal.mk
-include ${CHIBIOS}/os/hal/platforms/templates/platform.mk
-include ${CHIBIOS}/os/ports/GCC/SIMIA32/port.mk
-include ${CHIBIOS}/os/kernel/kernel.mk
-include ${CHIBIOS}/test/test.mk
-
-# List C source files here
-SRC = ${PORTSRC} \
- ${KERNSRC} \
- ${TESTSRC} \
- ${HALSRC} \
- ${PLATFORMSRC} \
+include $(CHIBIOS)/boards/ST_STM32F4_DISCOVERY/board.mk
+include $(CHIBIOS)/os/hal/templates/platform.mk
+include $(CHIBIOS)/os/hal/hal.mk
+include $(CHIBIOS)/os/ports/GCC/ARMCMx/STM32F4xx/port.mk
+include $(CHIBIOS)/os/kernel/kernel.mk
+#include $(CHIBIOS)/test/test.mk
+
+# Define linker script file here
+LDSCRIPT= $(PORTLD)/STM32F407xG.ld
+#LDSCRIPT= $(PORTLD)/STM32F407xG_CCM.ld
+
+# C sources that can be compiled in ARM or THUMB mode depending on the global
+# setting.
+CSRC = $(PORTSRC) \
+ $(KERNSRC) \
+ $(TESTSRC) \
+ $(HALSRC) \
+ $(PLATFORMSRC) \
$(BOARDSRC) \
main.c
-# List ASM source files here
-ASRC =
+# C++ sources that can be compiled in ARM or THUMB mode depending on the global
+# setting.
+CPPSRC =
-# List all user directories here
-UINCDIR = $(PORTINC) $(KERNINC) $(TESTINC) \
- $(HALINC) $(PLATFORMINC) $(BOARDINC) \
- $(CHIBIOS)/os/various
+# 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 =
-# List the user directory to look for the libraries here
-ULIBDIR =
+# 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 all user libraries here
-ULIBS =
+# 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 =
+
+# 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 =
+
+# List ASM source files here
+ASMSRC = $(PORTASM)
-# Define optimisation level here
-OPT = $(XOPT)
+INCDIR = $(PORTINC) $(KERNINC) $(TESTINC) \
+ $(HALINC) $(PLATFORMINC) $(BOARDINC) \
+ $(CHIBIOS)/os/various
#
-# End of user defines
-##############################################################################################
+# Project, sources and paths
+##############################################################################
+
+##############################################################################
+# Compiler settings
+#
+MCU = cortex-m4
-INCDIR = $(patsubst %,-I%,$(DINCDIR) $(UINCDIR))
-LIBDIR = $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR))
-DEFS = $(DDEFS) $(UDEFS) $(XDEFS)
-ADEFS = $(DADEFS) $(UADEFS)
-OBJS = $(ASRC:.s=.o) $(SRC:.c=.o)
-LIBS = $(DLIBS) $(ULIBS)
+#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
+OD = $(TRGT)objdump
+HEX = $(CP) -O ihex
+BIN = $(CP) -O binary
-LDFLAGS = -Wl,-Map=$(PROJECT).map,--cref,--no-warn-mismatch $(LIBDIR)
-ASFLAGS = -Wa,-amhls=$(<:.s=.lst) $(ADEFS)
-CPFLAGS = $(OPT) -Wall -Wstrict-prototypes -fverbose-asm -Wa,-ahlms=$(<:.c=.lst) $(DEFS)
+# ARM-specific options here
+AOPT =
-# Generate dependency information
-CPFLAGS += -MD -MP -MF .dep/$(@F).d
+# THUMB-specific options here
+TOPT = -mthumb -DTHUMB
+
+# Define C warning options here
+CWARN = -Wall -Wextra -Wstrict-prototypes
+
+# Define C++ warning options here
+CPPWARN = -Wall -Wextra
#
-# makefile rules
+# Compiler settings
+##############################################################################
+
+##############################################################################
+# Start of default section
#
-all: $(OBJS) $(PROJECT).exe
+# List all default C defines here, like -D_DEBUG=1
+DDEFS =
-%o : %c
- $(CC) -c $(CPFLAGS) -I . $(INCDIR) $< -o $@
+# List all default ASM defines here, like -D_DEBUG=1
+DADEFS =
-%o : %s
- $(AS) -c $(ASFLAGS) $< -o $@
+# List all default directories to look for include files here
+DINCDIR =
-%exe: $(OBJS)
- $(CC) $(OBJS) $(LDFLAGS) $(LIBS) -o $@
+# List the default directory to look for the libraries here
+DLIBDIR =
-clean:
- -rm -f $(OBJS)
- -rm -f $(PROJECT).exe
- -rm -f $(PROJECT).map
- -rm -f $(SRC:.c=.c.bak)
- -rm -f $(SRC:.c=.lst)
- -rm -f $(ASRC:.s=.s.bak)
- -rm -f $(ASRC:.s=.lst)
- -rm -fR .dep
+# List all default libraries here
+DLIBS =
#
-# Include the dependency files, should be the last of the makefile
+# End of default section
+##############################################################################
+
+##############################################################################
+# Start of user section
#
--include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
-# *** EOF ***
+# List all user C define here, like -D_DEBUG=1
+UDEFS =
+
+# Define ASM defines here
+UADEFS =
+
+# List all user directories here
+UINCDIR =
+
+# List the user directory to look for the libraries here
+ULIBDIR =
+
+# List all user libraries here
+ULIBS =
+
+#
+# End of user defines
+##############################################################################
+
+ifeq ($(USE_FPU),yes)
+ USE_OPT += -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -fsingle-precision-constant
+ DDEFS += -DCORTEX_USE_FPU=TRUE
+else
+ DDEFS += -DCORTEX_USE_FPU=FALSE
+endif
+
+ifeq ($(USE_FWLIB),yes)
+ include $(CHIBIOS)/ext/stm32lib/stm32lib.mk
+ CSRC += $(STM32SRC)
+ INCDIR += $(STM32INC)
+ USE_OPT += -DUSE_STDPERIPH_DRIVER
+endif
+
+include $(CHIBIOS)/os/ports/GCC/ARMCMx/rules.mk
diff --git a/testhal/testbuild/main.c b/testhal/testbuild/main.c
index c10499d38..b6b76b26a 100644
--- a/testhal/testbuild/main.c
+++ b/testhal/testbuild/main.c
@@ -29,5 +29,5 @@ int main(int argc, char *argv[]) {
(void)argc;
(void)argv;
- exit(0);
+ return 0;
}