Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
wendlers committed Feb 2, 2012
1 parent cf531b5 commit fa675e2
Show file tree
Hide file tree
Showing 47 changed files with 8,617 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CHANGELOG RobotRemCtrlFW
===============================================================================

Initial version 0.1
14.10.2011, sw@kaltpost.de
676 changes: 676 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

86 changes: 86 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
##
# Toplevel Makefile RobotRemCtrlFW
#
# Stefan Wendler, sw@kaltpost.de
##

BASEDIR = .
SRCDIR = src
BINDIR = bin
TESTBINDIR = test-bin
FIRMWARE = firmware.elf
OOCD_IF = interface/openocd-usb.cfg
OOCD_BOARD = board/stm32100b_eval.cfg
TESTSRCDIR = test-src
DEPLOYDIR = deploy
TMPDIR = /tmp
VERSION = 0.1
TARGET = RobotControlFW_v$(VERSION)

all: target

world: target target-test gen-docs

target:
make -C $(SRCDIR)

target-test: target
make -C $(TESTSRCDIR)

gen-docs: target
cd $(SRCDIR) && make gen-docs

style:
cd $(SRCDIR) && make style
cd $(TESTSRCDIR) && make style

check:
make -C $(SRCDIR) check
# We do not check the tests
# make -C $(TESTSRCDIR) check

flash-target: target
openocd -f $(OOCD_IF) -f $(OOCD_BOARD) \
-c init -c targets -c "halt" \
-c "flash write_image erase $(BINDIR)/$(FIRMWARE)" \
-c "verify_image $(BINDIR)/$(FIRMWARE)" \
-c "reset run" -c shutdown

flash-target-test: target-test
openocd -f $(OOCD_IF) -f $(OOCD_BOARD) \
-c init -c targets -c "halt" \
-c "flash write_image erase $(TESTBINDIR)/firmware.elf" \
-c "verify_image $(TESTBINDIR)/$(FIRMWARE)" \
-c "reset run" -c shutdown

deploy-src: target-test check style clean gen-docs
rm -fr $(TMPDIR)/$(TARGET)_src
mkdir $(TMPDIR)/$(TARGET)_src
cp -a ./* $(TMPDIR)/$(TARGET)_src/.
rm -fr $(TMPDIR)/$(TARGET)_src/deploy
rm -fr $(TMPDIR)/$(TARGET)_src/tools
mkdir $(TMPDIR)/$(TARGET)_src/deploy
(cd $(TMPDIR); tar --exclude=".svn" -jcvf $(TARGET)_src.tar.bz2 $(TARGET)_src)
mv $(TMPDIR)/$(TARGET)_src.tar.bz2 $(DEPLOYDIR)/.

deploy-bin: clean target-test
rm -fr $(TMPDIR)/$(TARGET)_bin
mkdir $(TMPDIR)/$(TARGET)_bin
cp CHANGELOG LICENSE README $(TMPDIR)/$(TARGET)_bin/.
cp -a ./bin $(TMPDIR)/$(TARGET)_bin/.
cp -a ./doc $(TMPDIR)/$(TARGET)_bin/.
cp -a ./test-bin $(TMPDIR)/$(TARGET)_bin/.
(cd $(TMPDIR); tar --exclude=".svn" -jcvf $(TARGET)_bin.tar.bz2 $(TARGET)_bin)
mv $(TMPDIR)/$(TARGET)_bin.tar.bz2 $(DEPLOYDIR)/.

deploy: deploy-src deploy-bin

tags: target
ctags -R --c++-kinds=+p --fields=+iaS --extra=+q $(SRCDIR)

clean:
make -C $(SRCDIR) clean
make -C $(TESTSRCDIR) clean
rm -fr doc/gen
rm -f bin/*
rm -f test-bin/*
Empty file added bin/emptyfile.txt
Empty file.
105 changes: 105 additions & 0 deletions common.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
##
# Common settings for Makefiles
#
# Stefan Wendler, sw@kaltpost.de
##

# compiler prefix
PREFIX ?= arm-none-eabi-
# PREFIX ?= arm-elf-

CC = $(PREFIX)gcc
LD = $(PREFIX)gcc
OBJCOPY = $(PREFIX)objcopy
OBJDUMP = $(PREFIX)objdump

INCDIR += -I./include -I$(HONE)/sat/arm-none-eabi/include
CFLAGS += -Os -g -Wall -Wextra -fno-common -mcpu=cortex-m3 -mthumb -msoft-float
CFLAGS += -MD $(INCDIR) -DSTM32F1

LDSCRIPT = $(BINARY).ld
LIBDIR = -L$(HOME)/sat/arm-none-eabi/lib
LIBS = -lopencm3_stm32f1
LDFLAGS += $(LIBDIR) $(LIBS) -T$(LDSCRIPT) -nostartfiles -Wall,--gc-sections
LDFLAGS += -mthumb -march=armv7 -mfix-cortex-m3-ldrd -msoft-float

# where to put generated binaries to
BINDIR ?= ../bin

# doxygen executable
DOXYGEN = doxygen

# doxygen flags
DOXYGENFLAGS = ../doxygen.conf

# styler to use
STYLER = astyle

# which c-style to use
# - see man astyle
STYLERFLAGS = --style=stroustrup

# cpp checker
CHECKER = cppcheck

# flags for checker
# CHECKERFLAGS = --error-exitcode=1 --enable=all

.SUFFIXES: .elf .bin .hex .srec .list .images
.SECONDEXPANSION:
.SECONDARY:

all: images

images: $(BINARY).images

%.images: %.bin %.hex %.srec %.list
@#echo "*** $* images generated ***"

%.bin: %.elf
@#printf " OBJCOPY $(*).bin\n"
$(OBJCOPY) -Obinary $(*).elf $(*).bin && cp $(*).bin $(BINDIR)/.

%.hex: %.elf
@#printf " OBJCOPY $(*).hex\n"
$(OBJCOPY) -Oihex $(*).elf $(*).hex && cp $(*).hex $(BINDIR)/.

%.srec: %.elf
@#printf " OBJCOPY $(*).srec\n"
$(OBJCOPY) -Osrec $(*).elf $(*).srec && cp $(*).srec $(BINDIR)/.

%.list: %.elf
@#printf " OBJDUMP $(*).list\n"
$(OBJDUMP) -S $(*).elf > $(*).list && cp $(*).list $(BINDIR)/.

%.elf: $(OBJS) $(LDSCRIPT)
@#printf " LD $(subst $(shell pwd)/,,$(@))\n"
$(LD) $(OBJS) $(LDFLAGS) -o $(*).elf && cp $(*).elf $(BINDIR)/.

%.o: %.c Makefile
@#printf " CC $(subst $(shell pwd)/,,$(@))\n"
$(CC) $(CFLAGS) -o $@ -c $<

%.o: %.cpp Makefile
@#printf " CC $(subst $(shell pwd)/,,$(@))\n"
$(CC) $(CFLAGS) -o $@ -c $<

SRC = $(wildcard *.c)
HDR = $(wildcard include/*.h)

style:
$(STYLER) $(STYLERFLAGS) $(SRC)
$(STYLER) $(STYLERFLAGS) $(HDR)

clean:
rm -f *.o
rm -f *.d
rm -f *.elf
rm -f *.bin
rm -f *.hex
rm -f *.srec
rm -f *.list
rm -f *.orig

.PHONY: images clean

Empty file added deploy/emptyfile.txt
Empty file.
Loading

0 comments on commit fa675e2

Please sign in to comment.