| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
We're going to merge into master without F2 support for this.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
|
|
|
|
|
|
| |
libmaple takes orders, it doesn't give them.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Tested on Maple Mini with examples/mini-exti-test. Changes to Wirish
are minor: use the new EXTI types exti_num and exti_cfg (see below) in
place of now-deprecated variants in ext_interrupts.cpp.
The way I originally did libmaple/exti.h was stupid, and fixing it
turned out to be a little disruptive.
libmaple/exti.h depends on libmaple/gpio.h (for AFIO), but that's a
classic case of exposed implementation detail. So invert the
dependency: make gpio.h depend on exti.h. Do this by adding exti_num
and exti_cfg to exti.h; these respectively replace afio_exti_num and
afio_exti_port. The afio_* variants are now deprecated. (Throw in a
typedef and some macros at the bottom of the F1 series/gpio.h for
backwards compatibility).
Make exti_attach_interrupt() and exti_detach_interrupt() take
exti_num/exti_cfg arguments instead of the afio_* variants.
Make the EXTI dispatch routines __always_inline to defeat GCC -Os.
Many renames throughout libmaple/stm32f1/ to stop using the deprecated
names. Also move the previously F1-only gpio_exti_port() function into
the public libmaple header. Reimplementing it in terms of rcc_clk_ids
lets us deprecate the gpio_dev->exti_port field, which will save space
in the future.
While we're there, I notice that struct gpio_dev is defined once per
series. That's dumb, as it misses the entire point of having device
structs: they contain what's portable. So put the F1 version (which
has the extra EXTI port field) into libmaple/gpio.h, and add the
necessary exti_ports to libmaple/stm32f2/gpio.c. Sigh. We'll get rid
of it eventually, at least.
Clean up some other mistakes in gpio.h files as well (mostly removing
util.h dependency). Sorry for the messy commit.
For portability, add a new series-specific exti function,
exti_select(). The F1 version in (new) libmaple/stm32f1/exti.c uses
AFIO and some new private functionality in libmaple/exti.c and (new)
libmaple/exti_private.h to make this convenient. We'll be able to do
the SYSCFG equivalent on F2 without any trouble.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
|
|
|
|
|
|
| |
Works on F1, doesn't on F2. Will figure that out next.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Untested, but the timers work on F2 (see exampes/test-timers.cpp), so
I'm hoping this is mostly OK. Note that there's an issue with TIMER2
and TIMER5 on F2: these timers have 32-bit counters, and the
HardwareTimer methods are all based on uint16 (like on F1).
I'm sorely tempted to keep this as-is; exposing the extra bits is just
extra documentation, and the HardwareTimer interface is already way
too complicated. The interface should still _work_; it just hides the
fact that you're missing out on the extra bits for some of the timers.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
|
|
|
|
|
|
|
| |
Yay, it just worked! Still, while we're here, touch up the make-up on
wirish_analog.cpp.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
| |
This is portable.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
|
|
|
|
| |
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
|
|
|
|
|
|
|
| |
The only nonportable parts of this file are based on the assumption
that we're on ILP32.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
The current shiftOut() is borrowed from Arduino, and is in an LGPL
file. Replace that file with a new MIT-licensed version containing a
new implementation.
The new version brings the clock line LOW before starting, to make
sure that the first pulse is detected if the clock line was previously
HIGH.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
There's enough infrastructure for a basic board.cpp on STM32F2, so we
might as well bring this back.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
We'll need to bring all this functionality back online piecemeal as we
add F2 support.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
|
|
|
|
|
|
| |
The wirish/comm/ directory is stupid.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Remove libcs3-related bits from support/ld. Break them out into
libmaple proper and Wirish as appropriate: vector table definition and
ISR declarations go into libmaple proper, and startup code goes into
Wirish. Vector table symbols are included into common.inc from an
STM32 family-specific directory under support/ld/stm32.
This is a combination of 5 commits. Individual commit messages follow:
libcs3_stm32_src: Don't depend on cs3.h.
So we can use the existing toolchain.
Move ISR decls/vector table into libmaple proper.
This allows us to configure the vector table on a per-family basis.
- Move
support/ld/libcs3_stm32_src/stm32_isrs.S
stm32_vector_table.S
to
libmaple/stm32f1/isrs_performance.S
vector_table_performance.S,
respectively.
The directory libmaple/stm32f1/ is intended to hold all
STM32F1-specific code within libmaple. Obviously, there's a lot of
work to do before this becomes true.
- support/ld/libcs3_stm32_src/Makefile: Don't try to compile
stm32_isrs.S and stm32_vector_table.S anymore.
- Add libmaple/stm32f1/rules.mk to include these new files in the
standard libmaple build.
- support/make/target-config.mk: Add LIBMAPLE_MODULE_FAMILY, which
selects a directory to use as a family-specific libmaple
submodule.
- Makefile: Add LIBMAPLE_MODULE_FAMILY to LIBMAPLE_MODULES.
Remove support/ld/libcs3_stm32_src and derived object files.
From support/ld/libcs3_stm32_src, move start.S and start_c.c into
Wirish. Modify wirish/rules.mk accordingly.
Delete support/ld/libcs3_stm32_*_density.a. These are no longer
necessary, as the relevant objects are included in the standard Wirish
build. Remove the GROUP statements from the board linker scripts
accordingly.
Remove SEARCH_DIR(.) from common.inc; it's no longer necessary. Also
fix up some comments that are now out of date.
wirish/start_c.c: Don't use CS3-style memory initialization.
Switch memory initialization to a simpler style of initializing .data
if necessary, then zeroing .bss. Initializing .data is only necessary
during Flash builds, since during RAM builds, LOADADDR(.data) ==
ADDR(.data).
This makes libmaple completely incompatible with the CS3 startup
sequence. Subsequent commits will clean up the namespace to reflect
that fact.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
HardwareTimer was removed from the build when the timer refactor was
done; this redoes it in terms of the new timer.h interface. A variety
of conflicting or badly designed bits were deprecated or removed.
I'm still not satisfied with this interface, as it's going to make
life difficult moving forward to high-density chips, where the
addition of basic timers means that the capture/compare methods won't
apply in some cases. However, we need to get 0.0.10 out the door, so
it'll have to do for now.
The docs are up to date, and contain a warning that the Wirish API
isn't stable and a recommendation to use libmaple proper.
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
/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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Basic PWM works. Had some problems in testing that might be due to
USART bugs.
HardwareTimer has been removed from the build for now; I will
re-implement it in terms of the new libmaple API, but consider it
deprecated. Let's come up with something better.
Servo is implemented in terms of HardwareTimer, so it also has been
temporarily removed from the build.
pwmWrite() likely got a little bit less inefficient due to
indirection, but the PIN_MAPs shrank by a pointer per PinMapping.
|
| |
|
| |
|
|
|
|
|
|
| |
ripped out marti's SystemTick for the sake of simplicity and added a
systick_resume function to libmaple. new example program demonstrates
the functionality, also demonstrates micros()/USB bug
|
| |
|
|
|
|
| |
support/make/build-rules.mk
|
|
|
|
| |
examples code cleanup, more descriptive comments, more notes
|
|
Major build system rewrite. New and exciting:
1. Proper dependency tracking. All source files including header files
should be properly tracked and recompiled as necessary when they are
changed.
2. Build-type tracking. If the target changes from 'ram' to 'flash,'
for example, the build system will force a rebuild rather than
incorrectly link modules to a different address.
3. New targets:
The old 'ram,' 'flash,' and 'jtag' targets have been replaced with
the environment variable MAPLE_TARGET, which controls the link address.
Users can either export it to their environment, or pass MAPLE_TARGET on
the command-line. Once this is set, sketches can be compiled with 'make
sketch,' or simply 'make.'
Note: the default is MAPLE_TARGET='flash.'
The target 'install' now automagically uploads the sketch to the board
using the appropriate method.
The 'run' target has been renamed to 'debug.' It starts an openocd gdb
server.
4. Odds and ends:
-Verbose and 'quiet' modes. Set V=1 for verbose compilation, the default
is quiet.
-Object file sizes and disassembly information is generated and placed
in build/$(BOARD).sizes and build/$(BOARD).disas, respectively.
-Parallel make with -j should speed things up if you have multiple
cores.
|