added building for amd64 in addition to for the BBB
diff --git a/aos/build/aos.gypi b/aos/build/aos.gypi
index f0ebb12..144bffb 100644
--- a/aos/build/aos.gypi
+++ b/aos/build/aos.gypi
@@ -30,9 +30,14 @@
'aos_target': 'static_library',
},
}, {
- 'make_global_settings': [
- ['CC', '<!(which arm-linux-gnueabihf-gcc-4.7)'],
- ['CXX', '<!(which arm-linux-gnueabihf-g++-4.7)'],
+ 'conditions': [
+ ['PLATFORM!="linux-amd64"', {
+ 'make_global_settings': [
+ ['CC', '<!(which arm-linux-gnueabihf-gcc-4.7)'],
+ ['CXX', '<!(which arm-linux-gnueabihf-g++-4.7)'],
+ ],
+ },
+ ],
],
'variables': {
'aos_target': 'executable',
@@ -92,15 +97,24 @@
'-fno-builtin',
'-fno-strict-aliasing',
],
- }, {
+ }],
+ ['PLATFORM=="linux"', {
'cflags': [
'-mcpu=cortex-a8',
'-mfpu=neon',
'-fstack-protector-all',
],
- }
- ]],
+ }],
+ ['PLATFORM=="linux-amd64"', {
+ 'cflags': [
+ '-march=atom',
+ '-mfpmath=sse',
+
+ '-fstack-protector-all',
+ ],
+ }],
+ ]
}
],
['OS=="crio"', {
diff --git a/aos/build/build.sh b/aos/build/build.sh
index 0fe13ab..9073492 100755
--- a/aos/build/build.sh
+++ b/aos/build/build.sh
@@ -17,7 +17,7 @@
export WIND_BASE=${WIND_BASE:-"/usr/local/powerpc-wrs-vxworks/wind_base"}
-[ "${PLATFORM}" == "crio" -o "${PLATFORM}" == "linux" ] || ( echo Platform "(${PLATFORM})" must be '"crio" or "linux"'. ; exit 1 )
+[ "${PLATFORM}" == "crio" -o "${PLATFORM}" == "linux" -o "${PLATFORM}" == "linux-amd64" ] || ( echo Platform "(${PLATFORM})" must be '"crio", "linux", or "linux-amd64"'. ; exit 1 )
[ "${DEBUG}" == "yes" -o "${DEBUG}" == "no" ] || ( echo Debug "(${DEBUG})" must be '"yes" or "no"'. ; exit 1 )
AOS=`dirname $0`/..
@@ -25,7 +25,8 @@
OUTDIR=${AOS}/../output/${OUT_NAME}
BUILD_NINJA=${OUTDIR}/build.ninja
-${AOS}/build/download_externals.sh
+${AOS}/build/download_externals.sh arm
+${AOS}/build/download_externals.sh amd64
. $(dirname $0)/tools_config
# The exciting quoting is so that it ends up with -DWHATEVER='"'`a command`'"'.
@@ -50,7 +51,8 @@
echo "${GYP_INCLUDE}" | ${GYP} \
--check --depth=${AOS}/.. --no-circular-check -f ninja \
-I${AOS}/build/aos.gypi -I/dev/stdin -Goutput_dir=output \
- -DOS=${PLATFORM} -DWIND_BASE=${WIND_BASE} -DDEBUG=${DEBUG} \
+ -DOS=$(echo ${PLATFORM} | sed 's/-.*//g') -DPLATFORM=${PLATFORM} \
+ -DWIND_BASE=${WIND_BASE} -DDEBUG=${DEBUG} \
${GYP_MAIN}
# Have to substitute "command = $compiler" so that it doesn't try to
# substitute them in the linker commands, where it doesn't work.
diff --git a/aos/build/download_externals.sh b/aos/build/download_externals.sh
index e50ff56..36ce094 100755
--- a/aos/build/download_externals.sh
+++ b/aos/build/download_externals.sh
@@ -4,19 +4,28 @@
AOS=$(readlink -f $(dirname $0)/..)
. $(dirname $0)/tools_config
-COMPILED=${EXTERNALS}/../compiled-arm
-CROSS_COMPILE=arm-linux-gnueabihf-
+if [ "$1" == "arm" ]; then
+ COMPILED=${EXTERNALS}/../compiled-arm
-export CC=${CROSS_COMPILE}gcc-4.7
-export CXX=${CROSS_COMPILE}g++-4.7
-export CFLAGS="-mcpu=cortex-a8 -mfpu=neon"
-export CXXFLAGS="-mcpu=cortex-a8 -mfpu=neon"
-export OBJDUMP=${CROSS_COMPLIE}objdump
-# Flags that should get passed to all configure scripts.
-# Some of them need to set LDFLAGS separately to work around stupid configure
-# scripts, so we can't just set that here.
-CONFIGURE_FLAGS="--host=arm-linux-gnueabihf CC=${CC} CXX=${CXX} CFLAGS=\"${CFLAGS}\" CXXFLAGS=\"${CXXFLAGS}\" OBJDUMP=${OBJDUMP}"
+ CROSS_COMPILE=arm-linux-gnueabihf-
+
+ export CC=${CROSS_COMPILE}gcc-4.7
+ export CXX=${CROSS_COMPILE}g++-4.7
+ export CFLAGS="-mcpu=cortex-a8 -mfpu=neon"
+ export CXXFLAGS="-mcpu=cortex-a8 -mfpu=neon"
+ export OBJDUMP=${CROSS_COMPILE}objdump
+ # Flags that should get passed to all configure scripts.
+ # Some of them need to set LDFLAGS separately to work around stupid configure
+ # scripts, so we can't just set that here.
+ CONFIGURE_FLAGS="--host=arm-linux-gnueabihf CC=${CC} CXX=${CXX} CFLAGS=\"${CFLAGS}\" CXXFLAGS=\"${CXXFLAGS}\" OBJDUMP=${OBJDUMP}"
+else
+ COMPILED=${EXTERNALS}/../compiled-amd64
+
+ export CFLAGS="-march=atom -mfpmath=sse"
+ export CXXFLAGS="-march=atom -mfpmath=sse"
+ CONFIGURE_FLAGS="CFLAGS=\"${CFLAGS}\" CXXFLAGS=\"${CXXFLAGS}\""
+fi
TMPDIR=/tmp/$$-aos-tmpdir
mkdir -p ${EXTERNALS}
diff --git a/aos/build/externals.gyp b/aos/build/externals.gyp
index 1d5d7fb..ee10566 100644
--- a/aos/build/externals.gyp
+++ b/aos/build/externals.gyp
@@ -4,8 +4,13 @@
'variables': {
'externals': '<(AOS)/../output/downloaded',
'externals_abs': '<!(readlink -f ../../output/downloaded)',
- 'compiled': '<(externals)/../compiled-arm',
- 'compiled_abs': '<(externals_abs)/../compiled-arm',
+ 'conditions': [['PLATFORM=="linux-amd64"', {
+ 'compiled': '<(externals)/../compiled-amd64',
+ 'compiled_abs': '<(externals_abs)/../compiled-amd64',
+ }, {
+ 'compiled': '<(externals)/../compiled-arm',
+ 'compiled_abs': '<(externals_abs)/../compiled-arm',
+ }]],
# These versions have to be kept in sync with the ones in download_externals.sh.
'eigen_version': '3.1.3',
diff --git a/aos/common/logging/logging_impl_test.cc b/aos/common/logging/logging_impl_test.cc
index faaf1cd..58b7b00 100644
--- a/aos/common/logging/logging_impl_test.cc
+++ b/aos/common/logging/logging_impl_test.cc
@@ -159,7 +159,7 @@
}
time::Time end = time::Time::Now();
time::Time diff = end - start;
- printf("short message took %lld nsec for %ld\n",
+ printf("short message took %" PRId64 " nsec for %ld\n",
diff.ToNSec(), kTimingCycles);
start = time::Time::Now();
@@ -168,7 +168,7 @@
}
end = time::Time::Now();
diff = end - start;
- printf("long message took %lld nsec for %ld\n",
+ printf("long message took %" PRId64 " nsec for %ld\n",
diff.ToNSec(), kTimingCycles);
}
diff --git a/aos/linux_code/ipc_lib/shared_mem.c b/aos/linux_code/ipc_lib/shared_mem.c
index 4126d65..4e38117 100644
--- a/aos/linux_code/ipc_lib/shared_mem.c
+++ b/aos/linux_code/ipc_lib/shared_mem.c
@@ -74,7 +74,8 @@
if (shm_address == MAP_FAILED) {
fprintf(stderr, "shared_mem: mmap(%p, 0x%zx, stuff, stuff, %d, 0) failed"
" with %d: %s\n",
- (void *)SHM_START, SIZEOFSHMSEG, shm, errno, strerror(errno));
+ (void *)SHM_START, (size_t)SIZEOFSHMSEG, shm,
+ errno, strerror(errno));
return -1;
}
printf("shared_mem: shm at: %p\n", shm_address);
@@ -115,7 +116,7 @@
void *shm_address = global_core->shared_mem;
if (munmap((void *)SHM_START, SIZEOFSHMSEG) == -1) {
fprintf(stderr, "shared_mem: munmap(%p, 0x%zx) failed with %d: %s\n",
- shm_address, SIZEOFSHMSEG, errno, strerror(errno));
+ shm_address, (size_t)SIZEOFSHMSEG, errno, strerror(errno));
return -1;
}
if (global_core->owner) {
diff --git a/aos/prime/input/joystick_input.cc b/aos/prime/input/joystick_input.cc
index 6439dbc..e53a180 100644
--- a/aos/prime/input/joystick_input.cc
+++ b/aos/prime/input/joystick_input.cc
@@ -28,7 +28,7 @@
}
if (!joysticks.DeserializeFrom(buffer, received)) {
- LOG(WARNING, "deserializing data from %zd bytes failed\n", received);
+ LOG(WARNING, "deserializing data from %d bytes failed\n", received);
continue;
}
diff --git a/bbb_cape/src/bbb/packet_finder.cc b/bbb_cape/src/bbb/packet_finder.cc
index 9e06b62..eace2aa 100644
--- a/bbb_cape/src/bbb/packet_finder.cc
+++ b/bbb_cape/src/bbb/packet_finder.cc
@@ -105,7 +105,7 @@
LOG(INFO, "invalid packet\n");
return false;
} else if (unstuffed != (packet_size_ - 4) / 4) {
- LOG(WARNING, "packet is %" PRIu32 " words instead of %" PRIu32 "\n",
+ LOG(WARNING, "packet is %" PRIu32 " words instead of %zu\n",
unstuffed, (packet_size_ - 4) / 4);
return false;
}
@@ -134,7 +134,7 @@
if (buf_[i] == 0) {
++zeros;
if (zeros == 4) {
- LOG(INFO, "found another packet start at %d\n", i);
+ LOG(INFO, "found another packet start at %zd\n", i);
packet_bytes_ = packet_size_ - (i + 1);
memmove(buf_, buf_ + i + 1, packet_bytes_);
return false;
diff --git a/frc971/control_loops/drivetrain/drivetrain.cc b/frc971/control_loops/drivetrain/drivetrain.cc
index 69d9c21..61217fa 100644
--- a/frc971/control_loops/drivetrain/drivetrain.cc
+++ b/frc971/control_loops/drivetrain/drivetrain.cc
@@ -58,7 +58,7 @@
} else {
Eigen::Matrix<double, 2, Eigen::Dynamic> region_vertices =
region.Vertices();
- double min_distance;
+ double min_distance = INFINITY;
int closest_i = 0;
for (int i = 0; i < region_vertices.outerSize(); i++) {
const double length = ::std::abs(
diff --git a/frc971/prime/build.sh b/frc971/prime/build.sh
index 81ae16a..81d7e28 100755
--- a/frc971/prime/build.sh
+++ b/frc971/prime/build.sh
@@ -3,3 +3,4 @@
cd $(dirname $0)
../../aos/build/build.sh linux prime.gyp no prime "$@"
+../../aos/build/build.sh linux-amd64 prime.gyp no prime-amd64 "$@"
diff --git a/output/.gitignore b/output/.gitignore
index 6ec381b..79c1adf 100644
--- a/output/.gitignore
+++ b/output/.gitignore
@@ -1,5 +1,6 @@
/prime/
/crio/
+/prime-amd64/
/flasher/
/compiled-*/
/ip_base.txt