Get a basic USB device working
It enumerates, takes its address, gets configured, and then Linux kind
of gives up because it has no endpoints.
Change-Id: I01f75acee419b585e455f428ee45bcd37f0ce189
diff --git a/tools/ci/run-tests.sh b/tools/ci/run-tests.sh
index 98762e7..cac8dce 100755
--- a/tools/ci/run-tests.sh
+++ b/tools/ci/run-tests.sh
@@ -3,3 +3,4 @@
bazel --batch test -c opt --curses=no --color=no --jobs=1 //...
bazel --batch build -c opt --curses=no --color=no --jobs=1 //... --cpu=roborio
+bazel --batch build -c opt --curses=no --color=no --jobs=1 //motors/... --cpu=cortex-m4f
diff --git a/tools/cpp/CROSSTOOL b/tools/cpp/CROSSTOOL
index 7e6efdb..6e0c158 100644
--- a/tools/cpp/CROSSTOOL
+++ b/tools/cpp/CROSSTOOL
@@ -242,7 +242,6 @@
compiler_flag: "-Wall"
compiler_flag: "-Wextra"
- compiler_flag: "-Wswitch-enum"
compiler_flag: "-Wpointer-arith"
compiler_flag: "-Wstrict-aliasing"
compiler_flag: "-Wcast-qual"
@@ -489,7 +488,6 @@
compiler_flag: "-Wall"
compiler_flag: "-Wextra"
- compiler_flag: "-Wswitch-enum"
compiler_flag: "-Wpointer-arith"
compiler_flag: "-Wstrict-aliasing"
compiler_flag: "-Wcast-qual"
@@ -744,7 +742,6 @@
compiler_flag: "-Wall"
compiler_flag: "-Wextra"
- compiler_flag: "-Wswitch-enum"
compiler_flag: "-Wpointer-arith"
compiler_flag: "-Wstrict-aliasing"
compiler_flag: "-Wcast-qual"
@@ -889,10 +886,17 @@
compiler_flag: "-D__STDC_FORMAT_MACROS"
compiler_flag: "-D__STDC_CONSTANT_MACROS"
compiler_flag: "-D__STDC_LIMIT_MACROS"
+
+ # Some identifiers for what MCU we're using.
compiler_flag: "-D__MK64FX512__"
compiler_flag: "-DF_CPU=120000000"
+
compiler_flag: "-Wl,--gc-sections"
+ # Newlib's stdint.h does this, but GCC's freestanding stdint.h doesn't use
+ # newlib's so we have to do it manually...
+ compiler_flag: "-D__have_long32"
+
# Make C++ compilation deterministic. Use linkstamping instead of these
# compiler symbols.
unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
@@ -925,10 +929,10 @@
linker_flag: "-Tmotors/core/mk64fx512.ld"
compiler_flag: "-fmessage-length=80"
+ compiler_flag: "-fmax-errors=20"
compiler_flag: "-Wall"
compiler_flag: "-Wextra"
- compiler_flag: "-Wswitch-enum"
compiler_flag: "-Wpointer-arith"
compiler_flag: "-Wcast-qual"
compiler_flag: "-Wwrite-strings"
@@ -953,10 +957,16 @@
# Enable debug symbols.
compiler_flag: "-g"
- # Commons symbols are weird and not what we want, so just give multiple
+ # Common symbols are weird and not what we want, so just give multiple
# declaration errors instead.
compiler_flag: "-fno-common"
+ # We're not a hosted environment (no file IO, main is called from our code,
+ # etc).
+ compiler_flag: "-ffreestanding"
+ # However, we still want to optimize things like memcpy.
+ compiler_flag: "-fbuiltin"
+
compilation_mode_flags {
mode: OPT
@@ -993,13 +1003,16 @@
action: 'c++-header-preprocessing'
action: 'c++-module-compile'
flag_group {
+ iterate_over: 'quote_include_paths'
flag: '-iquote'
flag: '%{quote_include_paths}'
}
flag_group {
+ iterate_over: 'include_paths'
flag: '-I%{include_paths}'
}
flag_group {
+ iterate_over: 'system_include_paths'
flag: '-iquote'
flag: '%{system_include_paths}'
}
diff --git a/tools/environments.bzl b/tools/environments.bzl
new file mode 100644
index 0000000..68e78de
--- /dev/null
+++ b/tools/environments.bzl
@@ -0,0 +1,5 @@
+# Contains some helpers for working with environments.
+
+mcu_cpus = [
+ "@//tools:cortex-m4f",
+]