Commit Graph

1360 Commits

Author SHA1 Message Date
Ben Brewer 1ebf172bcb stm32/dac: Update API to support multiple DACs and add v2 support 2021-01-07 15:30:51 +00:00
Kejia Hu 52781dee56 stm32g4: add SPI
The SPI peripheral on G4 is identical to F3, this patch copies the
header files directly from F3
2020-12-11 11:15:02 +00:00
Karl Palsson 97d5e9a403 doxygen: fix more broken groupings 2020-12-10 22:25:51 +00:00
Karl Palsson e07f23bb70 doxygen: fix many warnings on "end of file while in group" 2020-12-10 21:51:48 +00:00
Ben Brewer e923a6fe6a stm32g4: Add support for OPAMP
Move implementations into common and split into v1 and v2.
2020-12-10 16:46:24 +00:00
Karl Palsson 8435287300 stm32: dma: doxygen fixups
Use a single @defgroup for the "root" of a common heirarchy, and only
addtogroup for additions.  This prevents an alphabetically "first" entry
from being used as the documentation for the entire group.
2020-12-02 00:04:44 +00:00
Karl Palsson 382dde5a6d stm32f7/g4: usb: enable all classes 2020-12-01 23:37:26 +00:00
Karl Palsson f82053000c stm32: crs: fix doxygen
We need per device header includes to make the per target documentation
generation work properly.  The dispatch headers are to dispatch to the
_target_ not directly to the final implementation, remember, the final
required headers for each may be multiple files, plus extra definitions!
2020-12-01 23:13:38 +00:00
Ben Brewer 98855377c6 stm32g4: Enable CRS 2020-12-01 22:41:07 +00:00
Sam Kirkham 82b4626ae3 stm32g4: Add support for USB
Co-authored-by: Ben Brewer <ben.brewer@codethink.co.uk>
2020-12-01 22:41:07 +00:00
Sam Kirkham cdf235ca0c stm32g4: Add support for ADC
Co-authored-by: Ben Brewer <ben.brewer@codethink.co.uk>
2020-12-01 22:41:07 +00:00
Sam Kirkham b84bf6e244 stm32g4: Add support for DMA 2020-12-01 22:41:02 +00:00
Sam Kirkham 17d6660491 stm32g4: Add support for DMAMUX
Co-authored-by: Ben Brewer <ben.brewer@codethink.co.uk>
2020-12-01 22:41:02 +00:00
Sam Kirkham 0fbf6e8cc1 stm32g4: Add support for Timers 2020-12-01 22:41:02 +00:00
Ben Brewer f4f75c92dd stm32g4: Implement RCC
Co-authored-by: Sam Kirkham <sam.kirkham@codethink.co.uk>
2020-12-01 22:41:02 +00:00
Ben Brewer 59569bfb04 stm32g4: Implement FLASH 2020-12-01 22:41:02 +00:00
Ben Brewer c26eab2513 stm32g4: Implement PWR 2020-12-01 22:41:02 +00:00
Brian Viele e41ac6ea71 stm32: added peripheral clock get helpers for all stm32 platforms.
Allows for abstraction for code that's dependent on knowing the source clock
for a peripheral. Implemented a few core peripherals that tend to have clock
tree differences between platforms (USART, timers, I2C, SPI).
2020-11-28 22:13:25 +00:00
Kevin Stefanik df55d45cc1 pac55xx: add usart definitions and basic support code. 2020-11-28 22:13:25 +00:00
Kevin Stefanik 253a091936 pac55xx: adding memctl for flash/sram access, and clock/pll configuration functions.
Merge-conflict: took _prior_ verision of CCS_MUXSELR_MASK_PIN as
bracketing of (pin) seemed more correct!
2020-11-28 22:13:25 +00:00
Kevin Stefanik 245761f894 pac55xx: implemented CAN module interface for qorvo pac55xx. 2020-11-28 22:13:25 +00:00
Karl Palsson daf99b9b76 stm32: dcmi: hook up doxygen again
We still need stub .c files as we're using shared common files, so .d
tracking doesn't work.  It lets us setup basic introductory text anyway,
and there will be .c files eventually, so acceptable.
2020-11-28 22:13:25 +00:00
Graham Keeth d4d4c798a6 add usb audio, cdc, and midi stub files for doxy
- add stub files to relevant makefiles
- include <stdint.h> in respective headers to fix compilation
2020-11-28 22:13:25 +00:00
Ben Brewer 05f07c1051 stm32f3: Add support for OPAMP 2020-11-28 22:13:25 +00:00
Themroc d8d63b3184 stm32: timer common all: Fix documentation
Provide gpio examples for both f1 and "everyone else" gpio blocks

