aboutsummaryrefslogtreecommitdiffstats
path: root/firmware/cpu-firmware/Makefile
blob: 7927687501ad813fabfec644d5c30773dfbcb2d6 (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
STACKCHECK		:=	# Set to 1 to enable stack instrumentation

# Project name
NAME			:= cnc-control.cpu

# Project source files
SRCS			:= main.c 4094.c debug.c uart.c util.c lcd.c \
			   override.c machine_interface.c \
			   pdiusb.c usb.c spi.c
GEN_SRCS		:= descriptor_table.h

# Bootloader source files
BOOT_SRCS		:= bootloader.c usb.c pdiusb.c util.c uart.c spi.c
BOOT_GEN_SRCS		:= descriptor_table_mini.h
BOOT_OFFSET		:= 0x7000

# CPU speed, in Hz
F_CPU			:= 16000000UL

# Project fuse bits
LFUSE			:= 0xA0
HFUSE			:= 0xD8
EFUSE			:=

# Architecture configuration
GCC_ARCH		:= atmega32
AVRDUDE_ARCH		:= m32
FUNC_STACK_LIMIT	:= 32

# Programmer selection.
# Values can be:  avrisp2, mysmartusb
PROGRAMMER		:= avrisp2

# Instrumentation
INSTRUMENT_FUNC		:= $(if $(STACKCHECK),1)
BOOT_INSTRUMENT_FUNC	:=

# Additional compiler flags
CFLAGS			:= -I.. $(if $(STACKCHECK),-DSTACKCHECK)
LDFLAGS			:=
SPARSEFLAGS		:= -Wno-address-space
BOOT_CFLAGS		:= -I..
BOOT_LDFLAGS		:=
BOOT_SPARSEFLAGS	:= -Wno-address-space

# Additional "clean" and "distclean" target files
CLEAN_FILES		:=
DISTCLEAN_FILES		:=


include ../avrmakelib.mk


# USB ID configuration (pdiusb)
USB_VENDOR		= 0x6666
USB_PRODUCT		= 0xC8CC

ADMIN_TOOL		:= ../../driver/admin.py

boot-app: all
	$(ADMIN_TOOL) --enterboot
	$(ADMIN_TOOL) --flash-cpu $(HEX)
	$(ADMIN_TOOL) --exitboot

$(GEN_SRCS) $(BOOT_GEN_SRCS): %.h: %.py descriptor_generator.py
	$(QUIET_PYTHON2) $< $(USB_VENDOR) $(USB_PRODUCT) > $@

.PHONY: boot-app
bues.ch cgit interface