73 Commits

Author SHA1 Message Date
Karl Palsson
b860319785 make: use std=c99 everywhere by default.
setting "STANDARD_FLAGS=-std=c11" or similar will let you try out
alternate compilation modes.

Fixes https://github.com/libopencm3/libopencm3/issues/773
2017-06-08 23:01:45 +00:00
Tido Klaassen
aad8d06c3f make: rename CFLAGS in target Makefiles to TGT_CFLAGS
Renamed every instance of variable CFLAGS in target specific Makefiles
to TGT_CFLAGS to free up CFLAGS for user defined compiler flags.

Added information in README.md about existence and usage of CFLAGS
environment variable in build process.
2015-10-11 19:14:25 +00:00
Karl Palsson
6d658c20b8 make: use shared DEBUG_FLAGS (-gdb3) by default
-ggdb3 make slightly bigger .elf files, but allows gdb to understand
macros, which libopenocm3 uses somewhat extensively.  Make this the
default, and pull it up to the common base makefile, so it can be easily
substituted.
2015-05-04 13:45:07 +00:00
Frantisek Burian
6de1b50c4e [BUILD] Fix the correct make behavior if compiling inside tree
On linux, the output of CP rule was try to write to / which is - of course, forbidden for write.

This solution adds to each part of lib correct pointer to the root of lib where the libs should be written.

Bug found by Kuldeep Singh Dhaka.
2014-02-12 15:27:03 +00:00
Stefan Agner
7681597e42 Use type suffix to avoid warnings
When compiling with all warnings enabled, some defines can lead to
warning due to missing unsigned type suffix:

warning: integer overflow in expression [-Woverflow]

