Commit graph

35 commits

Author SHA1 Message Date
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 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 bcad639ff9 maple: board.cpp: More comments.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-08 18:46:25 -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 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 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 a504da225d Preprocessor-fu to derive BOARD_HAVE_USARTn from <board/board.h>.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-01 17:26:03 -04:00
Marti Bolivar d2c4bd6564 Bring back HardwareSerial.
To make this happen, we need to have <board/board.h> tell us whether
or not it's got each of the USARTs. Do that with BOARD_HAVE_USARTn,
for n = 1,...,6. This lets us define HardwareSerial instances only
when appropriate, and gets rid of some board-specific hacks we'd
accumulated.

The new <libmaple/usart.h> now has a convenience function for
determining the bus rate by using the appropriate STM32_PCLKx macro,
so we can shave a uint32 per instance, which is nice given that
they're all going to be in memory. This changes the constructor
arguments, but the API only specifies the semantics of the predefined
instances, so this is still backwards-compatible. (We should look into
storing the instances in Flash -- they don't change, after all.)

We don't actually need struct usart_dev's definition in
HardwareSerial.h, so replace it with a forward declaration and include
<libmaple/usart.h> it in HardwareSerial.cpp instead.

Assert some copyrights.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-01 01:28:51 -04:00
Anton Eltchaninov 2fb91678e0 STM32VLDiscovery support files
Signed-off-by: Anton Eltchaninov <anton.eltchaninov@gmail.com>
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-05-03 14:09:05 -04:00
Marti Bolivar 9ee66ebd61 [WIP] boards: Add st_stm3220g_eval.
This supports ST's STM3220G-EVAL, the standard "kitchen-sink"
evaluation board for the STM32F2 series.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-04-11 16:56:54 -04:00
Marti Bolivar 954f9e5065 Move public headers to include directories; related cleanups.
Move libmaple/*.h to (new) libmaple/include/libmaple/. The new
accepted way to include a libmaple header foo.h is with:

    #include <libmaple/foo.h>

This is more polite in terms of the include namespace. It also allows
us to e.g. implement the Arduino SPI library at all (which has header
SPI.h; providing it was previously impossible on case-insensitive
filesystems due to libmaple's spi.h).

Similarly for Wirish.

The old include style (#include "header.h") is now deprecated.

libmaple/*.h:

- Change include guard #defines from _FOO_H_ to _LIBMAPLE_FOO_H_.
- Add license headers where they're missing
- Add conditional extern "C" { ... } blocks where they're missing
  (they aren't always necessary, but we might was well do it against
  the future, while we're at it.).
- Change includes from #include "foo.h" to #include <libmaple/foo.h>.
- Move includes after extern "C".
- Remove extra trailing newlines

Note that this doesn't include the headers under libmaple/usb/ or
libmaple/usb/usb_lib. These will get fixed later.

libmaple/*.c:

- Change includes from #include "foo.h" to #include <libmaple/foo.h>.

Makefile:

- Add I$(LIBMAPLE_PATH)/include/libmaple to GLOBAL_FLAGS.  This allows
  for users (including Wirish) to migrate their code, but should go
  away ASAP, since it slows down compilation.

Wirish:

- Move wirish/**/*.h to (new) wirish/include/wirish/.  This ignores
  the USB headers, which, as usual, are getting handled after
  everything else.

- Similarly generify wirish/boards/ structure. For each supported
  board "foo", move wirish/boards/foo.h and wirish/boards/foo.cpp to
  wirish/boards/foo/include/board/board.h and
  wirish/boards/foo/board.cpp, respectively. Also remove the #ifdef
  hacks around the .cpp files.

- wirish/rules.mk: put wirish/boards/foo/include in the include path
  (and add wirish/boards/foo/board.cpp to the list of sources to be
  compiled). This allows saying:

      #include <board/board.h>

  instead of the hack currently in place. We can allow the user to
  override this setting later to make adding custom board definitions
  easier.

- Disable -Werror in libmaple/rules.mk, as the current USB warnings
  don't let the olimex_stm32_h103 board compile. We can re-enable
  -Werror once we've moved the board-specific bits out of libmaple
  proper.

libraries, examples:

- Update includes accordingly.
- Miscellaneous cosmetic fixups.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-04-11 16:56:50 -04:00
Marti Bolivar 545aae4459 usb: Move some board-specific configuration to Wirish.
Create new BOARD_USB_DISC_DEV and BOARD_USB_DISC_BIT board-specific
values.  Use these as arguments to setupUSB() and disableUSB().  This
helps make the USB stack more generic, and goes towards the resolution
of an important FIXME.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2011-10-18 13:30:17 -04:00
David Kiliani 1873871aea Add support for the Olimex STM32 H103 board.
Pin layout and header files for the STM32 H103 prototype board from
Olimex featuring an STM32F103RBT6 chip. This commit contains all
necessary changes to compile with BOARD=olimex_stm32_h103.

Signed-off-by: David Kiliani <mail@davidkiliani.de>
2011-09-27 16:44:53 -04:00
Marti Bolivar 0697f5d0d6 maple_native.cpp: Cosmetics.
Stick FSMC_BCR_MTYP_SRAM among the bitfields assigned to the BCR
write.  Technically not necessary (SRAM is the default after reset),
but good for readability and future-proofing.
2011-09-12 21:29:50 -04:00
Marti Bolivar 626e4e06f0 Maple Native: Fix BOARD_NR_USED_PINS, boardUsedPins. 2011-09-09 15:33:11 -04:00
Marti Bolivar 4a98ddaccb wirish/boards: Move includes into .cpp files.
The headers just #define some numbers, so there's no need for them to
be including libmaple headers.
2011-09-01 09:38:39 -04:00
Marti Bolivar d349f7cd6b maple_native.cpp: Add FSMC FIXME to resolve for 0.0.12. 2011-09-01 09:35:11 -04:00
Marti Bolivar 1769ba3a05 maple-native.cpp: Comment tweak.
First in what is sure to be a long series of efforts in educating
people that you can have GPIOs 56--100 or the SRAM chip, but not both.
2011-08-31 15:32:29 -04:00
Marti Bolivar 15b9adcf66 maple_native.cpp: mark initSRAMChip() static. 2011-08-31 15:00:54 -04:00
Marti Bolivar d055e99a9f maple_native.h: Fix USART pins.
These apparently didn't get updated from an earlier prototype's
values.
2011-08-30 18:16:00 -04:00
Marti Bolivar 9d9275e7a0 Docs: Fix several board-specific values.
Ugh.

Fix BOARD_NR_ADC_PINS and boardADCPins on Maple, Maple Mini, and Maple
RET6 Edition:

Maple and Maple RET6 Ed. don't have ADC on pin 3.  Seems likely that
the error was due to AIN being missing on the silkscreen.  They also
have ADC on pin 13.  This is not really true due to the voltage drop
across the built-in LED.

Maple Mini really should not include BOARD_LED_PIN among its ADC pins,
since it's not broken out to a header.

Fix BOARD_NR_PWM_PINS and boardPWMPins on Maple and RET6 Ed:

Both boards falsely include pin 25 as a PWM pin.  Maple RET6 Edition
also lacks some PWM pins.

Fix BOARD_NR_SPI on Maple RET6 Edition:

SPI3 uses PB4, which is unusable since it's tied to NRST.  This means
that SPI3 is not available on the RET6 edition.  Decreasing
BOARD_NR_SPI to 2 to accomodate this.  Leave the BOARD_SPI3_*_PIN
defines intact so as not to further clutter the rest of the library
with RET6-specific wrinkles.
2011-05-26 02:42:07 -04:00
Marti Bolivar 7444fc5a7a Punting the fix of Maple Native's boardUsedPins to 0.0.12. 2011-05-19 15:03:21 -04:00
Marti Bolivar f3d44dfa4e Adding SPI3 definitions for Maple RET6 Edition. 2011-05-11 13:23:30 -04:00
Marti Bolivar 5cf58d39d4 Maple Mini pin map fix.
Thanks, Xavier!
2011-05-04 13:36:52 -04:00
Marti Bolivar c436ffa1bb Native and FSMC cleanups.
Got rid of native_sram.h (and native_sram.cpp), and pushed their
functionality into maple_native.cpp.  Fixed includes in maple_native.h.

Fixed includes in fsmc.h.
2011-05-04 13:29:55 -04:00
Marti Bolivar 77f707d7b8 SPI refactor.
Still a polling driver, but the libmaple proper interface exposes
enough that users enable the various interrupts and define their own
IRQ handlers if they feel like it.

Wirish HardwareSPI interface was largely redone; it's more like the
Arduino implementation now, although there are some differences when I
didn't like their API.  The old methods are still there, but are
deprecated and slated for deletion in 0.1.0.

New board-specific values: BOARD_NR_SPI, BOARD_SPIx_NSS_PIN,
BOARD_SPIx_MOSI_PIN, BOARD_SPIx_MISO_PIN, and BOARD_SPIx_SCK_PIN, for
x from 1 to BOARD_NR_SPI.

Documentation was updated appropriately.
2011-04-28 14:23:30 -04:00
Marti Bolivar d4552d602c maple_native.cpp updates/fixes. 2011-04-27 17:38:55 -04:00
Marti Bolivar d5097adadf RET6 fixes 2011-04-27 15:33:06 -04:00
Marti Bolivar 2f07cb6f6c Better debug port support.
- gpio.h: afio_mapr_swj_config() renamed afio_cfg_debug_ports()

- [new] wirish_debug.h: disableDebugPorts(), enableDebugPorts()

- Maple, Maple Native, and Maple RET6 PIN_MAPs are now larger by 5,
  have mappings for the extra JTAG/SW pins.

  Documentation was updated appropriately.
2011-04-25 22:03:25 -04:00
Marti Bolivar 61ac368578 Updating Maple Native pins for prototype C. 2011-04-13 15:49:05 -04:00
Marti Bolivar 6cf3178996 Board-specific values; corresponding QA test generalizations.
Various board-specific #defines and arrays of pins added.

For the changelog (some of this information predates this commit):

* wirish/boards.h now declares the following arrays of pin numbers:

      * boardPWMPins - PWM-capable pins
      * boardADCPins - ADC-capable pins
      * boardUsedPins - pins already in use, e.g. BOARD_BUTTON_PIN

  It also declares a bool boardUsesPin(uint8 pin) function for
  convenient testing of whether a pin is in use.

* wirish/boards/*.h now define:

      * BOARD_USART1_TX_PIN
      * BOARD_USART1_RX_PIN
      * BOARD_USART2_TX_PIN
      * BOARD_USART2_RX_PIN
      * BOARD_USART3_TX_PIN
      * BOARD_USART3_RX_PIN
      * BOARD_NR_GPIO_PINS (renamed from NR_GPIO_PINS)
      * BOARD_NR_USARTS (renamed from NR_USARTS)
      * BOARD_NR_PWM_PINS
      * BOARD_NR_ADC_PINS
      * BOARD_NR_USED_PINS

* wirish/boards/maple_native.h now defines:

      * BOARD_UART4_TX_PIN
      * BOARD_UART4_RX_PIN
      * BOARD_UART5_TX_PIN
      * BOARD_UART5_RX_PIN

  (Unfortunately, wirish/boards/maple_RET6.h cannot, since at least
  one of the UART4/UART5 pins are used already; this will require layout
  changes for a wide-release Maple form factor RET6 board).

* wirish/boards/*.cpp all include the corresponding array definitions.
  They all live in flash by default, thanks to the new __FLASH__ macro
  in wirish/wirish_types.h, which is a synonym for the existing __attr_flash
  #define in libmaple/libmaple_types.h.

The documentation was updated to include this information.  It also
gained various FIXME/TODO comments related to its generalization
across boards.

The quality assurance-related examples (examples/qa-slave-shield.cpp
and examples/test-session.cpp) now make heavy use of board-specific
values to ensure portability.
2011-03-30 07:19:13 -04:00
Marti Bolivar c5e16e9625 Final stm32_pin_info design candidate; ADC3 support on Native.
Added an adc_dev to struct stm32_pin_info.  This was necessary to add
support for the channels on the Native which are only connected to
ADC3, but it does add a bunch of NULLs to the PIN_MAPs.

I don't think any other peripherals need representation on a per-pin
basis.  Each peripheral library will be responsible for keeping track
of related GPIO ports and bits, and we can throw #defines in to
boards/*.h for other things (e.g. BOARD_SPI1_MISO_PIN).

Fleshed out the ADC refactor and brought it more in keeping with the
new design as it evolves.

A couple of other tweaks.  Notably: waitForButtonPress() now takes a
default argument meaning "wait forever".

Removed Maple-specific documentation from core functions in io.h; this
information will need to go into the individual board docs files.
2011-03-25 20:09:30 -04:00
Marti Bolivar 9d2b4e574c Adding /wirish/boards/ for easier porting; shrank PIN_MAPs.
/wirish/boards/ contains xxx.h and xxx.cpp (for xxx=maple,
maple_native, maple_mini, maple_RET6).  The headers contain the
board-specific #defines that used to live in boards.h (except
BOARD_INIT, which was removed).  The CPP files contain the PIN_MAP
definitions that used to live in boards.cpp, and a proper boardInit()
function to replace the old BOARD_INIT macro.  This will make it
easier to add new boards in the future.

struct PinMapping was renamed struct stm32_pin_info, and was moved
into a new wirish_types.h.  Its external interrupt field was moved
into struct gpio_dev, which saves memory by storing an afio_exti_port
per port, rather than one per pin.  Also rearranged the stm32_pin_info
fields to improve packing.  Maple's PIN_MAP is now down to below 500
bytes.
2011-03-24 17:31:47 -04:00