Commit Graph

45 Commits

Author SHA1 Message Date
Karl Palsson 5eefc214f6 doc: stm32: fix "osc" incorrect linkages
Was copied around a lot, was always wrong.
2019-06-12 23:06:27 +00:00
Guillaume Revaillot f38c6f4f91 stm32l0: rcc: doc: fix rcc_clock_setup_pll brief.
rcc_clock_setup_pll allows to use HSE or HSI as PLL source, comment is misleading.
2019-06-12 23:06:22 +00:00
Karl Palsson c9d45e0e2c doc: stm32: move RCC to peripheral api style
For f7, it was completely missing doc markers
2019-06-12 21:56:09 +00:00
Karl Palsson 7be50a5e75 make: use $(PREFIX)gcc instead of $(PREFIX)-gcc
The leading - makes it rather inconsistent with the majority of other
projects around the world.  Use the form everyone else uses.
To solve this, properly pass prefix to inner makes as was always
intended.

Fixes: https://github.com/libopencm3/libopencm3/issues/1058
2019-06-07 21:25:46 +00:00
Guillaume Revaillot a652856533 stm32l0: rcc: add rcc_set_peripheral_clk_sel(periph, sel) 2019-06-03 22:29:45 +00:00
Guillaume Revaillot 8668f9198b stm32l0: rcc: add peripherals clock source selection helpers. 2019-06-03 22:29:45 +00:00
Guillaume Revaillot 6953138a28 stm32l0: add rcc_set_msi_range. 2019-06-03 22:29:45 +00:00
Karl Palsson da76279bc6 stm32: flash: move to peripheral_apis
Change the groupings and headings to make them all consistent.
2019-05-21 23:41:21 +00:00
Karl Palsson 508f8d9487 stm32: doc: gpio: move gpio to peripheral_apis
Drops dummy gpio.c files that weren't even being compiled in some cases.
2019-05-21 23:16:59 +00:00
Jacob Rodgers e2b67d7264 Set PLL source in rcc_clock_setup_pll() for STM32L0 2018-09-29 07:55:16 -07: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
Martin Sivak 572a50a53c stm32l0: include rtc module 2018-07-03 22:23:00 +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
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 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
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
Guillaume Revaillot c670bdca1a stm32l0: enable iwdg 2018-03-28 13:06:57 +00:00
Karl Palsson 8feb711ca0 stm32l0:rcc: add rcc_set_pll_source() as per L1
reported by: kaeipnos in https://github.com/libopencm3/libopencm3/pull/609
2018-03-02 22:42:05 +00:00
Karl Palsson c119ee7f9a stm32:l0: enable usart peripheral
Now that the usart-v2 peripheral is extracted cleanly, adding it for l0
is very simple.
2017-10-25 23:26:52 +00:00
Karl Palsson bc898d1f92 stm32l0: rcc: Add clock struct setup helper
Based on l1, l4 and friends.
2017-06-08 23:01:45 +00:00
Karl Palsson 29c712326f stm32: rcc: extract osc_bypass functions
rcc_osc_bypass_enable and rcc_osc_bypass_disable have been copy/pasted
around for the last time!  There's a compile bit to check for L0/L1, but
otherwise this is just code duplication for no gain.
2017-06-08 23:01:45 +00:00
Karl Palsson 2547bf66d9 stm32l0: flash: use common functionality
Provides all the basic core functionality shared with L1.  No special L0
functionality supported at this point.
2017-06-08 23:01:45 +00:00
Karl Palsson b860319785 make: use std=c99 everywhere by default.
setting "STANDARD_FLAGS=-std=c11" or similar will let you try out
alternate compilation modes.

Fixes https://github.com/libopencm3/libopencm3/issues/773
2017-06-08 23:01:45 +00:00
Matthew Lai 383fafc862 stm32: renamed pwr_common_all to pwr_common_v1, and pwr_common_l01 to pwr_common_v2 2017-03-30 21:48:08 +00:00
Sergey Matyukevich 59ef83a440 stm32: l0/l4: add i2c support
According to reference manuals both l0 and l4 have "v2" i2c peripheral.
This patch adds i2c support to l0 and l4 using previously unified "v2" i2c
headers and implementation.

No real hardware has been tested so far. Only compilation tests for both
libopencm3 and libopencm3-examples for all stm32 families.

