Commit dac26dfa authored by Colin González's avatar Colin González
Browse files

Merge branch 'master' of gitlab.in2p3.fr:colingd/freertos-template

parents 35ba4177 71e6e6aa
......@@ -48,17 +48,18 @@ TRACE_LEVEL = 5
# Optimization level, put in comment for debugging
OPTIMIZATION = -Os
AT91LIB = ./at91lib
AT91LIB = ./at91
FREERTOS = ./freertos
# Output file basename
OUTPUT = img-$(BOARD)-$(CHIP)
# Compile with chip specific features
include $(AT91LIB)/boards/$(BOARD)/$(CHIP)/chip.mak
include $(AT91LIB)/src/boards/$(BOARD)/$(CHIP)/chip.mak
# Compile for all memories available on the board (this sets $(MEMORIES))
include $(AT91LIB)/boards/$(BOARD)/board.mak
include $(AT91LIB)/src/boards/$(BOARD)/board.mak
# Output directories
BIN = bin
......@@ -79,16 +80,23 @@ OBJCOPY = $(CROSS_COMPILE)objcopy
# Flags
INCLUDES = -I$(AT91LIB)/boards/$(BOARD)
INCLUDES += -I$(AT91LIB)/peripherals
INCLUDES += -I$(AT91LIB)/components
INCLUDES += -I$(AT91LIB)
INCLUDES = -I$(AT91LIB)/include/at91/boards/$(BOARD)
INCLUDES += -I$(AT91LIB)/include/at91/peripherals
INCLUDES += -I$(AT91LIB)/include/at91/components
INCLUDES += -I$(AT91LIB)/include/at91
INCLUDES += -I$(AT91LIB)/include/
INCLUDES += -I$(AT91LIB)/src/peripherals/
INCLUDES += -I$(FREERTOS)/portable/GCC/ARM9_AT91SAM9G20
INCLUDES += -I$(FREERTOS)/portable/MemMang
INCLUDES += -I$(FREERTOS)/portable/
INCLUDES += -I$(FREERTOS)/include
INCLUDES += -I$(FREERTOS)/include/freertos/portable/GCC/ARM9_AT91SAM9G20
INCLUDES += -I$(FREERTOS)/include/freertos/portable/MemMang
INCLUDES += -I$(FREERTOS)/include/freertos/portable/
INCLUDES += -I$(FREERTOS)/include/
INCLUDES += -I$(FREERTOS)
INCLUDES += -Ihal/include/hal/
INCLUDES += -Ihal/include/
INCLUDES += -Isrc/
ifeq ($(CHIP_CORE), cortexm3)
......@@ -108,14 +116,17 @@ LDFLAGS = -g $(OPTIMIZATION) -nostartfiles $(TARGET_OPTS) -Wl,--gc-sections
#-------------------------------------------------------------------------------
# Directories where source files can be found
UTILITY = $(AT91LIB)/utility
PERIPH = $(AT91LIB)/peripherals
BOARDS = $(AT91LIB)/boards
UTILITY = $(AT91LIB)/src/utility
PERIPH = $(AT91LIB)/src/peripherals
BOARDS = $(AT91LIB)/src/boards
PORT = $(FREERTOS)/src/portable/GCC/ARM9_AT91SAM9G20
MEM_MGT = $(FREERTOS)/src/portable/MemMang
VPATH = src/
VPATH += src/ParTest
VPATH += src/serial
VPATH += $(AT91LIB)/src
VPATH += $(UTILITY)
VPATH += $(PERIPH)/dbgu
VPATH += $(PERIPH)/irq
......@@ -124,13 +135,16 @@ VPATH += $(PERIPH)/pit
VPATH += $(PERIPH)/tc
VPATH += $(PERIPH)/pmc
VPATH += $(PERIPH)/cp15
VPATH += $(PERIPH)/usart
VPATH += $(PERIPH)/systicks
VPATH += $(BOARDS)/$(BOARD)
VPATH += $(BOARDS)/$(BOARD)/$(CHIP)
VPATH += $(MEM_MGT)
VPATH += $(PORT)
VPATH += $(FREERTOS)
VPATH += $(FREERTOS)/src
VPATH += $(FREERTOS)/src/portable
VPATH += $(EDGE)
VPATH += hal/lib/
# Objects build from C source files
C_OBJECTS = main.o
......@@ -149,15 +163,16 @@ C_OBJECTS += board_memories.o
C_OBJECTS += aic.o
C_OBJECTS += cp15.o
C_OBJECTS += pit.o
C_OBJECTS += usart.o
C_OBJECTS += syscalls.o
C_OBJECTS += ExitHandler.o
# FreeRTOS objects build from C source files
C_OBJECTS += port.o
C_OBJECTS += portISR.o
C_OBJECTS += tasks.o
C_OBJECTS += queue.o
C_OBJECTS += event_groups.o
C_OBJECTS += list.o
C_OBJECTS += stream_buffer.o
C_OBJECTS += timers.o
C_OBJECTS += standardMemMang.o
C_OBJECTS += hooks.o
......@@ -183,8 +198,8 @@ define RULES
C_OBJECTS_$(1) = $(addprefix $(OBJ)/$(1)_, $(C_OBJECTS))
ASM_OBJECTS_$(1) = $(addprefix $(OBJ)/$(1)_, $(ASM_OBJECTS))
$(1): $$(ASM_OBJECTS_$(1)) $$(C_OBJECTS_$(1))
$(CC) $(LDFLAGS) -T"$(AT91LIB)/boards/$(BOARD)/$(CHIP)/$$@.lds" \
$(1): $$(ASM_OBJECTS_$(1)) $$(C_OBJECTS_$(1)) libHAL.a libHALD.a
$(CC) $(LDFLAGS) -Tsrc/sdram.lds \
-o $(OUTPUT)-$$@.elf $$^
$(OBJCOPY) -O binary $(OUTPUT)-$$@.elf $(OUTPUT)-$$@.bin
$(SIZE) $$^ $(OUTPUT)-$$@.elf
......@@ -208,7 +223,7 @@ endif
.PHONY: nand ram jlink flash connect clean
jlink: sdram
jlink:
@echo "Starting a J-Link connection."
./opt/jlink/jlink.sh
......
......@@ -270,8 +270,8 @@
{1 << 8, AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
/// MCI Slot 1 CD pin
//#define PINS_MCI1_CD \
// {1 << 2, AT91C_BASE_PIOC, AT91C_ID_PIOC, PIO_INPUT, PIO_PULLUP}
/* #define PINS_MCI1_CD \ */
/* {1 << 2, AT91C_BAS E_PIOC, AT91C_ID_PIOC, PIO_INPUT, PIO_PULLUP} */
//#define BOARD_SD_MCI1_PIN_CD PINS_MCI1_CD
......
/*!
* @file commons.h
* @date June, 2012
* @author Akhil Piplani
*
* @section DESCRIPTION
* Some commonly used preprocessor directives.
*/
#ifndef COMMONS_H_
#define COMMONS_H_
/*!
* Used by drivers to tell the callbacks if they are being called from
* within an ISR or from a regular task. This is required because FreeRTOS
* has different functions for handling semaphores from within an ISR and task.
*/
typedef enum _SystemContext {
task_context = 0x00,//!< task_context
isr_context = 0xFF //!< isr_context
} SystemContext;
#define STORAGE_RESTART_ON_SEMAPHORE_ERRORS 0
/*!
* Can be used to enable/disable debug functionalities across the project.
*/
#define FLIGHT_CONFIG 0
/*!
* Setting this to 0 will lead to standard stdio.h and string.h functions
* like printf being used instead of the ones implemented here.
* Using AT91LIB implementations reduces code size at the expense of features.
*
*
* A good tradeoff between using using newlib and AT91LIB implementations
* is newlib-nano which can be used in-place of newlib by
* making sure USE_AT91LIB_STDIO_AND_STRING is 0 and adding the following
* options to the linker :
* @verbatim
* --specs=nano.specs -lc -u _printf_float -u _scanf_float
* @endverbatim
*
* Further, not including the following linker options will reduce code size
* even more at the expense of floating point I/O.
* @verbatim
* -u _printf_float -u _scanf_float
* @endverbatim
*
*
* It is required to have this as a configuration in the project properties
* in the compiler section when setting this to 1.
*
* @note If you set this to 1, be sure to use functions implemented in util.c
* instead of scanf etc to get input from the user over the debug port.
*
* @see util.c stdio.c string.c
*/
#ifndef USE_AT91LIB_STDIO_AND_STRING
#define USE_AT91LIB_STDIO_AND_STRING 0
#endif
#endif /* COMMONS_H_ */
/* ----------------------------------------------------------------------------
* ATMEL Microcontroller Software Support
* ----------------------------------------------------------------------------
* Copyright (c) 2008, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ----------------------------------------------------------------------------
*/
//------------------------------------------------------------------------------
/// \unit
///
/// !Purpose
///
/// Methods and definitions for configuring interrupts using the Advanced
/// Interrupt Controller (AIC).
///
/// !Usage
///
/// -# Configure an interrupt source using AIC_ConfigureIT
/// -# Enable or disable interrupt generation of a particular source with
/// AIC_EnableIT and AIC_DisableIT.
///
/// \note Most of the time, peripheral interrupts must be also configured
/// inside the peripheral itself.
//------------------------------------------------------------------------------
/* PATCHED TO MATCH ISIS directory structure */
#ifndef AIC_H
#define AIC_H
//------------------------------------------------------------------------------
// Headers
//------------------------------------------------------------------------------
#include <board.h>
//------------------------------------------------------------------------------
// Definitions
//------------------------------------------------------------------------------
#ifndef AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL
/// Interrupt is internal and uses a logical 1 level.
#define AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL AT91C_AIC_SRCTYPE_INT_LEVEL_SENSITIVE
#endif
//------------------------------------------------------------------------------
// Global functions
//------------------------------------------------------------------------------
extern void AIC_ConfigureIT(unsigned int source,
unsigned int mode,
void (*handler)( void ));
extern void AIC_EnableIT(unsigned int source);
extern void AIC_DisableIT(unsigned int source);
#endif //#ifndef AIC_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment