Commit Graph

1325 Commits

Author SHA1 Message Date
Karl Palsson 54319107b0 ld: support ".noinit*" uninitialized ram section
Add support for a section(s) ".noinit*" that will be allocated in ram,
but not cleared or initialized.  This can be used for passing variables
between a bootloader and an app for instance, or even just between
restarts of your application.

Without any assigned usages of the section, there is zero change in ram
usage.  The align does nothing when the prior section was already
aligned.
2020-11-28 22:13:25 +00:00
Karl Palsson 1acfa1c917 stm32l1: desig: handle flash size footnotes from refman
Some of the chipid variants have some footnotes on reading the flash
size register, make sure we report things nicely.
2020-11-28 22:13:25 +00:00
Karl Palsson e15071dbf8 BREAKING: drop all part specific ld files
We were never going to be capable of supporting every single part
variant with their own files, so stop trying.  We've been supporting the
linker script generator for a long time now, so move on from these old
static files.

Breaking: if you were using one of these, and don't wish to use the
linker script generator, you should simply declare a stub linker script,
and include the generic section definitions file, and provide this in
your own application.

Old:
LDSCRIPT = $(OPENCM3_DIR)/lib/stm32/l1/stm32l15xxb.ld

New (linker script generator):

DEVICE=stm32l151cb

New (manual):

* Add file mymemorymap.ld, with contents similar too:
```
MEMORY
{
       rom (rx) : ORIGIN = 0x08000000, LENGTH = 256K
       ram (rwx) : ORIGIN = 0x20000000, LENGTH = 48K
}

/* Include the common ld script. */
INCLUDE cortex-m-generic.ld
```

LDSCRIPT=mymemorymap.ld

See ld/README for more information on using the linker script generator
2020-11-28 22:13:25 +00:00
Dima Barsky 08c5f2a1fb stm32: i2c-v1: Fixed a typo in i2c_read7_v1 and i2c_write7_v1
Replaced & with &&
Wait for all three bits to be set - SB, MSL, and BUSY.

Old code worked by chance, use booleans to correctly convey intent.
Reviewed-by: Karl Palsson <karlp@tweak.net.au>
2020-10-16 12:00:20 +00:00
Karl Palsson 5dc9dfac79 stm32h7: add dispatch for enabling FPU
Fixes: https://github.com/libopencm3/libopencm3/issues/1217
2020-10-07 21:41:53 +00:00
rma-x 24bef9c49e stm32:adc: Change bitwise AND to logical AND
The original bitwise AND was _functionally_ correct because all operands
were booleans, but it was very poor at conveying the intent.

Fixes #1230
2020-07-03 12:27:44 +00:00
Karl Palsson 503cebab87 stm32g4: turn on FPU in pre_main
Yep, all M4F need this file added.
2020-04-10 14:12:08 +00:00
Guillaume Revaillot 9bf6ce8b64 stm32g0: flash: add erase/program stuff
probably can be refactored with other chips, did not really looked yet.
2020-04-09 23:37:38 +00:00
Guillaume Revaillot d696e2c264 stm32g0: add device electronic signature offsets and build desig. 2020-04-09 23:37:38 +00:00
Karl Palsson 4e70d06d63 stm32g4: Add basic support
* memorymap
* vectors
* rcc
* gpios
* makefiles
* devices for linker script generation
* doc structure
2020-04-09 23:29:00 +00:00
Kevin Stefanik 89e90e0e5d pac55xx: gpio: fix gpio_set_af for pin alternate function settings.
register bits were not cleared before setting. refactored to be similar
to how the drive strength register is being set.
2020-04-09 14:17:27 +00:00
Brian Viele b1d8a4c546 stm32h7: added minimal stm32h7 exti defs, which share with G0.
Separated definitions that did not seem consistent between the "v2" EXTI
platforms. Added SYSCFG defs needed for EXTICR settings.
2020-03-23 09:23:21 -04:00
Karl Palsson 4a11e354a3 stm32l1: desig: use new mechanism to support different densities
Fixes: https://github.com/libopencm3/libopencm3/issues/234

uses the new mechanisms introduced to address a similar problem on F7.

Tested on a medium density part (0x429) that returns the same ids as
before, tested on a high density part that now _doesnt_, but that's now
correct :)
2020-03-06 22:53:03 +00:00
Karl Palsson 3df3ed7db9 doc: stm32f0/f3: adc: fix doxygen warnings 2020-03-06 01:13:22 +00:00
Brian Viele 4953d67aaa stm32h7: per comments, improved consistency with other rcc impls.
Reduced the sea of enums, and renamed config parameters to match other
implementations, cribbing off of the G0 config, as it is closer to the level
of complexity. Updated initialization code to utilize the new values.

