Commit graph

127 commits

Author SHA1 Message Date
Marti Bolivar ad153c3265 reset.py: Hackishly silence DeprecationWarning.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2011-10-07 14:39:07 -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 dcddff677c Add Windows support to DFU installation tools.
Tweak Makefile further for cs-make on Windows.  Add Windows support
to support/scripts/reset.py

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2011-09-26 15:50:12 -04:00
Marti Bolivar 0ae1bcb110 Update support/scripts/copy-to-ide.
Oh, copy-to-ide.  I long for your death.
2011-09-13 05:56:29 -04:00
Marti Bolivar ada25198f6 [support/ld] Unify linker scripts.
Add new common.inc, which is common_rom.inc with some
DEFINED(_FLASH_BUILD) usages thrown in to allow for RAM builds.  It
also uses a new REGION_RODATA region alias for read-only data.

Move section .USER_FLASH to REGION_RODATA.  This means it lives in RAM
under RAM builds.  Although this might be surprising, not doing so
would make RAM builds useless.

Modify the individual board linker scripts to properly set
REGION_RODATA and _FLASH_BUILD before calling out to common.inc.

Delete common_rom.inc, common_ram.inc, common_header.inc, in favor of
common.inc.  This should fix RAM builds on all boards.
2011-09-13 04:44:02 -04:00
Marti Bolivar c8223ee8ab [make] Factor out target/board configuration.
Comment the Makefile more verbosely.  It's been causing confusion on
the forums.

Add target-config.mk, this contains build configuration depending on
the BOARD and MEMORY_TARGET variables.  Its contents were cluttering
up the Makefile and making it harder to read.
2011-09-13 02:22:15 -04:00
Marti Bolivar 9cc8168568 [support/ld] Put Maple Native's heap on external SRAM chip.
Specify _lm_heap_start and _lm_heap_end in Maple Native's linker
scripts to point respectively to beginning and end of FSMC-mapped
external SRAM chip addresses.
2011-09-12 17:25:07 -04:00
Marti Bolivar fc4bd8eb9e [support/ld] Add linker support for reconfigurable heap.
- common_header.inc: Declare EXTERN symbols _lm_heap_start and
  _lm_heap_end.

- common_rom.inc: Check for _lm_heap_start and _lm_heap_end.  If they
  are defined, preserve their values.  Otherwise, _lm_heap_start is
  starts after .bss, and _lm_heap_end is the end of SRAM.

  This allows existing linker scripts to continue using the old heap
  scheme, but allows for customizability elsewhere.

- syscalls.c: Respect the addresses of _lm_heap_start and _lm_heap_end
  as the boundaries of the heap in _sbrk().
2011-09-12 17:25:01 -04:00
Marti Bolivar 780381d160 common_rom.inc: More comments.
Explain what's going on so unfamiliar readers have more hope.
2011-09-12 16:10:10 -04:00
Marti Bolivar 92ea94ce30 common_rom.inc: Eliminate apparently useless sections. 2011-09-09 15:33:11 -04:00
Marti Bolivar 9eca03d946 [support/ld] Rename vector table section. 2011-09-09 15:33:11 -04:00
Marti Bolivar 3668462312 Linker scripts: Remove useless junk. 2011-09-09 15:33:11 -04:00
Marti Bolivar e599718594 Linker scripts: Rename section targets.
Use region aliases in common_ram.inc, common_rom.inc.  These are
provided by the individual board scripts which include these.  Note
that the aliases have horrible names.  We'll need to fix that up.
2011-09-09 15:33:11 -04:00
Marti Bolivar 9bb668bb67 Linker scripts: Indent common_ram.inc, common_rom.inc. 2011-09-09 15:33:05 -04:00
Marti Bolivar 3f890b9587 Tidy up linker scripts.
Comment/whitespace changes only.
2011-09-07 23:34:23 -04:00
Marti Bolivar 8b9a3f4e7a [support/ld] Factor out header from common_rom.inc, common_ram.inc.
The linker scripts share an initial section.  Factor this out into a
new file common_header.inc, and have the main linker scripts include
this file.  Apart from eliminating a redundancy, this will make it
easier to add new linker scripts in the future.
2011-09-07 23:34:23 -04:00
Marti Bolivar cc6d21ac9f Doxyfile: add __DOXYGEN_PREDEFINED_HACK to PREDEFINED.
Doxygen refuses to trust us when we \def something that it doesn't
notice as a #define.  To work around this, we put
__DOXYGEN_PREDEFINED_HACK into our Doxyfile's PREDEFINED, so that
documentation may be inserted for #defines which we know will exist.
2011-08-22 23:29:59 -04:00
Marti Bolivar f4fb5c166e Fix Doxyfile. 2011-08-03 20:14:09 -04:00
Marti Bolivar f99e0310fa DMA: Fix non-working DMA interrupts.
libmaple/dma.c defines DMA interrupts __irq_dma_channel[1-7],
consistent with what is specified by support/ld/names.inc.  However,
names.inc is inconsistent with what support/ld/libcs3_stm32_src/
expects.  Specifically, it contradicts the files

