Skip to content

Commit 091235b

Browse files
author
Murat Fersatoglu
committed
Migration to softpack 2.0 step 1
1 parent 6297bfc commit 091235b

File tree

282 files changed

+66705
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

282 files changed

+66705
-0
lines changed

Makefile.inc

+109
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
all:
2+
3+
SOFTPACK_VERSION="2.0"
4+
AVAILABLE_MEMORIES = sram ddram
5+
AVAILABLE_BOARDS = sama5d4-xplained sama5d4-ek
6+
MEMORIES = sram ddram
7+
8+
eq = $(and $(findstring $(1),$(2)),$(findstring $(2),$(1)))
9+
10+
ifndef TARGET
11+
$(error "No TARGET specified.")
12+
endif
13+
14+
SELECTED_BOARD=$(strip $(foreach board,$(AVAILABLE_BOARDS),$(if $(call eq,$(TARGET),$(board)),$(board))))
15+
16+
ifeq (,$(SELECTED_BOARD))
17+
$(info The wanted target "$(TARGET)" is not supported)
18+
$(error Please set TARGET to one value from the list above: $(AVAILABLE_BOARDS))
19+
endif
20+
21+
ifeq ("y",$(TARGET:sama5d4-%="y"))
22+
SERIE=SERIE_SAMA5D4
23+
SERIEDIRNAME=sama5d4
24+
endif
25+
26+
ifeq ("y",$(TARGET:%-xplained="y"))
27+
BOARD=BOARD_SAMA5D4_XPLAINED
28+
CHIP=CHIP_SAMA5D44
29+
endif
30+
31+
ifeq ("y",$(TARGET:%-ek="y"))
32+
BOARD=BOARD_SAMA5D4_EK
33+
endif
34+
35+
#-------------------------------------------------------------------------------
36+
# Setup cross-compilation tools
37+
#-------------------------------------------------------------------------------
38+
# Tool suffix when cross-compiling
39+
CROSS_COMPILE = arm-none-eabi-
40+
41+
# Compilation tools
42+
CC = $(CROSS_COMPILE)gcc
43+
LD = $(CROSS_COMPILE)ld
44+
SIZE = $(CROSS_COMPILE)size
45+
STRIP = $(CROSS_COMPILE)strip
46+
OBJCOPY = $(CROSS_COMPILE)objcopy
47+
GDB = $(CROSS_COMPILE)gdb
48+
NM = $(CROSS_COMPILE)nm
49+
50+
#-------------------------------------------------------------------------------
51+
# Setup paths
52+
#-------------------------------------------------------------------------------
53+
ROOTDIR := $(dir $(lastword $(MAKEFILE_LIST)))
54+
LIBDIR := $(ROOTDIR)/lib
55+
TARGETDIR := $(ROOTDIR)/target
56+
DRIVERDIR := $(ROOTDIR)/drivers
57+
UTILSDIR := $(ROOTDIR)/utils
58+
RESOURCEDIR := $(TARGETDIR)/resources/gcc/$(SERIEDIRNAME)
59+
60+
#-------------------------------------------------------------------------------
61+
# Setup compilation params
62+
#-------------------------------------------------------------------------------
63+
64+
# include dirs
65+
INCLUDE_TARGET = -I$(TARGETDIR) -I$(TARGETDIR)/include
66+
INCLUDE_UTILS = -I$(UTILSDIR)
67+
INCLUDE_DRIVER = -I$(DRIVERDIR)
68+
INCLUDE_ROOTDIR = -I$(ROOTDIR)
69+
70+
OPTIMIZE_MEMORY = -Os
71+
OPTIMIZE_EXEC = -O2
72+
optimization = $(if $(call eq,sram,$(1)),$(OPTIMIZE_MEMORY),$(OPTIMIZE_EXEC))
73+
74+
# C flags
75+
CFLAGS = -Wall -Wchar-subscripts -Wcomment -Wformat=2 -Wimplicit-int
76+
CFLAGS += -Werror-implicit-function-declaration -Wmain -Wparentheses
77+
CFLAGS += -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs
78+
CFLAGS += -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef
79+
CFLAGS += -Wshadow -Wpointer-arith -Wbad-function-cast -Wwrite-strings
80+
CFLAGS += -Waggregate-return -Wstrict-prototypes
81+
CFLAGS += -Wmissing-prototypes -Wmissing-declarations
82+
CFLAGS += -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations
83+
CFLAGS += -Wredundant-decls -Wnested-externs -Winline -Wlong-long
84+
CFLAGS += -Wunreachable-code
85+
# To reduce application size use only integer printf function.
86+
CFLAGS += -Dprintf=iprintf
87+
CFLAGS += -mcpu=cortex-a5 -ffunction-sections
88+
CFLAGS += -g3 -Wall
89+
CFLAGS += -D$(CHIP) -D$(BOARD) -D$(SERIE) -DSOFTPACK_VERSION="\"$(SOFTPACK_VERSION)\""
90+
91+
# linkker flags
92+
LDFLAGS= -mcpu=cortex-a5 -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=entry -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols
93+
94+
#-------------------------------------------------------------------------------
95+
# we detect OS (Linux/Windows/Cygwin)
96+
# not defined for Cygwin
97+
#ifdef $(OS)
98+
ifdef SystemRoot
99+
RM=del
100+
RMDIR=rmdir /s /q
101+
PATHSEP=\\
102+
else
103+
RM=rm -f
104+
RMDIR=rm -fr
105+
endif
106+
107+
list-boards:
108+
@echo List of all available boards:
109+
@echo $(AVAILABLE_BOARDS)

