Commit Graph

2227 Commits

Author SHA1 Message Date
Karl Palsson d465291f45 tests: use the new auto depends on library
Provided in ea5d3cb7 genlink: provide LIBDEPS for libopencm3 itself
2018-08-17 00:15:01 +00:00
Christian Tacke d14033c744 genlink: provide LIBDEPS for libopencm3 itself
If $(OPENCM3_DIR)/lib/libopencm3_*.a exists, it will be linked in.
If we do that, we should also add it to the deps.
That way a newer *.a will result in a relink.

To use this, you should add a dependency to $(LIBDEPS) where you are
using $(LDFLAGS) and $(LDLIBS) now.

eg, old (wouldn't relink if the library changed)

$(PROJECT).elf: $(OBJS) $(LDSCRIPT)
        @printf "  LD\t$@\n"
        $(Q)$(LD) $(TGT_LDFLAGS) $(LDFLAGS) $(OBJS) $(LDLIBS) -o $@

new (will relink when the library changes)

$(PROJECT).elf: $(OBJS) $(LDSCRIPT) $(LIBDEPS)
        @printf "  LD\t$@\n"
        $(Q)$(LD) $(TGT_LDFLAGS) $(LDFLAGS) $(OBJS) $(LDLIBS) -o $@

Tested-by:  Karl Palsson <karlp@tweak.net.au>

Originally tracked via: https://github.com/libopencm3/libopencm3/pull/887
2018-08-17 00:15:01 +00:00
Karl Palsson f4bbe7c5bb usb: prevent registering duplicate config callbacks
Originally discussed at https://github.com/libopencm3/libopencm3/pull/722
2018-08-17 00:15:01 +00:00
Christian Tacke c55ec70f49 STM32: USART: Fix baudrate calculation for LPUART1
LPUART1 needs BRR to be 256 times the normal value.

Doing this with 64 bit math would work, but that pulls in quite a lot of
code for every platform, even if they don't have LPUART.

A little bit of maths, thanks to zyp on irc, lets us keep it in 32bit,
provided people don't try and use > 16MBaud on LPUARTs

Originally tracked via https://github.com/libopencm3/libopencm3/pull/888
2018-08-17 00:15:01 +00:00
Karl Palsson 49a8c041ff stm32f3: comparator: fix doxygen and use standard mask/shifts
Convert to standard style of unshifted field values.
2018-08-17 00:15:01 +00:00
Markus Kasten 0d0f59d8ce stm32f3: add comparator register definitions 2018-08-17 00:15:01 +00:00
Karl Palsson 05ce5de4c2 stm32f2/4: link in the specific flash.o files.
We extracted code out to the common files, but they weren't being
linked.  This didn't matter in the past, as they were empty.

Fixes: 46d4103c stm32: flash: move wait_for_last to f2/f4 explicitly.

Fixes: https://github.com/libopencm3/libopencm3/issues/953
2018-08-14 11:19:58 +00:00
Chris Sp 8b1ac585df stm32f4: rcc: typo fix MCO2
Just a small typo I came across while trying to get MCO to work on my board.
The define is not used in any other files as far as I can tell, but of
course applications might break if they use the misspelt variant.
2018-08-07 15:12:58 +00:00
Karl Palsson ddc7ab8c6c stm32l4: flash: don't use misleading names
flash_clear_pgperr_flag is a name used on f247, which is actually most
analogous to the SIZERR bit on l4, (it's a parallelism error)

the bit being cleared originally in this function, PROGERR is a new bit,
and should have it's own name.

Add a function to handle the previously unhandled size/parallelism flag,
and rename the existing one to properly reflect it's new name.
2018-07-29 20:31:17 +00:00
Karl Palsson 659d52b952 stm32f7: flash: drop unimplemented function declaration
flash_art_disable was never implemented, and isn't really a super useful
function anyway, so just drop the decl, rather than implementing it.
2018-07-29 20:31:17 +00:00
Karl Palsson 231f21296f stm32: f247: flash: use common code.
This shows what is _actually_ different for f7.  A couple of option
bits, and a renaming of bit 7 of the status register, from Program
Sequence Error to Erase Sequence Error.

We keep the separate implementation of wait_for_last_operation, to meet
the "suggestions" of the reference manual to insert a DSB instruction.

Keeping the renamed bit/functions also requires us to keep separate
implementations of the flag clearing functions
2018-07-29 20:31:17 +00:00
Karl Palsson 46d4103c1d stm32: flash: move wait_for_last to f2/f4 explicitly.
We're preparing to use all the common code for f2, f4, f7 and large
chunks of l4.  Extract things that we know need to be done differently
there.
2018-07-29 20:31:17 +00:00
Karl Palsson 76d392ee47 stm32: flash: drop common_f234
Move the last few register defines back to their relevant headers, add
doxygen and groups.  While these registers _were_ "common" they were the
_only_ common things, so it's simpler for future work (merging f7 with
f2/4) to move them back separately.
2018-07-29 20:31:17 +00:00
Karl Palsson eafc46ff24 stm32: flash: extract wait_for_last_operation to top level
This then eliminates the misguided attempts at merging f2/4 and f3 flash
support.  Some headers remain.
2018-07-29 20:31:17 +00:00
Karl Palsson c272ea410e stm32: flash: move clear all status flags to single common header
We've got a "f" flash file for common apis now, use it.
2018-07-29 20:31:17 +00:00
Karl Palsson a949b223c3 stm32f3: flash: pgerr is not the same as pgperr
F3's flash interface is actually quite different, don't try and force
sharing code that isn't really related.  The "PGERR" is a very different
bit than the parallelism error that f2/4/7 have.
2018-07-29 20:31:17 +00:00
Karl Palsson b9448bff16 stm32l4: flash: fix page erase for second bank
l4 is pages, not sectors, so update apis to be consistent. (other
families use page/sector as defined in the reference manual)
Make sure that pages on the second bank can also be erased.  Use the
same style in use for f2/4/7 for sector numbers across banks.
2018-07-29 20:31:17 +00:00
Karl Palsson 850931dbcd stm32: flash_unlock_option_bytes is common code.
The keys differ between some familes, but the documentation and
implementation are standard.
2018-07-29 20:31:17 +00:00
Karl Palsson c5a3350a7d stm32l: flash: rename option unlock keys or consistency
Paves the way for using common code.
2018-07-29 20:31:17 +00:00
Karl Palsson 4517ec81fd stm32: flash: remove superfluous locking of option bytes
Comments were not consistent, and this serves no purpose.  There's no
reason to explicitly lock the flash first before unlocking.  These bits
are simply set when the keys are written.
2018-07-29 20:31:17 +00:00
Karl Palsson 7a27795d8c stm32: flash: pull out i/d cache support.
Copied a few times.
2018-07-29 20:31:17 +00:00
Karl Palsson 2bf7eb4a0c stm32: flash: pull set_ws up to common code
All that changes is the size of the field.
2018-07-29 20:31:17 +00:00
Karl Palsson 4840b6bc7e stm32: flash: pull up clear_eop
All the "f" type flash parts have an EOP flag, even if it's in different
bit positions.  Add a header for this common functionality, and move
it's implementation to the existing common file.
2018-07-29 20:31:17 +00:00
Karl Palsson da7ebafcbe stm32: flash: pull lock/unlock up to common_f.
This is a common operation, so definition in _all, and every part except
l0/l1 have the same implementation.  Bring in an _f file too.
2018-07-29 20:31:17 +00:00
Karl Palsson b23dccc7ae stm32: flash: pull up prefetch to _all
Turns out, there's lots of common code for flash.  Pull up prefetch
on/off to start with, as there's only a single bit name different.

Pull up the definitions of common API functions too, starting with
flash_set_ws.  Even if the implementations are different, things that
meant to be the same, should be defined centrally.
2018-07-29 20:31:17 +00:00
Karl Palsson 9dd901ba27 stm32: flash: BSY bit has never been writable.
This has been copied around for years, but has never been a writable bit
on any target.
2018-07-29 20:31:17 +00:00
Karl Palsson 30d88452e6 stm32f4: flash: support discontinuous sectors on banked flash
The sector list is numerically contiguous, but the bits to write are not
contiguous.  Good job ST.

Fixes: https://github.com/libopencm3/libopencm3/pull/934

Don't see any reason to make public definitions of these sorts of magic
numbers, they're completely internal to sector addressing.
2018-07-29 20:31:17 +00:00
DanielePettenuzzo 6e1edc3656 stm32f7 usart.h: add macro for usart6 and uart 7 and 8 2018-07-29 20:31:17 +00:00
Jordi Pakey-Rodriguez cc8c8a2f83 stm32f4: power: update rcc_clock_scale enum
- Change .power_save to .voltage_scale, a pwr_vos_scale enum
- Enable pwr clock before setting VOS scale
- Fix flash wait states
- Make flash_set_ws more robust
2018-07-29 20:31:17 +00:00
Karl Palsson e076c3cadd doc: stm32: rtc common v2: convert comments to doxygen
Grouping and making the existing comments doxygen friendly
2018-07-29 20:31:17 +00:00
Alexey Ryabov 22f7348b89 stm32: rtc: add missing definitions 2018-07-29 20:31:17 +00:00
Karl Palsson 33ef6fd816 stm32f3: rcc: fix extern name for hsi structs
Fixes: ab9e425272
2018-07-29 20:31:17 +00:00
keepkeyjon 8071c6cf01 irq2nvic: Use weak-alias declarations instead of #pragma weak
... since Clang doesn't infer the function type on '#pragma weak x = y'-style
declarations, and instead leaves it as "<overloaded function type>", thus
leading to a type conflict when assigning the ISRs to the interrupt vector.

This has no impact on normal use, but it makes it more compatible, nd
that's always a good thing.

Before (vector_nvic.c generated)
 ...
 #pragma weak usart1_isr = blocking_handler
 ...

After:
 ...
 void usart1_isr(void) __attribute__((weak, alias("blocking_handler")));
 ...
2018-07-29 20:31:17 +00:00
keepkeyjon f53e12d2da cm3: Only inline asm is allowed in naked functions
According to: https://gcc.gnu.org/onlinedocs/gcc-6.2.0/gcc/ARM-Function-Attributes.html

"Only basic asm statements can safely be included in naked functions (see Basic
Asm). While using extended asm or a mixture of basic asm and C code may appear
to work, they cannot be depended upon to work reliably and are not supported."
2018-07-29 20:31:17 +00:00
keepkeyjon f2589bc7d8 cm3 startup: main should return int.
assuming main is a void function isn't really correct, even if we're
ignoring the return value.
2018-07-29 20:31:17 +00:00
Karl Palsson b309b7e082 make: report errors from multiple sub builds properly.
The reporting of make errors wasn't catching a failure from multiple
sublibs. rework it to iterate all found, rather than trying a single
file test.
2018-07-29 20:31:17 +00:00
Karl Palsson 72e1ffdc72 usb-gadget0: stm32f3: drop debug, be more consistent
Don't spew loop prints, be more like all the other targets.
2018-07-29 20:31:17 +00:00
Chuck McManis 63e0b6df3a Device Data: Add Specs for STM32F4[67]9 variant
The reference manual is incorrect, the data sheet is correct.
There is 320K of ram (up to address 0x20050000). This has been
tested on the STM32F469I-disco board.
2018-07-13 20:18:44 +00:00
Matt Anderson 0d5e51a8a7 STM32F0: Add RCC API for I2C1 clock source
* Providing API to set/clear RCC_CFGR3_I2C1SW on STM32F0, duplicated
	from STM32F3 applies only to I2C1.
