Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: de7cacd133
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 75 lines (58 sloc) 2.427 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
#
# To use this test harness Makefile:
# 1) checkout the Milkymist SOC git repository
# git clone git://github.com/milkymist/milkymist.git
# 2) build the SOC bios software (see the SOC README)
# ./build_bios.sh
# 3) Set MMDIR to the SOC directory
# 4) Add your files to the OBJECTS variable
# 5) set the CC variable appropriately
# 6) make depend
# 7) make
#
MMDIR=/Users/jpbonn/Documents/soc/milkymist
# Set BOARDOBJSDIR to the directory containing the
# startup files (crt0.c, init.c, isr.c)
BOARDOBJSDIR=/Users/jpbonn/Documents/clang-demos/hello

BIOSOBJECTS=$(BOARDOBJSDIR)/crt0.o $(BOARDOBJSDIR)/init.o $(BOARDOBJSDIR)/isr.o
OBJECTS = $(BIOSOBJECTS) main.o

# Mico32 toolchain
#
#CC=lm32-rtems4.11-gcc
CC=/Users/jpbonn/Documents/mico32/install2/bin/clang -march=mico32 -ccc-host-triple mico32-elf -ccc-gcc-name /opt/rtems-4.11/bin/lm32-rtems4.11-gcc
GCC=lm32-rtems4.11-gcc
AS=lm32-rtems4.11-as
LD=lm32-rtems4.11-ld
OBJCOPY=lm32-rtems4.11-objcopy
AR=lm32-rtems4.11-ar
RANLIB=lm32-rtems4.11-ranlib


# Toolchain options
#
INCLUDES=-I$(MMDIR)/software/include -I$(MMDIR)/software/include/base -I$(MMDIR)/tools
ASFLAGS=$(INCLUDES)
CFLAGS=-O3 -g -nostdinc -Wall -mbarrel-shift-enabled -mmultiply-enabled -mdivide-enabled -msign-extend-enabled -fno-builtin -fsigned-char -fsingle-precision-constant $(INCLUDES)
LDFLAGS=-nostdinc -nostdlib -nodefaultlibs

SEGMENTS=-j .text -j .data -j .rodata

all: main.elf main-rescue.elf

%.bin: %.elf
$(MAKE) -C $(MMDIR)/tools
$(OBJCOPY) $(SEGMENTS) -O binary $< $@
chmod -x $@
$(MMDIR)/tools/mkmmimg $@ write

# make sure the linker*.ld at the first of depends
main.elf: $(BOARDOBJSDIR)/linker.ld $(OBJECTS)
main-rescue.elf: $(BOARDOBJSDIR)/linker-rescue.ld $(OBJECTS)

# The following files use inline assembly so we need to use GCC:
$(BOARDOBJSDIR)/init.o: $(BOARDOBJSDIR)/init.c
$(GCC) $(CFLAGS) -c -o $@ $<

$(BOARDOBJSDIR)/isr.o: $(BOARDOBJSDIR)/isr.c
$(GCC) $(CFLAGS) -c -o $@ $<

%.elf:
$(LD) $(LDFLAGS) -T $< -N -o $@ $(OBJECTS) -L$(MMDIR)/software/libhpdmc -L$(MMDIR)/software/libbase -L$(MMDIR)/software/libhal -L$(MMDIR)/software/libnet --start-group -lhpdmc -lbase-light -lhal -lnet --end-group
chmod -x $@

.PHONY: clean depend

depend:
makedepend -Y -- $(CFLAGS) -- *.c $(BOARDOBJSDIR)/*.c

clean:
rm -f *.o main.elf main.bin main-rescue.elf main-rescue.bin .*~ *~ Makefile.bak $(BOARDOBJSDIR)/*.o


# The following lines will get regenerated by "make depend":
Something went wrong with that request. Please try again.