Commit graph

101 commits

Author SHA1 Message Date
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
Jason Kotzin
34beeae925 USB core updated for reentrance based on Christian Cier-Zniewski's branch 2012-09-13 10:43:35 -07:00
Piotr Esden-Tempski
7373bfcb9b Merging pull request #26 "Linker script cleanup/improvements"
Merge remote-tracking branch 'schodet/linker-script'
2012-09-10 13:42:10 -07: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
Ken Sarkies
9af50d6e5c STM32F1xx Additional minor changes to adc.h and adc.c 2012-08-31 21:47:30 +09:30
Ken Sarkies
acc276a612 ADC documentation added
In adc.h additional defines needed to assist documentation - lines 172-191
added, and 384,436-451 are duplicates of earlier defines to complete
parameter sets (compiler has no trouble with these).

Minor doc corrections to other files.

No code changes (apart from additional defines).
2012-08-31 09:54:31 +09:30
Piotr Esden-Tempski
d98dab6ae2 Merging pull request #23 Changed markup to get more control over documentation.
Merge remote-tracking branch 'ksarkies/doc'
2012-08-25 15:16:50 -07:00
Ken Sarkies
52533a6e3d STM32F1xx: Changed markup to get more control over documentation, each
file having its own group module rather than using @file.

No code changes except for the following:

gpio: Added function to map the eventout signal plus two Remap functions
dma: Prevent changing base addresses while channel enabled (see datasheet)
pwr: Added pwr.c (new file)
timer: Removed the last function that I introduced recently; there is already
an equivalent function present. Changed some parameter names for consistency.
2012-08-20 17:19:20 +09:30
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
Ken Sarkies
52fd7c7976 STM32F timers. Doxygen markup added, and some code changes:
1. Remove the extra mask (TIM_DIER(timer_peripheral) & flag)
in timer_get_flag. Not all flags in SR relate to IRQs and the flags that
do might be useful even if interrupts not enabled.

2. In a number of functions (e.g. timer_set_output_idle_state) that only
apply to advanced timers, add test for TIM1 and TIM8, as done in some others.

3. Added timer_force_event to manipulate the EG register

TBD DMA burst - can't get my head around why this would be useful.
Someone must have thought so!
2012-07-10 09:32:47 +09:30
Karl Palsson
83d62e9bfc Add linker scripts with memory maps for F100 series.
These definitions are a physical property of the device for most purposes.
No reason not to supply them premade.
2012-06-29 02:10:53 -07:00
Karl Palsson
450c3e00a1 Basic helper routines for CRC
Note, the CRC block is pretty useless for interoperability.  It only operates on 32bit
chunks, and in a different bit order.  No attempt to make full helpers for compatibility
with other implementations has been done.

https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2Fcortex_mx_stm32%2FCRC%20computation&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=2006
2012-06-29 02:08:53 -07:00
Piotr Esden-Tempski
a70eabb3e1 Merge pull request #11 "Add helper function for max clock on HSI for f100"
Merge remote-tracking branch 'karlp/hsi_f1_24'
2012-06-27 13:58:14 -07:00
Piotr Esden-Tempski
4a17185791 Merge pull request #10 "Add Device Electronic Signature support."
Merge remote-tracking branch 'karlp/desig'
2012-06-27 13:56:55 -07:00
Karl Palsson
62849f043c Add helper function for max clock on HSI for f100
Based on existing HSI code. Tested with f100c8, on custom board with no
external crystals or resonators.
2012-06-12 20:56:34 +00:00
Karl Palsson
71a3a7f2b1 Add Device Electronic Signature support.
Working unique id support, but not 100% convinced that this is the "least surprise"
path.  ST's docs provide the bits from low to high, in 2xu16 and 2xu32.
But to get it back as a "u96" the highest bits should be first?
2012-06-12 20:53:59 +00:00
Ken Sarkies
06620040aa Header files for Doxygen group structure, layout changes to headings, example markup in stm32f1/ rcc 2012-05-28 21:38:55 +09:30
Piotr Esden-Tempski
7011d47c70 Mark reg32 variables as used. So that the compiler does not complain. 2012-05-25 17:56:15 -07:00
Piotr Esden-Tempski
3596075ee0 Fixed the linker scripts to be the way Tomaz Solc proposed.
Something went wrong when cherrypicking his commits in the pull request.
Sorry about that. :(
2012-04-25 17:34:07 +02:00
Piotr Esden-Tempski
3b20a5e34e Removed the load address statement from the .bss section.
Otherwise the linker will complain: "section has both a load address and
a load region"
2012-04-24 09:34:39 +02:00
Tomaz Solc
bf65589183 Support for exception handling in linker scripts.
This is needed even in plain C when 64 bit variable (e.g. long long int)
arithmetic is used. For example it is required when newlib is compiled with
--enable-newlib-io-long-long.

Conflicts:

	lib/stm32/f1/libopencm3_stm32f1.ld
	lib/stm32/f2/libopencm3_stm32f2.ld
2012-04-24 09:16:22 +02:00
Tomaz Solc
5510e1fe3b Wait for writes to finish upon exiting RTC config
This fixes race condition when rtc_get_counter_val() call immediately follows
rtc_set_counter_val().
2012-04-24 09:06:32 +02:00
Gareth McMullin
8820277f09 Added functions for configuring timers in slave mode. 2012-04-08 14:12:21 +12:00
Gareth McMullin
a8ec86a527 Added functions for timer input capture polarity and enable/disable. 2012-04-08 13:55:16 +12:00
Gareth McMullin
4b041697f4 Added convenience function for timer input selection. 2012-04-08 11:56:42 +12:00
Gareth McMullin
a62473fbdf Added convenience funcions for timer input capture filter and prescaler. 2012-04-08 11:11:52 +12:00
Gareth McMullin
567faa9b61 Corrected parameters of timer_set_mode() to u32. 2012-04-07 20:31:56 +12:00
Piotr Esden-Tempski
26de4cb9d6 Constand value for resetting CAN_TDTxR was too big. Fixed. 2012-03-19 23:09:18 -07:00
Piotr Esden-Tempski
ec34e21ead Changed parameter size for trigger enable. 2012-03-19 20:20:05 -07:00
Piotr Esden-Tempski
451a5e227d Started some cleanup in the ADC headers and convenience code. 2012-03-19 17:38:24 -07:00
Piotr Esden-Tempski
4fbd42148a Added basic exception handling to the stm32 linker scripts. Thanks Mike Smith! 2012-03-18 22:59:31 -07:00
Piotr Esden-Tempski
789ae97212 Some additional LGPL3+ license change cleanups.
Changed the license to LGPL3+ for some makefiles that got ommited in the
previous big patch commit.

Corrected a find and replace error in a linker file.
2012-03-02 15:39:15 -08:00
Piotr Esden-Tempski
43561de329 License change of the library to LGPL, version 3 or later.
Agreed to by all the significant contributors to the library.
2012-03-02 14:44:49 -08:00
Piotr Esden-Tempski
ec904f176b Cleaned up and streamlined DMA support for f1. Definitely needs a bunch of testing! 2012-02-29 16:02:51 -08:00
Piotr Esden-Tempski
cbef43ddd8 Added set priority group convenience function. 2012-02-24 16:43:37 -08:00
Gareth McMullin
03e44e91e3 Linker scripts provide stack pointer at the top of RAM.
Thanks to Tomaz Solc.
2012-02-12 15:00:09 -08:00
Piotr Esden-Tempski
1a3ad6e998 Added the entry point definiton to all stm32 linker scripts. This allows gdb to reset the target correctly on exit. 2012-02-11 22:24:41 -08:00
Uwe Hermann
9532195e65 More coding-style and cosmetic fixes. 2012-02-06 23:39:06 +01:00
Fergus Noble
fae83c43c1 Discard .ARM.exidx section to make newlib 64bit (long long) printf support work. This may need to be fixed if using C++. 2012-02-06 23:08:06 +01:00
Piotr Esden-Tempski
bf4f8480a6 Added address legend to the interrupt vector. Made it easier to crosscheck for correctness. 2011-11-16 18:41:48 -08:00
Piotr Esden-Tempski
c6f30043fd Added UART4 and UART5 gpio definitions for stm32f1. Also corrected the naming everywhere. Both peripherals are UARTS not U_S_ARTS. 2011-11-16 18:17:56 -08:00
Uwe Hermann
608ca2a811 stm32/f1/gpio.c: Add some Doxygen comments. 2011-11-17 00:12:47 +01:00
Uwe Hermann
d97c937b8e lib: More small fixes. 2011-11-17 00:09:29 +01:00
Uwe Hermann
8725bc5171 lib/stm32/f1: Coding-style fixes. 2011-11-17 00:09:27 +01:00
Gareth McMullin
7546ad9736 Fixed loading of .data in linker scripts.
This fixes a problem where the linker included some padding
bytes between the end of the .text section (_etext) and the
start of the .data section.

The C runtime copies from _etext, so all static initialised data
was corrupted.  This change forces the .data section to be written
at _etext to avoid this problem.
2011-11-12 21:29:41 +13:00
Stephen Caudle
4c18313da6 Fix alignment issue in data section 2011-11-07 23:23:16 -05:00
Stephen Caudle
1dc4645732 Update makefiles to reflect stm32 lib folder name changes 2011-10-30 17:42:49 -04:00
Stephen Caudle
b3a710b0bc Rename stm32 lib folders to be consistent with include 2011-10-30 17:42:49 -04:00