Attempt to be more brutal by delaying more often, instead of always
promptly servicing the usb stack.
This is implemented via using timer6 to do a known number of
microseconds busy delay, and so only works on platforms that have
reached at least core timer functionality, and provide the
rcc_apb1_frequency variable.
NOTE! This will _fail_ on devices using the st_usbfs drivers at present,
but the code _should_ work, and the tests land to verify that the
library fix, fixes the problem. (see subsequent commit)
This introduces the first firmware setup specifically for automated testing.
Based heavily on the linux kernel project's "USB Gadget Zero" idea, and in
theory, this should be testable with <kernelsrc>/tools/usb/testusb.c but...
not yet. It's tricky to set that up and poorly documented, so we've got our
own tests instead. Instead, we include a set of python unit tests using pyusb.
These currently only test a basic core subset of functionality, but have already been
very helpful in finding latent bugs.
In this first stage, we support only the stm32f4 disco board, (MB997) and
FullSpeed USB devices. A generic "rules.mk" is introduced to support multi
platform builds. (See below)
Some basic performance tests are included, but as they take some time to run,
you must manually enable them. See the README for more information
NOTE! Only the source/sink functional interface is supported, loopback will require
some comparision with a real gadget zero to check exactly how it's working.
FOOTNOTES 1:
This introduces a rules.mk file that is arguably substantially simpler[1] for
re-use, and then uses this rules.mk file to support multiple target outputs
from the same shared source tree. Less path requirements are imposed, and less
variables need to be defined in each project's makefile. A separate bin
directory is created for each project.
All useful settings and configurations imported from the original library rules
file.
cxx support untested, but lifted from the original library rules file.
[1] Than the file in the libopencm3-examples repo it is loosely based on.
We haven't yet moved everything over to any autogenerated linker scripts, so
include more common templates instead of proliferating mountains of them in
every example.
All #includes now explicitly use the "<libopencm3/stm32/rcc.h>" format.
If you want to get rid of the "libopencm3" prefix in your local project you
can add a respective -I entry in your Makefile (not recommended though).
All .ld files and .a libs are installed in $(TOOLCHAIN_DIR)/lib
directly (as before), but are now renamed to avoid potential
conflicts now or in the future. Examples:
libopencm3_lpc13xx.a
libopencm3_lpc13xx.ld
libopencm3_stm32.a
libopencm3_stm32.ld