The "timer" example is actually "the same" for both f1 and f4. Do a
sanity sweep over the commentary, remove all vestiges that this was
cloned from a motor control example, and synchronize both examples.
Future work should extract the common portions "somewhere" but at least
make them consistent for now.
This example was functionally similar to the "other" example, but had
the actual functional mouse movement disabled. To reduce maintennance
cost with slightly divergent examples, simply drop the less useful
example.
The example is pointlessly complicated and includes lots of dead code,
but at least remove the wasteful and confusing references to the
temperature channel as pointed out on github.
Using GPIOA_IDR directly looks a bit arcane, and the example can benefit
from introducing gpio_get() and how to use it. The stm32f0-discovery
example already does it like this.
When using netcat to send commands to an already existing openocd
session, you must path full paths to the file to flash. There's no
guarantee that it is running from the same directory as the present
example
Some demos will use object files from a different directory and
those files would not be cleaned by the simple CLEAN rule. This
small change insures that those objects and their dependency files
are also cleaned.
Instead of OOCD_SERIAL triggering an attempt to use a specific ftdi based
adapter, introduce common target/interface pairs, OOCD_INTERFACE and
OOCD_TARGET, and an override via OOCD_FILE allowing full control.
Further, attempt to connect to a running openocd instance to flash if possible.
This _will not_ work well if you have multiple openocd instances open at once,
but that's a rare use case.
Examples:
OOCD_INTERFACE=stlink-v2
OOCD_TARGET=stm32f0x
--> openocd ... -f interface/stlink-v2.cfg -f target/stm32f0x.cfg)
OOCD_FILE=board/ek-lm4f120xl.cfg
--> openocd ... -f $(OOCD_FILE) (ie, the variable is passed untouched)
As part of implementing this, correct variables that were always wrong, and
update the openocd flashing commands to use current commands.
As in the main library, instead of constructing and making our own CFLAGS
CXXFLAGS and LDFLAGS variables, use TGT_ for ones we construct, and include any
user provided variables afterwards.
Using the latest (as of today) gcc-arm-embedded toolchain caused two build
failures similar to:
error: unknown type name 'cookie_io_functions_t'
These custom IO functions are now protected by a define, so define _GNU_SOURCE
which enables all such areas. This is a libc issue.
Signed-off-by: Trevor Woerner <twoerner@gmail.com>
If the library files are missing (haven't been built) it's better to get a
failure message saying that, rather than a failed dependency with no rules to
generated it.
Before: (I'd manually removed the f4 library)
```
$ make clean all V=1
Using ../../../../../libopencm3/ path to library
rm -f *.o *.d *.elf *.bin *.hex *.srec *.list *.map
make: *** No rule to make target `adc-dac-printf.elf', needed by `elf'. Stop.
```
After:
```
$ make clean all V=1
Using ../../../../../libopencm3/ path to library
rm -f *.o *.d *.elf *.bin *.hex *.srec *.list *.map
arm-none-eabi-gcc -Os -g -Wextra -Wshadow -Wimplicit-function-declaration
-Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes -fno-common
-ffunction-sections -fdata-sections -MD -Wall -Wundef
-I../../../../../libopencm3//include -DSTM32F4 -mthumb -mcpu=cortex-m4
-mfloat-abi=hard -mfpu=fpv4-sp-d16 -o adc-dac-printf.o -c adc-dac-printf.c
arm-none-eabi-gcc --static -nostartfiles -L../../../../../libopencm3//lib
-T../stm32f4-discovery.ld -Wl,-Map=adc-dac-printf.map -Wl,--gc-sections -mthumb
-mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 adc-dac-printf.o
-lopencm3_stm32f4 -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group -o
adc-dac-printf.elf
/home/karlp/tools/gcc-arm-none-eabi-4_9-2015q2/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/bin/ld:
cannot find -lopencm3_stm32f4
collect2: error: ld returned 1 exit status
make: *** [adc-dac-printf.elf] Error 1
```
I strongly feel that the latter is far more informative.
I'd love to meet the person who managed to use flossjtag interface
with a Stellaris board, but until we can meet, use the correct
interface, which is ti-icdi. Note that this setting is redundant,
since the board config file already specifies the correct interface;
however, OOCD_INTERFACE variable cannot be empty, by virtue of how
higher-level makefiles are written.
The unique serial number from the device unique signature block was never used
in any examples. Add it to the these two usb midi examples, to have a user for
this api available for reference.
This brings in the new ADC api for STM32 parts.
Update to new standardized ADC apis.
Drops pointless channel definitions, uses common names for common functions.
No functional changes.
Based on work in: https://github.com/libopencm3/libopencm3-examples/pull/130
Update documentation and comments in code to reflect reality.
Ensure that GPIO pin output speed is actually set, to ensure that 48Mhz sysclk
output is functional.
Actually set AF, instead of relying on reset values.
Replace the systick code, the core of this example, with some code that has
less traps and surprises. Instead of trying to get a direct interrupt x times
per second, and reguarly running into problems with the 24 bit counter limit,
use a method that triggers an interrupt every x ms instead. Tested MCO and
blink rates with a logic analyser, properly verified working now :)
Correctly migrate stm32f103_usb_driver to st_usbfs_v1_driver instead of the
f107 driver.
Fixes: 976720c355
Reviewed-by: Karl Palsson <karlp@tweak.net.au>
Be specifically careful with the usb examples. There is likely some
breakage to be expected, not sure I updated all the drivers to the
correct types for the respective chips.
As found in 6f2b39c1be6a8b9531264d92138dc2629d51cfa0, you can't just register a
control callback by itself, you can only register them in the set config
callback, (or, at least, _after_ set config has been done.
This has been compile tested only for the extra examples that were found to
have this failing pattern.
This has been broken since f87170e when set config started clearing control
handlers to be re-registered by different configurations.
Fix this example to use a set config callback to setup control transfer
callbacks, just like CDC-ACM demos. With this fix, this demo works with
dfu-tool 0.8
Signed-off-by: Karl Palsson <karlp@tweak.net.au>
This example muxes two pins as GPIO and enables one GPIO (logical
high). The other GPIO is then read in the main loop. One can use
a jumper to bridge the two GPIOs to see that also reading succeeds.
The UART's baud rate is calculated using the current clock
configuration from the clock module. This example makes use
of the standard C library and writes the characters to the
UART in blocking mode.
This example takes advantage of the big Flash memory space and
uses the standard library functions printf, and fgets to
implement a simple interactive application.