Signed-off-by: Sergey Matyukevich <geomatsi@gmail.com>
2017-03-30 21:48:07 +00:00
Karl Palsson 05829037de stm32:rng: add common v1 to l0,l4,f7
This is a common peripheral based on reference manual inspection.
2017-03-30 21:48:07 +00:00
Karl Palsson c9c5cb7c9c style: fix some of the easier style bugs
No real changes.
2017-03-30 21:48:07 +00:00
Seven Watt 8a62618a63 stm32l0: add exti to makefile
Tested with a Lora radio application that used three GPIO lines to send
different interrupts from the radio module to the L052. Tested with a
Jeenode Zero Rev1
2017-02-17 09:43:01 +00:00
Karl Palsson 08aac020ad stm32: rcc: provide async routines for osc checks
Start providing async routines for all blocking routines, to make it
easier to use libopencm3 in some RTOS environments.  This is not in
anyway intended to be complete, this just covers a single blocking
routine, rcc_wait_for_osc_ready.  Documentation added to the top level,
and provided for all stm32 families.
2016-08-18 23:41:04 +00:00
Eric Kerman 9b642dea2a stm32l0: Add timer support
Signed-off-by: Karl Palsson <karlp@tweak.net.au>
2016-08-15 21:10:07 +00:00
Karl Palsson 77c0a2058c stm32l0: land adc-v2 peripheral support
Now that the big pieces of the adc-v2 common files are in place, start
including l0 in the builds.  This includes only the very very basic core v2
peripheral functions, and the very basic definitions.
2016-03-30 16:59:56 +00:00
Karl Palsson 3a7cbec776 stm32l/stm32f: name space standardization [BREAKING]
As done by esden for the F4, remove typedefs and add prefixes to clock enums
This extends this to all stm32 families.

    Let's not hide the fact that these variables are structs/enums.

    We are filling up the namespace badly enough, we should be prefixing as
    much as we can with the module names at least. As users we already run
    often enough in namespace colisions we don't have to make it worse.

    * CLOCK_3V3_xxx enums renamed to RCC_CLOCK_3V3_xxx
    * clock enums (PLL, HSI, HSE ...) prefixed with RCC_
    * scale enum of pwr module prefixed with PWR_
2015-12-14 23:26:42 +01:00
Piotr Esden-Tempski b1049f9a6f [Style] Stylefix sweep over the whole codebase. 2015-12-14 22:57:15 +01:00
Tido Klaassen aad8d06c3f make: rename CFLAGS in target Makefiles to TGT_CFLAGS
Renamed every instance of variable CFLAGS in target specific Makefiles
to TGT_CFLAGS to free up CFLAGS for user defined compiler flags.

Added information in README.md about existence and usage of CFLAGS
environment variable in build process.
2015-10-11 19:14:25 +00:00
Karl Palsson f1d8a7ef04 stm32l0: Add USB support via st_usbfs driver. 2015-10-06 00:54:17 +00:00
Robin Kreis add087aafc stm32l0: include desig.c (device electronic signature)
Simple functional peripheral, just needs to be included in the build.
2015-10-06 00:53:51 +00:00
Robin Kreis 112cf5d085 stm32l0: commonize PWR definitions and add to l0 2015-10-06 00:53:51 +00:00
Karl Palsson 29ede503f3 stm32l0: rcc: add more helper routines. 2015-10-06 00:53:51 +00:00
Karl Palsson 63cfc6932a stm32l0: Add Clock Recovery System to build 2015-10-06 00:53:02 +00:00
Karl Palsson 6d658c20b8 make: use shared DEBUG_FLAGS (-gdb3) by default
-ggdb3 make slightly bigger .elf files, but allows gdb to understand
macros, which libopenocm3 uses somewhat extensively.  Make this the
default, and pull it up to the common base makefile, so it can be easily
substituted.
2015-05-04 13:45:07 +00:00
Karl Palsson f51698fff4 stm32:l0: RCC: add osc_on/osc_off helpers
These are the routines that have custom switch cases, and aren't easy targets
for pulling out.
2014-12-03 11:13:39 +00:00
Karl Palsson 160a644bc6 stm32:l0: Add linker script / memory sizes
Easier to pick a corresponding part.
2014-12-03 11:13:39 +00:00
Karl Palsson 378069091a stm32:l0: Add RCC register definitions
Tested with a miniblink example on the l053 discovery board.

Only register definitions at this stage, no helpers.
Register definitions from RM0367r2, hopefully the biggest
superset of L0 parts.

Signed-off-by: Karl Palsson <karlp@tweak.net.au>
2014-12-03 11:13:39 +00:00
Karl Palsson 2c475a38d5 stm32:l0: Correctly compile as m0+, not m0.
Committed to binutils back in 2012, so even though it has no real impact, it at
least does the right thing for future compilers to make better decisions.

Signed-off-by: Karl Palsson <karlp@tweak.net.au>
2014-11-18 21:50:10 +00:00
Frantisek Burian f9152eb00a [stm32l0] Initial support for STM32L0 architecture, Add GPIO peripheral 2014-10-15 19:31:41 +02:00