Skip to content

Commit

Permalink
Merge pull request OpenCyphal-Garage#2 from thirtytwobits/master
Browse files Browse the repository at this point in the history
Issue OpenCyphal-Garage#1 fix build
  • Loading branch information
pavel-kirienko authored Aug 4, 2018
2 parents 16750fc + 16005d0 commit bdc85d6
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 2 deletions.
11 changes: 11 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
language: cpp
compiler: gcc
dist: trusty
sudo: true
env:
matrix:
- TARGET=native
before_install:
- ./bootstrap.sh
script:
- cd test_olimex_lpc_p11c24; make
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,12 @@ Cons:

Please use the test application distributed with this driver as a starting point in developing your own
firmware for this platform. It can be easily adapted for any hardware platform.

To build the example using vagrant do:

```
vagrant up
vagrant ssh
cd test_olimex_lpc_p11c24
make
```
23 changes: 23 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
# Every Vagrant development environment requires a box. You can search for
# boxes at https://vagrantcloud.com/search.

config.vm.box = "ubuntu/trusty64"

# use shell and other provisioners as usual
config.vm.provision :shell, path: "bootstrap.sh"

config.vm.provider "virtualbox" do |v|
v.memory = 1024
v.cpus = 4
end
config.vm.provision "shell" do |s|
s.inline = <<-SCRIPT
# Change directory automatically on ssh login
echo "cd /vagrant" >> /home/vagrant/.bashrc
SCRIPT
end
end
30 changes: 30 additions & 0 deletions bootstrap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash

# +----------------------------------------------------------+
# | BASH : Modifying Shell Behaviour
# | (https://www.gnu.org/software/bash/manual)
# +----------------------------------------------------------+
# Treat unset variables and parameters other than the special
# parameters ‘@’ or ‘*’ as an error when performing parameter
# expansion. An error message will be written to the standard
# error, and a non-interactive shell will exit.
set -o nounset

# Exit immediately if a pipeline returns a non-zero status.
set -o errexit

# If set, the return value of a pipeline is the value of the
# last (rightmost) command to exit with a non-zero status, or
# zero if all commands in the pipeline exit successfully.
set -o pipefail

# +----------------------------------------------------------+

sudo apt-get update
sudo apt-get -y install software-properties-common
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa -y
sudo apt-get update
sudo apt-get -y install python3
sudo apt-get -y install git
sudo apt-get -y install gcc-arm-embedded
28 changes: 26 additions & 2 deletions test_olimex_lpc_p11c24/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# Pavel Kirienko, 2014 <pavel.kirienko@gmail.com>
#

BUILDDIR := build

CPPSRC := $(wildcard src/*.cpp) \
$(wildcard src/sys/*.cpp)

Expand All @@ -13,13 +15,15 @@ DEF = -DFW_VERSION_MAJOR=1 -DFW_VERSION_MINOR=0
INC = -Isrc/sys \
-isystem lpc_chip_11cxx_lib/inc

JLINK_PART := LPC11C24

#
# UAVCAN library
#

DEF += -DUAVCAN_TINY=1

include ../../../libuavcan/include.mk
include $(BUILDDIR)/libuavcan/libuavcan/include.mk
CPPSRC += $(LIBUAVCAN_SRC)
INC += -I$(LIBUAVCAN_INC)

Expand All @@ -43,7 +47,6 @@ endif
# Build configuration
#

BUILDDIR = build
OBJDIR = $(BUILDDIR)/obj
DEPDIR = $(BUILDDIR)/dep

Expand Down Expand Up @@ -111,12 +114,33 @@ $(CPPOBJ): $(OBJDIR)/%.o: %.cpp
@echo
$(CPPC) -c $(DEF) $(INC) $(CPPFLAGS) $< -o $@

$(BUILDDIR)/libuavcan/libuavcan/include.mk : | $(BUILDDIR)
cd $| && git clone --recurse-submodules https://github.com/UAVCAN/libuavcan.git

clean:
rm -rf $(BUILDDIR) dsdlc_generated

size: $(ELF)
@if [ -f $(ELF) ]; then echo; $(SIZE) $(ELF); echo; fi;

$(BUILDDIR)/$(JLINK_PART).jlink : $(BIN)
@echo "\
connect \n\
h \n\
rx 100 \n\
loadfile $< \n\
r \n\
q\n" > $@

# do `make ENV_JLINK_COMMANDER=path/to/JLink jlinkto-olimex` to build
# and upload firmware to an attached olimex lpcp11c24 dev board
# using an attached JLink debug probe.
jlinkto-olimex : $(BUILDDIR)/$(JLINK_PART).jlink
$(ENV_JLINK_COMMANDER) -Device $(JLINK_PART) \
-If SWD \
-Speed 4000 \
-CommanderScript $<

.PHONY: all clean size $(BUILDDIR)

# Include the dependency files, should be the last of the makefile
Expand Down

0 comments on commit bdc85d6

Please sign in to comment.