- support/ld/libcs3_stm32_src/stm32_isrs.S
- support/ld/libcs3_stm32_src/stm32_vector_table.S

Which use the names __irq_dma1_channel[1-7].

Change names.inc and dma.c to use the correct IRQ names.

The original names.inc/libcs3_stm32_src inconsistency was introduced
in 43d6921658, but dma.c had the correct
names until ec3cf2903f, where they were
renamed for consistency with names.inc.  At that point, DMA interrupts
stopped working.  (This was documented in the commit message).

Thanks to forum user robodude666 for tracking this down.
2011-06-20 15:22:03 -04:00
Marti Bolivar f36a1d9849 Remove reST documentation, attendant updates.
The documentation covers topics not specifically relevant to libmaple,
so it doesn't make sense for it to be part of the libmaple source
distribution.

Delete the docs/ tree, and prepare libmaple for use with the new
leaflabs-docs repo, which will contain the docs from now on.

* README: update to reflect this change

* support/doxygen/Doxyfile: This is the old docs/Doxyfile

* Makefile: Add a doxygen target

* wirish/comm/HardwareSerial.h: fix reference to docs/.  The comment
  informing maintainers that the HardwareSerial interface is
  documented by hand refers to the docs/ tree, which no longer exists.
  Update it to refer to the separate leaflabs-docs repository.

* support/scripts/copy-to-ide: No longer build the documentation
2011-06-11 20:05:33 -04:00
Camille Moncelier 628750bf82 Added libs in libraries/ to the include path
- This allows to including of libs headers eg:

      #include <Servo.h>

	which wasn't possible for some reason.
2011-06-02 13:26:24 -04:00
Perry Hung 949927dbb0 openocd: Add missing file
Forgot openocd support script in
0e5eb75c80.
2011-05-27 06:55:10 -04:00
Perry Hung 75efbd356e openocd: Fix repeated JTAG flash failure, use alternate reset config
1) Reset, halt, and unprotect the the flash before writing to it.
This fixes a bug in which every other flash attempt would fail.

2) Maple R5 and below have NRST and JTNRST erroneously tied together,
resulting in a full TAP and system reset when a reset is asserted.
This prevents the 'reset halt' command from working.

This can be fixed hard-hack style by cutting the trace out of JTNRST.

Users of the Leaf Maple JTAG adapter will also need to cut the trace
between TRST and SRST.

3) Assuming you have a functioning 'reset halt' setup (see 2),
the 'make debug' command now halts the chip and waits for a gdb
connection before proceeding execution.
2011-05-26 20:44:47 -04:00
Perry Hung 0e5eb75c80 openocd: Detect openocd version
Small script to detect the openocd version and choose the appropriate
debug/flash script for use with JTAG debugging.
2011-05-26 20:13:09 -04:00
Marti Bolivar ff5ae825d6 Converting all files to UNIX newlines.
Committing the results of running the following on the libmaple root
directory:

