Commit graph

12 commits

Author SHA1 Message Date
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 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 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 8796a81efc Slightly improve and generify the USB infrastructure.
The good news is that <libmaple/usb.h> and <libmaple/usb_cdcacm.h> did
turn out generic enough in what they specify to go on unchanged.

However, we can't just go on assuming that there's USB just because
we're on an F1. Now that there's value line in the tree, we need to be
more careful (value line F1s don't have USB peripherals). To that end,
make all the F1 board-includes/*.mk files specify what line their MCU
is with an MCU_F1_LINE variable. Use that to hack
libmaple/usb/rules.mk so we only try to build the USB module under
appropriate circumstances.

While we're at it, add a vector_symbols.inc for value line MCUs under
support/ld/. We need this to get the target-config.mk modifications
implied by the addition of MCU_F1_LINE. We'll fix up some other
performance-line-isms under libmaple/stm32f1 in a separate commit.

Also in libmaple/usb/:

- Move everything into a new stm32f1 directory. Due to aforementioned
  rules.mk hacks, there is no immediate need for an stm32f2
  directory (USB support doesn't exist there).

- Update the README for style and content.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-03 22:40:39 -04:00
Marti Bolivar 6c52b7e870 Bring timer initialization back to init().
Turns out the F1 code was pretty portable after all, so take it from
the F1 boards_setup.cpp and stick it back into boards.cpp. The only
change needed was to add a call to the newly-minted
timer_has_cc_channel() (and this is necessary on F103 XL-density,
anyway).

Also assert LeafLabs copyright in boards.cpp. We really need to do
this throughout the library; it's basically been rewritten since
Perry.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-02 21:04:13 -04:00
Marti Bolivar 9d8a2d7d0e examples/blinky.cpp works on F2.
Only OUTPUT mode is tested; any other modes might work, but no
guarantees.

Bring back:

- wirish/wirish_digital.cpp
- wirish/cxxabi-compat.cpp
- wirish/wirish_time.cpp

Add new:

- wirish/stm32f1/wirish_digital.cpp
- wirish/stm32f2/wirish_digital.cpp

Move pinMode() from wirish/wirish_digital.cpp into the file by the
same basename in wirish/stm32f1. This implementation is tied to
F1. Add an F2 implementation in wirish/stm32f2/wirish_digital.cpp.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-05-31 17:24:41 -04:00
Marti Bolivar 53a51ccf05 stm32.h: Various updates, mostly to help STM32F1 line support.
Add STM32_HAVE_USB feature test macro requirement for
<series/stm32.h>. This will let us test if we've got a USB peripheral.
wirish/stm32f1/boards_setup.cpp is set up to use this when turning on
USB CDC ACM support at init() time.

Rework the STM32F1 <series/stm32.h> to make it easier to support the
various lines that subdivide that series. We don't really support
anything besides performance line yet, but there's been enough
enthusiasm for value and connectivity line support in the past that
these hooks seem worth adding. This means adding an STM32_F1_LINE
macro and STM32_F1_LINE_[PERFORMANCE,VALUE,ACCESS,CONNECTIVITY] macros
for values that STM32_F1_LINE can take, and generalizing the rest of
the file to begin taking this into account. Some TODOs remain, but
filling these in is the responsibility of future libmaple porting
efforts.

One pleasant consequence of the F1 stm32.h rework is that the build
system no longer has to tell us what density of F103 we're building
for, so remove that from the relevant support/make/board-includes/
files.

Add some tweaks to <libmaple/stm32.h> and the STM32F2 stm32.h header
to make sure this went through properly, and continues to go through
properly in the future.
2012-04-24 05:01:28 -04:00
Marti Bolivar 645ab9108a stm32f1 boards_setup.cpp: Allow overriding the PLL multiplier.
Allow <board/board.h> to override the PLL multiplier by defining
BOARD_RCC_PLLMUL. This should be useful for e.g. value line MCUs,
which have slower clocks. It's also probably useful for people who
have external oscillators different from the 8 MHz ones we use on all
of our boards.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-04-23 13:45:15 -04:00
Marti Bolivar a949744d3c Resurrect ADC support.
Standard refactoring: add series headers for F1 and F2, along with
series adc.c files. There are some issues relating to adc_extsel_event
to hammer out later, but this will do for now.

We also add some new portability interfaces to libmaple/adc.h in order
for Wirish to use the same code to initialize the ADCs at init() time.

As usual, F1 is untested.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-04-11 16:56:56 -04:00
Marti Bolivar 87ce0f6c58 [FIXME] Resurrect boards.cpp for F2 and F1.
FIXME:

- F1 support currently appears to be failing in start_c.c, for some
  unknown reason. This will need to get sorted out later.

Add a new wirish namespace, and a sub-namespace wirish::priv::. Put a
bunch of board setup routines in this namespace, and declare them in
new wirish/boards_private.h. boards.cpp uses this to perform
initialization tasks in a portable way, with two new boards_setup.cpp
files under wirish/stm32f1 and wirish/stm32f2 handling the
series-specific details.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-04-11 16:56:54 -04:00