16 Commits

Author SHA1 Message Date
Karl Palsson
c6743f9ecd vector: make common linker definitions available to users
_data_loadaddr, _data, _edata, _ebss, _stack and vector_table all now
available in vector.h.

Suggested on IRC
2017-10-18 20:05:14 +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
Forrest Voight
4a21730bb6 startup: Explicitly enable STKALIGN for all parts.
SCB.CCR.STKALIGN enables the automatic aligning of the stack pointer to 8 bytes
on interrupt entry.  Per ARM recommendations, and for AAPCS compliance, this
bit should be enabled at all times.  ARMv6M has this hardcoded to 1. Cortex M3
has this broken in rev 0, optional (default off) in rev 1, and optional
(default on) in rev 2 and later. M4(f) has optional (default on) for all
revisions, M7 has hardcoded to 1.

See Section 2.3.3 in ARM document IHI0046B:
http://infocenter.arm.com/help/topic/com.arm.doc.ihi0046b/IHI0046B_ABI_Advisory_1.pdf

To ensure that all parts behave correctly, we make sure that we hardcode the
feature on, for all parts.  While not _required_ for anything other than rev1
cm3, inserting it into the common reset handler ensures no-one gets any
surprises.

Fixes Github issue #516
2015-08-14 01:14:01 +00:00
Stefan Agner
0d5dac515a init: call pre_main before C++ constructors
This moves the platform specific initialization function pre_main
in front of C++ constructors. This is especially necessary for
platforms which need to setup the stack pointer (pre_main itself
is inline, hence no stack needed for this function).
2014-10-07 11:31:36 +00:00
Piotr Esden-Tempski
a909b5ca9e [Style] Global style fix run. 2014-01-03 01:07:30 +01:00
BuFran
e1ebcc9da8 [Cortex] Add preliminary support for core-dependent defines ARMv6m / ARMv7m, ARMv7em 2013-08-22 17:18:35 -07:00
Piotr Esden-Tempski
7df63fcae0 First coarse run to fix coding style in locm3.
Added --terse and --mailback options to the make stylecheck target. It
also does continue even if it enounters a possible error.

We decided on two exceptions from the linux kernel coding standard:
- Empty wait while loops may end with ; on the same line.
- All blocks after while, if, for have to be in brackets even if they
  only contain one statement. Otherwise it is easy to introduce an
  error.

Checkpatch needs to be adapted to reflect those changes.
2013-06-12 18:22:56 -07:00
Nicolas Schodet
b2df978eae Add support for static constructors and destructors 2013-04-24 22:49:25 +02:00
Piotr Esden-Tempski
3d3ddc7014 Fixed all warnings for examples. 2013-02-26 19:33:42 -08:00
Karl Palsson
22d8891fee Remove assembly forcing stack.
Fixes #51

There should be no reason for manually trying to load the stack.  Cortex
devices can be programmed with only C, and any code that needed this
would indicate broken vectors.
2013-01-16 20:41:26 +00:00
Norbert Braun
569ebfdffb Add __attribute__ ((naked)) to reset_handler() 2012-11-28 15:28:42 +01:00
chrysn
0548317683 fix bug resulting from equally named files
the local vector.o files shadowed the ../cm3/vector.c from VPATH,
resulting in empty reset vectors.
2012-10-18 18:54:52 +02:00
chrysn
c69916ffb6 integrate irq2nvic_h script in buildprocess 2012-10-18 17:58:12 +02:00
chrysn
ae832b4ee8 split irq.yaml output in nvic.h and vector_nvic.h
the weak pragmas need to be used in the very compilation unit where
their target is defined, requiring another dispatch
2012-10-18 17:33:20 +02:00
chrysn
5afa53f01a drop two-line vector.c dispatchers in favor of central dispatch 2012-10-18 16:29:58 +02:00
chrysn
a69d83d312 unified vector table initialization
the cortex generic interrupts get moved to lib/cm3/vector.c, the
platorms' individual irq names, initialization and handler prototypes go
to platoform specific irq.h files.

as the vector.c file heavily depends on platoform specific headers, it
can't be built once-and-for-all in lib/cm3/, so there are inclusion
stubs in the various architecture dirs; this might be better solved with
Makefile / include path handling.

one particular file is lib/lpc43xx/vector.c; that platform's
initialization code contains an additional section to copy everything
from flash to ram (which probably performs better there). that code
still resides in the inclusion stub, and gets mashed in using defines.
would need a cleaner implementation together with the Makefile solution.

this commit contains some files of the upcoming efm32 branch, from which
it was cherry-picked.

the .bin files produced from before and after this commit only differ in
lpc43xx, where the startup sequence was subtly modified.
2012-10-05 00:55:24 +02:00