2184 Commits

Author SHA1 Message Date
fenugrec
410f2dd5a1 STM32 timers: avoid RMW when clearing interrupt flags
All defined bits are rc_w0.

The paranoid version of this would write 0 to the reserved bits (0 is the
"reset value"), but this would require knowing which flags are valid on the
actual platform, and adding the corresponding macros.
2016-02-29 20:45:18 +00:00
fenugrec
1d36685759 Cortex: interrupt handling to use uint32_t instead of bool.
This is more in line with the actual hardware (u32 registers), and will still
work if PRIMASK or FAULTMASK ever have more than 1 bit defined.
The functions cm_is_masked_interrupts() and cm_is_masked_faults() are
unchanged, since returning 'bool' fits with the function naming.

Fixes most of github issue #475. What remains "unfixed" is the absence
of functions to simply 'get' the u32 value of PRIMASK and FAULTMASK registers.
2016-02-28 18:02:57 +00:00
Karl Palsson
58f9909474 cm3: remove duplicate confusing MPU defines.
The MPU RASR AP table has a duplicate entries for Privileged ReadOnly
and Usermode ReadOnly, in the source ARM document (Cortex M3 TRM)
Remove the duplicate here.

The MPU RASR Shareable, Bufferable and Cacheable bits are all individual
bits, and none of the existing defines appear to even match the ARM
documentation.  Remove them, but leave the definitions of the bit
positions.

Reported by MightyPork on IRC
2016-02-28 18:00:22 +00:00
Karl Palsson
eebef01718 stm32f1: remove artificial limit on gpio remap mask
Connectivity line devices have more remaps available, and the existing code was
artificially and needlessly preventing those remaps from being set, even if
defined.

While implementing this, the existing code to handle SWJ remap was found to be
inconsistent with the reference manual and has been fixed.

Fixes github issue #369
2016-02-28 17:53:58 +00:00
Karl Palsson
84dec14d60 tests: extract serials to optional local config
Instead of having committed files containing a single developer's serials, use
optional includes to include a local config file for each board.

If you have only a single board connected, simply:

$ make -f Makefile.<board> clean all flash

If you have multiple boards connected, make sure to fill in the appropriate
hla_serial in your openocd.<board>.local.cfg file, and then run the same
commands.
2016-02-28 17:47:28 +00:00
Karl Palsson
5738e9515d stm32: rcc: fix missing ahb_frequency struct
Original commits, while appearing clean and tidy, hadn't even been
compile tested.  Trust no-one. Not even Scully.

Fixes: 770878e7b4ac12513e121e087261ca0972ba04e6
Fixes: 86d20ef00c00a14d7a4f0b834b9b608b2dd3638a
Fixes: 05ff0df32226dc28e22b98afde07bb886af9ddc9
2016-02-17 16:21:30 +00:00
Yiyu Zhu
770878e7b4 stm32f3: provide correct ahb frequency 2016-02-17 09:34:35 +00:00
Yiyu Zhu
86d20ef00c stm32l1: provide correct ahb frequency 2016-02-17 09:34:35 +00:00
Yiyu Zhu
05ff0df322 stm32f4: provide correct AHB frequency 2016-02-17 09:34:35 +00:00
Karl Palsson
3777b96cd5 stm32f1: remove duplicate incorrect flash size register
DESIG_FLASH_SIZE is provided for all stm32 parts in desig.h, correctly defined
as 16bits.  Remove the incorrect duplicate definition within the f1 flash
handling code.

Fixes github issues #621
2016-02-16 21:34:17 +00:00
Karl Palsson
6853b7ac5a cortex-m7: fix badly committed incomplete test
Bad merge, bad tests, bad author.

Fixes: 7545a321b0043c682cb196a6dbe592e363925b38
2016-02-16 10:12:56 +00:00
Karl Palsson
7545a321b0 cortex-m7: improve compiler detection
Recent debian testing and ubuntu 15.10 releases contain a
gcc-arm-none-eabi toolchain that returns 0 for the test with -mcpu and
-fsyntax-only, despite not actually supporting cortex-m7.  They then
failed hard on actual compilation steps.

Use the --help=target output instead. tested with old g-a-e 4.7 and
newer releases.
2016-02-16 09:47:17 +00:00
Karl Palsson
6d4a7d1d0c devices.data: fix f7 and l0 tech details
f7 has -mfpu=fpv5-sp-d16 in the lib makefile, devices.data should have
the same setting.
l0 is a cortex m0+, not a cortex m0, and uses cortex-m0plus in the
library makefile, and should have the same setting in the devices.data
file.
2016-02-05 12:30:24 +00:00
svo
d7f09d1178 usb: Return configuration = 0 in Addressed state.
This is as per USB 2.0 chapter 9 specifications, and
enables passing of USB-IF Chapter 9 tests.
2016-01-27 00:13:05 +00:00
Karl Palsson
63fda0a231 tests: gadget0: config should be 0 in addressed state 2016-01-27 00:13:05 +00:00
Karl Palsson
8225089cc9 tests: show expected, actual _and_ custom messages
See
https://docs.python.org/2/library/unittest.html#unittest.TestCase.longMessage

Allows showing the 42 != 69 : custom message instead of _only_ showing the
custom message if one was specified.
2016-01-27 00:13:05 +00:00
Karl Palsson
e6f6122965 tests: trivial: drop redundant ; 2016-01-27 00:12:59 +00:00
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: 3a7cbec776bc9b9b53eefc26d5bf365466977e5a
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