Commit Graph

290 Commits

Author SHA1 Message Date
Sergey Alirzaev
fc60651b6a stm32f4-discovery: add new board revision 2017-08-25 14:55:45 +00:00
Chuck McManis
766f89c724 Better Debugging in make
This commit does two things, it removes the "Quiet" flag
from the flash target so you can see what it is trying to
do when it trys to flash your code, and it adds a make
target print-% which can be used to print the resolved
value of make variables (also helpful in figuring out
what it is trying to do).
2016-12-29 15:38:50 +00:00
Karl Palsson
d23bee4f1a docs: mention targets might need GNU awk 2016-12-27 21:43:04 +00:00
Karl Palsson
1b92d46b97 docs: try and clear up how "make flash" works
Likely to be insufficient, but perhaps a start.

See https://github.com/libopencm3/libopencm3-examples/issues/34
2016-12-27 21:41:08 +00:00
Karl Palsson
c03b580722 stm32: morse timer: remove WFI where not critical
__WFI is not standardized, though often provided.  As it's not a core
part of this example, drop it.
2016-12-17 00:24:36 +00:00
Karl Palsson
9af2b8c7fb stm32: morse timer: standardize example
Simplify, clarify and synchronize the two morse LED blinker examples.
Prepare for one day extracting the core as common morse example code.
2016-12-17 00:23:10 +00:00
Karl Palsson
d2abd471a5 stm32: timer: further clarify example commentary
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.
2016-12-16 22:41:15 +00:00
Valentin Ochs
da04ccdf71 stm32: timer: Clarify some misleading comments.
Start clearing up misleading/redundant commentary.
2016-12-16 22:35:22 +00:00
Karl Palsson
1260b16772 timer_reset -> rcc_periph_reset_pulse() replace
timer_reset wasn't fully implemented for all timers on all series, and
was simply a wrapper of the RST bits in the RCC registers anyway.

First part of https://github.com/libopencm3/libopencm3/issues/709
2016-12-16 21:32:36 +00:00
Karl Palsson
833da68c18 f1: h103: drop duplicate usb_hid example.
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.
2016-12-16 21:27:25 +00:00
Karl Palsson
8fae7811a8 stm32f1: ubshid: add re-enumeration forcing.
This makes the demo reliably work on "generic" "other" style f1 boards
out of the box.
2016-12-16 21:27:25 +00:00
Karl Palsson
23001dfbcb stm32f1: hid: drop irrelevant gpio A15 config
Relates to jtag vs swd on some specific board, but not relevant to the
demo.
2016-12-16 21:27:25 +00:00
Karl Palsson
c22200ceb5 stm32f4: clarify input mode comment
Based on irc discussion, make the comment more accurately reflect what
the code is doing.
2016-11-23 17:36:01 +00:00
Karl Palsson
ed6973584c f3: adc: drop the _worst_ of the bad code
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.
2016-10-28 17:39:38 +00:00
Roland Hieber
bb8f4699da stm32 button: use more idiomatic GPIO read
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.
2016-10-11 19:51:51 +02:00
Karl Palsson
4dfa31f9f8 rules.mk: flash: send full path for existing openocd
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
2016-10-04 20:25:49 +00:00
Karl Palsson
eb54fbf285 adc: update to standardized calibrate api
Drop leftover code from before they were blocking, unify all to standard
api.
2016-10-01 16:13:45 +00:00
Karl Palsson
fc690fd6c4 upgrade library to latest.
Requires changes to all temperature sensor enabling on f1.
2016-10-01 16:02:26 +00:00
Karl Palsson
9fbac7daaf .gitignore more project files
add intellij (clion/pycharm) and eclipse project files to the ignore
list.
2016-09-02 21:12:28 +00:00
Chuck McManis
da679c1775 [Makefile]: add objects to clean target
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.
2016-08-18 22:51:55 +00:00
Karl Palsson
bcd7d57c11 make flash: overhaul openocd configuration
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.
2016-08-18 22:41:23 +00:00
Karl Palsson
b227e1609c rules: provide default C and C++ standards
Default CSTD to c99, no default for CXXSTD, but if provided it will be used.