Originally filed at: https://github.com/libopencm3/libopencm3/pull/1243

Reviewed-by: Karl Palsson <karlp@tweak.net.au>
 (Merged old and new into two new examples)
2020-11-28 22:13:25 +00:00
Matt Walker 1c54d58c81 STM32H7: Support the RNG Peripheral
The random number generator on the STM32H7 is identical to the v1 RNG
already present in the library. So use that, and make sure that the RCC
knows about the peripheral.

Originally filed at: https://github.com/libopencm3/libopencm3/pull/1244

Reviewed-by: Karl Palsson <karlp@tweak.net.au>
 * whitespace changes from review
2020-11-28 22:13:25 +00:00
tute-avalos b47d769369 stm32: uart: Add Trasmission Complete enable/disable interrupt functions 2020-11-28 22:13:25 +00:00
Matthew Lai c49b4d35c2 stm32f7: added USB OTG FS/HS
Originally tracked at https://github.com/libopencm3/libopencm3/pull/958
While it doesn't work for everyone, this is clearly the basic first
steps required for any progress to be made.

Reviewed-by: Karl Palsson <karlp@tweak.net.au>
2020-11-28 22:13:25 +00:00
Karl Palsson 5f051241a8 stm32f1: rcc: provide struct based clock helpers
As on every other family.

Fixes: https://github.com/libopencm3/libopencm3/issues/1172
2020-11-28 22:13:25 +00:00
Karl Palsson a7902aa4d0 stm32l1: rcc/lcd: fix RTCSEL HSE definition
Wrong since original commit in 2013.

LCD code can't actually automatically determine clock speed if it's HSE,
as we don't know here whether what HSE is, nor what it's divided by.
For more fun, that old 2014 API doesn't have any way of flagging that it
failed either.  Hooray.
2020-11-28 22:13:25 +00:00
Devan Lai c13c2b3b3c usb: Allow registration of a single non-contiguous string descriptor for WinUSB
Classic WinUSB support is detected by probing for a string descriptor
at index 0xEE with a special string.
usbd_register_extra_string() allows registration of a string at this
index without having to provide 237 other string descriptors

Originally filed as https://github.com/libopencm3/libopencm3/pull/849

WCID reference: https://github.com/pbatard/libwdi/wiki/WCID-Devices
2020-11-28 22:13:25 +00:00
Manuel Bl e9c94760e6 stm32l4: enable USB OTG driver 2020-11-28 22:13:25 +00:00
Karl Palsson 76c0a8c289 stm32: rcc: convert to use new standard defines 2020-11-28 22:13:25 +00:00
Karl Palsson 43b3fa5ddc stm32l0/l1: flash: support half page flashing
Tested on L1 and L0 using the "dapboot" project, see
https://github.com/devanlai/dapboot/pull/27 for L1
and
https://github.com/devanlai/dapboot/pull/30 for L0
2020-11-28 22:13:25 +00:00
Karl Palsson b88196f807 ld: support ".ramtext" section hook to place functions in ram
We already had the hooks for ccmram and ram1 and ram2 and ram3 and xsram
for "other" ram sections, but there was no method, out of the box, for
placing a function in "normal" ram.  The "easy" method of labelling a
function as ".data.someramfunc" causes warnings because code isn't meant
to have a name like ".data*" so we must explicitly add a new code
section.

Signed-off-by: Karl Palsson <karlp@tweak.net.au>
2020-11-28 22:13:25 +00:00
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