Commit graph

262 commits

Author SHA1 Message Date
Daniel Nyström ce07837e32 wirish/syscalls.c: Replace obsolete caddr_t with void *
caddr_t is obsolete in POSIX and thus unavailable in most modern
toolchains. caddr_t usage should be replaced by void *.

stddef.h includes the size_t typedef which was missing.

Signed-off-by: Daniel Nyström <daniel@nystrom.st>
2013-06-04 14:17:38 +02:00
Magnus Lundin f55297e7a3 Use linker symbol __text_start__ to setup base of nvic vector table.
Signed-off-by: Magnus Lundin <lundin@mlu.mine.nu>
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2013-05-03 19:10:21 -04:00
Magnus Lundin f66451de16 wirish/syscalls.c: add weak exit function.
For toolchains which require an exit function.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2013-05-02 11:39:24 -04:00
Manuel Odendahl cea8158e97 Check if the last packet sent was the full endpoint size, in this case flush the host buffers by sending a 0 byte packet
Signed-off-by: Manuel Odendahl <wesen@ruinwesen.com>
2013-01-17 21:23:37 +01:00
Marti Bolivar c5dfc108e6 Merge branch 'callback_interrupt_handlers' 2012-09-03 18:29:45 -04:00
Marti Bolivar d3581c10d5 ext_interrupts.cpp: Doxygen fixups.
Keep the Doxygen in the header as per Wirish conventions.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-09-03 18:27:51 -04:00
Marti Bolivar ef280366bc Whitespace fixups to EXTI files.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-09-03 18:27:18 -04:00
Aditya Gaddam e77b2b7f46 "Callback versions of functions now take voidArgumentFuncPtr. We can probably use voidFuncPtr instead, but this way people can see that the function expects something different. Existing functions haven't changed in signature.
Signed-off-by: Aditya Gaddam <adityagaddam@gmail.com>"
2012-09-02 11:04:01 -04:00
Marti Bolivar 9992325cef Include <stdint.h> from wirish.h.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-08-31 16:12:28 -04:00
Aditya Gaddam f6f2601213 "Added ability to set callbacks for interrupts that get an argument. This argument can be the instance that needs to handle the interrupt, or just a random argument you might find useful later. Suggestions from mbolivar and iperry from pull53 on libmaple were taken into account.
Signed-off-by: Aditya Gaddam <adityagaddam@gmail.com>"
2012-08-31 14:19:57 -04:00
Marti Bolivar 853d0b1a5a HardwareSPI: move warning into .cpp from header.
This causes the warning to be emitted at most once. As is, it can be
emitted each time HardwareSPI.h is included, which is annoying.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-08-27 16:50:57 -04:00
Marti Bolivar 2022b933be usb_serial.cpp: Hackishly silence spurious warnings on VLDiscovery.
Guard hooks with BOARD_HAVE_SERIALUSB to keep GCC quiet.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-08-27 16:50:57 -04:00
Marti Bolivar 64e8a234bf usb_serial.cpp: Neaten up reset signal RX hook.
Move magic bytes from stack to Flash. De-magic-number sizeof magic
byte buffer. Use uintptr_t instead of unsigned int when casting
address of wait_reset().

Based on a patch by Michael Hope.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-08-22 13:26:43 -04:00
Marti Bolivar a3a49c3ea9 Make PRIMASK set/clear functions __always_inline.
This is just to ensure that -Os doesn't prevent these from getting
inlined.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-08-14 11:35:01 -04:00
Marti Bolivar c3a8dfd1ca wirish/ext_interrupts.h: Doxygen
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-08-14 11:32:47 -04:00
Marti Bolivar 2424108a14 Add support for ARM's GCC ARM embedded toolchain.
Based on patches provided by Hanspeter Portner:

http://forums.leaflabs.com/topic.php?id=1717#post-11812
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-08-05 13:27:13 -04:00
Marti Bolivar 6126bf5919 Move bootloader details out of libmaple.h.
Finally!

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-07-31 17:27:43 -04:00
Marti Bolivar 15b8a03de9 HardwareSerial: make read() block until data arrive.
This makes the HardwareSerial behavior match that of SerialUSB, and
should help avoid confusion.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-07-31 16:49:00 -04:00
Marti Bolivar 365f45679b Move bootloader reset signal detection to Wirish.
Use usb_cdcacm hooks to move the DTR edge and "1EAF" magic packet
detection to usb_serial.cpp. We'll later be able to extend this system
to support Leonardo-style reset signalling.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-07-31 15:04:49 -04:00
Marti Bolivar 7c976e4e5d Hack: Provide a hook so Mini doesn't disable JTAG/SWD.
The nonexistence of a configuration system is starting to become kind
of a pain. Oh well; let's keep piling hacks on until things break.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-07-31 15:04:49 -04:00
Marti Bolivar 77efc209f9 usb_serial.cpp: Minor tweak.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-07-25 17:19:41 -04:00
Marti Bolivar dbb3869eda Add pin alias enums to other boards.
Repeat Anton's VLDiscovery trick on the rest of the boards. Leave out
st_stm3220g_eval since that's just a teaser to get people to play with
F2.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-07-24 19:12:29 -04:00
Marti Bolivar 50ee2097b3 Doxygen hacks and fixups.
- Shut Doxygen up in various places
- Fix some genuine docs bugs
- Ignore sources we're not responsible for

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-28 17:29:43 -04:00
Marti Bolivar 5675fb0d73 Clean up micros().
Don't leave US_PER_MS user-visible. Remove an unnecessary variable.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-27 14:04:10 -04:00
Marti Bolivar 12aecf584e STM32F1: Bring back HardwareSPI.
We're going to merge into master without F2 support for this.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-26 18:13:12 -04:00
Marti Bolivar 139ea7c353 Bring back and fix up util.c functionality.
Rip out the existing nonportable pieces, and shove them under
wirish/stm32f1, using weak symbols so users who only want libmaple
proper don't end up with build errors. Add stubbed-out (and only
partially functional) definitions for F2 targets under wirish/stm32f2.

