Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/next' into os/OP-899_board-renam…
Browse files Browse the repository at this point in the history
…e-and-config-rework
  • Loading branch information
Oleg Semyonov committed Apr 24, 2013
2 parents 8a3881b + 15fd460 commit 33ed88e
Show file tree
Hide file tree
Showing 21 changed files with 1,882 additions and 142 deletions.
7 changes: 5 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
# Line endings normalization: http://wiki.openpilot.org/display/Doc/Coding+Style
# You need at least git 1.7.2 for this to work (previous versions ignore text and eol attributes).
#
# Make sure you have committed all local changes first. Then use the following bash commands
# to normalize your local repository to be able to merge it with a mainline:
# To merge your old branch with new normalized version use the following git option:
# git merge ... -X renormalize
#
# To reformat your local branch completely make sure you have committed all local changes first.
# Then use the following bash commands:
#
# Minimal normalization:
# git rm --cached -r .
Expand Down
27 changes: 27 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,28 @@ package: all_fw all_ground uavobjects_matlab
$(foreach fw_targ, $(PACKAGE_ELF_TARGETS), $(call COPY_FW_FILES,$(fw_targ),.elf,))
$(MAKE) --no-print-directory -C $(ROOT_DIR)/package --file=$(UNAME).mk $@

##############################
#
# Source code formatting
#
##############################

# $(1) = Uncrustify target (e.g flight or ground)
# $(2) = Target root directory
define UNCRUSTIFY_TEMPLATE

.PHONY: uncrustify_$(1)
uncrustify_$(1):
@$(ECHO) "Auto-formatting $(1) source code"
$(V1) UNCRUSTIFY_CONFIG="make/templates/uncrustify.cfg" $(SHELL) make/scripts/uncrustify.sh $(call toprel, $(2))
endef

$(eval $(call UNCRUSTIFY_TEMPLATE,flight,$(ROOT_DIR)/flight))
$(eval $(call UNCRUSTIFY_TEMPLATE,ground,$(ROOT_DIR)/ground))

.PHONY: uncrustify_all
uncrustify_all: $(addprefix uncrustify_,flight ground)

##############################
#
# Build info
Expand Down Expand Up @@ -814,6 +836,7 @@ help:
@$(ECHO) " qt_sdk_install - Install the QT development tools"
@$(ECHO) " mingw_install - Install the MinGW toolchain (Windows only)"
@$(ECHO) " python_install - Install the Python interpreter (Windows only)"
@$(ECHO) " uncrustify_install - Install the Uncrustify source code beautifier"
@$(ECHO) " openocd_install - Install the OpenOCD JTAG daemon"
@$(ECHO) " stm32flash_install - Install the stm32flash tool for unbricking F1-based boards"
@$(ECHO) " dfuutil_install - Install the dfu-util tool for unbricking F4-based boards"
Expand Down Expand Up @@ -908,6 +931,10 @@ help:
@$(ECHO) " clean_package - Clean, build and package the OpenPilot platform-dependent package"
@$(ECHO) " package - Build and package the OpenPilot platform-dependent package"
@$(ECHO)
@$(ECHO) " [Code Formatting]"
@$(ECHO) " uncrustify_<source> - Reformat <source> code. <source> can be flight or ground"
@$(ECHO) " uncrustify_all - Reformat all source code"
@$(ECHO)
@$(ECHO) " Hint: Add V=1 to your command line to see verbose build output."
@$(ECHO)
@$(ECHO) " Notes: All tool distribution files will be downloaded into $(DL_DIR)"
Expand Down
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
2 changes: 2 additions & 0 deletions make/.gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

*.mk text eol=lf
*.py text eol=lf
*.sh text eol=lf

