diff options
author | tfateba <tfateba@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2017-01-04 15:35:42 +0000 |
---|---|---|
committer | tfateba <tfateba@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2017-01-04 15:35:42 +0000 |
commit | 44fd241085f8d5d08d0075998ff06ef5b04502e4 (patch) | |
tree | d9ae0c80a2bcd2a6eba43443ba8f14309d3845e5 /testhal/AVR/GPT | |
parent | 88fb5a300170328eed00bb9846077cbe8c90a736 (diff) | |
download | ChibiOS-44fd241085f8d5d08d0075998ff06ef5b04502e4.tar.gz ChibiOS-44fd241085f8d5d08d0075998ff06ef5b04502e4.tar.bz2 ChibiOS-44fd241085f8d5d08d0075998ff06ef5b04502e4.zip |
Update AVR testhal GPT and fixed #error invalid configuration file.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10014 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'testhal/AVR/GPT')
-rw-r--r-- | testhal/AVR/GPT/Makefile | 41 | ||||
-rw-r--r-- | testhal/AVR/GPT/chconf.h | 98 | ||||
-rw-r--r-- | testhal/AVR/GPT/main.c | 27 | ||||
-rw-r--r-- | testhal/AVR/GPT/mcuconf.h | 18 | ||||
-rw-r--r-- | testhal/AVR/GPT/readme.txt | 2 |
5 files changed, 116 insertions, 70 deletions
diff --git a/testhal/AVR/GPT/Makefile b/testhal/AVR/GPT/Makefile index cb84f1e26..b1b164e80 100644 --- a/testhal/AVR/GPT/Makefile +++ b/testhal/AVR/GPT/Makefile @@ -40,7 +40,7 @@ #----------------------------------------------------------------------------
# MCU name
-MCU = atmega1280
+MCU = atmega2560
# Processor frequency.
F_CPU = 16000000
@@ -64,19 +64,17 @@ include $(CHIBIOS)/os/hal/ports/AVR/platform.mk include $(CHIBIOS)/os/hal/osal/rt/osal.mk
include $(CHIBIOS)/os/rt/rt.mk
include $(CHIBIOS)/os/common/ports/AVR/compilers/GCC/mk/port.mk
-include $(CHIBIOS)/test/rt/test.mk
+include $(CHIBIOS)/os/hal/lib/streams/streams.mk
# List C source files here. (C dependencies are automatically generated.)
-SRC = $(PORTSRC) \
- $(KERNSRC) \
- $(TESTSRC) \
- $(HALSRC) \
+SRC = $(KERNSRC) \
+ $(PORTSRC) \
$(OSALSRC) \
+ $(HALSRC) \
$(PLATFORMSRC) \
$(BOARDSRC) \
+ $(STREAMSSRC) \
$(CHIBIOS)/os/various/evtimer.c \
- $(CHIBIOS)/os/hal/lib/streams/memstreams.c \
- $(CHIBIOS)/os/hal/lib/streams/chprintf.c \
main.c
# List C++ source files here. (C dependencies are automatically generated.)
@@ -108,7 +106,7 @@ DEBUG = dwarf-2 # For a directory that has spaces, enclose it in quotes.
EXTRAINCDIRS = $(CHIBIOS)/os/license $(PORTINC) $(KERNINC) $(TESTINC) \
$(HALINC) $(OSALINC) $(PLATFORMINC) \
- $(BOARDINC) $(CHIBIOS)/os/various
+ $(STREAMSINC) $(BOARDINC) $(CHIBIOS)/os/various
# Compiler flag to set the C Standard level.
# c89 = "ANSI" C
@@ -153,6 +151,9 @@ CFLAGS += -Wstrict-prototypes CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
CFLAGS += $(CSTANDARD)
+CFLAGS += -mrelax
+CFLAGS += -fdata-sections
+CFLAGS += -ffunction-sections
#---------------- Compiler Options C++ ----------------
# -g*: generate debugging information
@@ -179,6 +180,8 @@ CFLAGS += -Wundef CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
#CPPFLAGS += $(CSTANDARD)
+CPPFLAGS += -fdata-sections
+CPPFLAGS += -ffunction-sections
#---------------- Assembler Options ----------------
# -Wa,...: tell GCC to pass this to the assembler.
@@ -238,7 +241,7 @@ EXTMEMOPTS = # -Wl,...: tell GCC to pass this to linker.
# -Map: create map file
# --cref: add cross reference to map file
-LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
+LDFLAGS = -Wl,-Map=$(TARGET).map,--cref,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
@@ -252,18 +255,17 @@ LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) # Type: avrdude -c ?
# to get a full listing.
#
-AVRDUDE_PROGRAMMER = stk500v2
+AVRDUDE_PROGRAMMER = wiring
# com1 = serial port. Use lpt1 to connect to parallel port.
-AVRDUDE_PORT = /dev/tty.usbmodemfd121 # programmer connected to serial device
+AVRDUDE_PORT = /dev/ttyUSB0
-AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
-#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
+AVRDUDE_WRITE_FLASH = -D -U flash:w:$(TARGET).hex
# Uncomment the following if you want avrdude's erase cycle counter.
# Note that this counter needs to be initialized first using -Yn,
# see avrdude manual.
-#AVRDUDE_ERASE_COUNTER = -y
+AVRDUDE_ERASE_COUNTER = -y
# Uncomment the following if you do /not/ wish a verification to be
# performed after programming the device.
@@ -272,11 +274,14 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex # Increase verbosity level. Please use this when submitting bug
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
-#AVRDUDE_VERBOSE = -v -v
+AVRDUDE_VERBOSE = -v -v
-AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
+AVRDUDE_FLAGS = -p $(MCU)
+AVRDUDE_FLAGS += -P $(AVRDUDE_PORT)
+AVRDUDE_FLAGS += -b 115200
+AVRDUDE_FLAGS += -c $(AVRDUDE_PROGRAMMER)
AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
-AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
+AVRDUDE_FLAGS += -v $(AVRDUDE_VERBOSE)
AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
#---------------- Debugging Options ----------------
diff --git a/testhal/AVR/GPT/chconf.h b/testhal/AVR/GPT/chconf.h index 060431195..4b231009b 100644 --- a/testhal/AVR/GPT/chconf.h +++ b/testhal/AVR/GPT/chconf.h @@ -28,6 +28,8 @@ #ifndef CHCONF_H
#define CHCONF_H
+#define _CHIBIOS_RT_CONF_
+
/*===========================================================================*/
/**
* @name System timers settings
@@ -46,7 +48,7 @@ * @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit.
*/
-#define CH_CFG_ST_FREQUENCY 1000
+#define CH_CFG_ST_FREQUENCY 15624
/**
* @brief Time delta constant for the tick-less mode.
@@ -56,7 +58,7 @@ * The value one is not valid, timeouts are rounded up to
* this value.
*/
-#define CH_CFG_ST_TIMEDELTA 0
+#define CH_CFG_ST_TIMEDELTA 2
/** @} */
@@ -78,7 +80,7 @@ * @note Disabling the round robin preemption makes the kernel more compact
* and generally faster.
*/
-#define CH_CFG_TIME_QUANTUM 20
+#define CH_CFG_TIME_QUANTUM 0
/**
* @brief Managed RAM size.
@@ -181,16 +183,6 @@ #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
/**
- * @brief Atomic semaphore API.
- * @details If enabled then the semaphores the @p chSemSignalWait() API
- * is included in the kernel.
- *
- * @note The default is @p TRUE.
- * @note Requires @p CH_CFG_USE_SEMAPHORES.
- */
-#define CH_USE_SEMSW TRUE
-
-/**
* @brief Mutexes APIs.
* @details If enabled then the mutexes APIs are included in the kernel.
*
@@ -297,18 +289,6 @@ #define CH_CFG_USE_HEAP FALSE
/**
- * @brief C-runtime allocator.
- * @details If enabled the the heap allocator APIs just wrap the C-runtime
- * @p malloc() and @p free() functions.
- *
- * @note The default is @p FALSE.
- * @note Requires @p CH_CFG_USE_HEAP.
- * @note The C-runtime may or may not require @p CH_CFG_USE_MEMCORE, see the
- * appropriate documentation.
- */
-#define CH_CFG_USE_MALLOC_HEAP FALSE
-
-/**
* @brief Memory Pools Allocator APIs.
* @details If enabled then the memory pools allocator APIs are included
* in the kernel.
@@ -378,7 +358,14 @@ *
* @note The default is @p FALSE.
*/
-#define CH_DBG_ENABLE_TRACE FALSE
+#define CH_DBG_ENABLE_TRACE CH_DBG_TRACE_MASK_DISABLED
+
+/**
+ * @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_TRACE_BUFFER_SIZE 128
/**
* @brief Debug option, stack checks.
@@ -424,9 +411,9 @@ /**
* @brief Threads descriptor structure extension.
- * @details User fields added to the end of the @p Thread structure.
+ * @details User fields added to the end of the @p thread_t structure.
*/
-#define THREAD_EXT_FIELDS \
+#define CH_CFG_THREAD_EXTRA_FIELDS \
/* Add threads custom fields here.*/
/**
@@ -436,19 +423,15 @@ * @note It is invoked from within @p chThdInit() and implicitly from all
* the threads creation APIs.
*/
-#define THREAD_EXT_INIT_HOOK(tp) { \
+#define CH_CFG_THREAD_INIT_HOOK(tp) { \
/* Add threads initialization code here.*/ \
}
/**
* @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 THREAD_EXT_EXIT_HOOK(tp) { \
+#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
/* Add threads finalization code here.*/ \
}
@@ -461,6 +444,40 @@ }
/**
+ * @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.*/ \
+}
+
+/**
+ * @brief Idle thread leave 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 deactivate a power saving mode.
+ */
+#define CH_CFG_IDLE_LEAVE_HOOK() { \
+ /* Idle-leave code here.*/ \
+}
+
+/**
* @brief Idle Loop hook.
* @details This hook is continuously invoked by the idle thread loop.
*/
@@ -473,7 +490,7 @@ * @details This hook is invoked in the system tick handler immediately
* after processing the virtual timers queue.
*/
-#define SYSTEM_TICK_EVENT_HOOK() { \
+#define CH_CFG_SYSTEM_TICK_HOOK() { \
/* System tick event code here.*/ \
}
@@ -482,10 +499,19 @@ * @details This hook is invoked in case to a system halting error before
* the system is halted.
*/
-#define SYSTEM_HALT_HOOK() { \
+#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
/* 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.*/ \
+}
+
/** @} */
/*===========================================================================*/
diff --git a/testhal/AVR/GPT/main.c b/testhal/AVR/GPT/main.c index 929c5f8d4..a64dcef06 100644 --- a/testhal/AVR/GPT/main.c +++ b/testhal/AVR/GPT/main.c @@ -18,15 +18,15 @@ #include "hal.h"
#include "chprintf.h"
-static void gpt2cb(GPTDriver *gptp)
-{
+BaseSequentialStream * chp = (BaseSequentialStream *) &SD1;
+
+static void gpt3cb(GPTDriver *gptp) {
palTogglePad(IOPORT2, 7);
}
-static GPTConfig gpt2cfg =
-{
+static GPTConfig gpt3cfg = {
1000, /* Timer clock. */
- gpt2cb /* Timer callback. */
+ gpt3cb /* Timer callback. */
};
/*
@@ -48,16 +48,17 @@ int main(void) { palSetPadMode(IOPORT2, 7, PAL_MODE_OUTPUT_PUSHPULL);
sdStart(&SD1, NULL);
- gptStart(&GPTD1, &gpt2cfg);
+ gptStart(&GPTD3, &gpt3cfg);
+
+ gptStartContinuous(&GPTD3, 500);
- gptStartContinuous(&GPTD1, 500);
while (1) {
- chprintf(&SD1, "OCR1A: %d, TCCR1B: %x, period: %d, counter: %d , TCNT1: %d\r\n",
- OCR1A,
- TCCR1B,
- GPTD1.period,
- GPTD1.counter,
- TCNT1);
+ chprintf(chp, "OCR3A: %d, TCCR3B: %x, period: %d, counter: %d , TCNT3: %d\r\n",
+ OCR3A,
+ TCCR3B,
+ GPTD3.period,
+ GPTD3.counter,
+ TCNT3);
chThdSleepMilliseconds(100);
}
}
diff --git a/testhal/AVR/GPT/mcuconf.h b/testhal/AVR/GPT/mcuconf.h index 69ec6da52..99f88382a 100644 --- a/testhal/AVR/GPT/mcuconf.h +++ b/testhal/AVR/GPT/mcuconf.h @@ -31,10 +31,24 @@ #define AVR_ADC_USE_ADC1 FALSE
/*
+ * EXT drivers system settings.
+ */
+#define AVR_EXT_USE_INT0 FALSE
+#define AVR_EXT_USE_INT1 FALSE
+#define AVR_EXT_USE_INT2 FALSE
+#define AVR_EXT_USE_INT3 FALSE
+#define AVR_EXT_USE_INT4 FALSE
+#define AVR_EXT_USE_INT5 FALSE
+
+/*
* CAN driver system settings.
*/
/*
+ * MAC driver system settings.
+ */
+
+/*
* PWM driver system settings.
*/
#define AVR_PWM_USE_TIM1 FALSE
@@ -54,9 +68,9 @@ /*
* GPT driver system settings.
*/
-#define AVR_GPT_USE_TIM1 TRUE
+#define AVR_GPT_USE_TIM1 FALSE
#define AVR_GPT_USE_TIM2 FALSE
-#define AVR_GPT_USE_TIM3 FALSE
+#define AVR_GPT_USE_TIM3 TRUE
#define AVR_GPT_USE_TIM4 FALSE
#define AVR_GPT_USE_TIM5 FALSE
diff --git a/testhal/AVR/GPT/readme.txt b/testhal/AVR/GPT/readme.txt index 24aadca30..8c60f057f 100644 --- a/testhal/AVR/GPT/readme.txt +++ b/testhal/AVR/GPT/readme.txt @@ -1,5 +1,5 @@ *****************************************************************************
-** ChibiOS/RT port for Atmel AVR ATmega1280. **
+** ChibiOS/RT port for Atmel AVR ATmega2560. **
*****************************************************************************
** TARGET **
|