-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·106 lines (83 loc) · 2.65 KB
/
Makefile
File metadata and controls
executable file
·106 lines (83 loc) · 2.65 KB
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
#
# Copyright (c) 2012 Pekka Nikander. See NOTICE for licensing information.
#
# Application files, platform-independent
SRCS := main.c
# Chip-specific files
SRCS += stm32f051_init.c
SRCS += enc28j60/enc28j60_init.c
SRCS += enc28j60/enc28j60.c
SRCS += enc28j60/enc28j60_packet.c
SRCS += enc28j60/enc28j60_stm32f0_spi.c
# HTTPD
ifeq (true,true)
C = ../Contiki
SRCS += $C/core/sys/process.c $C/core/sys/etimer.c $C/core/sys/timer.c
SRCS += $C/core/net/tcpip.c $C/core/net/psock.c $C/core/lib/memb.c
SRCS += $C/apps/webserver/httpd.c $C/apps/webserver/http-strings.c
SRCS += $C/apps/webserver/httpd-cgi.c
SRCS += httpd-fs.c
SRCS += $C/apps/webserver/webserver-nogui.c
SRCS += $C/cpu/arm/common/dbg-io/dbg-snprintf.c
SRCS += $C/cpu/arm/common/dbg-io/strformat.c
SRCS += clock.c
SRCS += cgi.c
CFLAGS += -I. -I$C -DCONTIKI=1 -I$C/cpu/arm/common/dbg-io
CFLAGS += -I$C/apps/webserver
CFLAGS += -Wno-missing-field-initializers
CFLAGS += -Wno-sign-compare
endif
# uIP
UIP = ../Contiki/core/net
CFLAGS += -I. -I$(UIP) -I$(UIP)/..
SRCS += $(UIP)/uip.c $(UIP)/uip_arp.c
# Platform
PLATFORM=stm32f0
# Platform files
SRCS += $(PLATFORM)/startup_$(PLATFORM)xx.s $(PLATFORM)/system_$(PLATFORM)xx.c
# Project name for output files
PROJ_NAME=PETnode
# Location of the linker scripts
LDSCRIPT_INC=ldscripts
###################################################
CC=arm-none-eabi-gcc
OBJCOPY=arm-none-eabi-objcopy
OBJDUMP=arm-none-eabi-objdump
SIZE=arm-none-eabi-size
CFLAGS += -g -std=c99 -Os -Wall -Werror -Wextra
CFLAGS += -mlittle-endian -mcpu=cortex-m0 -march=armv6-m -mthumb
CFLAGS += -ffunction-sections -fdata-sections
CFLAGS += -Wl,--gc-sections -Wl,-Map=$(PROJ_NAME).map
CFLAGS += -nodefaultlibs
CFLAGS += -I. -I$(PLATFORM) -Ienc28j60 -Iinclude
###################################################
ROOT=$(shell pwd)
###################################################
all: $(PROJ_NAME).elf
$(PROJ_NAME).elf: $(SRCS) pahka-fsdata.c
$(CC) $(CFLAGS) $(SRCS) -o $@ -L$(LDSCRIPT_INC) -T$(PLATFORM).ld
$(OBJCOPY) -O ihex $(PROJ_NAME).elf $(PROJ_NAME).hex
$(OBJCOPY) -O binary $(PROJ_NAME).elf $(PROJ_NAME).bin
$(OBJDUMP) -St $(PROJ_NAME).elf >$(PROJ_NAME).lst
$(SIZE) $(PROJ_NAME).elf
./pahka-fsdata.c: $(wildcard ./pahka-fs/*.*)
$C/tools/makefsdata -d ./pahka-fs -o ./pahka-fsdata.c
touch ./httpd-fs.c
clean:
find ./ -name '*~' | xargs rm -f
rm -f *.o
rm -f $(PROJ_NAME).elf
rm -f $(PROJ_NAME).hex
rm -f $(PROJ_NAME).bin
rm -f $(PROJ_NAME).map
rm -f $(PROJ_NAME).lst
rm -f ./httpd-fsdata.c
install: all
st-flash erase
st-flash write $(PROJ_NAME).bin 0x08000000
test: install
echo "Reset the device and press enter."
read foo
-sudo arp -d 10.0.0.2
ping -c 2 10.0.0.2
wget http://10.0.0.2