/templates/firmwareinfotemplate.c text eol=lf
/templates/gcs_version_info_template.h text eol=crlf
/templates/*.txt text eol=crlf
/templates/uncrustify.cfg text eol=lf
1 change: 0 additions & 1 deletion make/firmware-defs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ MSG_CLEANING = $(QUOTE) CLEAN $(MSG_EXTRA) $(QUOTE)
MSG_ASMFROMC = $(QUOTE) AS(C) $(MSG_EXTRA) $(QUOTE)
MSG_ASMFROMC_ARM = $(QUOTE) AS(C)-ARM $(MSG_EXTRA) $(QUOTE)
MSG_PYMITEINIT = $(QUOTE) PY $(MSG_EXTRA) $(QUOTE)
MSG_INSTALLING = $(QUOTE) INSTALL $(MSG_EXTRA) $(QUOTE)
MSG_OPFIRMWARE = $(QUOTE) OPFW $(MSG_EXTRA) $(QUOTE)
MSG_FWINFO = $(QUOTE) FWINFO $(MSG_EXTRA) $(QUOTE)
MSG_JTAG_PROGRAM = $(QUOTE) JTAG-PGM $(MSG_EXTRA) $(QUOTE)
Expand Down
56 changes: 56 additions & 0 deletions make/scripts/uncrustify.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash -e
#
# uncrustify.sh - source code processing script.
# Copyright (c) 2013, The OpenPilot Team, http://www.openpilot.org
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#

# The following environment variables must be set
: ${UNCRUSTIFY?} ${UNCRUSTIFY_CONFIG?}

# No format flag file name
NO_FORMAT=.no-auto-format

# Recursive directory tree walk function
recursive()
{
if [ -d "$1" ]; then
# skip directory if no-format file is found
if [ -f "$1/$NO_FORMAT" ]; then
echo "Skipping: $1/"
return
fi
echo "Processing: $1/"

# process all files and subdirectories
local name
for name in $1/*; do
recursive "$name"
done
else
# process only known file extensions
case "$1" in
*.c|*.h|*.cc|*.cpp|*.hpp)
${UNCRUSTIFY} -c "${UNCRUSTIFY_CONFIG}" --no-backup "$1"
;;
esac
fi
}

# Entry point
for dir in $*; do
recursive "$dir"
done
192 changes: 96 additions & 96 deletions make/scripts/win_sdk_install.sh
Original file line number Diff line number Diff line change
@@ -1,96 +1,96 @@
#!/bin/bash
#
# win_sdk_install.sh - Windows toolchain install script.
# Copyright (c) 2013, The OpenPilot Team, http://www.openpilot.org
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#

# This script should be launched from git bash prompt. It assumes MSYS
# environment and expects path names in the form of /C/some/path, where
# C is a drive letter, and paths are in MSYS format. It probably won't
# work under cygwin.
SCRIPT_PATH="`echo "$BASH_SOURCE" | sed 's|\\\\|/|g; s|^\(.\):|/\1|'`"
SCRIPT_NAME="`basename \"$SCRIPT_PATH\"`"
SCRIPT_DIR="`dirname \"$SCRIPT_PATH\"`"
ROOT_DIR="`pushd \"$SCRIPT_DIR/../..\" >/dev/null && pwd && popd >/dev/null`"
TOOLS_DIR="$ROOT_DIR/tools"

# Tools URLs to fetch
WGET_URL="http://wiki.openpilot.org/download/attachments/18612236/wget.exe"
MAKE_URL="http://wiki.openpilot.org/download/attachments/18612236/make.exe"

# Expected tools paths
WGET="$TOOLS_DIR/bin/`basename \"$WGET_URL\"`"
MAKE="$TOOLS_DIR/bin/`basename \"$MAKE_URL\"`"

# wget is necessary to fetch other files
WGET_NAME="`basename \"$WGET\"`"
if [ ! -x "$WGET" ]; then
echo "$SCRIPT_NAME: $WGET_NAME not found, fetching from $WGET_URL"
mkdir -p "`dirname \"$WGET\"`"

VBSCRIPT="$TOOLS_DIR/fetch.$$.vbs"
cat >"$VBSCRIPT" <<-EOF
url = WScript.Arguments.Item(0)
file = WScript.Arguments.Item(1)
Dim xHttp: Set xHttp = CreateObject("MSXML2.ServerXMLHTTP")
xHttp.Open "GET", url, False
xHttp.setOption 2, SXH_SERVER_CERT_IGNORE_ALL_SERVER_ERRORS
xHttp.Send
If xHttp.Status = 200 Then
Dim bStrm: Set bStrm = CreateObject("AdoDb.Stream")
With bStrm
.Type = 1 '// binary
.Open
.Write xHttp.ResponseBody
.SaveToFile file, 2 '// overwrite
.Close
End With
WScript.Quit(0)
Else
WScript.Quit(1)
End IF
EOF

cscript "$VBSCRIPT" "$WGET_URL" "$WGET"
rc=$?
rm "$VBSCRIPT"

if [ $rc -ne 0 ]; then
echo "$SCRIPT_NAME: $WGET_NAME fetch error, hope it's in the path..."
WGET="$WGET_NAME"
fi
fi

# make is necessary to fetch all SDKs
MAKE_NAME="`basename \"$MAKE\"`"
if [ ! -x "$MAKE" ]; then
echo "$SCRIPT_NAME: $MAKE_NAME not found, fetching from $MAKE_URL"
MAKE_DIR="`dirname \"$MAKE\"`"
mkdir -p "$MAKE_DIR"
$WGET -N --content-disposition -P "$MAKE_DIR" "$MAKE_URL"
if [ $? -ne 0 ]; then
echo "$SCRIPT_NAME: $MAKE_NAME fetch error, hope it's in the path..."
MAKE="$MAKE_NAME"
fi
fi

# Finally we can fetch all SDKs using top level Makefile
cd "$ROOT_DIR"
echo "Run 'tools/bin/make all_sdk_install' to install the other tools"
echo " or 'tools/bin/make help' for more info on make targets"
#!/bin/bash
#
# win_sdk_install.sh - Windows toolchain install script.
# Copyright (c) 2013, The OpenPilot Team, http://www.openpilot.org
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#

# This script should be launched from git bash prompt. It assumes MSYS
# environment and expects path names in the form of /C/some/path, where
# C is a drive letter, and paths are in MSYS format. It probably won't
# work under cygwin.
SCRIPT_PATH="`echo "$BASH_SOURCE" | sed 's|\\\\|/|g; s|^\(.\):|/\1|'`"
SCRIPT_NAME="`basename \"$SCRIPT_PATH\"`"
SCRIPT_DIR="`dirname \"$SCRIPT_PATH\"`"
ROOT_DIR="`pushd \"$SCRIPT_DIR/../..\" >/dev/null && pwd && popd >/dev/null`"
TOOLS_DIR="$ROOT_DIR/tools"

# Tools URLs to fetch
WGET_URL="http://wiki.openpilot.org/download/attachments/18612236/wget.exe"
MAKE_URL="http://wiki.openpilot.org/download/attachments/18612236/make.exe"

# Expected tools paths
WGET="$TOOLS_DIR/bin/`basename \"$WGET_URL\"`"
MAKE="$TOOLS_DIR/bin/`basename \"$MAKE_URL\"`"

# wget is necessary to fetch other files
WGET_NAME="`basename \"$WGET\"`"
if [ ! -x "$WGET" ]; then
echo "$SCRIPT_NAME: $WGET_NAME not found, fetching from $WGET_URL"
mkdir -p "`dirname \"$WGET\"`"

VBSCRIPT="$TOOLS_DIR/fetch.$$.vbs"
cat >"$VBSCRIPT" <<-EOF
url = WScript.Arguments.Item(0)
file = WScript.Arguments.Item(1)
Dim xHttp: Set xHttp = CreateObject("MSXML2.ServerXMLHTTP")
xHttp.Open "GET", url, False
xHttp.setOption 2, SXH_SERVER_CERT_IGNORE_ALL_SERVER_ERRORS
xHttp.Send
If xHttp.Status = 200 Then
Dim bStrm: Set bStrm = CreateObject("AdoDb.Stream")
With bStrm
.Type = 1 '// binary
.Open
.Write xHttp.ResponseBody
.SaveToFile file, 2 '// overwrite
.Close
End With
WScript.Quit(0)
Else
WScript.Quit(1)
End IF
EOF

cscript "$VBSCRIPT" "$WGET_URL" "$WGET"
rc=$?
rm "$VBSCRIPT"

if [ $rc -ne 0 ]; then
echo "$SCRIPT_NAME: $WGET_NAME fetch error, hope it's in the path..."
WGET="$WGET_NAME"
fi
fi

# make is necessary to fetch all SDKs
MAKE_NAME="`basename \"$MAKE\"`"
if [ ! -x "$MAKE" ]; then
echo "$SCRIPT_NAME: $MAKE_NAME not found, fetching from $MAKE_URL"
MAKE_DIR="`dirname \"$MAKE\"`"
mkdir -p "$MAKE_DIR"
$WGET -N --content-disposition -P "$MAKE_DIR" "$MAKE_URL"
if [ $? -ne 0 ]; then
echo "$SCRIPT_NAME: $MAKE_NAME fetch error, hope it's in the path..."
MAKE="$MAKE_NAME"
fi
fi

# Finally we can fetch all SDKs using top level Makefile
cd "$ROOT_DIR"
echo "Run 'tools/bin/make all_sdk_install' to install the other tools"
echo " or 'tools/bin/make help' for more info on make targets"
Loading

0 comments on commit 33ed88e

Please sign in to comment.