Commit Graph

1917 Commits

Author SHA1 Message Date
fenugrec ad5ec6af08 Cortex-M defines : fix potential issue where PRIMASK and FAULTMASK operations could be optimized out by gcc.
This adds the "volatile" keyword to all the inline assembly. gcc docs say "You can prevent an asm instruction from being deleted by writing the keyword volatile after the asm.". Testing (see comments of github issue #475) shows that indeed gcc can remove some inline asm, in at least this situation:
-multiple calls to cm_is_masked_interrupts() in the same scope/context
- -Os or -O2 optimization
This is problem because the value of PRIMASK could change between two calls to cm_is_masked_interrupts().
Adding the volatile keyword fixes this, and probably costs less than adding a full barrier (like adding "memory" to the clobber list).
2016-01-10 11:13:25 -05:00
Jean-Philippe Ouellet 1cca117e58 Fix a few comments with logical/bitwise OR reversed. 2016-01-09 20:37:20 +00:00
Ondřej Hruška fb410a403d cm3/sync: Fix broken mutex_trylock()
Fails when the mutex was already locked.

Implemented zyp's fix for broken mutex. If it's 1 (= failure) by default, the function works fine.

irc log for reference
```
<zyp> strex returns 1 if it fails, 0 if it's successful
<zyp> but if the mutex is already locked, line 57 skips the status update and status gets remains at the initial value which means successful, which is wrong
<zyp> changing line 54 to status = 1 should do the trick
```
2016-01-06 14:36:30 +00:00
Oliver Meier 5996ac606b tests: usb gadget0: Add stm32f429i-disco support
The F429i board has the user USB OTG port connected to the HS capable
OTG core, rather than the FS OTG core.  It is still only operating in FS
mode, as you need a ULPI phy to use HS mode.
2016-01-05 18:11:59 +00:00
Karl Palsson b81588da74 tests: gadget0: Update for namespace cleanups
Fixes: 3a7cbec776
2016-01-05 18:00:00 +00:00
Karl Palsson 609cfe7f28 stm32: spi: correct typo in PHILIPS
Fixes: #589 on github
2016-01-04 17:13:30 +00:00
kbob faf69592cb Fixed misc. errata found in efm32/lg include files. 2015-12-17 19:35:02 -08:00
Piotr Esden-Tempski e8a4a37b9c Added gitter channel badge. 2015-12-15 17:38:33 +01:00
Piotr Esden-Tempski 17f159dec9 [PWR] Removed unneeded vos_scale_t definiton. 2015-12-15 00:51:18 +01:00
Piotr Esden-Tempski 830cf7bfc4 [RCC] Added missing prefix to the hsi setup table in f3. 2015-12-15 00:28:52 +01:00
Piotr Esden-Tempski 5828a77749 [Style] More whitespace fixes. 2015-12-14 23:42:27 +01: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 d680be81b5 [stm32f4] Remove rcc typedefs added prefixes to clock related enums.
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:32 +01:00
Piotr Esden-Tempski b1049f9a6f [Style] Stylefix sweep over the whole codebase. 2015-12-14 22:57:15 +01:00
Piotr Esden-Tempski 1f6fd11dd9 [Style] Fixed all style errors in the efm32. 2015-12-14 19:30:04 +01:00
Kuldeep Singh Dhaka 77354cb371 Inital support for EFM32LG 2015-12-13 19:56:19 +01:00
Devan Lai c28d9727d7 stm32f0: flash: Add BOOT_SEL and nBOOT0 definitions for FLASH_OBR
Checked against RM0091rev8
2015-12-13 01:07:26 +00:00
Karl Palsson 7c1cd2e5cd Drop "install" target and documentation.
This has hurt many many many people over it's lifetime, by confusing their
multilib toolchains.  Simply drop it outright.  People who _really_ know what
they're doing are still perfectly entitled to "install" portions of this
project in suitable locations for their own use.
2015-12-06 22:17:30 +00:00
Constantine Verutin 2eade079a9 Fix flash size for stm32f401x(D|E) in devices.data. According to
datasheet(http://www.st.com/st-web-ui/static/active/en/resource/technical/document/datasheet/DM00102166.pdf,
page 11) stm32f401xD has 384 Kb of flash and stm32f401xE has 512.
2015-12-02 10:15:09 +00:00
Jim Paris 01f08c4638 Remove WEAK from handler prototypes
These prototypes affect functions defined by application code.  Only
the implementations in libopencm3 are supposed to be weak; the
functions in application code should definitely not be.  Otherwise,
you'll end up with two weak symbols being linked together, and
it's luck as to which one the linker picks.
2015-11-24 09:55:27 +00:00
Karl Palsson 1ebfc4b26e lpc17xx: Correct duplicate CLKOUT definition
Checked against UM10360 rev3.1

Reported-by: <karl.robinsod@gmail.com>
2015-11-23 09:51:18 +00:00
Karl Palsson f14c678ccb stm32l4: add gpio support
Just the basic core common functionality gained for free by being a common
peripheral.  Enough for a miniblink.

Fixes some errors in the GPIO memory map.  ST's naming of AHB2 vs AHB3 is
confusing.
2015-11-13 02:13:31 +00:00
Karl Palsson 8afc983f3e stm32l4: Add RCC definitions
Bring in the core common code, and now that it's used, pull in the common
memorymap
2015-11-13 01:15:17 +00:00
Karl Palsson d0ac7feb3b stm32l4: Add linker generation support 2015-11-11 00:51:50 +00:00
Karl Palsson 7233d1112c stm32l4: Add to documentation build
Don't include any of the common files yet, we're only getting a stub framework
up for further work.

This is mostly noise adding links from the other families to make the l4
"exist"
2015-11-11 00:51:08 +00:00
Karl Palsson 507c184456 stm32l4: initial memorymap and vector support
Values from RM0351rev1, with the correction of the duplicate TIM1_CC entry.

Only stub support so far, but this opens up the beginning of build testing.
2015-11-10 23:47:57 +00:00
Karl Palsson 00cbf86e77 scripts: clean generated cmsis headers too 2015-11-10 23:47:57 +00:00
Karl Palsson a939810940 stm32f0: Add rcc compatibility aliases
Many stm32 families have multiple ADC and DAC peripherals.  F0 (so far) only
has one.  To make it easier to use the same code on many stm32 families,
provide an alias for ADC1 to ADC.
2015-11-10 22:00:11 +00:00
Nicolas Schodet 9b8d44e8a3 stm32f4: add GPIOJ & GPIOK
They are available on STM32F429 and STM32F439.
2015-11-10 14:27:57 +01:00
Karl Palsson fd100ea6c2 stm32f0: rcc: doxygen update prediv
After adding support to the f3, add missing doxygen support to the f0
equivalent.  This improves things and keeps them consistent until/if they are
pulled out as common code.
2015-11-08 15:36:32 +00:00
Karl Palsson a444aa4476 stm32f3: rcc: Add pll source prediv support
Based on the f0 support, which has identical functionality, but with doxygen
added.  Bits renamed as they are only HSE prediv on some targets, and makes
things more consistent with the f0.

Fixes part of github issue #560
2015-11-08 15:36:32 +00:00
Karl Palsson 489dc5125e stm32f3: rcc: support setting ADC prescalers
If you are in async mode (ADC_CCR.CKMODE == 0) (the reset default) you still
need to set the prescalers before the ADC will actually enable.
2015-11-08 15:36:32 +00:00
Karl Palsson 674cd9bfe9 stm32f3: rcc: Update ENR/RST definitions for newer docs
Based on latest RM0316rev5, and fixed a bug in f37x CEC bit definition that
overlapped.
2015-11-08 15:36:32 +00:00
Karl Palsson 4d7694b454 stm32f3: rcc: consistent masks for pll multiplier
All other masks consistently used a separate mask/shift define, bring the pll
multiplier function in line, and use the same form as other functions.
2015-11-08 15:36:32 +00:00
Karl Palsson 129a874cf8 stm32f3: rcc: Correct name of pll multiplier helper.
This function was badly copied and pasted from the f4 library, where there are
two functions, rcc_set_main_pll_hsi and rcc_set_main_pll_hse which combine
source, multipliers, dividers and other pll factors.

On F3, (not all of them, but the ones we support now), the function as
implemented has nothing to do with hsi / hse, and instead is simply selecting
the PLL multiplier.
2015-11-08 15:36:32 +00:00
Karl Palsson 10ef294e5d stm32f3: rcc: Set prescalers properly.
Copypasta from f4 rcc code was only modified to shift the result, but not clear
the existing settings properly. Add mask/shift definitions and use them
properly.
2015-11-08 15:36:32 +00:00
Karl Palsson ce9dab2a92 stm32f3: rcc: drop unused "power_save" parameter
Badly copied from F4 rcc code, there's no power save support in the f3 rcc
tree.
2015-11-08 15:36:32 +00:00
Karl Palsson 388138b953 stm32f3: Include at least a single linker script for f3 standard
This is the f3 on the common f3 discovery board.
2015-11-08 15:36:32 +00:00
Karl Palsson 5f2f296047 stm32l1: add l100xc linker script
Less eeprom and ram than l15x series.
2015-11-06 00:05:22 +00:00
Joost Rijneveld 74cd99343b stm32f4: linker scripts: add CCM to F405
The filename has always been wrong, "6" is a temperature grade, but f405 and
f407 are in the same datasheet, and all have the 64k CCM.  Add it to the linker
script.
2015-11-06 00:03:36 +00:00
Karl Palsson e6f267e103 stm32f7: Update TODO memory map items
DBGMCU and flash size and unique id registers had simply been copied from F4,
with TODO markers.  Checked against current datasheet and ref manual
2015-11-01 14:21:07 +00:00
Karl Palsson ab0552b1f7 stm32f7: correct addresses for calibration values 2015-11-01 14:12:37 +00:00
Alexandru M Stan 435cbcc675 stm32f0: Fix TSC_IOGxCR
TSC_IOGxCR is actually a 32 bit register, of which 13 bits are used
(rest are reserved).

Also, added x-1 since G0 is not a valid group, TSC_IOGCSR_GxE(1) is supposed
to be at 0x34, not 0x38.
2015-10-24 20:06:12 -07:00
Karl Palsson ff6cc954b7 stm32: adc: drop non-existant adc_set_single_channel
Was only in the (obviously out of date) documented example and as a
declaration.  No implementations.  Dropping immediately, but documentation
still needs further work.
2015-10-17 01:23:56 +00:00
Karl Palsson fbd25fb16f stm32f7: missing ; in rcc enumerations 2015-10-15 12:31:01 +00:00
Karl Palsson caeeed2b0f stm32f7: FPU only single precision on f7 :(
Boo ST.
2015-10-15 12:28:54 +00:00
Karl Palsson 5ece67ad5d stm32f7: Add rcc.h
Full clean manually checked against RM0385rev2.

Header definitions only.
2015-10-15 11:49:28 +00:00
Karl Palsson c1c37a8b0f stm32f7: Update IRQs from latest ref manual
One name change and some new ones.
2015-10-15 10:36:54 +00:00
Frantisek Burian 3ef2c38120 [stm32f7] Add initial support of the family, GPIO support.
Most changes are noise from doxygen.
Readme udpated to explain newer FP_FLAGS for m7
stm32f7 library is skipped if the toolchain doesn't support it yet.
2015-10-15 10:34:28 +00:00
Karl Palsson 2e25d678ba Surround all macro parameters with ()
Followup from c72f3d588a
2015-10-15 01:03:18 +00:00