The behavior on F103 targets is the same as it was before (though the
assertion framework has always been broken and badly needs
replacement, that awaits another commit). We additionally now skip
re-enabling USB on F1 targets without USB, to make things work on
value line MCUs.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-26 18:03:40 -04:00
Marti Bolivar bf2600871e HardwareTimer: add a c_dev().
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-13 11:54:42 -04:00
Marti Bolivar 707b552a65 HardwareSPI: add a c_dev().
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-13 11:54:42 -04:00
Marti Bolivar 13a0db8f74 HardwareSerial: Add c_dev() accessor for instance's usart_dev*.
This is analagous to std::string::c_str().

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-13 11:54:20 -04:00
Marti Bolivar e3fc4cd14d Typo fix.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-12 16:03:17 -04:00
Marti Bolivar bcad639ff9 maple: board.cpp: More comments.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-08 18:46:25 -04:00
Marti Bolivar 93eb9368db Bring back <wirish/wirish_debug.h>.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-08 18:34:33 -04:00
Marti Bolivar a58d1275c6 maple: board.h: More comments, remove SYSTICK_RELOAD_VAL.
We derive SYSTICK_RELOAD_VAL from CYCLES_PER_MICROSECOND now, so let's
hide it for expert use.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-08 18:21:02 -04:00
Marti Bolivar 14ce7ffcca wirish/syscalls.c: Assert LeafLabs copyright.
_sbrk() is new in 2011, and there've been changes in 2012.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-07 19:15:05 -04:00
Marti Bolivar f370db157f wirish/syscalls.c: Weaken I/O related function defs.
For overriding.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-07 19:15:05 -04:00
Marti Bolivar d14105d11e Move syscalls.c into Wirish.
libmaple takes orders, it doesn't give them.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-07 19:15:05 -04:00
Marti Bolivar e652fe6e58 maple/board.cpp: Demo weakness of boardInit().
This shows people what to do to write boardInit(), but also how to
save work if they don't need it.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-07 03:38:30 -04:00
Marti Bolivar eb0dcd048f maple/board.cpp: Use PMAP_ROW().
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-07 03:38:30 -04:00
Marti Bolivar d44225c4bb board_private.h: Add PMAP_ROW() convenience macro.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-07 03:38:30 -04:00
Marti Bolivar c1771ff616 maple/board.cpp: Add more explanatory comments.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-07 03:38:30 -04:00
Marti Bolivar 9a081c2d52 isButtonPressed(): Take a pin and pressedLevel argument.
This allows dealing with push-buttons on pins other than
BOARD_BUTTON_PIN.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-07 03:38:30 -04:00
Marti Bolivar 8266812149 <wirish/boards.h>: Add BOARD_BUTTON_PRESSED_LEVEL.
This allows boards to override the logic level of a pressed
button. All Maple boards have a pressed button read HIGH, but if the
opposite convention is used, isButtonPressed() will infinite loop.

Make isButtonPressed() respect this setting.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-07 03:38:30 -04:00
Marti Bolivar 0986300f42 wirish/boards.h: Optionally derive SYSTICK_RELOAD_VAL.
It's stupid to make everyone keep this around.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-07 03:38:29 -04:00
Marti Bolivar 4e20383ff5 STM32F2: Allow boards to override PLL configuration.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-07 03:38:29 -04:00
Marti Bolivar 4f4b601504 HardwareSerial.cpp: Fix "#warn" -> "#warning".
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-07 03:38:29 -04:00
Marti Bolivar cc28a31a5b wirish: Weaken boards_private.h definitions.
This lets users override them conveniently if our decisions don't
suit.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-07 03:38:29 -04:00
Marti Bolivar dbe91ade96 Provide wirish::priv::series_init() on F1.
This lets us remove the weak definition in boards.cpp.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-07 03:38:29 -04:00
Marti Bolivar 4d6905d298 Remove a completed FIXME comment.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-07 03:38:28 -04:00
Marti Bolivar 3cc2ff5f50 STM32F2: Add EXTI support.
Add series headers to keep the base pointers, and (on F2) use SYSCFG
to tell exti_do_select() where the EXTI control registers are. No
surprises.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-03 22:45:41 -04:00
Marti Bolivar c2a5783312 STM32F2: Turn on SYSCFG I/O compensation during init().
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-03 22:45:41 -04:00