Add required gnu99 flags to projects using gnu styles.
2016-08-18 22:41:23 +00:00
Karl Palsson
408b83f47a make: provide "examplesclean" to avoid cleaning library as well
We already have "make examples" and "make lib" but make clean cleans
everything.  Not super useful for end users, but rather handy for people
working on the examples.
2016-08-18 22:41:23 +00:00
Karl Palsson
30667fe62c rules: rename file only.
Trivial rename, allow vim to properly detect the file as a makefile.
2016-08-18 22:41:23 +00:00
Karl Palsson
133a45b734 atmel samd: initial blinky demo
Uses the DEVICE linker and config generation style.
2016-08-18 22:41:23 +00:00
Karl Palsson
b5fcf55005 stm32f4: switch two examples to linker generation
Proves that the tree can have projects specifying the linker script explicitly,
and also "modern" projects specifying simply the DEVICE= variable.
2016-08-18 22:41:23 +00:00
Karl Palsson
0f04829415 gitignore generated linker script files 2016-08-18 22:41:23 +00:00
Karl Palsson
de0d4af890 make: enable DEVICE _or_ LDSCRIPT to be specified
First step towards migrating towards generated devices.
2016-08-18 22:41:16 +00:00
Karl Palsson
52b12d5259 update library: pickup devices.data and friends 2016-08-18 22:39:25 +00:00
Karl Palsson
140d0864b8 rules: use TGT_xxx to avoid trampling user vars
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.
2016-08-18 22:39:25 +00:00
Karl Palsson
4b772a4437 rules: pull up optimization level 2016-08-18 22:39:25 +00:00
Trevor Woerner
a5641ab63e cookie_io fixes for gcc-5.3
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>
2016-06-17 10:31:56 -04:00
Karl Palsson
8924042d2a stm32f4: timer: correct misleading comments.
Code was correct, comment was badly imported.
2016-05-03 21:14:09 +00:00
Karl Palsson
5b35c7d7a1 rules: provide better feedback on missing libraries.
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.
2016-04-17 00:21:24 +00:00
Alexandru Gagniuc
07c2326f7e examples/tiva/lm4f: Use correct openocd interface
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.
2016-04-11 23:27:23 +00:00
Karl Palsson
9f8d37d8c8 stm32f4: usb midi: use unique serial numbers
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.
2016-04-11 23:24:23 +00:00
Karl Palsson
2092a6759d update libopencm3
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
2016-04-10 13:49:07 +00:00
Karl Palsson
b50cdb56de stm32f0: systick_blink: Robustness and correctness fixes
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 :)
2016-04-07 22:04:03 +00:00
Karl Palsson
dfc4763ab3 scripts: import BMP helper scripts from library.
These should have been moved over when the library was initial split.
Even if we eventually drop any attempt at flash support, at least have all the
files here.
2016-02-29 21:33:22 +00:00
Karl Palsson
7bbc57df75 Drop explict M3 reference from readme.
While the library and project remain libopencm3, there's no reason to
explicitly limit things to M3 in the introductory text.
2016-02-08 14:07:54 +00:00
Fabian Bartschke
ec1d59e344 stm32f4-discovery: correct part number for alternatives
STM32F401 Discovery is labelled MB1115B:
http://www.st.com/stm32f401discovery
2016-01-21 00:08:11 +00:00
Karl Palsson
b22ea8b616 stm32f1: maple LED is on A5.
Fix incorrect RCC port.  Only applies to "maple" not to maple mini.

Fixes github issue #117
2016-01-11 10:01:22 +00:00
Zhiyuan Wan
7322fdcdb9 stm32f103: fix all usb driver
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>
2016-01-03 14:51:12 +00:00
Piotr Esden-Tempski
8ce9536b2e Added gitter chat badge. 2015-12-15 17:41:07 +01:00
Piotr Esden-Tempski
976720c355 Updated libopencm3 to current master. Made all examples compile again.
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.
2015-12-15 00:56:25 +01:00
Piotr Esden-Tempski
f0009c64dc Added some more files to gitignore. 2015-12-15 00:06:06 +01:00
Andrew Chen
2314635cf0 Makefile.include: don't override DEFS
Allow examples (such as usart-semihosting) to set DEFS for their own use,
and _then_ add the target definitions.
2015-12-10 15:51:57 +00:00
Karl Palsson
070e5bbb94 make: allow specifying OPENCM3_DIR on command line
Allow specifying the path to the library on the command line, without
editing the makefile
2015-10-21 15:19:53 +00:00
Karl Palsson
3a275fb601 make: respect OPENCM3_DIR variable
When checking for the existing of the library, respect the variable
that's defined instead of checking a hardcoded path.
2015-10-21 15:19:49 +00:00
Karl Palsson
393fe8e449 stm32: usb: register control handlers in config callback
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.
2015-08-23 15:02:34 +00:00