-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
47 lines (32 loc) · 1.3 KB
/
Makefile
File metadata and controls
47 lines (32 loc) · 1.3 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
# set this to false to disable sonars in firmware
CC=avr-gcc
AS=avr-gcc
INCLUDE_DIRS=-I.
CC_OPTS=-Wall --std=gnu99 -DF_CPU=16000000UL -O3 -funsigned-char -funsigned-bitfields -fshort-enums -Wall -Wstrict-prototypes -mmcu=atmega2560 $(INCLUDE_DIRS) -D__AVR_3_BYTE_PC__
AS_OPTS=-x assembler-with-cpp $(CC_OPTS)
AVRDUDE=avrdude
# com1 = serial port. Use lpt1 to connect to parallel port.
AVRDUDE_PORT = /dev/ttyUSB0 # programmer connected to serial device
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET):i
AVRDUDE_FLAGS = -p m2560 -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) -b 115200
AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
AVRDUDE_FLAGS += -D -q -V -C /usr/share/arduino/hardware/tools/avr/../avrdude.conf
AVRDUDE_FLAGS += -c wiring
OBJS=atomport_asm.o interrupt.o list.o pid.o pool_allocator.o scheduler.o syscall.o syscall_internal.o tcb.o timer.o uart.o vale_os.o semaphore.o
BINS= main.elf
.phony: clean all
all: $(BINS)
#common objects
%.o: %.c
$(CC) $(CC_OPTS) -c $<
%.o: %.s
$(AS) $(AS_OPTS) -c $<
%.elf: %.o $(OBJS)
$(CC) $(CC_OPTS) -o $@ $< $(OBJS) $(LIBS)
%.hex: %.elf
avr-objcopy -O ihex -R .eeprom $< $@
$(AVRDUDE) $(AVRDUDE_FLAGS) -U flash:w:$@:i #$(AVRDUDE_WRITE_EEPROM)
clean:
rm -rf $(OBJS) $(BINS) *.hex *~ *.o