osd-contiki/Makefile

60 lines
1.4 KiB
Makefile
Raw Normal View History

2012-10-03 20:37:11 +02:00
PROJECT_ELF=uart.elf
PROJECT_MOT=$(PROJECT_ELF:.elf=.mot)
PROJECT_MAP=$(PROJECT_ELF:.elf=.map)
PROJECT_LST=$(PROJECT_ELF:.elf=.lst)
# Find latest installed GNURL78 toolchain. If your toolchain is already in PATH, just comment next line.
TOOL_PATH:=$(shell find /usr/share -maxdepth 1 -type d -iname "gnurl78*" | sort | tail -n 1)/bin
PREFIX:=$(TOOL_PATH)/rl78-elf
2012-10-03 20:37:11 +02:00
LD = $(PREFIX)-gcc
CC = $(PREFIX)-gcc
AS = $(PREFIX)-gcc
OBJCOPY = $(PREFIX)-objcopy
OBJDUMP = $(PREFIX)-objdump
SIZE = $(PREFIX)-size
COMMON_PATH = ../common
PROJECT_PATH = .
PROJECT_LNK = $(COMMON_PATH)/rl78-R5F100SL.ld
CFLAGS = -Wall -Wextra -Os -ggdb -ffunction-sections -fdata-sections -I$(PROJECT_PATH) -I$(COMMON_PATH) -mmul=g13
LDFLAGS = -Wl,--gc-sections -Wl,-Map=$(PROJECT_MAP) -T $(PROJECT_LNK) -nostartfiles
SOURCES = \
$(PROJECT_PATH)/main.c \
$(PROJECT_PATH)/uart0.c \
$(END)
OBJS = $(SOURCES:.c=.o) $(COMMON_PATH)/crt0.o
.PHONY: all
all: $(PROJECT_MOT) $(PROJECT_LST)
$(SIZE) $(PROJECT_ELF)
rom: $(PROJECT_MOT)
$(PROJECT_MOT): $(PROJECT_ELF)
$(OBJCOPY) -O srec $^ $@
$(PROJECT_LST): $(PROJECT_ELF)
$(OBJDUMP) -DS $^ > $@
$(PROJECT_ELF): $(OBJS)
$(LD) $(LDFLAGS) -o $@ $^
flash: $(PROJECT_MOT)
rl78flash -m2 -b500000 -vvwri /dev/ttyUSB0 $^
erase:
rl78flash -m2 -b500000 -vveri /dev/ttyUSB0
terminal:
rl78flash -rt9600 /dev/ttyUSB0
2012-10-03 20:37:11 +02:00
clean:
-rm -f $(OBJS) $(PROJECT_ELF) $(PROJECT_MOT) $(PROJECT_MAP) $(PROJECT_LST)