Added flash and LDO configuration from RCC init to be more consistent with
STM32 platform initialization.
2020-03-05 22:07:10 +00:00
François Finfe fb0cac49cb stm32: adc-v2: add adc_{en,dis}able_delayed_conversion_mode
To control AUTODELAY feature of the ADC.
2020-03-04 23:29:31 +00:00
Karl Palsson f1073e7991 stm32h7: stop attempting to use common usart code.
Until h7 implements a method of providing the periph clocks in a
compatible manner, they simply can't use the common_all files.
2020-03-04 23:24:02 +00:00
Brian Viele 2ca56f4c21 stm32h7: updates to PWR and RCC to support PLL configuration.
PLL configuration on the H7 is pretty involved, and takes a number of
configurations to make it work. In order to make peripheral drivers a bit
easier to implement, working with a soft clock tree in the rcc module which
stores the clock settings for each clock as they are setup such that users
can request the clock value from the RCC module for configuration. Added
getter for the clock which allows the user to pass the base address of the
peripheral, and get the peripheral clock value for convenience.

Clock configuration is still missing values for setting up all of the kernel
clocks for the peripherals, but this is in work, and there is a framework to
do so.

Have tested to 400MHz without issue. Peripherals that are explicitly supported
are working and the clock tree values appear to follow correctly.

Added LDO settings to allow setting the scaling to support high frequencies.
2020-03-04 23:17:02 +00:00
Matthew Lai 97688b913e stm32: desig: refactor to allow targets to have different addresses
In this commit, support for the different base addresses for different
F7 parts is added, but the mechanism is now in place for L1 and others.

Reviewed-by: Karl Palsson <karlp@tweak.net.au>
(whitespace fixed, commit msg reworded)
2020-03-04 22:16:31 +00:00
Karl Palsson f1b4a4dfff stm32f3: adc: consistently use unshifted
and tweak teh docs a little
2020-03-04 22:02:45 +00:00
François Finfe 49285ed8e1 stm32f3: fix missing reg mask for adc_set_multi_mode
Missing defines for ADC_CCR DUAL values have also been added.
2020-02-19 00:13:00 +01:00
Caleb Szalacinski 4b3d583394 swm050: register fix for timer_clock_div 2020-01-28 23:53:55 -06:00
Karl Palsson 8a915a8a18 doc: sam: fix duplicate and missing parameter docs 2020-01-28 23:04:30 +00:00
Karl Palsson 7da29d3d5f stm32: desig: doc: merge duplicate documentation sections
Use the best one.
2020-01-28 23:03:39 +00:00
Karl Palsson 8c37e5cea0 stm32: crc: merge duplicate documentation
Avoids warnings from doxygen.  Leaves it purely in the headers so it's
accessible in code completion as well.
2020-01-28 22:41:14 +00:00
Karl Palsson 6f25d51be6 cm3: nvic: use separate documentation to avoid warnings on cm0
Squelches some doxygen warnings, and makes the generated docs "right"
for each arch
2020-01-28 22:31:38 +00:00
Karl Palsson 26d6f8f77e swm050: timer: use more standard bit definitions
We normally use periph_reg_field naming, and most of this file was
already consistent. Switch the stragglers.
2020-01-28 22:31:38 +00:00
Karl Palsson a6aecf8ccd swm050: simplify doxygen
We don't need groupings around each enum, they format nicely into a
section already.  Likewise, the doxygen _is_ documentation, so we don't
need extra versions of it in places. Also fix a few warnings generated.
2020-01-28 22:31:24 +00:00
Caleb Szalacinski f06a1ca958 SWM050: Adds the timer peripheral and updates the README. 2020-01-28 20:58:50 +00:00
Guillaume Revaillot a8a92b4c11 rng: fix clock error handling, based on RM.
According to L4/L0/G0 RM, in case of clock error, interrupt flag must
be cleared, and CECS flag should be cleared as soon as clock meets
requirement.

Reviewed-on: https://github.com/libopencm3/libopencm3/pull/1062
2020-01-05 00:25:12 +00:00
Guillaume Revaillot 5866852a90 rng: handle noise source / seed error.
If noise source error occurs, flag must be cleared and data register
must be discarded (at least 12 reads to flush pipeline on G0). Other
device mention start/restart of chip, so, do both (better safe than
sorry).

