Commit Graph

2399 Commits

Author SHA1 Message Date
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
Karl Palsson b4154f3ce6 doc: convert i2c to peripherals_api 2018-07-03 22:23:00 +00:00
Karl Palsson 40024fa211 doc: convert SPI to peripheral_api style
Response to cmcmanis having trouble finding it online
2018-07-03 22:23:00 +00:00
Karl Palsson b9cf3a7072 doc: convert CRC periphal to common naming
Previously scattered about under "crc_file" and under "STM32blah->CRC"

Deletes empty doxygen marker files, and uses groups instead.
2018-07-03 22:23:00 +00:00
Karl Palsson b47b967440 doc: use common naming for peripheral apis
Only applied to STM32 doc trees at present.

Instead of declaring a group for "STM32blah" in the doc-blah.h files,
and then trying to put all the common+specific peripheral code into
those groups, (which is what led to the stub doxygen holder empty .c
files)  Just use a standard name like "Peripheral APIS" and place
everything into that.

Demonstrated by converting ADC and USART peripherals, which is
definitely not complete, but it shows how to make things less magical,
and less prone to copy/paste errors.  Now, you can copy/paste and it
will do the right thing, because everyone uses the same group names.

This is also how to unify the mix of "STM32blah->Periphblah" and _also_
the dangling "periph_file" modules in doxygen, it merges them together
properly, as they're intended to be really.
2018-07-03 22:23:00 +00:00
Karl Palsson 7b9baabd69 stm32: drop empty usart.c files
On some targets these weren't even being referenced, on others they
were, in all cases they were empty and contributed no value.

They _actually_ served to declare groupings for doxygen, but we can do
that in a different manner, without having to have dummy files around.
2018-07-03 22:23:00 +00:00
Karl Palsson 595aa806e6 efm32: add USB mass storage class code
We added this in the main branch earlier, but efm32 usb code was in
flux.  Added now that it's stable again.
2018-06-27 22:13:40 +00:00
Chuck McManis 564e485989 devices.data: Add STM32F446xC/E data 2018-06-23 22:21:53 +00:00
Karl Palsson ea6a5a7efd tests: rules.mk: avoid non-posix brace expansion
Brace expansion is not posix defined, even if it's widely available.
Avoid it's use for portability.
2018-06-08 10:02:42 +00:00
Karl Palsson bc70d3b459 add USB mass storage class code where it was ommitted
Quite a few families didn't get the usb mass storage class code added.
Add it to all devices with usb support.
2018-06-07 12:09:11 +00:00
Karl Palsson 2352d5d1fb stm32: i2c-v2: Fix typo in CR1_ADDRIE
Reported in: https://github.com/libopencm3/libopencm3/issues/925
2018-06-07 12:01:11 +00:00
Karl Palsson dc64929b78 tests: gadget0: add stm32f3-disco
Another readily available board with a user USB port, and this one lets
you test the st usbfs peripheral on a device with trace facilities.
2018-05-01 22:23:47 +00:00
Karl Palsson b25a1ae0eb gadget0: work around "ValueError: The device has no langid"
pyusb quirk.
2018-05-01 22:23:47 +00:00
Karl Palsson 2204f447bb BREAKING: stm32f3:rcc: add more generic pll setup routines
Deprecate the old routine and make a new one that actually handles HSI
and HSE properly, and includes the predivider and the usb divider
settings as well.
2018-05-01 22:23:44 +00:00
Karl Palsson 622475f543 BREAKING: stm32f3:rcc: use more common MUL names
Make the defines as they are on other families, try and make more
defines the same, not arbitrarily different.
2018-05-01 22:19:28 +00:00
Karl Palsson ef44bdd09e BREAKING: stm32f0/f1: standardize flash_prefetch_xx
use the same API on all families, flash_prefetch_{enable,disable}()
2018-05-01 22:19:28 +00:00
Karl Palsson 389ec82538 stm32f3: flash: add prefetch helpers
Should be added to f2/f4 as well, but the bit definitions are different.
2018-05-01 22:19:28 +00:00
Martin Sivak f0e128673d Add DMA support to STM32L0
STM32L0 uses the same DMA peripheral as STM32F0, F1, L1 and others
with some differences. Those are mostly in the number of supported
controllers and channels.

This patch enables the basic support with no attempt to only expose
the available controllers / channels.

For more information see the ST Application Note AN2548.

Signed-off-by: Martin Sivak <mars@montik.net>
2018-04-29 19:22:13 +00:00
Guillaume Revaillot 54c6c833fe stm32: stm32f09x has two independent dma controlers, add RCC bits. 2018-04-29 13:16:36 +00:00
Karl Palsson 255a594300 stm32: spi-v2: enable SSOE by default for the common case
See also f80bff2133

This makes the v2 peripheral behave consistently with the v1 peripheral
code, and more in line with users expectations.

Fixes: https://github.com/libopencm3/libopencm3/issues/391
Fixes: https://github.com/libopencm3/libopencm3/issues/232
2018-04-28 21:12:27 +00:00
Guillaume Revaillot bf125e91f9 stm32: rework spi, based on PR #740 and #742.
split spi stuff in three part:
 - v1 : basic spi peripheral
 - v1_frf : v1 spi with frf mode additional bit in spi_cr2 / spi_sr
 - v2 : spi with variable datasize, fifo and other fancy stuff.

v1 maps to f1 chips
v1_frf to f2, f4 and l0,l1
v2 to f0, f3 and l4

This breaks spi_master_init API for v2 devices : function prototype from
common spi header used to be abused, with DFF bit reused for CRCL bit.
New v2 spi_master_init does not handle anymore CRCL bits, as it does not
usually mess with other crc configuration.
2018-04-28 21:12:27 +00:00
Guillaume Revaillot 0deb58c73c stm32: fix spi_init_master documentation.
Doc mentions SPI_CR_BR_FPCLK_*, but spi_init_master needs offseted register value (SPI_CR_BAUDRATE_FPCLK_*).
Align documentation with code.
2018-04-28 21:12:27 +00:00
Karl Palsson 34462ac54a stm32: adc v2: add some minor doxygen 2018-04-28 21:12:27 +00:00
Vegard Lillevoll 41cad7c065 stm32: adc-v2: Add ADC_CFGR1_AUTOFF 2018-04-28 21:12:27 +00:00
Vegard Lillevoll bbe71b4c4f STM32F0: Added ADC1_CCR definition 2018-04-28 21:12:27 +00:00
Karl Palsson 64c5535693 stm32l0: adc: add sample time definitions 2018-04-28 21:12:27 +00:00
Karl Palsson 9a05dcb6c0 ld scripts: drop duplication of standard sections
Instead of every "simple" target having their own duplicate file with
all the section mappings, just provide a single, simple,
"cortex-m-generic.ld" that works with our startup code and any simple
rom/ram system.  This also drops the pointless copying of files all over
the place.  Using -L flags properly is sufficient, and the standard file
is now in the root of the library already.
2018-04-28 21:12:27 +00:00
kbob dd87b5bed2 EFM32WG and EZR32WG: use hard-fp as it's available 2018-04-27 21:37:03 +00:00
kbob e8154aa44a efm32: Add EZR32WG "EZRadio Wonder Gecko" family. 2018-04-27 21:37:03 +00:00