$ fromdos `grep --exclude-dir='[.]git' -Ilsr $'\r$' .`
2011-05-10 16:41:37 -04:00
Marti Bolivar 812e16a540 Ancillary file cleanups. 2011-04-14 14:28:23 -04:00
Marti Bolivar 27b40a52de stm32loader.py prints more information about what it's doing. 2011-04-08 18:58:58 -04:00
Marti Bolivar b20009eddd Hacks to get things to compile in the IDE. 2011-03-30 13:57:33 -04:00
Marti Bolivar 580f0b6965 Maple RET6 edition support 2011-03-16 17:56:54 -04:00
Perry Hung ce3f7b9fea support: linker: Fix high density vector table
Entries for high-density interrupt vectors were incorrectly declared to
be .weak instead of .long.

Thanks redfox74!
2011-03-15 19:36:46 -04:00
Marti Bolivar 0ce646b265 Cleanups; new support/gdb/gpio.gdb. 2011-03-11 16:46:33 -05:00
Perry Hung 43d6921658 Refactor linker scripts. Rename irq and exception handlers.
Add common linker scripts for ram and rom. Add medium and high density
libraries for libcs3.
2011-02-27 15:56:40 -05:00
Marti Bolivar 12914284f5 Merge branch 'nzmichaelh-master' into master.
This provides DMA, IWDG, PWR, and BKP support, and fixes several bugs.

Conflicts:
	libmaple/adc.h
	libmaple/libmaple.h
	libmaple/ring_buffer.h
2011-02-16 01:17:21 -05:00
Marti Bolivar 0713c12711 Function examples/test-session.cpp on Native 2011-02-10 17:50:26 -05:00
Perry Hung 1b25f1e86a support: Add openocd scripts for openocd 0.4.0
flash and run scripts for opencd v0.4.0

also snuck in a gitignore rule for notes/
2011-01-25 01:05:58 -05:00
Marti Bolivar f06d137957 updating copy-to-ide script for more convenient IDE compilation 2011-01-13 00:10:06 -05:00
Marti Bolivar 8c4f52b5ab 0.0.9 release.
Made some changes to Servo to get it to compile from within the IDE.

Also fixed a lurking broken link in the docs.
2010-12-15 19:17:55 -05:00
Marti Bolivar 88cb23747e Finalized 0.0.9 documentation. 2010-12-15 16:16:31 -05:00
Marti Bolivar 8658f090c2 maple mini runs blinky now.
still need usb descriptors to improve, and also nothing else is tested.
2010-10-22 21:13:02 -04:00
Michael Hope 6fcd4cd306 Merge remote branch 'upstream/master' 2010-09-29 20:45:57 +13:00
Michael Hope 0fcccd921e Added support for programming ELF files without converting first. 2010-09-29 20:28:39 +13:00
Michael Hope d470dc6daa Do basic validation on the boot version and chip IDs. 2010-09-29 20:21:52 +13:00
Michael Hope 97f6b77b58 Make the initial chip detection much more robust. 2010-09-29 20:20:32 +13:00
Michael Hope 3b48e21018 Changed the exception handling so that Ctrl-C passes through and isn't treated as a timeout. 2010-09-29 20:06:51 +13:00
Michael Hope 1169dc6e3b Added auto detection of the USB to serial port under Linux and MacOS. 2010-09-29 20:01:10 +13:00
Perry Hung 2e79aafb70 Enable USB auto-reset in a hard fault.
Redirect thread-mode execution to a fail routine which throbs the LED to
indicate a hard fault. Because the fail routine runs in thread mode
with interrupts on, USB auto-reset should now work. Test by executing
some bogus instruction (e.g. *(volatile int*)0xf34fdaa = 0;) and check
that the auto-reset continues to work.
2010-09-17 03:49:14 -04:00
Perry Hung bdb85a4549 Improve reset reliability on OS X.
The USB reset scheme on OS X is unreliable. Adding a little bit of sleep
seems to make it much more reliable. This will probably do until we get
a chance to rewrite the USB stack and redo the whole auto-reset
scheme...
2010-09-17 01:48:52 -04:00
Perry Hung f37e717c8a Fix maple linker memory map for jtag target 2010-09-16 21:46:36 -04:00
Marti Bolivar 208e35e7d7 exposed build-targets.mk 2010-09-13 15:15:39 -04:00
bnewbold 3b2cca3d37 changes to copy-to-ide for portable branch 2010-09-02 20:03:32 -04:00
bnewbold 800b8ca1c1 board-specifc linker scripts 2010-09-02 17:39:52 -04:00
bnewbold d6a3299168 Various fixes, working with Maple 2010-09-01 00:02:36 -04:00
bnewbold 0ccec95446 Portability fixes
Still not working but fixed a lot of merge errors
2010-08-31 22:05:39 -04:00
bnewbold 2c2812b620 added stm32loader.py upload script 2010-08-31 17:45:26 -04:00
bnewbold 02d7b08f04 Merge maple-native changes into portable
This compiles for both maple and maple_native but is untested.
2010-08-31 17:39:46 -04:00
Marti Bolivar 42fd9fdf2d Toolchain improvements
Updated Makefile to read the directory where libmaple is from the
environment variable LIBMAPLE_PATH, if it exists, defaulting to the
current working directory otherwise.