Reviewed-on: https://github.com/libopencm3/libopencm3/pull/1062
2020-01-05 00:25:00 +00:00
Guillaume Revaillot 5a53f18a78 rng: check error before checking if data ready.
mostly cosmetic, but ease debugging.
2020-01-05 00:24:43 +00:00
Guillaume Revaillot 64baacfbbf rng: add irq enable/disable helper. 2020-01-05 00:24:43 +00:00
Jacob Walser e2ac1a6358 stm32f3: bugfix + adjust wwdg threshold signatures to support 12 bit resolution
- these registers are 12 bits wide
- bugfix clearing thresholds so that both upper and lower thresholds can be
  configured on the **window** watchdog
2020-01-05 00:10:12 +00:00
Jacob Walser a759a0d9c9 stm32f3: unify implementation with f0 adc_enable_analog_watchdog_on_selected_channel
- match the same logic as the f0 api
- use ADC_CFGR1_AWD1CH_VAL macro to mask the channel bits
- don't check if channel is < 18q
- enable the awd in addition to setting the selection to single channel monitoring (in following with the signature and @brief 'enable'
2020-01-05 00:10:01 +00:00
Jacob Walser 854da9635e stm32f0: adjust wwdg threshold signatures to support 12 bit resolution 2020-01-05 00:08:48 +00:00
balanceTWK 6fc1ff225e stm32:L4:flash: support erasing pages on bank 2
Reviewed-by: Karl Palsson <karlp@tweak.net.au> (fixed code style)
2020-01-05 00:03:06 +00:00
Guillaume Revaillot db6237cd1e stm32: extract g0 exti stuff to exti_common_v2.
stm32l5 basically uses the same stuff.
2020-01-01 19:47:13 +01:00
Sam Protsenko f7a952c41a stm32: Fix typo in RCC related comments
ABP -> APB

Signed-off-by: Sam Protsenko <joe.skb7@gmail.com>
2019-12-26 13:46:30 +00:00
Karl Palsson df15b263d2 usb: hid: add a stub file for doxygen
Unlike with the doxygen source generation, we can't autoguess which of
the class files are eligible automatically.  Instead, make a stub hid
file, (which we can now start adding to, if desired) and include it in
all builds that include other class stubs.
2019-12-25 21:04:17 +00:00
Guillaume Revaillot f70f0d0b7b stm32g0: pwr: doc: remove duplicated ingroup 2019-12-25 20:34:11 +00:00
Guillaume Revaillot 169d23568f stm32: lptimer: fix documentation 2019-12-25 20:34:11 +00:00
Karl Palsson a5b6673b62 stm32: usart-v2: fix some doxygen linking problems 2019-12-25 20:30:03 +00:00
Brian Viele aabefeac92 stm32h7: usart: support new fifo features
Supported by H7 and G4 varieties at present.
2019-12-25 20:29:24 +00:00
Karl Palsson fa3c1df6f5 pac55xx: fix up and simplify some doxygen 2019-12-25 13:44:49 +00:00
Brian Viele a3406f100b pac55xx: gpio: Initial Implementation of PAC55xx GPIO Driver
* Conforms mostly to the STM32 GPIO API where possible.
* Supports pin configuration (direction, pull-up/down, etc.) as well
  as pinmux configuration.
* Supports set/clear/get operations to the GPIO port/pins.
* Created base doxy header and groups to align with existing formatting.
2019-12-25 13:44:35 +00:00
Karl Palsson 9598b7f424 doc: stm32:rcc: flag "better" periph enable options
The original rcc_peripheral_enable_clock aren't explicitly deprecated,
as they do let you enable multiple periphs in one call.  But they're
error prone, from user feedback, so update the docs to ensure people
know what the other options are.
2019-12-12 20:37:58 +00:00
Karl Palsson 85275fd62e stm32f1: adc: doc: drop undocumented examples
There's already example code, this was just conflicting extra code that
wasn't being included in doxygen anyway.
2019-12-12 20:36:51 +00:00
Karl Palsson 557e7aa50f doc: avoid usage of rcc_peripheral_enable_clock
Use the simpler, safer rcc_periph_clock_enable instead
2019-12-12 20:35:57 +00:00
TomasPech 4a9ba30138 stm32f4: rcc_clock_setup_pll() correctly enable PWR
Original code used the special macros for rcc_periph_clock_enable
instead of the appropraite APB1ENR bit definition.

Switch to the correct, simpler form, using the correct parameter.
2019-12-12 20:12:27 +00:00