2018-07-03 22:30:24 +00:00
Matthew Lai 68fce5a0ab stm32f7: rcc: fixed wrong constants, added more settings, clock setup refactoring 2018-07-03 22:23:00 +00:00
Matthew Lai ba0e0424b5 stm32f7: flash: added proper support 2018-07-03 22:23:00 +00:00
Karl Palsson ab9e425272 stm32f3: rcc: add hse preconfigurations
Just a single 8Mhz in, 72mhz (max) out, which suits the f3 discovery
boards for instance.
2018-07-03 22:23:00 +00:00
Karl Palsson ee8b5bf4ac stm32f3: rcc: drop useless 44MHz clock structure.
This clock speed is not USB compatible, it's not the maximum for
anything, nor the minimum, it's just a distraction.  Drop it.
2018-07-03 22:23:00 +00:00
Chuck McManis 1e9a2e641c stm32F4: LTDC - bit defines without semantics
The LTDC include file was defined with combined bit
semantics and bit position. As a result instead of
LTDC_GCR_VSPOL which is the bit which defines vertical
sync polarity, this had been defined to be
LTDC_GCR_VSPOL_LOW (0) and LTDC_GCR_VSPOL_HIGH (non zero).
This sort of define makes it impossible to know ahead of
time what operation would set or reset the bit (some are
negative logic, others are postive logic, so affirmative
defines could mean either "set the bit" or "reset the bit"
I've added the non-semantic bit define so that it is clear
in my code if the bit is being set or reset.

Discussion took place at https://github.com/libopencm3/libopencm3/pull/889
2018-07-03 22:23:00 +00:00
Karl Palsson 034dbf20ff stm32: timers: drop deprecated timer_reset()
We didn't actually mark it deprecated very well, but it was
non-functional, and simply a poorly implemented wrapper for
rcc_periph_reset_pulse() anyway.

It's now been obsoleted in the examples for more than a year, and it's
time to kill it outright.

Fixes: https://github.com/libopencm3/libopencm3/issues/709
2018-07-03 22:23:00 +00:00
Karl Palsson 64e26832c7 tests: makefiles need to handle linker script generators too
Without this you get errors about not finding the linker script (because
it will be generated) and linker errors due to bare -l flags.
2018-07-03 22:23:00 +00:00
Karl Palsson b48b94fa07 make: catch submake errors and present them in the log
This makes it more obvious with parallel makes when a single target has
failed.
2018-07-03 22:23:00 +00:00
Sebastian Holzapfel dfc67c03dc usb audio: add descriptors for streaming feature units 2018-07-03 22:23:00 +00:00
Martin Sivak 572a50a53c stm32l0: include rtc module 2018-07-03 22:23:00 +00:00
Guillaume Revaillot 8310de2f5b doc: convert stm32 iwdg peripheral to common naming 2018-07-03 22:23:00 +00:00