summaryrefslogtreecommitdiff
path: root/openpicc/Makefile
blob: a1b7a55a12d6eb6a215f2788a5a888202eed79f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#	FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.
#
#	This file is part of the FreeRTOS.org distribution.
#
#	FreeRTOS.org 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 2 of the License, or
#	(at your option) any later version.
#
#	FreeRTOS.org 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 FreeRTOS.org; if not, write to the Free Software
#	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#	A special exception to the GPL can be applied should you wish to distribute
#	a combined work that includes FreeRTOS.org, without being obliged to provide
#	the source code for any proprietary components.  See the licensing section 
#	of http://www.FreeRTOS.org for full details of how and when the exception
#	can be applied.
#
#	***************************************************************************
#	See http://www.FreeRTOS.org for documentation, latest information, license 
#	and contact details.  Please ensure to read the configuration and relevant 
#	port sections of the online documentation.
#	***************************************************************************

CC=arm-elf-gcc
OBJCOPY=arm-elf-objcopy
OBJDUMP=arm-elf-objdump
ARCH=arm-elf-ar
CRT0=os/boot/boot.s
DEBUG=-g
OPTIM=-O2
LDSCRIPT=config/atmel-rom.ld
ARCH=AT91SAM7S256

#
# CFLAGS common to both the THUMB and ARM mode builds
#

CFLAGS= \
-D __$(ARCH)__ \
-Iconfig \
-Iapplication \
-Ios/core/include  \
-Ios/usb  \
-Ios/core/ARM7_AT91SAM7S  \
-Wall  \
-Werror \
-Wextra  \
-Wno-multichar \
-Wstrict-prototypes  \
-Wno-strict-aliasing  \
-D SAM7_GCC  \
-mcpu=arm7tdmi  \
-ffunction-sections \
-fdata-sections \
-T$(LDSCRIPT) \
$(DEBUG)  \
$(OPTIM) \
-fomit-frame-pointer

LINKER_FLAGS=-Xlinker -oopenpicc.elf -Xlinker -M -Xlinker -Map=openpicc.map

#
# Source files that must be built to ARM mode.
#
ARM_SRC= \
  application/main.c \
  application/led.c \
  application/cmd.c \
  application/env.c \
  application/da.c \
  application/adc.c \
  application/pll.c \
  application/pio_irq.c \
  application/ssc_picc.c \
  application/tc_cdiv_sync.c \
  application/tc_fdt.c \
  application/tc_cdiv.c \
  os/boot/Cstartup_SAM7.c \
  os/core/list.c \
  os/core/queue.c \
  os/core/tasks.c \
  os/core/ARM7_AT91SAM7S/lib_AT91SAM7.c \
  os/core/ARM7_AT91SAM7S/port.c \
  os/core/ARM7_AT91SAM7S/portISR.c \
  os/core/MemMang/heap_2.c \
  os/usb/USB-CDC.c \
  os/usb/USBIsr.c
#  application/mesh/mesh.c \

#
# Define all object files.
#
ARM_OBJ = $(ARM_SRC:.c=.o)
FREERTOS_THUMB_OBJ = $(FREERTOS_THUMB_SRC:.c=.o)
DEMO_APP_THMUB_OBJ = $(DEMO_APP_THMUB_SRC:.c=.o)

openpicc.bin : openpicc.elf
	$(OBJCOPY) openpicc.elf -O binary openpicc.bin

openpicc.hex : openpicc.elf
	$(OBJCOPY) openpicc.elf -O ihex openpicc.hex

openpicc.elf : $(ARM_OBJ) $(DEMO_APP_THMUB_OBJ) $(FREERTOS_THUMB_OBJ) $(CRT0) Makefile config/FreeRTOSConfig.h
	$(CC) $(CFLAGS) $(ARM_OBJ) $(DEMO_APP_THMUB_OBJ) $(FREERTOS_THUMB_OBJ) -nostartfiles $(CRT0) $(LINKER_FLAGS)
	$(OBJDUMP) -d openpicc.elf > openpicc.asm

$(DEMO_APP_THMUB_OBJ)  : %.o : %.c $(LDSCRIPT) Makefile config/FreeRTOSConfig.h
	$(CC) -c $(THUMB_FLAGS) $(CFLAGS) $< -o $@

$(FREERTOS_THUMB_OBJ)  : %.o : %.c $(LDSCRIPT) Makefile config/FreeRTOSConfig.h
	$(CC) -c $(THUMB_FLAGS) $(CFLAGS) $< -o $@

$(ARM_OBJ) : %.o : %.c $(LDSCRIPT) Makefile config/FreeRTOSConfig.h
	$(CC) -c $(CFLAGS) $< -o $@

clean :
	touch Makefile
	find -name '*.o' -exec rm \{\} \;
	rm -f openpicc.bin openpicc.elf openpicc.map openpicc.asm

personal git repositories of Harald Welte. Your mileage may vary