This fix should not affected behavior at all, since calculation with
such overflows lead to the same actual address when writing to that
location. However, it makes the warning disappear and also defines
the right data type for a memory location.
2014-02-06 00:59:39 +01:00
BuFran
65eaad938f [Style] checked and corrected 2013-08-22 22:29:40 -07:00
Alexandru Gagniuc
52d34c814b Global: Allow overriding float-abi flags
We currently default to "-mfloat-abi=hard -mfpu=fpv4-sp-d16" for M4F cores, and
and variations of "-mfloat-abi=soft" for the others. Keep the M4F default, and
move others to no FP flags for consistency, but allow overriding these flags
via the FP_FLAGS environment variable.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2013-07-07 18:59:33 -07:00
Ben Gamari
63d150008a lpc43xx/ssp: Mark ssp_wait_until_not_busy as static 2013-07-07 18:50:51 -07:00
Ben Gamari
5d4f759c92 lpc43xx/timer: Add timer utilities 2013-07-07 18:50:44 -07:00
Ben Gamari
d7fdcefbd7 lpc43xx: Fix rom_to_ram linker script
It was missing some definitions compared to the libopencm3_lpc43xx.ld.
2013-07-07 18:22:56 -04:00
Ben Gamari
78081bd794 lpc43xx: Add irq.yaml for M0 core 2013-07-07 13:52:16 -07:00
Ben Gamari
c25461dfce lpc43xx: Move M4 specific files to m4/ 2013-07-07 13:52:15 -07:00
Ben Gamari
9aa2f82164 lpc32xx_ram_only.ld: Fix region name 2013-07-07 13:52:15 -07:00
Ben Gamari
8eb5fba93b lpc43xx/uart: Fix code style 2013-07-07 13:52:15 -07:00
Ben Gamari
fa47bb80d5 lpc43xx/uart: Fix TER register definition
I'm not sure why bit 7 and offset 0x30 were used previously. Revision
1.6 of UM10503 claims that the TXEN bit is bit 0 in all UARTs' TER
registers.
2013-07-07 13:52:15 -07:00
Ben Gamari
8201703e64 lpc43xx/ssp: Fix duplicate function definition from merge 2013-07-07 13:52:14 -07:00
Ben Gamari
994e679fb8 lpc43xx: Clean up linker script breakage from merge 2013-07-07 13:52:14 -07:00
Ben Gamari
e8af7a98ee lpc43xx/ssp: Add ssp_transfer 2013-07-07 13:52:13 -07:00
Ben Gamari
0d29b1d2d6 lpc43: Use uint*_t instead of u* 2013-07-07 13:52:13 -07:00
Ben Gamari
26162762b7 lpc43xx: Update linker scripts 2013-07-07 13:52:13 -07:00
Ben Gamari
17fd708f66 Move lpc43xx and lpc43xx_m0 code to lpc43xx/ hierarchy
Previously there were nasty dependency issues causing M4 objects to be
linked into the M0 library
2013-07-07 13:52:13 -07:00
Hoernchen
4c8d260232 make sure the m0 is really running/stopped 2013-07-07 13:52:13 -07:00
TitanMKD
786e3215a4 Fixed a problem with rom to ram. (which can produce error "cannot move location counter backwards") 2013-07-07 13:52:12 -07:00
TitanMKD
0dec187fee lpc43xx basic IPC for multicore M4 & M0 (with basic examples for hackrf jellybean). 2013-07-07 13:52:12 -07:00
TitanMKD
edab264704 Added _data_rom / _edata_rom for ld ram only and standard spifi ld Fixed ROM to RAM copy of ".data" 2013-07-07 13:52:12 -07:00
Jared Boone
f4e45e74bc Add a duty cycle count argument to i2c0_init() to adjust for changes in APB1 clock. 2013-07-07 13:52:12 -07:00
Jared Boone
18bcbc3d28 Consolidate ssp_read and ssp_write into a single function, ssp_transfer. SSP bus transfers are bi-directional -- when bytes are written, they are also read. 2013-07-07 13:52:12 -07:00
Jared Boone
25d7853422 Switch ssp.c to using CGU #defines instead of local #defines. 2013-07-07 13:52:12 -07:00
Jared Boone
18d72099a5 Changed ldscripts to use new RAM region names, placed .data/.bss/stack into separate local RAM region.
Added ldscript for RAM-only debugging over SWD or JTAG.
2013-07-07 13:52:10 -07:00
Jared Boone
ffffb71ba2 Added distinct _bss ldscript constant, in case .text and .bss are not contiguous. 2013-07-07 13:52:10 -07:00
Jared Boone
24d8d81b43 Add generated bit/shift/mask #defines for CGU, CREG, RGU, USB (USB0 only) peripherals.
Added script used to generate #defines above.
Fixed one small change in the #define naming scheme in i2c0_init().
2013-07-07 13:52:08 -07:00
TitanMKD
f8542c09a6 UART driver and Example code for JellyBean. 2013-07-07 13:52:07 -07:00
Piotr Esden-Tempski
34de1e776e Changed to use stdint types. 2013-06-12 19:11:22 -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
Ken Sarkies
1627cd60c3 Documentation structures added to place the non-STM32 families into the documentation tree.
Actual documentation has not been added. Volunteers?
2013-04-14 15:30:02 +02:00
Piotr Esden-Tempski
9c552e7585 Fix all remaining lib warnings. 2013-02-26 17:32:07 -08:00
Piotr Esden-Tempski
b0233ae6fb Added more warning CFLAGS to all makefiles. 2013-02-26 16:42:20 -08:00
chrysn
99d7b21032 define platform specific constants for all chips
previously, only stm32 chips passed the information about which chip to
build on into the compiler. this information is essential to dispatch,
thus defining LPC13XX, LPC17XX, LPC43XX and LM3S in analogy to
STM32F1..4.
2012-10-19 19:10:42 +02:00
chrysn
75c2165827 build common .o files everywhere (fixes issue #29)
vector.o, nvic.o, scb.o and assert.o are available on every platform,
but at least some of them differ between the implementations. they
already got built explicityly on some platforms; now adding them to the
common Makefile.include.
2012-10-19 18:56:39 +02:00
chrysn
bc5146b710 unified systick handling
the only change this results in in the example binaries is in the
hackrf-jellybean/systick example, where the the check in
systick_set_clocksource for overflowing from the stm32 area gets used.
2012-10-18 22:48:14 +02: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
5afa53f01a drop two-line vector.c dispatchers in favor of central dispatch 2012-10-18 16:29:58 +02:00
chrysn
9c13299f25 unified nvic.c 2012-10-18 13:22:12 +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
Tomaz Solc
fc4047e4b4 Add assert macros to aid in debugging.
Adds libopencm3/cm3/assert.h header that provides assertion check macros
similar to those provided by the standard C library.

Thanks to Nicolas Schodet for help.
2012-10-02 08:48:45 +02:00
Nicolas Schodet
82ef2936a6 Support exceptions on all targets 2012-09-03 20:41:15 +02:00
Nicolas Schodet
74cd991e7e Use a specific symbol for data source address in flash
That way, data source address does not depend on any other unrelated change in
linker script.

This also fixes cases when .data input section is aligned on 8 bytes.  The new
version does not provide any address for the output section so that it is
aligned to the strictest input section.  The _data_loadaddr symbol will
always take this alignment into account.
2012-09-03 20:28:12 +02:00
Nicolas Schodet
2a35377980 Clean up and make linker scripts more uniform
This includes:

 - fix some comments indent,
 - add entry point,
 - align exported symbols,
 - remove unneeded "." assignments.
2012-09-03 19:53:43 +02:00
Piotr Esden-Tempski
3441bba1c4 Changed local build target for library and linker files.
- The library files are now being built into the lib subdirectory of the
  source.
- The linker files for each library are being copied into the lib source
  subdirectory.

Motivation: The relative locations of files in the source directory after make
are now the same as after make install now. This makes it easier to
reuse examples with their makefiles outside of the libopencm3
sourcecode directory.
2012-08-13 15:19:57 -07:00