Updated reset.py to look around in /dev for the Maple serial port,
prompting the user if there appear to be multiple possibilities and
complaining if there aren't any.
2010-08-29 20:29:31 -04:00
Marti Bolivar b10ef4875f fix reset.py to work on OS X,; .gitignore leaves out ~ files; cleanup
support/make/build-rules.mk
2010-08-29 02:07:32 -04:00
bnewbold 0a6a19cf76 MEMORY_TARGET not MAPLE_TARGET 2010-08-25 18:21:51 -04:00
bnewbold db260e6c3d added stm32loader.py upload script 2010-08-25 18:12:54 -04:00
bnewbold 5f11e12d66 added libm.a to linker scripts to fix sqrt() bug
Fixes a bug noted by several users when using math functions like cos(),
sqrt(), etc in the Maple IDE. This bug did not seem to affect Makefile
compiles.
2010-08-19 16:53:56 -04:00
bnewbold 0f55cc0d89 partial progress on FSMC for SRAM 2010-08-05 21:47:22 -04:00
bnewbold ccd9833f26 Some refactoring 2010-08-05 21:43:58 -04:00
bnewbold 36b1c5e1ea latest greatest udev rule 2010-07-09 21:14:27 -04:00
Perry Hung 3aa755870a makefile: fix install target
The makefile 'install' target should upload to whatever the last build
target was, regardless of the environment's value of MAPLE_TARGET.
2010-07-08 22:27:37 -04:00
bnewbold e20771d282 more codeblocks fixes; verbose build output 2010-07-08 20:04:05 -04:00
Perry Hung 2c043efb66 make: Modularize makefiles, add dependency tracking, build-type tracking
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.
2010-06-25 21:23:04 -04:00
bnewbold cbe359ff2c codeblocks support stuff 2010-06-18 14:48:53 -04:00
bnewbold 57662f99c4 osx reset script changes 2010-06-10 13:32:29 -04:00
bnewbold d349b13258 new reset scheme, compatbile with old 2010-06-10 13:07:53 -04:00
AJM be55939829 added a somewhat broken version of the reset magic number scheme.
current version gets stuck in the isr somewhere. not sure why or where. must debug.
2010-06-09 22:25:14 -04:00
AJM 8afc89be1d first approach at modding the reset scheme
now we reset from recv bytes. After receiving the DTR/RTS toggle the next byte in from usb is parsed as the program_delay. For now, this just delays the reset for a period to close the serial port gracefully. Later, this delay will perhaps inform the bootloader of how long to live for...
2010-06-09 15:52:29 -04:00
Perry Hung e2b295651a trivial: fixed incorrect comment on jtag scan chain in openocd scripts 2010-06-05 21:46:22 -04:00
bnewbold 7824df10c4 fixed copy-to-ide linker stuff 2010-06-04 19:58:36 -04:00
bnewbold 3b11433f36 updated TODO, copy-to-ide 2010-06-04 19:05:10 -04:00
Perry Hung 1a908d88b8 fix botched merge from linker-refactor 2010-05-28 22:52:53 -04:00
Perry Hung 6434610803 Moved reset script to support directory
For kicks.
2010-05-28 05:24:21 -04:00
Perry Hung acf8b5476f udev rule symlink
new udev rule, adds a symlink to /dev/maple
2010-05-28 03:08:36 -04:00