mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-09 12:08:37 +08:00
@@ -48,3 +48,5 @@ unittests/build
|
||||
.vagrant
|
||||
*.pretty
|
||||
xcode
|
||||
src/platforms/posix/px4_messages/
|
||||
src/platforms/qurt/px4_messages/
|
||||
|
||||
+10
-6
@@ -60,18 +60,22 @@ env:
|
||||
script:
|
||||
- ccache -z
|
||||
- arm-none-eabi-gcc --version
|
||||
- echo 'Running Tests..' && echo -en 'travis_fold:start:script.1\\r'
|
||||
- echo 'Building POSIX Firmware..' && echo -en 'travis_fold:start:script.1\\r'
|
||||
- make posix -j4
|
||||
- ccache -s
|
||||
- echo -en 'travis_fold:end:script.1\\r'
|
||||
- echo 'Running Tests..' && echo -en 'travis_fold:start:script.2\\r'
|
||||
- make tests
|
||||
- cat src/modules/systemlib/mixer/mixer_multirotor.generated.h
|
||||
- echo -en 'travis_fold:end:script.1\\r'
|
||||
- echo 'Building NuttX..' && echo -en 'travis_fold:start:script.2\\r'
|
||||
- echo -en 'travis_fold:end:script.2\\r'
|
||||
- echo 'Building NuttX..' && echo -en 'travis_fold:start:script.3\\r'
|
||||
- make archives
|
||||
- ccache -s
|
||||
- echo -en 'travis_fold:end:script.2\\r'
|
||||
- echo 'Building Firmware..' && echo -en 'travis_fold:start:script.3\\r'
|
||||
- echo -en 'travis_fold:end:script.3\\r'
|
||||
- echo 'Building NuttX Firmware..' && echo -en 'travis_fold:start:script.4\\r'
|
||||
- make -j4
|
||||
- ccache -s
|
||||
- echo -en 'travis_fold:end:script.3\\r'
|
||||
- echo -en 'travis_fold:end:script.4\\r'
|
||||
- zip Firmware.zip Images/*.px4
|
||||
|
||||
after_script:
|
||||
|
||||
@@ -53,13 +53,13 @@ export GIT_DESC
|
||||
#
|
||||
# Canned firmware configurations that we (know how to) build.
|
||||
#
|
||||
KNOWN_CONFIGS := $(subst config_,,$(basename $(notdir $(wildcard $(PX4_MK_DIR)config_*.mk))))
|
||||
KNOWN_CONFIGS := $(subst config_,,$(basename $(notdir $(wildcard $(PX4_MK_DIR)/$(PX4_TARGET_OS)/config_*.mk))))
|
||||
CONFIGS ?= $(KNOWN_CONFIGS)
|
||||
|
||||
#
|
||||
# Boards that we (know how to) build NuttX export kits for.
|
||||
#
|
||||
KNOWN_BOARDS := $(subst board_,,$(basename $(notdir $(wildcard $(PX4_MK_DIR)board_*.mk))))
|
||||
KNOWN_BOARDS := $(subst board_,,$(basename $(notdir $(wildcard $(PX4_MK_DIR)/$(PX4_TARGET_OS)/board_*.mk))))
|
||||
BOARDS ?= $(KNOWN_BOARDS)
|
||||
|
||||
#
|
||||
@@ -97,6 +97,7 @@ upload:
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(PX4_TARGET_OS),nuttx)
|
||||
#
|
||||
# Built products
|
||||
#
|
||||
@@ -209,6 +210,7 @@ menuconfig:
|
||||
@$(ECHO) ""
|
||||
@$(ECHO) "The menuconfig goal must be invoked without any other goal being specified"
|
||||
@$(ECHO) ""
|
||||
|
||||
endif
|
||||
|
||||
$(NUTTX_SRC): checksubmodules
|
||||
@@ -216,6 +218,20 @@ $(NUTTX_SRC): checksubmodules
|
||||
$(UAVCAN_DIR):
|
||||
$(Q) (./Tools/check_submodules.sh)
|
||||
|
||||
endif
|
||||
|
||||
ifeq ($(PX4_TARGET_OS),nuttx)
|
||||
# TODO
|
||||
# Move the above nuttx specific rules into $(PX4_BASE)makefiles/firmware_nuttx.mk
|
||||
endif
|
||||
ifeq ($(PX4_TARGET_OS),posix)
|
||||
include $(PX4_BASE)makefiles/firmware_posix.mk
|
||||
endif
|
||||
ifeq ($(PX4_TARGET_OS),qurt)
|
||||
include $(PX4_BASE)makefiles/firmware_qurt.mk
|
||||
endif
|
||||
|
||||
|
||||
.PHONY: checksubmodules
|
||||
checksubmodules:
|
||||
$(Q) ($(PX4_BASE)/Tools/check_submodules.sh)
|
||||
@@ -229,7 +245,7 @@ MSG_DIR = $(PX4_BASE)msg
|
||||
UORB_TEMPLATE_DIR = $(PX4_BASE)msg/templates/uorb
|
||||
MULTIPLATFORM_TEMPLATE_DIR = $(PX4_BASE)msg/templates/px4/uorb
|
||||
TOPICS_DIR = $(PX4_BASE)src/modules/uORB/topics
|
||||
MULTIPLATFORM_HEADER_DIR = $(PX4_BASE)src/platforms/nuttx/px4_messages
|
||||
MULTIPLATFORM_HEADER_DIR = $(PX4_BASE)src/platforms/$(PX4_TARGET_OS)/px4_messages
|
||||
MULTIPLATFORM_PREFIX = px4_
|
||||
TOPICHEADER_TEMP_DIR = $(BUILD_DIR)topics_temporary
|
||||
GENMSG_PYTHONPATH = $(PX4_BASE)Tools/genmsg/src
|
||||
@@ -255,6 +271,21 @@ testbuild:
|
||||
$(Q) (cd $(PX4_BASE) && $(MAKE) distclean && $(MAKE) archives && $(MAKE) -j8)
|
||||
$(Q) (zip -r Firmware.zip $(PX4_BASE)/Images)
|
||||
|
||||
posix:
|
||||
make PX4_TARGET_OS=posix
|
||||
|
||||
nuttx:
|
||||
make PX4_TARGET_OS=nuttx
|
||||
|
||||
qurt:
|
||||
make PX4_TARGET_OS=qurt
|
||||
|
||||
posixrun:
|
||||
Tools/posix_run.sh
|
||||
|
||||
qurtrun:
|
||||
make PX4_TARGET_OS=qurt sim
|
||||
|
||||
#
|
||||
# Unittest targets. Builds and runs the host-level
|
||||
# unit tests.
|
||||
|
||||
Executable
+150
@@ -0,0 +1,150 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import glob
|
||||
import sys
|
||||
|
||||
# This script is run from Build/<target>_default.build/$(PX4_BASE)/Firmware/src/systemcmds/topic_listener
|
||||
|
||||
# argv[1] must be the full path of the top Firmware dir
|
||||
|
||||
raw_messages = glob.glob(sys.argv[1]+"/msg/*.msg")
|
||||
messages = []
|
||||
message_elements = []
|
||||
|
||||
|
||||
for index,m in enumerate(raw_messages):
|
||||
temp_list_floats = []
|
||||
temp_list_uint64 = []
|
||||
temp_list_bool = []
|
||||
if("actuator_control" not in m and "pwm_input" not in m and "position_setpoint" not in m):
|
||||
temp_list = []
|
||||
f = open(m,'r')
|
||||
for line in f.readlines():
|
||||
if(line.split(' ')[0] == "float32"):
|
||||
temp_list.append(("float",line.split(' ')[1].split('\t')[0].split('\n')[0]))
|
||||
elif(line.split(' ')[0] == "uint64"):
|
||||
temp_list.append(("uint64",line.split(' ')[1].split('\t')[0].split('\n')[0]))
|
||||
elif (line.split(' ')[0] == "bool"):
|
||||
temp_list.append(("bool",line.split(' ')[1].split('\t')[0].split('\n')[0]))
|
||||
elif (line.split(' ')[0] == "uint8") and len(line.split('=')) == 1:
|
||||
temp_list.append(("uint8",line.split(' ')[1].split('\t')[0].split('\n')[0]))
|
||||
elif ('float32[' in line.split(' ')[0]):
|
||||
num_floats = int(line.split(" ")[0].split("[")[1].split("]")[0])
|
||||
temp_list.append(("float_array",line.split(' ')[1].split('\t')[0].split('\n')[0],num_floats))
|
||||
|
||||
f.close()
|
||||
messages.append(m.split('/')[-1].split('.')[0])
|
||||
message_elements.append(temp_list)
|
||||
|
||||
num_messages = len(messages);
|
||||
|
||||
print
|
||||
print """
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2015 PX4 Development Team. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name PX4 nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file topic_listener.cpp, autogenerated by Tools/generate_listener.py
|
||||
*
|
||||
* Tool for listening to topics when running flight stack on linux.
|
||||
*/
|
||||
#include <px4_middleware.h>
|
||||
#include <px4_app.h>
|
||||
#include <px4_config.h>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
#include <cstring>
|
||||
#include <uORB/uORB.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
"""
|
||||
for m in messages:
|
||||
print "#include <uORB/topics/%s.h>" % m
|
||||
|
||||
|
||||
print """
|
||||
extern "C" __EXPORT int listener_main(int argc, char *argv[]);
|
||||
|
||||
int listener_main(int argc, char *argv[]) {
|
||||
int sub = -1;
|
||||
orb_id_t ID;
|
||||
if(argc < 3) {
|
||||
printf("need at least two arguments: topic name, number of messages to print\\n");
|
||||
return 1;
|
||||
}
|
||||
"""
|
||||
print "\tuint32_t num_msgs = (uint32_t)std::stoi(argv[2],NULL,10);"
|
||||
print "\tif(strncmp(argv[1],\"%s\",50)== 0) {" % messages[0]
|
||||
print "\t\tsub = orb_subscribe(ORB_ID(%s));" % messages[0]
|
||||
print "\t\tID = ORB_ID(%s);" % messages[0]
|
||||
print "\t\tstruct %s_s container;" % messages[0]
|
||||
print "\t\tmemset(&container, 0, sizeof(container));"
|
||||
for index,m in enumerate(messages[1:]):
|
||||
print "\t} else if(strncmp(argv[1],\"%s\",50) == 0) {" % m
|
||||
print "\t\tsub = orb_subscribe(ORB_ID(%s));" % m
|
||||
print "\t\tID = ORB_ID(%s);" % m
|
||||
print "\t\tstruct %s_s container;" % m
|
||||
print "\t\tmemset(&container, 0, sizeof(container));"
|
||||
print "\t\tbool updated;"
|
||||
print "\t\tfor(uint32_t i = 0;i<num_msgs;i++) {"
|
||||
print "\t\t\torb_check(sub,&updated);"
|
||||
print "\t\t\tupdated = true;"
|
||||
print "\t\t\tif(updated) {"
|
||||
print "\t\t\torb_copy(ID,sub,&container);"
|
||||
for item in message_elements[index+1]:
|
||||
if item[0] == "float":
|
||||
print "\t\t\tprintf(\"%s: %%f\\n \",(double)container.%s);" % (item[1], item[1])
|
||||
elif item[0] == "float_array":
|
||||
print "\t\t\tprintf(\"%s:\");" % item[1]
|
||||
print "\t\t\tfor (int j=0;j<%d;j++) {" % item[2]
|
||||
print "\t\t\t\tprintf(\"%%f \",(double)container.%s[j]);" % item[1]
|
||||
print "\t\t\t}"
|
||||
print "\t\t\tprintf(\"\\n\");"
|
||||
elif item[0] == "uint64":
|
||||
print "\t\t\tprintf(\"%s: %%lu\\n \",container.%s);" % (item[1], item[1])
|
||||
elif item[0] == "uint8":
|
||||
print "\t\t\tprintf(\"%s: %%u\\n \",container.%s);" % (item[1], item[1])
|
||||
elif item[0] == "bool":
|
||||
print "\t\t\tprintf(\"%s: %%s\\n \",container.%s ? \"True\" : \"False\");" % (item[1], item[1])
|
||||
print "\t\t\t}"
|
||||
print "\t\t}"
|
||||
print "\t} else {"
|
||||
print "\t\t printf(\" Topic did not match any known topics\\n\");"
|
||||
print "\t}"
|
||||
print("\t return 0;")
|
||||
|
||||
print "}"
|
||||
Executable
+126
@@ -0,0 +1,126 @@
|
||||
#!/usr/bin/env python
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (C) 2015 Mark Charlebois. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name PX4 nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
import glob
|
||||
builtins = glob.glob("builtin_commands/COMMAND*")
|
||||
|
||||
apps = []
|
||||
for f in builtins:
|
||||
apps.append(f.split(".")[-1].split("_main")[0])
|
||||
|
||||
print
|
||||
print """
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#define __EXPORT
|
||||
|
||||
#include <px4_tasks.h>
|
||||
#include <px4_posix.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
extern void px4_show_devices(void);
|
||||
|
||||
extern "C" {
|
||||
"""
|
||||
for app in apps:
|
||||
print "extern int "+app+"_main(int argc, char *argv[]);"
|
||||
|
||||
print """
|
||||
static int shutdown_main(int argc, char *argv[]);
|
||||
static int list_tasks_main(int argc, char *argv[]);
|
||||
static int list_files_main(int argc, char *argv[]);
|
||||
static int list_devices_main(int argc, char *argv[]);
|
||||
static int list_topics_main(int argc, char *argv[]);
|
||||
}
|
||||
|
||||
|
||||
static map<string,px4_main_t> app_map(void);
|
||||
|
||||
static map<string,px4_main_t> app_map(void)
|
||||
{
|
||||
static map<string,px4_main_t> apps;
|
||||
"""
|
||||
for app in apps:
|
||||
print '\tapps["'+app+'"] = '+app+'_main;'
|
||||
|
||||
print '\tapps["shutdown"] = shutdown_main;'
|
||||
print '\tapps["list_tasks"] = list_tasks_main;'
|
||||
print '\tapps["list_files"] = list_files_main;'
|
||||
print '\tapps["list_devices"] = list_devices_main;'
|
||||
print '\tapps["list_topics"] = list_topics_main;'
|
||||
print """
|
||||
return apps;
|
||||
}
|
||||
|
||||
map<string,px4_main_t> apps = app_map();
|
||||
|
||||
static void list_builtins(void)
|
||||
{
|
||||
cout << "Builtin Commands:" << endl;
|
||||
for (map<string,px4_main_t>::iterator it=apps.begin(); it!=apps.end(); ++it)
|
||||
cout << '\t' << it->first << endl;
|
||||
}
|
||||
|
||||
static int shutdown_main(int argc, char *argv[])
|
||||
{
|
||||
cout << "Shutting down" << endl;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
static int list_tasks_main(int argc, char *argv[])
|
||||
{
|
||||
px4_show_tasks();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int list_devices_main(int argc, char *argv[])
|
||||
{
|
||||
px4_show_devices();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int list_topics_main(int argc, char *argv[])
|
||||
{
|
||||
px4_show_topics();
|
||||
return 0;
|
||||
}
|
||||
static int list_files_main(int argc, char *argv[])
|
||||
{
|
||||
px4_show_files();
|
||||
return 0;
|
||||
}
|
||||
"""
|
||||
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ ! -d /fs/msdcard ] && [ ! -w /fs/msdcard ]
|
||||
then
|
||||
echo "Need to create/mount writable /fs/microsd"
|
||||
echo "sudo mkdir -p /fs/msdcard"
|
||||
echo "sudo chmod 777 /fs/msdcard"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d /eeprom ] && [ ! -w /eeprom ]
|
||||
then
|
||||
echo "Need to create/mount writable /eeprom"
|
||||
echo "sudo mkdir -p /eeprom"
|
||||
echo "sudo chmod 777 /eeprom"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Build/posix_default.build/mainapp posix-configs/posixtest/init/rc.S
|
||||
Executable
+121
@@ -0,0 +1,121 @@
|
||||
#!/usr/bin/env python
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (C) 2015 Mark Charlebois. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name PX4 nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
import glob
|
||||
#builtins = glob.glob("../Build/linux_default.build/builtin_commands/COMMAND*")
|
||||
builtins = glob.glob("builtin_commands/COMMAND*")
|
||||
|
||||
apps = []
|
||||
for f in builtins:
|
||||
apps.append(f.split(".")[-1].split("_main")[0])
|
||||
|
||||
print
|
||||
print """
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <px4_tasks.h>
|
||||
#include <px4_posix.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
extern void px4_show_devices(void);
|
||||
|
||||
extern "C" {
|
||||
"""
|
||||
for app in apps:
|
||||
print "extern int "+app+"_main(int argc, char *argv[]);"
|
||||
|
||||
print """
|
||||
static int shutdown_main(int argc, char *argv[]);
|
||||
static int list_tasks_main(int argc, char *argv[]);
|
||||
static int list_files_main(int argc, char *argv[]);
|
||||
static int list_devices_main(int argc, char *argv[]);
|
||||
static int list_topics_main(int argc, char *argv[]);
|
||||
}
|
||||
|
||||
|
||||
void init_app_map(map<string,px4_main_t> &apps)
|
||||
{
|
||||
"""
|
||||
for app in apps:
|
||||
print '\tapps["'+app+'"] = '+app+'_main;'
|
||||
|
||||
print '\tapps["shutdown"] = shutdown_main;'
|
||||
print '\tapps["list_tasks"] = list_tasks_main;'
|
||||
print '\tapps["list_files"] = list_files_main;'
|
||||
print '\tapps["list_devices"] = list_devices_main;'
|
||||
print '\tapps["list_topics"] = list_topics_main;'
|
||||
|
||||
print """
|
||||
}
|
||||
|
||||
void list_builtins(map<string,px4_main_t> &apps)
|
||||
{
|
||||
printf("Builtin Commands:\\n");
|
||||
for (map<string,px4_main_t>::iterator it=apps.begin(); it!=apps.end(); ++it)
|
||||
printf("\\t%s\\n", (it->first).c_str());
|
||||
}
|
||||
|
||||
static int shutdown_main(int argc, char *argv[])
|
||||
{
|
||||
printf("Shutting down\\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
static int list_tasks_main(int argc, char *argv[])
|
||||
{
|
||||
px4_show_tasks();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int list_devices_main(int argc, char *argv[])
|
||||
{
|
||||
px4_show_devices();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int list_topics_main(int argc, char *argv[])
|
||||
{
|
||||
px4_show_topics();
|
||||
return 0;
|
||||
}
|
||||
static int list_files_main(int argc, char *argv[])
|
||||
{
|
||||
px4_show_files();
|
||||
return 0;
|
||||
}
|
||||
"""
|
||||
|
||||
+23
-8
@@ -7,8 +7,9 @@ with Makefile in the parent directory.
|
||||
|
||||
../Makefile
|
||||
|
||||
Top-level makefile for the PX4 build system. This makefile supports
|
||||
building NuttX archives, as well as supervising the building of all
|
||||
Top-level makefile for the PX4 build system.
|
||||
This makefile supports building NuttX archives for the NuttX based
|
||||
configurations, as well as supervising the building of all
|
||||
of the defined PX4 firmware configurations.
|
||||
|
||||
Try 'make help' in the parent directory for documentation.
|
||||
@@ -25,6 +26,14 @@ firmware.mk
|
||||
source tree. When used in this mode, at least BOARD, MODULES and
|
||||
CONFIG_FILE must be set.
|
||||
|
||||
firmware_nuttx.mk
|
||||
|
||||
Called by firmware.mk to build NuttX based firmware.
|
||||
|
||||
firmware_posix.mk
|
||||
|
||||
Called by firmware.mk to build POSIX (non-ROS) based firmware.
|
||||
|
||||
module.mk
|
||||
|
||||
Called by firmware.mk to build individual modules.
|
||||
@@ -34,22 +43,28 @@ module.mk
|
||||
|
||||
nuttx.mk
|
||||
|
||||
Called by ../Makefile to build or download the NuttX archives.
|
||||
Called by ../Makefile to build or download the NuttX archives if
|
||||
PX4_TARGET_OS is set to "nuttx".
|
||||
|
||||
posix.mk
|
||||
|
||||
Called by ../Makefile to set POSIX specific parameters if
|
||||
PX4_TARGET_OS is set to "posix".
|
||||
|
||||
upload.mk
|
||||
|
||||
Called by ../Makefile to upload files to a target board. Can be used
|
||||
by external build systems as well.
|
||||
by external build systems as well. (NuttX targets only)
|
||||
|
||||
setup.mk
|
||||
|
||||
Provides common path and tool definitions. Implements host system-specific
|
||||
compatibility hacks.
|
||||
Provides common path and tool definitions. Implements host
|
||||
system-specific compatibility hacks. Sets PX4_TARGET_OS.
|
||||
|
||||
board_<boardname>.mk
|
||||
|
||||
Board-specific configuration for <boardname>. Typically sets CONFIG_ARCH
|
||||
and then includes the toolchain definition for the board.
|
||||
Board-specific configuration for <boardname>. Typically sets
|
||||
CONFIG_ARCH and then includes the toolchain definition for the board.
|
||||
|
||||
config_<boardname>_<configname>.mk
|
||||
|
||||
|
||||
+26
-6
@@ -132,7 +132,7 @@ include $(MK_DIR)/setup.mk
|
||||
ifneq ($(CONFIG_FILE),)
|
||||
CONFIG := $(subst config_,,$(basename $(notdir $(CONFIG_FILE))))
|
||||
else
|
||||
CONFIG_FILE := $(wildcard $(PX4_MK_DIR)/config_$(CONFIG).mk)
|
||||
CONFIG_FILE := $(wildcard $(PX4_MK_DIR)/$(PX4_TARGET_OS)/config_$(CONFIG).mk)
|
||||
endif
|
||||
ifeq ($(CONFIG),)
|
||||
$(error Missing configuration name or file (specify with CONFIG=<config>))
|
||||
@@ -150,7 +150,7 @@ $(info % CONFIG = $(CONFIG))
|
||||
ifeq ($(BOARD),)
|
||||
BOARD := $(firstword $(subst _, ,$(CONFIG)))
|
||||
endif
|
||||
BOARD_FILE := $(wildcard $(PX4_MK_DIR)/board_$(BOARD).mk)
|
||||
BOARD_FILE := $(wildcard $(PX4_MK_DIR)/$(PX4_TARGET_OS)/board_$(BOARD).mk)
|
||||
ifeq ($(BOARD_FILE),)
|
||||
$(error Config $(CONFIG) references board $(BOARD), but no board definition file found)
|
||||
endif
|
||||
@@ -186,10 +186,10 @@ EXTRA_CLEANS =
|
||||
INCLUDE_DIRS += $(PX4_MODULE_SRC)drivers/boards/$(BOARD)
|
||||
|
||||
################################################################################
|
||||
# NuttX libraries and paths
|
||||
# OS specific libraries and paths
|
||||
################################################################################
|
||||
|
||||
include $(PX4_MK_DIR)/nuttx.mk
|
||||
include $(PX4_MK_DIR)/$(PX4_TARGET_OS).mk
|
||||
|
||||
################################################################################
|
||||
# Modules
|
||||
@@ -213,7 +213,7 @@ endef
|
||||
MODULE_MKFILES := $(foreach module,$(MODULES),$(call MODULE_SEARCH,$(module)))
|
||||
MISSING_MODULES := $(subst MISSING_,,$(filter MISSING_%,$(MODULE_MKFILES)))
|
||||
ifneq ($(MISSING_MODULES),)
|
||||
$(error Can't find module(s): $(MISSING_MODULES))
|
||||
$(error Cant find module(s): $(MISSING_MODULES))
|
||||
endif
|
||||
|
||||
# Make a list of the object files we expect to build from modules
|
||||
@@ -273,7 +273,7 @@ endef
|
||||
LIBRARY_MKFILES := $(foreach library,$(LIBRARIES),$(call LIBRARY_SEARCH,$(library)))
|
||||
MISSING_LIBRARIES := $(subst MISSING_,,$(filter MISSING_%,$(LIBRARY_MKFILES)))
|
||||
ifneq ($(MISSING_LIBRARIES),)
|
||||
$(error Can't find library(s): $(MISSING_LIBRARIES))
|
||||
$(error Cant find library(s): $(MISSING_LIBRARIES))
|
||||
endif
|
||||
|
||||
# Make a list of the archive files we expect to build from libraries
|
||||
@@ -311,6 +311,7 @@ $(LIBRARY_CLEANS):
|
||||
LIBRARY_MK=$(mkfile) \
|
||||
clean
|
||||
|
||||
ifeq ($(PX4_TARGET_OS),nuttx)
|
||||
################################################################################
|
||||
# ROMFS generation
|
||||
################################################################################
|
||||
@@ -434,6 +435,7 @@ SRCS += $(BUILTIN_CSRC)
|
||||
|
||||
EXTRA_CLEANS += $(BUILTIN_CSRC)
|
||||
|
||||
endif
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
@@ -456,6 +458,7 @@ endif
|
||||
# Build rules
|
||||
################################################################################
|
||||
|
||||
ifeq ($(PX4_TARGET_OS),nuttx)
|
||||
#
|
||||
# What we're going to build.
|
||||
#
|
||||
@@ -466,6 +469,7 @@ PRODUCT_PARAMXML = $(WORK_DIR)/parameters.xml
|
||||
|
||||
.PHONY: firmware
|
||||
firmware: $(PRODUCT_BUNDLE)
|
||||
endif
|
||||
|
||||
#
|
||||
# Object files we will generate from sources
|
||||
@@ -487,6 +491,7 @@ $(filter %.cpp.o,$(OBJS)): $(WORK_DIR)%.cpp.o: %.cpp $(GLOBAL_DEPS)
|
||||
$(filter %.S.o,$(OBJS)): $(WORK_DIR)%.S.o: %.S $(GLOBAL_DEPS)
|
||||
$(call ASSEMBLE,$<,$@)
|
||||
|
||||
ifeq ($(PX4_TARGET_OS),nuttx)
|
||||
#
|
||||
# Built product rules
|
||||
#
|
||||
@@ -530,7 +535,22 @@ clean: $(MODULE_CLEANS)
|
||||
$(Q) $(REMOVE) $(PRODUCT_BUNDLE) $(PRODUCT_BIN) $(PRODUCT_ELF)
|
||||
$(Q) $(REMOVE) $(OBJS) $(DEP_INCLUDES) $(EXTRA_CLEANS)
|
||||
$(Q) $(RMDIR) $(NUTTX_EXPORT_DIR)
|
||||
endif
|
||||
|
||||
# Include the OS specific build rules
|
||||
# The rules must define the "firmware" make target
|
||||
#
|
||||
|
||||
ifeq ($(PX4_TARGET_OS),nuttx)
|
||||
# TODO
|
||||
# Move above nuttx specific rules to $(MK_DIR)/nuttx_romfs.mk
|
||||
endif
|
||||
ifeq ($(PX4_TARGET_OS),posix)
|
||||
include $(MK_DIR)/posix_elf.mk
|
||||
endif
|
||||
ifeq ($(PX4_TARGET_OS),qurt)
|
||||
include $(MK_DIR)/qurt_elf.mk
|
||||
endif
|
||||
|
||||
#
|
||||
# DEP_INCLUDES is defined by the toolchain include in terms of $(OBJS)
|
||||
|
||||
@@ -0,0 +1,151 @@
|
||||
#
|
||||
# Copyright (c) 2012-2015 PX4 Development Team. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name PX4 nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
#
|
||||
# Built products
|
||||
#
|
||||
|
||||
DESIRED_FIRMWARES = $(foreach config,$(CONFIGS),$(IMAGE_DIR)$(config).px4)
|
||||
STAGED_FIRMWARES = $(foreach config,$(KNOWN_CONFIGS),$(IMAGE_DIR)$(config).px4)
|
||||
FIRMWARES = $(foreach config,$(KNOWN_CONFIGS),$(BUILD_DIR)$(config).build/firmware.px4)
|
||||
|
||||
all: $(DESIRED_FIRMWARES)
|
||||
|
||||
#
|
||||
# Copy FIRMWARES into the image directory.
|
||||
#
|
||||
# XXX copying the .bin files is a hack to work around the PX4IO uploader
|
||||
# not supporting .px4 files, and it should be deprecated onced that
|
||||
# is taken care of.
|
||||
#
|
||||
$(STAGED_FIRMWARES): $(IMAGE_DIR)%.px4: $(BUILD_DIR)%.build/firmware.px4
|
||||
@$(ECHO) %% Copying $@
|
||||
$(Q) $(COPY) $< $@
|
||||
$(Q) $(COPY) $(patsubst %.px4,%.bin,$<) $(patsubst %.px4,%.bin,$@)
|
||||
|
||||
#
|
||||
# Generate FIRMWARES.
|
||||
#
|
||||
.PHONY: $(FIRMWARES)
|
||||
$(BUILD_DIR)%.build/firmware.px4: config = $(patsubst $(BUILD_DIR)%.build/firmware.px4,%,$@)
|
||||
$(BUILD_DIR)%.build/firmware.px4: work_dir = $(BUILD_DIR)$(config).build/
|
||||
$(FIRMWARES): $(BUILD_DIR)%.build/firmware.px4: generateuorbtopicheaders checksubmodules
|
||||
@$(ECHO) %%%%
|
||||
@$(ECHO) %%%% Building $(config) in $(work_dir)
|
||||
@$(ECHO) %%%%
|
||||
$(Q) $(MKDIR) -p $(work_dir)
|
||||
$(Q) $(MAKE) -r -C $(work_dir) \
|
||||
-f $(PX4_MK_DIR)firmware.mk \
|
||||
CONFIG=$(config) \
|
||||
WORK_DIR=$(work_dir) \
|
||||
$(FIRMWARE_GOAL)
|
||||
|
||||
#
|
||||
# Make FMU firmwares depend on the corresponding IO firmware.
|
||||
#
|
||||
# This is a pretty vile hack, since it hard-codes knowledge of the FMU->IO dependency
|
||||
# and forces the _default config in all cases. There has to be a better way to do this...
|
||||
#
|
||||
FMU_VERSION = $(patsubst px4fmu-%,%,$(word 1, $(subst _, ,$(1))))
|
||||
define FMU_DEP
|
||||
$(BUILD_DIR)$(1).build/firmware.px4: $(IMAGE_DIR)px4io-$(call FMU_VERSION,$(1))_default.px4
|
||||
endef
|
||||
FMU_CONFIGS := $(filter px4fmu%,$(CONFIGS))
|
||||
$(foreach config,$(FMU_CONFIGS),$(eval $(call FMU_DEP,$(config))))
|
||||
|
||||
#
|
||||
# Build the NuttX export archives.
|
||||
#
|
||||
# Note that there are no explicit dependencies extended from these
|
||||
# archives. If NuttX is updated, the user is expected to rebuild the
|
||||
# archives/build area manually. Likewise, when the 'archives' target is
|
||||
# invoked, all archives are always rebuilt.
|
||||
#
|
||||
# XXX Should support fetching/unpacking from a separate directory to permit
|
||||
# downloads of the prebuilt archives as well...
|
||||
#
|
||||
NUTTX_ARCHIVES = $(foreach board,$(BOARDS),$(ARCHIVE_DIR)$(board).export)
|
||||
.PHONY: archives
|
||||
archives: checksubmodules $(NUTTX_ARCHIVES)
|
||||
|
||||
# We cannot build these parallel; note that we also force -j1 for the
|
||||
# sub-make invocations.
|
||||
ifneq ($(filter archives,$(MAKECMDGOALS)),)
|
||||
.NOTPARALLEL:
|
||||
endif
|
||||
|
||||
J?=1
|
||||
|
||||
$(ARCHIVE_DIR)%.export: board = $(notdir $(basename $@))
|
||||
$(ARCHIVE_DIR)%.export: configuration = nsh
|
||||
$(NUTTX_ARCHIVES): $(ARCHIVE_DIR)%.export: $(NUTTX_SRC)
|
||||
@$(ECHO) %% Configuring NuttX for $(board)
|
||||
$(Q) (cd $(NUTTX_SRC) && $(RMDIR) nuttx-export)
|
||||
$(Q) $(MAKE) -r -j$(J) -C $(NUTTX_SRC) -r $(MQUIET) distclean
|
||||
$(Q) (cd $(NUTTX_SRC)/configs && $(COPYDIR) $(PX4_BASE)nuttx-configs/$(board) .)
|
||||
$(Q) (cd $(NUTTX_SRC)tools && ./configure.sh $(board)/$(configuration))
|
||||
@$(ECHO) %% Exporting NuttX for $(board)
|
||||
$(Q) $(MAKE) -r -j$(J) -C $(NUTTX_SRC) -r $(MQUIET) CONFIG_ARCH_BOARD=$(board) export
|
||||
$(Q) $(MKDIR) -p $(dir $@)
|
||||
$(Q) $(COPY) $(NUTTX_SRC)nuttx-export.zip $@
|
||||
$(Q) (cd $(NUTTX_SRC)/configs && $(RMDIR) $(board))
|
||||
|
||||
#
|
||||
# The user can run the NuttX 'menuconfig' tool for a single board configuration with
|
||||
# make BOARDS=<boardname> menuconfig
|
||||
#
|
||||
ifeq ($(MAKECMDGOALS),menuconfig)
|
||||
ifneq ($(words $(BOARDS)),1)
|
||||
$(error BOARDS must specify exactly one board for the menuconfig goal)
|
||||
endif
|
||||
BOARD = $(BOARDS)
|
||||
menuconfig: $(NUTTX_SRC)
|
||||
@$(ECHO) %% Configuring NuttX for $(BOARD)
|
||||
$(Q) (cd $(NUTTX_SRC) && $(RMDIR) nuttx-export)
|
||||
$(Q) $(MAKE) -r -j$(J) -C $(NUTTX_SRC) -r $(MQUIET) distclean
|
||||
$(Q) (cd $(NUTTX_SRC)/configs && $(COPYDIR) $(PX4_BASE)nuttx-configs/$(BOARD) .)
|
||||
$(Q) (cd $(NUTTX_SRC)tools && ./configure.sh $(BOARD)/nsh)
|
||||
@$(ECHO) %% Running menuconfig for $(BOARD)
|
||||
$(Q) $(MAKE) -r -j$(J) -C $(NUTTX_SRC) -r $(MQUIET) menuconfig
|
||||
@$(ECHO) %% Saving configuration file
|
||||
$(Q)$(COPY) $(NUTTX_SRC).config $(PX4_BASE)nuttx-configs/$(BOARD)/nsh/defconfig
|
||||
else
|
||||
menuconfig:
|
||||
@$(ECHO) ""
|
||||
@$(ECHO) "The menuconfig goal must be invoked without any other goal being specified"
|
||||
@$(ECHO) ""
|
||||
endif
|
||||
|
||||
$(NUTTX_SRC): checksubmodules
|
||||
|
||||
$(UAVCAN_DIR):
|
||||
$(Q) (./Tools/check_submodules.sh)
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
#
|
||||
# Copyright (c) 2012-2015 PX4 Development Team. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name PX4 nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
#
|
||||
# Built products
|
||||
#
|
||||
FIRMWARES = $(foreach config,$(KNOWN_CONFIGS),$(BUILD_DIR)$(config).build/firmware.a)
|
||||
|
||||
all: $(FIRMWARES)
|
||||
|
||||
#
|
||||
# Generate FIRMWARES.
|
||||
#
|
||||
.PHONY: $(FIRMWARES)
|
||||
$(BUILD_DIR)%.build/firmware.a: config = $(patsubst $(BUILD_DIR)%.build/firmware.a,%,$@)
|
||||
$(BUILD_DIR)%.build/firmware.a: work_dir = $(BUILD_DIR)$(config).build/
|
||||
$(FIRMWARES): $(BUILD_DIR)%.build/firmware.a: generateuorbtopicheaders
|
||||
@$(ECHO) %%%%
|
||||
@$(ECHO) %%%% Building $(config) in $(work_dir)
|
||||
@$(ECHO) %%%%
|
||||
$(Q) $(MKDIR) -p $(work_dir)
|
||||
$(Q) $(MAKE) -r -C $(work_dir) \
|
||||
-f $(PX4_MK_DIR)firmware.mk \
|
||||
CONFIG=$(config) \
|
||||
WORK_DIR=$(work_dir) \
|
||||
$(FIRMWARE_GOAL)
|
||||
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
#
|
||||
# Copyright (c) 2012-2015 PX4 Development Team. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name PX4 nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
#
|
||||
# Built products
|
||||
#
|
||||
FIRMWARES = $(foreach config,$(KNOWN_CONFIGS),$(BUILD_DIR)$(config).build/firmware.a)
|
||||
|
||||
all: $(FIRMWARES)
|
||||
|
||||
#
|
||||
# Generate FIRMWARES.
|
||||
#
|
||||
.PHONY: $(FIRMWARES)
|
||||
$(BUILD_DIR)%.build/firmware.a: config = $(patsubst $(BUILD_DIR)%.build/firmware.a,%,$@)
|
||||
$(BUILD_DIR)%.build/firmware.a: work_dir = $(BUILD_DIR)$(config).build/
|
||||
$(FIRMWARES): $(BUILD_DIR)%.build/firmware.a: generateuorbtopicheaders
|
||||
@$(ECHO) %%%%
|
||||
@$(ECHO) %%%% Building $(config) in $(work_dir)
|
||||
@$(ECHO) %%%%
|
||||
$(Q) $(MKDIR) -p $(work_dir)
|
||||
$(Q) $(MAKE) -r -C $(work_dir) \
|
||||
-f $(PX4_MK_DIR)firmware.mk \
|
||||
CONFIG=$(config) \
|
||||
WORK_DIR=$(work_dir) \
|
||||
$(FIRMWARE_GOAL)
|
||||
|
||||
HEXAGON_TOOLS_ROOT = /opt/6.4.05
|
||||
#V_ARCH = v4
|
||||
V_ARCH = v5
|
||||
HEXAGON_CLANG_BIN = $(addsuffix /qc/bin,$(HEXAGON_TOOLS_ROOT))
|
||||
SIM = $(HEXAGON_CLANG_BIN)/hexagon-sim
|
||||
SIMFLAGS+= -m$(V_ARCH)
|
||||
sim:
|
||||
$(SIM) $(SIMFLAGS) Build/qurt_default.build/mainapp
|
||||
@@ -93,7 +93,7 @@ $(info %% LIBRARY_MK = $(LIBRARY_MK))
|
||||
#
|
||||
# Get the board/toolchain config
|
||||
#
|
||||
include $(PX4_MK_DIR)/board_$(BOARD).mk
|
||||
include $(PX4_MK_DIR)/$(PX4_TARGET_OS)/board_$(BOARD).mk
|
||||
|
||||
#
|
||||
# Get the library's config
|
||||
|
||||
@@ -144,6 +144,7 @@ MODULE_ENTRYPOINT ?= $(MODULE_COMMAND)_main
|
||||
MODULE_STACKSIZE ?= CONFIG_PTHREAD_STACK_DEFAULT
|
||||
MODULE_PRIORITY ?= SCHED_PRIORITY_DEFAULT
|
||||
MODULE_COMMANDS += $(MODULE_COMMAND).$(MODULE_PRIORITY).$(MODULE_STACKSIZE).$(MODULE_ENTRYPOINT)
|
||||
CXXFLAGS += -DPX4_MAIN=$(MODULE_COMMAND)_app_main
|
||||
endif
|
||||
|
||||
ifneq ($(MODULE_COMMANDS),)
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
# building firmware.
|
||||
#
|
||||
|
||||
MODULES += platforms/nuttx/px4_layer platforms/common
|
||||
|
||||
#
|
||||
# Check that the NuttX archive for the selected board is available.
|
||||
#
|
||||
|
||||
@@ -0,0 +1,219 @@
|
||||
#
|
||||
# Copyright (C) 2012 PX4 Development Team. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name PX4 nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
#
|
||||
# Makefile for PX4 Nuttx based firmware images.
|
||||
#
|
||||
|
||||
################################################################################
|
||||
# ROMFS generation
|
||||
################################################################################
|
||||
|
||||
ifneq ($(ROMFS_ROOT),)
|
||||
ifeq ($(wildcard $(ROMFS_ROOT)),)
|
||||
$(error ROMFS_ROOT specifies a directory that does not exist)
|
||||
endif
|
||||
|
||||
#
|
||||
# Note that there is no support for more than one root directory or constructing
|
||||
# a root from several templates. That would be a nice feature.
|
||||
#
|
||||
|
||||
# Add dependencies on anything in the ROMFS root directory
|
||||
ROMFS_FILES += $(wildcard \
|
||||
$(ROMFS_ROOT)/* \
|
||||
$(ROMFS_ROOT)/*/* \
|
||||
$(ROMFS_ROOT)/*/*/* \
|
||||
$(ROMFS_ROOT)/*/*/*/* \
|
||||
$(ROMFS_ROOT)/*/*/*/*/* \
|
||||
$(ROMFS_ROOT)/*/*/*/*/*/*)
|
||||
ifeq ($(ROMFS_FILES),)
|
||||
$(error ROMFS_ROOT $(ROMFS_ROOT) specifies a directory containing no files)
|
||||
endif
|
||||
ROMFS_DEPS += $(ROMFS_FILES)
|
||||
|
||||
# Extra files that may be copied into the ROMFS /extras directory
|
||||
# ROMFS_EXTRA_FILES are required, ROMFS_OPTIONAL_FILES are optional
|
||||
ROMFS_EXTRA_FILES += $(wildcard $(ROMFS_OPTIONAL_FILES))
|
||||
ROMFS_DEPS += $(ROMFS_EXTRA_FILES)
|
||||
|
||||
ROMFS_IMG = romfs.img
|
||||
ROMFS_SCRATCH = romfs_scratch
|
||||
ROMFS_CSRC = $(ROMFS_IMG:.img=.c)
|
||||
ROMFS_OBJ = $(ROMFS_CSRC:.c=.o)
|
||||
LIBS += $(ROMFS_OBJ)
|
||||
LINK_DEPS += $(ROMFS_OBJ)
|
||||
|
||||
# Remove all comments from startup and mixer files
|
||||
ROMFS_PRUNER = $(PX4_BASE)/Tools/px_romfs_pruner.py
|
||||
|
||||
# Turn the ROMFS image into an object file
|
||||
$(ROMFS_OBJ): $(ROMFS_IMG) $(GLOBAL_DEPS)
|
||||
$(call BIN_TO_OBJ,$<,$@,romfs_img)
|
||||
|
||||
# Generate the ROMFS image from the root
|
||||
$(ROMFS_IMG): $(ROMFS_SCRATCH) $(ROMFS_DEPS) $(GLOBAL_DEPS)
|
||||
@$(ECHO) "ROMFS: $@"
|
||||
$(Q) $(GENROMFS) -f $@ -d $(ROMFS_SCRATCH) -V "NSHInitVol"
|
||||
|
||||
# Construct the ROMFS scratch root from the canonical root
|
||||
$(ROMFS_SCRATCH): $(ROMFS_DEPS) $(GLOBAL_DEPS)
|
||||
$(Q) $(MKDIR) -p $(ROMFS_SCRATCH)
|
||||
$(Q) $(COPYDIR) $(ROMFS_ROOT)/* $(ROMFS_SCRATCH)
|
||||
# delete all files in ROMFS_SCRATCH which start with a . or end with a ~
|
||||
$(Q) $(RM) $(ROMFS_SCRATCH)/*/.[!.]* $(ROMFS_SCRATCH)/*/*~
|
||||
ifneq ($(ROMFS_EXTRA_FILES),)
|
||||
$(Q) $(MKDIR) -p $(ROMFS_SCRATCH)/extras
|
||||
$(Q) $(COPY) $(ROMFS_EXTRA_FILES) $(ROMFS_SCRATCH)/extras
|
||||
endif
|
||||
$(Q) $(PYTHON) -u $(ROMFS_PRUNER) --folder $(ROMFS_SCRATCH)
|
||||
|
||||
EXTRA_CLEANS += $(ROMGS_OBJ) $(ROMFS_IMG)
|
||||
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
# Builtin command list generation
|
||||
################################################################################
|
||||
|
||||
#
|
||||
# Builtin commands can be generated by the configuration, in which case they
|
||||
# must refer to commands that already exist, or indirectly generated by modules
|
||||
# when they are built.
|
||||
#
|
||||
# The configuration supplies builtin command information in the BUILTIN_COMMANDS
|
||||
# variable. Applications make empty files in $(WORK_DIR)/builtin_commands whose
|
||||
# filename contains the same information.
|
||||
#
|
||||
# In each case, the command information consists of four fields separated with a
|
||||
# period. These fields are the command's name, its thread priority, its stack size
|
||||
# and the name of the function to call when starting the thread.
|
||||
#
|
||||
BUILTIN_CSRC = $(WORK_DIR)builtin_commands.c
|
||||
|
||||
# command definitions from modules (may be empty at Makefile parsing time...)
|
||||
MODULE_COMMANDS = $(subst COMMAND.,,$(notdir $(wildcard $(WORK_DIR)builtin_commands/COMMAND.*)))
|
||||
|
||||
# We must have at least one pre-defined builtin command in order to generate
|
||||
# any of this.
|
||||
#
|
||||
ifneq ($(BUILTIN_COMMANDS),)
|
||||
|
||||
# (BUILTIN_PROTO,<cmdspec>,<outputfile>)
|
||||
define BUILTIN_PROTO
|
||||
$(ECHO) 'extern int $(word 4,$1)(int argc, char *argv[]);' >> $2;
|
||||
endef
|
||||
|
||||
# (BUILTIN_DEF,<cmdspec>,<outputfile>)
|
||||
define BUILTIN_DEF
|
||||
$(ECHO) ' {"$(word 1,$1)", $(word 2,$1), $(word 3,$1), $(word 4,$1)},' >> $2;
|
||||
endef
|
||||
|
||||
# Don't generate until modules have updated their command files
|
||||
$(BUILTIN_CSRC): $(GLOBAL_DEPS) $(MODULE_OBJS) $(MODULE_MKFILES) $(BUILTIN_COMMAND_FILES)
|
||||
@$(ECHO) "CMDS: $@"
|
||||
$(Q) $(ECHO) '/* builtin command list - automatically generated, do not edit */' > $@
|
||||
$(Q) $(ECHO) '#include <nuttx/config.h>' >> $@
|
||||
$(Q) $(ECHO) '#include <nuttx/binfmt/builtin.h>' >> $@
|
||||
$(Q) $(foreach spec,$(BUILTIN_COMMANDS),$(call BUILTIN_PROTO,$(subst ., ,$(spec)),$@))
|
||||
$(Q) $(foreach spec,$(MODULE_COMMANDS),$(call BUILTIN_PROTO,$(subst ., ,$(spec)),$@))
|
||||
$(Q) $(ECHO) 'const struct builtin_s g_builtins[] = {' >> $@
|
||||
$(Q) $(foreach spec,$(BUILTIN_COMMANDS),$(call BUILTIN_DEF,$(subst ., ,$(spec)),$@))
|
||||
$(Q) $(foreach spec,$(MODULE_COMMANDS),$(call BUILTIN_DEF,$(subst ., ,$(spec)),$@))
|
||||
$(Q) $(ECHO) ' {NULL, 0, 0, NULL}' >> $@
|
||||
$(Q) $(ECHO) '};' >> $@
|
||||
$(Q) $(ECHO) 'const int g_builtin_count = $(words $(BUILTIN_COMMANDS) $(MODULE_COMMANDS));' >> $@
|
||||
|
||||
SRCS += $(BUILTIN_CSRC)
|
||||
|
||||
EXTRA_CLEANS += $(BUILTIN_CSRC)
|
||||
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
# Build rules
|
||||
################################################################################
|
||||
|
||||
#
|
||||
# What we're going to build.
|
||||
#
|
||||
PRODUCT_BUNDLE = $(WORK_DIR)firmware.px4
|
||||
PRODUCT_BIN = $(WORK_DIR)firmware.bin
|
||||
PRODUCT_ELF = $(WORK_DIR)firmware.elf
|
||||
PRODUCT_PARAMXML = $(WORK_DIR)/parameters.xml
|
||||
|
||||
.PHONY: firmware
|
||||
firmware: $(PRODUCT_BUNDLE)
|
||||
|
||||
#
|
||||
# Built product rules
|
||||
#
|
||||
|
||||
$(PRODUCT_BUNDLE): $(PRODUCT_BIN)
|
||||
@$(ECHO) %% Generating $@
|
||||
ifdef GEN_PARAM_XML
|
||||
python $(PX4_BASE)/Tools/px_process_params.py --src-path $(PX4_BASE)/src --board CONFIG_ARCH_BOARD_$(CONFIG_BOARD) --xml
|
||||
$(Q) $(MKFW) --prototype $(IMAGE_DIR)/$(BOARD).prototype \
|
||||
--git_identity $(PX4_BASE) \
|
||||
--parameter_xml $(PRODUCT_PARAMXML) \
|
||||
--image $< > $@
|
||||
else
|
||||
$(Q) $(MKFW) --prototype $(IMAGE_DIR)/$(BOARD).prototype \
|
||||
--git_identity $(PX4_BASE) \
|
||||
--image $< > $@
|
||||
endif
|
||||
|
||||
$(PRODUCT_BIN): $(PRODUCT_ELF)
|
||||
$(call SYM_TO_BIN,$<,$@)
|
||||
|
||||
$(PRODUCT_ELF): $(OBJS) $(MODULE_OBJS) $(LIBRARY_LIBS) $(GLOBAL_DEPS) $(LINK_DEPS) $(MODULE_MKFILES)
|
||||
$(call LINK,$@,$(OBJS) $(MODULE_OBJS) $(LIBRARY_LIBS))
|
||||
|
||||
#
|
||||
# Utility rules
|
||||
#
|
||||
|
||||
.PHONY: upload
|
||||
upload: $(PRODUCT_BUNDLE) $(PRODUCT_BIN)
|
||||
$(Q) $(MAKE) -f $(PX4_MK_DIR)/upload.mk \
|
||||
METHOD=serial \
|
||||
CONFIG=$(CONFIG) \
|
||||
BOARD=$(BOARD) \
|
||||
BUNDLE=$(PRODUCT_BUNDLE) \
|
||||
BIN=$(PRODUCT_BIN)
|
||||
|
||||
.PHONY: clean
|
||||
clean: $(MODULE_CLEANS)
|
||||
@$(ECHO) %% cleaning
|
||||
$(Q) $(REMOVE) $(PRODUCT_BUNDLE) $(PRODUCT_BIN) $(PRODUCT_ELF)
|
||||
$(Q) $(REMOVE) $(OBJS) $(DEP_INCLUDES) $(EXTRA_CLEANS)
|
||||
$(Q) $(RMDIR) $(NUTTX_EXPORT_DIR)
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
#
|
||||
# Copyright (C) 2012 PX4 Development Team. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name PX4 nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
#
|
||||
# Rules and definitions related to handling the Linux specific impl when
|
||||
# building firmware.
|
||||
#
|
||||
|
||||
MODULES += \
|
||||
platforms/common \
|
||||
platforms/posix/px4_layer
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
#
|
||||
# Board-specific definitions for the POSIX port of PX4
|
||||
#
|
||||
|
||||
#
|
||||
# Configure the toolchain
|
||||
#
|
||||
CONFIG_ARCH = NATIVE
|
||||
CONFIG_BOARD = POSIXTEST
|
||||
|
||||
include $(PX4_MK_DIR)/toolchain_native.mk
|
||||
@@ -0,0 +1,78 @@
|
||||
#
|
||||
# Makefile for the POSIXTEST *default* configuration
|
||||
#
|
||||
|
||||
#
|
||||
# Board support modules
|
||||
#
|
||||
MODULES += drivers/device
|
||||
MODULES += drivers/blinkm
|
||||
MODULES += drivers/hil
|
||||
MODULES += drivers/rgbled
|
||||
MODULES += drivers/led
|
||||
MODULES += modules/sensors
|
||||
#MODULES += drivers/ms5611
|
||||
|
||||
#
|
||||
# System commands
|
||||
#
|
||||
MODULES += systemcmds/param
|
||||
MODULES += systemcmds/mixer
|
||||
MODULES += systemcmds/topic_listener
|
||||
|
||||
#
|
||||
# General system control
|
||||
#
|
||||
MODULES += modules/mavlink
|
||||
|
||||
#
|
||||
# Estimation modules (EKF/ SO3 / other filters)
|
||||
#
|
||||
MODULES += modules/attitude_estimator_ekf
|
||||
MODULES += modules/ekf_att_pos_estimator
|
||||
|
||||
#
|
||||
# Vehicle Control
|
||||
#
|
||||
MODULES += modules/mc_pos_control
|
||||
MODULES += modules/mc_att_control
|
||||
|
||||
#
|
||||
# Library modules
|
||||
#
|
||||
MODULES += modules/systemlib
|
||||
MODULES += modules/systemlib/mixer
|
||||
MODULES += modules/uORB
|
||||
MODULES += modules/dataman
|
||||
MODULES += modules/sdlog2
|
||||
MODULES += modules/simulator
|
||||
MODULES += modules/commander
|
||||
|
||||
#
|
||||
# Libraries
|
||||
#
|
||||
MODULES += lib/mathlib
|
||||
MODULES += lib/mathlib/math/filter
|
||||
MODULES += lib/geo
|
||||
MODULES += lib/geo_lookup
|
||||
MODULES += lib/conversion
|
||||
|
||||
#
|
||||
# Linux port
|
||||
#
|
||||
MODULES += platforms/posix/px4_layer
|
||||
MODULES += platforms/posix/drivers/accelsim
|
||||
MODULES += platforms/posix/drivers/gyrosim
|
||||
MODULES += platforms/posix/drivers/adcsim
|
||||
MODULES += platforms/posix/drivers/barosim
|
||||
MODULES += platforms/posix/drivers/tonealrmsim
|
||||
MODULES += platforms/posix/drivers/airspeedsim
|
||||
|
||||
#
|
||||
# Unit tests
|
||||
#
|
||||
#MODULES += platforms/posix/tests/hello
|
||||
#MODULES += platforms/posix/tests/vcdev_test
|
||||
#MODULES += platforms/posix/tests/hrt_test
|
||||
#MODULES += platforms/posix/tests/wqueue
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
#
|
||||
# Copyright (C) 2012 PX4 Development Team. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name PX4 nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
#
|
||||
# Makefile for PX4 POSIX based firmware images.
|
||||
#
|
||||
|
||||
################################################################################
|
||||
# Build rules
|
||||
################################################################################
|
||||
|
||||
#
|
||||
# What we're going to build.
|
||||
#
|
||||
PRODUCT_SHARED_LIB = $(WORK_DIR)firmware.a
|
||||
PRODUCT_SHARED_PRELINK = $(WORK_DIR)firmware.o
|
||||
|
||||
.PHONY: firmware
|
||||
firmware: $(PRODUCT_SHARED_LIB) $(WORK_DIR)mainapp
|
||||
|
||||
#
|
||||
# Built product rules
|
||||
#
|
||||
|
||||
$(PRODUCT_SHARED_PRELINK): $(OBJS) $(MODULE_OBJS) $(LIBRARY_LIBS) $(GLOBAL_DEPS) $(LINK_DEPS) $(MODULE_MKFILES)
|
||||
$(call PRELINKF,$@,$(OBJS) $(MODULE_OBJS) $(LIBRARY_LIBS))
|
||||
|
||||
$(PRODUCT_SHARED_LIB): $(PRODUCT_SHARED_PRELINK)
|
||||
$(call LINK_A,$@,$(PRODUCT_SHARED_PRELINK))
|
||||
|
||||
MAIN = $(PX4_BASE)/src/platforms/posix/main.cpp
|
||||
$(WORK_DIR)mainapp: $(PRODUCT_SHARED_LIB)
|
||||
$(PX4_BASE)/Tools/posix_apps.py > apps.h
|
||||
$(call LINK,$@, -I. $(MAIN) $(PRODUCT_SHARED_LIB))
|
||||
|
||||
#
|
||||
# Utility rules
|
||||
#
|
||||
|
||||
.PHONY: clean
|
||||
clean: $(MODULE_CLEANS)
|
||||
@$(ECHO) %% cleaning
|
||||
$(Q) $(REMOVE) $(PRODUCT_ELF)
|
||||
$(Q) $(REMOVE) $(OBJS) $(DEP_INCLUDES) $(EXTRA_CLEANS)
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
#
|
||||
# Copyright (C) 2015 Mark Charlebois. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name PX4 nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
#
|
||||
# Rules and definitions related to handling the Linux specific impl when
|
||||
# building firmware.
|
||||
#
|
||||
|
||||
MODULES += \
|
||||
platforms/common
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
#
|
||||
# Board-specific definitions for the Linux port of PX4
|
||||
#
|
||||
|
||||
#
|
||||
# Configure the toolchain
|
||||
#
|
||||
CONFIG_ARCH = HEXAGON
|
||||
CONFIG_BOARD = QURTTEST
|
||||
|
||||
include $(PX4_MK_DIR)/toolchain_hexagon.mk
|
||||
@@ -0,0 +1,78 @@
|
||||
#
|
||||
# Makefile for the Foo *default* configuration
|
||||
#
|
||||
|
||||
#
|
||||
# Use the configuration's ROMFS.
|
||||
#
|
||||
#ROMFS_ROOT = $(PX4_BASE)/ROMFS/px4fmu_common
|
||||
|
||||
#
|
||||
# Board support modules
|
||||
#
|
||||
MODULES += drivers/device
|
||||
MODULES += drivers/blinkm
|
||||
MODULES += drivers/hil
|
||||
MODULES += drivers/led
|
||||
MODULES += drivers/rgbled
|
||||
#MODULES += modules/sensors
|
||||
#MODULES += drivers/ms5611
|
||||
|
||||
#
|
||||
# System commands
|
||||
#
|
||||
MODULES += systemcmds/param
|
||||
|
||||
#
|
||||
# General system control
|
||||
#
|
||||
#MODULES += modules/mavlink
|
||||
|
||||
#
|
||||
# Estimation modules (EKF/ SO3 / other filters)
|
||||
#
|
||||
#MODULES += modules/attitude_estimator_ekf
|
||||
#MODULES += modules/ekf_att_pos_estimator
|
||||
|
||||
#
|
||||
# Vehicle Control
|
||||
#
|
||||
#MODULES += modules/mc_att_control
|
||||
|
||||
#
|
||||
# Library modules
|
||||
#
|
||||
MODULES += modules/systemlib
|
||||
MODULES += modules/systemlib/mixer
|
||||
MODULES += modules/uORB
|
||||
#MODULES += modules/dataman
|
||||
#MODULES += modules/sdlog2
|
||||
MODULES += modules/simulator
|
||||
#MODULES += modules/commander
|
||||
|
||||
#
|
||||
# Libraries
|
||||
#
|
||||
MODULES += lib/mathlib
|
||||
MODULES += lib/mathlib/math/filter
|
||||
#MODULES += lib/geo
|
||||
#MODULES += lib/geo_lookup
|
||||
MODULES += lib/conversion
|
||||
|
||||
#
|
||||
# QuRT port
|
||||
#
|
||||
MODULES += platforms/qurt/px4_layer
|
||||
MODULES += platforms/posix/drivers/accelsim
|
||||
MODULES += platforms/posix/drivers/gyrosim
|
||||
MODULES += platforms/posix/drivers/adcsim
|
||||
MODULES += platforms/posix/drivers/barosim
|
||||
|
||||
#
|
||||
# Unit tests
|
||||
#
|
||||
MODULES += platforms/qurt/tests/hello
|
||||
MODULES += platforms/posix/tests/vcdev_test
|
||||
MODULES += platforms/posix/tests/hrt_test
|
||||
MODULES += platforms/posix/tests/wqueue
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
This patch is required for QuRT. complex.h defines "I" and it replaces "I" in the
|
||||
enum definition without this patch creating an error.
|
||||
|
||||
diff --git a/Eigen/src/Core/SolveTriangular.h b/Eigen/src/Core/SolveTriangular.h
|
||||
index ef17f28..1116270 100644
|
||||
--- a/Eigen/src/Core/SolveTriangular.h
|
||||
+++ b/Eigen/src/Core/SolveTriangular.h
|
||||
@@ -112,6 +112,9 @@ template<typename Lhs, typename Rhs, int Mode, int Index, int Size,
|
||||
bool Stop = Index==Size>
|
||||
struct triangular_solver_unroller;
|
||||
|
||||
+#ifdef __PX4_QURT
|
||||
+#undef I
|
||||
+#endif
|
||||
template<typename Lhs, typename Rhs, int Mode, int Index, int Size>
|
||||
struct triangular_solver_unroller<Lhs,Rhs,Mode,Index,Size,false> {
|
||||
enum {
|
||||
@@ -0,0 +1,77 @@
|
||||
#
|
||||
# Copyright (C) 2012 PX4 Development Team. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name PX4 nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
#
|
||||
# Makefile for PX4 Linux based firmware images.
|
||||
#
|
||||
|
||||
################################################################################
|
||||
# Build rules
|
||||
################################################################################
|
||||
|
||||
#
|
||||
# What we're going to build.
|
||||
#
|
||||
PRODUCT_SHARED_LIB = $(WORK_DIR)firmware.a
|
||||
PRODUCT_SHARED_PRELINK = $(WORK_DIR)firmware.o
|
||||
|
||||
.PHONY: firmware
|
||||
firmware: $(PRODUCT_SHARED_LIB) $(WORK_DIR)mainapp
|
||||
|
||||
#
|
||||
# Built product rules
|
||||
#
|
||||
|
||||
$(PRODUCT_SHARED_PRELINK): $(OBJS) $(MODULE_OBJS) $(LIBRARY_LIBS) $(GLOBAL_DEPS) $(LINK_DEPS) $(MODULE_MKFILES)
|
||||
$(call PRELINKF,$@,$(OBJS) $(MODULE_OBJS) $(LIBRARY_LIBS))
|
||||
|
||||
$(PRODUCT_SHARED_LIB): $(PRODUCT_SHARED_PRELINK)
|
||||
$(call LINK_A,$@,$(PRODUCT_SHARED_PRELINK))
|
||||
|
||||
$(WORK_DIR)apps.cpp: $(PX4_BASE)/Tools/qurt_apps.py
|
||||
$(PX4_BASE)/Tools/qurt_apps.py > $@
|
||||
|
||||
$(WORK_DIR)apps.o: $(WORK_DIR)apps.cpp
|
||||
$(call COMPILEXX,$<, $@)
|
||||
mv $(WORK_DIR)apps.cpp $(WORK_DIR)apps.cpp_sav
|
||||
|
||||
$(WORK_DIR)mainapp: $(WORK_DIR)apps.o $(PRODUCT_SHARED_LIB)
|
||||
$(call LINK,$@, $^)
|
||||
|
||||
#
|
||||
# Utility rules
|
||||
#
|
||||
|
||||
.PHONY: clean
|
||||
clean: $(MODULE_CLEANS)
|
||||
@$(ECHO) %% cleaning
|
||||
$(Q) $(REMOVE) $(PRODUCT_ELF)
|
||||
$(Q) $(REMOVE) $(OBJS) $(DEP_INCLUDES) $(EXTRA_CLEANS)
|
||||
+8
-1
@@ -33,6 +33,13 @@
|
||||
# Path and tool setup
|
||||
#
|
||||
|
||||
export PX4_TARGET_OS ?= nuttx
|
||||
|
||||
# PX4_TARGET_OS can be nuttx, posix, or qurt
|
||||
ifeq ($(PX4_TARGET_OS),)
|
||||
$(error Use: make PX4_TARGET_OS=<target> where <target> is nuttx, posix, or qurt)
|
||||
endif
|
||||
|
||||
#
|
||||
# Some useful paths.
|
||||
#
|
||||
@@ -47,8 +54,8 @@ export PX4_LIB_DIR = $(abspath $(PX4_BASE)/src/lib)/
|
||||
export PX4_PLATFORMS_DIR = $(abspath $(PX4_BASE)/src/platforms)/
|
||||
export PX4_MK_DIR = $(abspath $(PX4_BASE)/makefiles)/
|
||||
export NUTTX_SRC = $(abspath $(PX4_BASE)/NuttX/nuttx)/
|
||||
export MAVLINK_SRC = $(abspath $(PX4_BASE)/mavlink/include/mavlink/v1.0)/
|
||||
export NUTTX_APP_SRC = $(abspath $(PX4_BASE)/NuttX/apps)/
|
||||
#export MAVLINK_SRC = $(abspath $(PX4_BASE)/mavlink/include/mavlink/v1.0)/
|
||||
export MAVLINK_SRC = $(abspath $(PX4_BASE)/mavlink)/
|
||||
export UAVCAN_DIR = $(abspath $(PX4_BASE)/uavcan)/
|
||||
export ROMFS_SRC = $(abspath $(PX4_BASE)/ROMFS)/
|
||||
|
||||
@@ -107,7 +107,7 @@ endif
|
||||
ifeq ($(CONFIG_BOARD),)
|
||||
$(error Board config does not define CONFIG_BOARD)
|
||||
endif
|
||||
ARCHDEFINES += -DCONFIG_ARCH_BOARD_$(CONFIG_BOARD)
|
||||
ARCHDEFINES += -DCONFIG_ARCH_BOARD_$(CONFIG_BOARD) -D__PX4_NUTTX
|
||||
|
||||
# optimisation flags
|
||||
#
|
||||
@@ -138,7 +138,6 @@ ARCHWARNINGS = -Wall \
|
||||
-Wdouble-promotion \
|
||||
-Wshadow \
|
||||
-Wfloat-equal \
|
||||
-Wframe-larger-than=1024 \
|
||||
-Wpointer-arith \
|
||||
-Wlogical-op \
|
||||
-Wmissing-declarations \
|
||||
|
||||
@@ -0,0 +1,314 @@
|
||||
#
|
||||
# Copyright (C) 2015 Mark Charlebois. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name PX4 nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
#
|
||||
# Definitions for a generic GNU ARM-EABI toolchain
|
||||
#
|
||||
|
||||
#$(info TOOLCHAIN gnu-arm-eabi)
|
||||
|
||||
# Toolchain commands. Normally only used inside this file.
|
||||
#
|
||||
HEXAGON_TOOLS_ROOT = /opt/6.4.05
|
||||
HEXAGON_SDK_ROOT = /opt/Hexagon_SDK/2.0
|
||||
#V_ARCH = v4
|
||||
V_ARCH = v5
|
||||
CROSSDEV = hexagon-
|
||||
HEXAGON_BIN = $(addsuffix /gnu/bin,$(HEXAGON_TOOLS_ROOT))
|
||||
HEXAGON_CLANG_BIN = $(addsuffix /qc/bin,$(HEXAGON_TOOLS_ROOT))
|
||||
HEXAGON_LIB_DIR = $(HEXAGON_TOOLS_ROOT)/gnu/hexagon/lib
|
||||
HEXAGON_ISS_DIR = $(HEXAGON_TOOLS_ROOT)/qc/lib/iss
|
||||
TOOLSLIB = $(HEXAGON_TOOLS_ROOT)/dinkumware/lib/$(V_ARCH)/G0
|
||||
QCTOOLSLIB = $(HEXAGON_TOOLS_ROOT)/qc/lib/$(V_ARCH)/G0
|
||||
QURTLIB = $(HEXAGON_SDK_ROOT)/lib/common/qurt/ADSP$(V_ARCH)MP/lib
|
||||
#DSPAL = $(PX4_BASE)/../dspal_libs/libdspal.a
|
||||
|
||||
|
||||
CC = $(HEXAGON_CLANG_BIN)/$(CROSSDEV)clang
|
||||
CXX = $(HEXAGON_CLANG_BIN)/$(CROSSDEV)clang++
|
||||
CPP = $(HEXAGON_CLANG_BIN)/$(CROSSDEV)clang -E
|
||||
LD = $(HEXAGON_BIN)/$(CROSSDEV)ld
|
||||
AR = $(HEXAGON_BIN)/$(CROSSDEV)ar rcs
|
||||
NM = $(HEXAGON_BIN)/$(CROSSDEV)nm
|
||||
OBJCOPY = $(HEXAGON_BIN)/$(CROSSDEV)objcopy
|
||||
OBJDUMP = $(HEXAGON_BIN)/$(CROSSDEV)objdump
|
||||
|
||||
QURTLIBS = \
|
||||
$(TOOLSLIB)/init.o \
|
||||
$(TOOLSLIB)/libc.a \
|
||||
$(TOOLSLIB)/libqcc.a \
|
||||
$(TOOLSLIB)/libstdc++.a \
|
||||
$(QURTLIB)/crt0.o \
|
||||
$(QURTLIB)/libqurt.a \
|
||||
$(QURTLIB)/libqurtkernel.a \
|
||||
$(QURTLIB)/libqurtcfs.a \
|
||||
$(QURTLIB)/libqube_compat.a \
|
||||
$(QURTLIB)/libtimer.a \
|
||||
$(QURTLIB)/libposix.a \
|
||||
$(QURTLIB)/../examples/cust_config.o \
|
||||
$(QCTOOLSLIB)/libhexagon.a \
|
||||
$(TOOLSLIB)/fini.o
|
||||
|
||||
|
||||
|
||||
|
||||
# Check if the right version of the toolchain is available
|
||||
#
|
||||
CROSSDEV_VER_SUPPORTED = 6.4.05
|
||||
CROSSDEV_VER_FOUND = $(shell $(CC) --version | sed -n 's/^.*version \([\. 0-9]*\),.*$$/\1/p')
|
||||
|
||||
ifeq (,$(findstring $(CROSSDEV_VER_FOUND), $(CROSSDEV_VER_SUPPORTED)))
|
||||
$(error Unsupported version of $(CC), found: $(CROSSDEV_VER_FOUND) instead of one in: $(CROSSDEV_VER_SUPPORTED))
|
||||
endif
|
||||
|
||||
|
||||
# XXX this is pulled pretty directly from the fmu Make.defs - needs cleanup
|
||||
|
||||
MAXOPTIMIZATION ?= -O0
|
||||
|
||||
# Base CPU flags for each of the supported architectures.
|
||||
#
|
||||
ARCHCPUFLAGS = -m$(V_ARCH)
|
||||
|
||||
|
||||
# Set the board flags
|
||||
#
|
||||
ifeq ($(CONFIG_BOARD),)
|
||||
$(error Board config does not define CONFIG_BOARD)
|
||||
endif
|
||||
ARCHDEFINES += -DCONFIG_ARCH_BOARD_$(CONFIG_BOARD) \
|
||||
-D__PX4_QURT -D__PX4_POSIX \
|
||||
-D__EXPORT= \
|
||||
-D__QDSP6_DINKUM_PTHREAD_TYPES__ \
|
||||
-Dnoreturn_function= \
|
||||
-Drestrict= \
|
||||
-I$(HEXAGON_TOOLS_ROOT)/gnu/hexagon/include \
|
||||
-I$(PX4_BASE)/src/lib/eigen \
|
||||
-I$(PX4_BASE)/src/platforms/qurt/include \
|
||||
-I$(PX4_BASE)/../dspal/include \
|
||||
-I$(PX4_BASE)/../dspal/sys \
|
||||
-I$(PX4_BASE)/mavlink/include/mavlink \
|
||||
-I$(QURTLIB)/..//include \
|
||||
-Wno-error=shadow
|
||||
|
||||
# optimisation flags
|
||||
#
|
||||
ARCHOPTIMIZATION = $(MAXOPTIMIZATION) \
|
||||
-g3 \
|
||||
-fno-strict-aliasing \
|
||||
-fomit-frame-pointer \
|
||||
-funsafe-math-optimizations \
|
||||
-ffunction-sections \
|
||||
-fdata-sections
|
||||
|
||||
# enable precise stack overflow tracking
|
||||
# note - requires corresponding support in NuttX
|
||||
INSTRUMENTATIONDEFINES = $(ARCHINSTRUMENTATIONDEFINES_$(CONFIG_ARCH))
|
||||
|
||||
# Language-specific flags
|
||||
#
|
||||
ARCHCFLAGS = -std=gnu99
|
||||
ARCHCXXFLAGS = -fno-exceptions -fno-rtti -std=gnu++0x -fno-threadsafe-statics -D__CUSTOM_FILE_IO__
|
||||
|
||||
# Generic warnings
|
||||
#
|
||||
ARCHWARNINGS = -Wall \
|
||||
-Wextra \
|
||||
-Werror \
|
||||
-Wno-unused-parameter \
|
||||
-Wno-unused-function \
|
||||
-Wno-unused-variable \
|
||||
-Wno-gnu-array-member-paren-init \
|
||||
-Wno-cast-align \
|
||||
-Wno-missing-braces \
|
||||
-Wno-strict-aliasing
|
||||
# -Werror=float-conversion - works, just needs to be phased in with some effort and needs GCC 4.9+
|
||||
# -Wcast-qual - generates spurious noreturn attribute warnings, try again later
|
||||
# -Wconversion - would be nice, but too many "risky-but-safe" conversions in the code
|
||||
# -Wcast-align - would help catch bad casts in some cases, but generates too many false positives
|
||||
|
||||
# C-specific warnings
|
||||
#
|
||||
ARCHCWARNINGS = $(ARCHWARNINGS) \
|
||||
-Wstrict-prototypes \
|
||||
-Wnested-externs
|
||||
|
||||
# C++-specific warnings
|
||||
#
|
||||
ARCHWARNINGSXX = $(ARCHWARNINGS) \
|
||||
-Wno-missing-field-initializers
|
||||
|
||||
# pull in *just* libm from the toolchain ... this is grody
|
||||
LIBM := $(shell $(CC) $(ARCHCPUFLAGS) -print-file-name=libm.a)
|
||||
EXTRA_LIBS += $(LIBM)
|
||||
|
||||
# Flags we pass to the C compiler
|
||||
#
|
||||
CFLAGS = $(ARCHCFLAGS) \
|
||||
$(ARCHCWARNINGS) \
|
||||
$(ARCHOPTIMIZATION) \
|
||||
$(ARCHCPUFLAGS) \
|
||||
$(ARCHINCLUDES) \
|
||||
$(INSTRUMENTATIONDEFINES) \
|
||||
$(ARCHDEFINES) \
|
||||
$(EXTRADEFINES) \
|
||||
$(EXTRACFLAGS) \
|
||||
-fno-common \
|
||||
$(addprefix -I,$(INCLUDE_DIRS))
|
||||
|
||||
# Flags we pass to the C++ compiler
|
||||
#
|
||||
CXXFLAGS = $(ARCHCXXFLAGS) \
|
||||
$(ARCHWARNINGSXX) \
|
||||
$(ARCHOPTIMIZATION) \
|
||||
$(ARCHCPUFLAGS) \
|
||||
$(ARCHXXINCLUDES) \
|
||||
$(INSTRUMENTATIONDEFINES) \
|
||||
$(ARCHDEFINES) \
|
||||
-DCONFIG_WCHAR_BUILTIN \
|
||||
$(EXTRADEFINES) \
|
||||
$(EXTRACXXFLAGS) \
|
||||
$(addprefix -I,$(INCLUDE_DIRS))
|
||||
|
||||
ifeq (1,$(V_dynamic))
|
||||
CXX_FLAGS += -fpic -D__V_DYNAMIC__
|
||||
endif
|
||||
|
||||
# Flags we pass to the assembler
|
||||
#
|
||||
AFLAGS = $(CFLAGS) -D__ASSEMBLY__ \
|
||||
$(EXTRADEFINES) \
|
||||
$(EXTRAAFLAGS)
|
||||
|
||||
LDSCRIPT = $(PX4_BASE)/posix-configs/posixtest/scripts/ld.script
|
||||
# Flags we pass to the linker
|
||||
#
|
||||
LDFLAGS += -g -nostdlib --section-start .start=0x1d000000\
|
||||
$(EXTRALDFLAGS) \
|
||||
$(addprefix -L,$(LIB_DIRS))
|
||||
|
||||
# Compiler support library
|
||||
#
|
||||
LIBGCC := $(shell $(CC) $(ARCHCPUFLAGS) -print-libgcc-file-name)
|
||||
|
||||
# Files that the final link depends on
|
||||
#
|
||||
LINK_DEPS += $(LDSCRIPT)
|
||||
|
||||
# Files to include to get automated dependencies
|
||||
#
|
||||
DEP_INCLUDES = $(subst .o,.d,$(OBJS))
|
||||
|
||||
# Compile C source $1 to object $2
|
||||
# as a side-effect, generate a dependency file
|
||||
#
|
||||
define COMPILE
|
||||
@$(ECHO) "CC: $1"
|
||||
@$(MKDIR) -p $(dir $2)
|
||||
@echo $(Q) $(CCACHE) $(CC) -MD -c $(CFLAGS) $(abspath $1) -o $2
|
||||
$(Q) $(CCACHE) $(CC) -MD -c $(CFLAGS) $(abspath $1) -o $2
|
||||
endef
|
||||
|
||||
# Compile C++ source $1 to $2
|
||||
# as a side-effect, generate a dependency file
|
||||
#
|
||||
define COMPILEXX
|
||||
@$(ECHO) "CXX: $1"
|
||||
@$(MKDIR) -p $(dir $2)
|
||||
@echo $(Q) $(CCACHE) $(CXX) -MD -c $(CXXFLAGS) $(abspath $1) -o $2
|
||||
$(Q) $(CCACHE) $(CXX) -MD -c $(CXXFLAGS) $(abspath $1) -o $2
|
||||
endef
|
||||
|
||||
# Assemble $1 into $2
|
||||
#
|
||||
define ASSEMBLE
|
||||
@$(ECHO) "AS: $1"
|
||||
@$(MKDIR) -p $(dir $2)
|
||||
$(Q) $(CC) -c $(AFLAGS) $(abspath $1) -o $2
|
||||
endef
|
||||
|
||||
# Produce partially-linked $1 from files in $2
|
||||
#
|
||||
#$(Q) $(LD) -Ur -o $1 $2 # -Ur not supported in ld.gold
|
||||
define PRELINK
|
||||
@$(ECHO) "PRELINK: $1"
|
||||
@$(MKDIR) -p $(dir $1)
|
||||
@echo $(Q) $(LD) -Ur -o $1 $2
|
||||
$(Q) $(LD) -Ur -o $1 $2
|
||||
|
||||
endef
|
||||
# Produce partially-linked $1 from files in $2
|
||||
#
|
||||
#$(Q) $(LD) -Ur -o $1 $2 # -Ur not supported in ld.gold
|
||||
define PRELINKF
|
||||
@$(ECHO) "PRELINKF: $1"
|
||||
@$(MKDIR) -p $(dir $1)
|
||||
@echo $(Q) $(LD) -Ur -T$(LDSCRIPT) -o $1 $2
|
||||
$(Q) $(LD) -Ur -T$(LDSCRIPT) -o $1 $2
|
||||
|
||||
endef
|
||||
# $(Q) $(LD) -Ur -o $1 $2 && $(OBJCOPY) --localize-hidden $1
|
||||
|
||||
# Update the archive $1 with the files in $2
|
||||
#
|
||||
define ARCHIVE
|
||||
@$(ECHO) "AR: $2"
|
||||
@$(MKDIR) -p $(dir $1)
|
||||
$(Q) $(AR) $1 $2
|
||||
endef
|
||||
|
||||
# Link the objects in $2 into the shared library $1
|
||||
#
|
||||
define LINK_A
|
||||
@$(ECHO) "LINK_A: $1"
|
||||
@$(MKDIR) -p $(dir $1)
|
||||
echo "$(Q) $(AR) $1 $2"
|
||||
$(Q) $(AR) $1 $2
|
||||
endef
|
||||
|
||||
# Link the objects in $2 into the shared library $1
|
||||
#
|
||||
define LINK_SO
|
||||
@$(ECHO) "LINK_SO: $1"
|
||||
@$(MKDIR) -p $(dir $1)
|
||||
echo "$(Q) $(CXX) $(LDFLAGS) -shared -Wl,-soname,`basename $1`.1 -o $1 $2 $(LIBS) $(EXTRA_LIBS)"
|
||||
$(Q) $(CXX) $(LDFLAGS) -shared -Wl,-soname,`basename $1`.1 -o $1 $2 $(LIBS) -pthread -lc
|
||||
endef
|
||||
|
||||
# Link the objects in $2 into the application $1
|
||||
#
|
||||
define LINK
|
||||
@$(ECHO) "LINK: $1"
|
||||
@$(MKDIR) -p $(dir $1)
|
||||
@echo $(Q) $(LD) $(LDFLAGS) -o $1 --start-group $2 $(EXTRA_LIBS) $(QURTLIBS) --end-group
|
||||
$(Q) $(LD) $(LDFLAGS) -o $1 --start-group $2 $(EXTRA_LIBS) $(QURTLIBS) --end-group
|
||||
endef
|
||||
|
||||
@@ -0,0 +1,357 @@
|
||||
#
|
||||
# Copyright (C) 2012-2014 PX4 Development Team. All rights reuint32_tserved.
|
||||
#
|
||||
# 2005 Modified for clang and GCC on POSIX:
|
||||
# Author: Mark Charlebois <charlebm@gmail.com>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name PX4 nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
#
|
||||
# Definitions for a native GCC toolchain
|
||||
#
|
||||
|
||||
#$(info TOOLCHAIN native)
|
||||
|
||||
# Toolchain commands. Normally only used inside this file.
|
||||
#
|
||||
|
||||
# Set to 1 for GCC-4.8.2 and to 0 for Clang-3.5 (Ubuntu 14.04)
|
||||
USE_GCC?=0
|
||||
|
||||
ifneq ($(USE_GCC),1)
|
||||
|
||||
HAVE_CLANG35:=$(shell clang-3.5 -dumpversion 2>/dev/null)
|
||||
|
||||
# Clang will report 4.2.1 as GCC version
|
||||
HAVE_CLANG:=$(shell clang -dumpversion)
|
||||
|
||||
#If using ubuntu 14.04 and packaged clang 3.5
|
||||
ifeq ($(HAVE_CLANG35),4.2.1)
|
||||
USE_GCC=0
|
||||
CLANGVER=-3.5
|
||||
else
|
||||
|
||||
#If using ubuntu 12.04 and downloaded clang 3.4.2
|
||||
ifeq ($(HAVE_CLANG),4.2.1)
|
||||
USE_GCC=0
|
||||
CLANGVER=
|
||||
endif
|
||||
endif
|
||||
|
||||
# If no version of clang was found
|
||||
ifeq ($(HAVE_CLANG35),)
|
||||
ifeq ($(HAVE_CLANG),)
|
||||
$(error Clang not found. Try make USE_GCC=1)
|
||||
endif
|
||||
endif
|
||||
endif # USE_GCC is not 1
|
||||
|
||||
ifeq ($(USE_GCC),1)
|
||||
# GCC Options:
|
||||
CC = gcc
|
||||
CXX = g++
|
||||
CPP = gcc -E
|
||||
|
||||
# GCC Version
|
||||
DEV_VER_SUPPORTED = 4.8.1 4.8.2 4.9.1
|
||||
|
||||
else
|
||||
# Clang options
|
||||
CC = clang$(CLANGVER)
|
||||
CXX = clang++$(CLANGVER)
|
||||
CPP = clang$(CLANGVER) -E
|
||||
|
||||
# Clang GCC reported version
|
||||
DEV_VER_SUPPORTED = 4.2.1
|
||||
endif
|
||||
|
||||
#LD = ld.gold
|
||||
LD = ld.bfd
|
||||
AR = ar rcs
|
||||
NM = nm
|
||||
OBJCOPY = objcopy
|
||||
OBJDUMP = objdump
|
||||
|
||||
# Check if the right version of the toolchain is available
|
||||
#
|
||||
DEV_VER_FOUND = $(shell $(CC) -dumpversion)
|
||||
|
||||
ifeq (,$(findstring $(DEV_VER_FOUND), $(DEV_VER_SUPPORTED)))
|
||||
$(error Unsupported version of $(CC), found: $(DEV_VER_FOUND) instead of one in: $(DEV_VER_SUPPORTED))
|
||||
endif
|
||||
|
||||
|
||||
# XXX this is pulled pretty directly from the fmu Make.defs - needs cleanup
|
||||
|
||||
MAXOPTIMIZATION ?= -O3
|
||||
|
||||
# Enabling stack checks if OS was build with them
|
||||
#
|
||||
|
||||
# Set the board flags
|
||||
#
|
||||
ifeq ($(CONFIG_BOARD),)
|
||||
$(error Board config does not define CONFIG_BOARD)
|
||||
endif
|
||||
ARCHDEFINES += -DCONFIG_ARCH_BOARD_$(CONFIG_BOARD) \
|
||||
-D__PX4_LINUX -D__PX4_POSIX \
|
||||
-Dnoreturn_function= \
|
||||
-I$(PX4_BASE)/src/modules/systemlib \
|
||||
-I$(PX4_BASE)/src/lib/eigen \
|
||||
-I$(PX4_BASE)/src/platforms/posix/include \
|
||||
-I$(PX4_BASE)/mavlink/include/mavlink \
|
||||
-Wno-error=shadow
|
||||
|
||||
# optimisation flags
|
||||
#
|
||||
ARCHOPTIMIZATION = $(MAXOPTIMIZATION) \
|
||||
-g3 \
|
||||
-fno-strict-aliasing \
|
||||
-fomit-frame-pointer \
|
||||
-funsafe-math-optimizations \
|
||||
-fno-builtin-printf \
|
||||
-ffunction-sections \
|
||||
-fdata-sections
|
||||
|
||||
# Language-specific flags
|
||||
#
|
||||
ARCHCFLAGS = -std=gnu99 -g
|
||||
ARCHCXXFLAGS = -fno-exceptions -fno-rtti -std=c++0x -fno-threadsafe-statics -D__CUSTOM_FILE_IO__ -g
|
||||
|
||||
# Generic warnings
|
||||
#
|
||||
# Disabled
|
||||
# -Wshadow - Breaks for the libeigen package headers
|
||||
# -Wframe-larger-than=1024 - Only needed for embedded
|
||||
|
||||
ARCHWARNINGS = -Wall \
|
||||
-Wextra \
|
||||
-Werror \
|
||||
-Wfloat-equal \
|
||||
-Wpointer-arith \
|
||||
-Wmissing-declarations \
|
||||
-Wpacked \
|
||||
-Wno-unused-parameter \
|
||||
-Wno-packed \
|
||||
-Werror=format-security \
|
||||
-Werror=array-bounds \
|
||||
-Wfatal-errors \
|
||||
-Werror=unused-variable \
|
||||
-Werror=reorder \
|
||||
-Werror=uninitialized \
|
||||
-Werror=init-self
|
||||
|
||||
# Add compiler specific options
|
||||
ifeq ($(USE_GCC),1)
|
||||
ARCHDEFINES += -Wno-error=logical-op
|
||||
ARCHWARNINGS += -Wdouble-promotion \
|
||||
-Wlogical-op \
|
||||
-Wformat=1 \
|
||||
-Werror=unused-but-set-variable \
|
||||
-Werror=double-promotion
|
||||
ARCHOPTIMIZATION += -fno-strength-reduce
|
||||
else
|
||||
ARCHWARNINGS += -Wno-gnu-array-member-paren-init
|
||||
endif
|
||||
|
||||
# -Werror=float-conversion - works, just needs to be phased in with some effort and needs GCC 4.9+
|
||||
# -Wcast-qual - generates spurious noreturn attribute warnings, try again later
|
||||
# -Wconversion - would be nice, but too many "risky-but-safe" conversions in the code
|
||||
# -Wcast-align - would help catch bad casts in some cases, but generates too many false positives
|
||||
|
||||
# C-specific warnings
|
||||
#
|
||||
ARCHCWARNINGS = $(ARCHWARNINGS) \
|
||||
-Wbad-function-cast \
|
||||
-Wstrict-prototypes \
|
||||
-Wmissing-prototypes \
|
||||
-Wnested-externs
|
||||
|
||||
# Add compiler specific options
|
||||
ifeq ($(USE_GCC),1)
|
||||
ARCHCWARNINGS += -Wold-style-declaration \
|
||||
-Wmissing-parameter-type \
|
||||
-Wno-error=unused-local-typedefs \
|
||||
-Wno-error=enum-compare \
|
||||
-Wno-error=float-equal
|
||||
endif
|
||||
|
||||
# C++-specific warnings
|
||||
#
|
||||
ARCHWARNINGSXX = $(ARCHWARNINGS) \
|
||||
-Wno-missing-field-initializers
|
||||
|
||||
# pull in *just* libm from the toolchain ... this is grody
|
||||
LIBM := $(shell $(CC) $(ARCHCPUFLAGS) -print-file-name=libm.a)
|
||||
#EXTRA_LIBS += $(LIBM)
|
||||
EXTRA_LIBS += -pthread -lm -lrt
|
||||
|
||||
# Flags we pass to the C compiler
|
||||
#
|
||||
CFLAGS = $(ARCHCFLAGS) \
|
||||
$(ARCHCWARNINGS) \
|
||||
$(ARCHOPTIMIZATION) \
|
||||
$(ARCHCPUFLAGS) \
|
||||
$(ARCHINCLUDES) \
|
||||
$(INSTRUMENTATIONDEFINES) \
|
||||
$(ARCHDEFINES) \
|
||||
$(EXTRADEFINES) \
|
||||
$(EXTRACFLAGS) \
|
||||
-fno-common \
|
||||
$(addprefix -I,$(INCLUDE_DIRS))
|
||||
|
||||
# Flags we pass to the C++ compiler
|
||||
#
|
||||
CXXFLAGS = $(ARCHCXXFLAGS) \
|
||||
$(ARCHWARNINGSXX) \
|
||||
$(ARCHOPTIMIZATION) \
|
||||
$(ARCHCPUFLAGS) \
|
||||
$(ARCHXXINCLUDES) \
|
||||
$(INSTRUMENTATIONDEFINES) \
|
||||
$(ARCHDEFINES) \
|
||||
-DCONFIG_WCHAR_BUILTIN \
|
||||
$(EXTRADEFINES) \
|
||||
$(EXTRACXXFLAGS) \
|
||||
-Wno-effc++ \
|
||||
$(addprefix -I,$(INCLUDE_DIRS))
|
||||
|
||||
ifeq ($(USE_GCC),0)
|
||||
CXXFLAGS += -Wno-deprecated-register \
|
||||
-Wno-tautological-constant-out-of-range-compare \
|
||||
-Wno-unused-private-field \
|
||||
-Wno-unused-const-variable
|
||||
endif
|
||||
|
||||
# Flags we pass to the assembler
|
||||
#
|
||||
AFLAGS = $(CFLAGS) -D__ASSEMBLY__ \
|
||||
$(EXTRADEFINES) \
|
||||
$(EXTRAAFLAGS)
|
||||
|
||||
LDSCRIPT = $(PX4_BASE)/posix-configs/posixtest/scripts/ld.script
|
||||
# Flags we pass to the linker
|
||||
#
|
||||
LDFLAGS += $(EXTRALDFLAGS) \
|
||||
$(addprefix -L,$(LIB_DIRS))
|
||||
|
||||
# Compiler support library
|
||||
#
|
||||
LIBGCC := $(shell $(CC) $(ARCHCPUFLAGS) -print-libgcc-file-name)
|
||||
|
||||
# Files that the final link depends on
|
||||
#
|
||||
#LINK_DEPS += $(LDSCRIPT)
|
||||
LINK_DEPS +=
|
||||
|
||||
# Files to include to get automated dependencies
|
||||
#
|
||||
DEP_INCLUDES = $(subst .o,.d,$(OBJS))
|
||||
|
||||
# Compile C source $1 to object $2
|
||||
# as a side-effect, generate a dependency file
|
||||
#
|
||||
define COMPILE
|
||||
@$(ECHO) "CC: $1"
|
||||
@$(MKDIR) -p $(dir $2)
|
||||
$(Q) $(CCACHE) $(CC) -MD -c $(CFLAGS) $(abspath $1) -o $2
|
||||
endef
|
||||
|
||||
# Compile C++ source $1 to $2
|
||||
# as a side-effect, generate a dependency file
|
||||
#
|
||||
define COMPILEXX
|
||||
@$(ECHO) "CXX: $1"
|
||||
@$(MKDIR) -p $(dir $2)
|
||||
@echo $(Q) $(CCACHE) $(CXX) -MD -c $(CXXFLAGS) $(abspath $1) -o $2
|
||||
$(Q) $(CCACHE) $(CXX) -MD -c $(CXXFLAGS) $(abspath $1) -o $2
|
||||
endef
|
||||
|
||||
# Assemble $1 into $2
|
||||
#
|
||||
define ASSEMBLE
|
||||
@$(ECHO) "AS: $1"
|
||||
@$(MKDIR) -p $(dir $2)
|
||||
$(Q) $(CC) -c $(AFLAGS) $(abspath $1) -o $2
|
||||
endef
|
||||
|
||||
# Produce partially-linked $1 from files in $2
|
||||
#
|
||||
#$(Q) $(LD) -Ur -o $1 $2 # -Ur not supported in ld.gold
|
||||
define PRELINK
|
||||
@$(ECHO) "PRELINK: $1"
|
||||
@$(MKDIR) -p $(dir $1)
|
||||
$(Q) $(LD) -Ur -o $1 $2
|
||||
|
||||
endef
|
||||
# Produce partially-linked $1 from files in $2
|
||||
#
|
||||
#$(Q) $(LD) -Ur -o $1 $2 # -Ur not supported in ld.gold
|
||||
define PRELINKF
|
||||
@$(ECHO) "PRELINK: $1"
|
||||
@$(MKDIR) -p $(dir $1)
|
||||
$(Q) $(LD) -Ur -T$(LDSCRIPT) -o $1 $2
|
||||
|
||||
endef
|
||||
# $(Q) $(LD) -Ur -o $1 $2 && $(OBJCOPY) --localize-hidden $1
|
||||
|
||||
# Update the archive $1 with the files in $2
|
||||
#
|
||||
define ARCHIVE
|
||||
@$(ECHO) "AR: $2"
|
||||
@$(MKDIR) -p $(dir $1)
|
||||
$(Q) $(AR) $1 $2
|
||||
endef
|
||||
|
||||
# Link the objects in $2 into the shared library $1
|
||||
#
|
||||
define LINK_A
|
||||
@$(ECHO) "LINK_A: $1"
|
||||
@$(MKDIR) -p $(dir $1)
|
||||
echo "$(Q) $(AR) $1 $2"
|
||||
$(Q) $(AR) $1 $2
|
||||
endef
|
||||
|
||||
# Link the objects in $2 into the shared library $1
|
||||
#
|
||||
define LINK_SO
|
||||
@$(ECHO) "LINK_SO: $1"
|
||||
@$(MKDIR) -p $(dir $1)
|
||||
echo "$(Q) $(CXX) $(LDFLAGS) -shared -Wl,-soname,`basename $1`.1 -o $1 $2 $(LIBS) $(EXTRA_LIBS)"
|
||||
$(Q) $(CXX) $(LDFLAGS) -shared -Wl,-soname,`basename $1`.1 -o $1 $2 $(LIBS) -pthread -lc
|
||||
endef
|
||||
|
||||
# Link the objects in $2 into the application $1
|
||||
#
|
||||
define LINK
|
||||
@$(ECHO) "LINK: $1"
|
||||
@$(MKDIR) -p $(dir $1)
|
||||
$(Q) $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $1 $2 $(LIBS) $(EXTRA_LIBS) $(LIBGCC)
|
||||
|
||||
endef
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ upload-serial-px4fmu-v2: $(BUNDLE) $(UPLOADER)
|
||||
$(Q) $(PYTHON) -u $(UPLOADER) --port $(SERIAL_PORTS) $(BUNDLE)
|
||||
|
||||
upload-serial-aerocore:
|
||||
openocd -f $(PX4_BASE)/makefiles/gumstix-aerocore.cfg -c 'init; reset halt; flash write_image erase $(PX4_BASE)/../Bootloader/px4aerocore_bl.bin 0x08000000; flash write_image erase $(PX4_BASE)/Build/aerocore_default.build/firmware.bin 0x08004000; reset run; exit'
|
||||
openocd -f $(PX4_BASE)/makefiles/nuttx/gumstix-aerocore.cfg -c 'init; reset halt; flash write_image erase $(PX4_BASE)/../Bootloader/px4aerocore_bl.bin 0x08000000; flash write_image erase $(PX4_BASE)/Build/aerocore_default.build/firmware.bin 0x08004000; reset run; exit'
|
||||
|
||||
upload-serial-px4-stm32f4discovery: $(BUNDLE) $(UPLOADER)
|
||||
$(Q) $(PYTHON) -u $(UPLOADER) --port $(SERIAL_PORTS) $(BUNDLE)
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
uorb start
|
||||
simulator start -s
|
||||
barosim start
|
||||
adcsim start
|
||||
accelsim start
|
||||
gyrosim start
|
||||
param set CAL_GYRO0_ID 2293760
|
||||
param set CAL_ACC0_ID 1310720
|
||||
param set CAL_ACC1_ID 1376256
|
||||
param set CAL_MAG0_ID 196608
|
||||
rgbled start
|
||||
mavlink start -d /tmp/ttyS0
|
||||
sensors start
|
||||
hil mode_pwm
|
||||
commander start
|
||||
list_devices
|
||||
@@ -0,0 +1,46 @@
|
||||
/****************************************************************************
|
||||
* ld.script
|
||||
*
|
||||
* Copyright (C) 2015 Mark Charlebois. All rights reserved.
|
||||
* Author: Mark Charlebois <charlebm@gmail.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name PX4 nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
/*
|
||||
* Construction data for parameters.
|
||||
*/
|
||||
__param : ALIGN(8) {
|
||||
__param_start = .;
|
||||
KEEP(*(__param*))
|
||||
__param_end = .;
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,7 @@
|
||||
* Driver for the Eagle Tree Airspeed V3 connected via I2C.
|
||||
*/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <px4_config.h>
|
||||
|
||||
#include <drivers/device/i2c.h>
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
* Generic driver for airspeed sensors connected via I2C.
|
||||
*/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <px4_config.h>
|
||||
|
||||
#include <drivers/device/i2c.h>
|
||||
|
||||
@@ -55,9 +55,14 @@
|
||||
#include <math.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef __PX4_NUTTX
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/wqueue.h>
|
||||
#include <nuttx/clock.h>
|
||||
#
|
||||
#else
|
||||
#include <px4_workqueue.h>
|
||||
#endif
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
@@ -95,8 +100,8 @@ public:
|
||||
|
||||
virtual int init();
|
||||
|
||||
virtual ssize_t read(struct file *filp, char *buffer, size_t buflen);
|
||||
virtual int ioctl(struct file *filp, int cmd, unsigned long arg);
|
||||
virtual ssize_t read(device::file_t *filp, char *buffer, size_t buflen);
|
||||
virtual int ioctl(device::file_t *filp, int cmd, unsigned long arg);
|
||||
|
||||
/**
|
||||
* Diagnostics - print some basic information about the driver.
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
* Implementation of AR.Drone 1.0 / 2.0 motor control interface.
|
||||
*/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <px4_config.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -121,7 +121,7 @@ int ardrone_interface_main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
thread_should_exit = false;
|
||||
ardrone_interface_task = task_spawn_cmd("ardrone_interface",
|
||||
ardrone_interface_task = px4_task_spawn_cmd("ardrone_interface",
|
||||
SCHED_DEFAULT,
|
||||
SCHED_PRIORITY_MAX - 15,
|
||||
1100,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user