drivers/Makefile

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# ----------------------------------------------------------------------------
2+
# SAM Software Package License
3+
# ----------------------------------------------------------------------------
4+
# Copyright (c) 2013, Atmel Corporation
5+
#
6+
# All rights reserved.
7+
#
8+
# Redistribution and use in source and binary forms, with or without
9+
# modification, are permitted provided that the following conditions are met:
10+
#
11+
# - Redistributions of source code must retain the above copyright notice,
12+
# this list of conditions and the disclaimer below.
13+
#
14+
# Atmel's name may not be used to endorse or promote products derived from
15+
# this software without specific prior written permission.
16+
#
17+
# DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
18+
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
20+
# DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
21+
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
23+
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
26+
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27+
# ----------------------------------------------------------------------------
28+
29+
# Makefile for compiling the Getting Started with sama5d4x Microcontrollers project
30+
31+
MAKEFILEDIR := $(dir $(lastword $(MAKEFILE_LIST)))
32+
include $(MAKEFILEDIR)/../Makefile.inc
33+
34+
#-------------------------------------------------------------------------------
35+
# User-modifiable options
36+
#-------------------------------------------------------------------------------
37+
38+
# Defines which are the available memory targets for the sama5d4x-XULT board.
39+
40+
# Trace level used for compilation
41+
# (can be overriden by adding TRACE_LEVEL=#number to the command-line)
42+
# TRACE_LEVEL_DEBUG 5
43+
# TRACE_LEVEL_INFO 4
44+
# TRACE_LEVEL_WARNING 3
45+
# TRACE_LEVEL_ERROR 2
46+
# TRACE_LEVEL_FATAL 1
47+
# TRACE_LEVEL_NO_TRACE 0
48+
TRACE_LEVEL = 4
49+
BIN = bin
50+
OBJ = obj
51+
# Output directories
52+
53+
DRIVERSUBDIRS = av bus core crypto io #net serial time wireless
54+
55+
#-------------------------------------------------------------------------------
56+
# Tools
57+
#-------------------------------------------------------------------------------
58+
#LIBS = -Wl,--start-group -lgcc -Wl,--end-group
59+
INCLUDES = $(INCLUDE_TARGET) $(INCLUDE_UTILS) $(INCLUDE_DRIVER) $(INCLUDE_ROOTDIR)
60+
CFLAGS += $(INCLUDES) -DTRACE_LEVEL=$(TRACE_LEVEL)
61+
ASFLAGS = -mcpu=cortex-a5 -Wall -g $(INCLUDES) -D__SAMA5D44__ -D__ASSEMBLY__
62+
63+
64+
define LIBRULES
65+
$(eval BUILDDIR = $(MAKEFILEDIR)/$(1)/build/$(TARGET)/$(2))
66+
$(eval include $(MAKEFILEDIR)/$(1)/Makefile.files)
67+
68+
$(BUILDDIR)/$(BIN) $(BUILDDIR)/$(OBJ):
69+
mkdir -p $$@
70+
71+
$(1): $(BUILDDIR)/$(BIN) $(BUILDDIR)/$(BIN)/lib$(TARGET)_$(1).a
72+
@echo Built driver $(1)
73+
74+
$(BUILDDIR)/$(BIN)/lib$(TARGET)_$(1).a: $(addprefix $(BUILDDIR)/$(OBJ)/,$(OBJECTS))
75+
$(AR) -r $$@ $$^
76+
77+
$(BUILDDIR)/$(OBJ)/%.o: $(1)/%.c $(BUILDDIR)/$(OBJ)
78+
$(CC) $(CFLAGS) $(LDFLAGS) $(call optimization,$(2)) $(LD_OPTIONAL) -c $$< -o $$@
79+
endef
80+
81+
drivers: $(DRIVERSUBDIRS)
82+
83+
$(foreach MEMORY, $(MEMORIES), \
84+
$(foreach dir, $(DRIVERSUBDIRS), $(eval $(call LIBRULES,$(dir),$(MEMORY)))) \
85+
)
86+
87+
$(BIN) $(OBJ):
88+
mkdir $@
89+

drivers/av/Makefile.files

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
OBJECTS = lcd_draw.o \
2+
lcd_font.o \
3+
lcd_font10x14.o \
4+
lcdd.o \
5+
isi.o \
6+
wm8904.o

0 commit comments

Comments
 (0)