Commit graph

41 commits

Author SHA1 Message Date
Marti Bolivar 51699a1991 fixup! Add support for ARM's GCC ARM embedded toolchain.
Oops.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-08-05 14:17:06 -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 efe5f02e41 Rework linker scripts.
Having separate linker scripts for all the boards is a bad idea. Most
boards really only need to specify MEMORY and the appropriate
REGION_ALIASES() so that support/ld/common.inc can do its work. Not
having infrastructure for this leads to duplication -- viz. the Maple
Mini linker scripts are identical to the Maple's, and the
olimex_stm32_h103 linker directory is just a symlink to
Maple's. Clearly, the current structure is wrong.

To fix it, instead of having per-board subdirectories of support/ld/,
add per-MEMORY subdirectories of (new) support/ld/stm32/mem/. The
per-board .mk files under support/mk/board-includes/ now reference
these directly, and target-config.mk and the Makefile handle this
appropriately. We move some other stuff around in target-config.mk to
make this all more convenient, and even allow more overriding of the
libmaple defaults on a per-board basis. Custom board hacks will be
easier now.

Unfortunately, lots of duplication under support/ld/stm32/mem/ is
necessary, as the LENGTH attribute in a MEMORY region specification
doesn't support arithmetic expressions, and ld doesn't seem to have
any way to specify MEMORY at the command line (why?!). If we find a
better way than this, we should do it.

If a board (e.g. Maple Native) _does_ really need special
memory-related configuration, you can always put a per-board
subdirectory of support/ld/stm32/mem. We do this here to configure the
heap.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-07 03:44:31 -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
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 066fda7613 ld/make: Add support for STM3220G-EVAL board.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-04-11 16:56:53 -04:00
Marti Bolivar 65ec23254a support/ld: Add STM32F2 vector symbols.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-04-11 16:56:53 -04:00
Marti Bolivar 096d86c3f8 Add build support for targeting multiple STM32 series.
Add an MCU_SERIES variable to each of the files under
support/make/board-includes, which declares the series as "stm32f1" in
each case.

Use this in target-config.mk when determining LD_SERIES_PATH (with a
hack since we only support performance line) and
LIBMAPLE_MODULE_SERIES.  We must move support/ld/stm32/series/f1 to
.../series/stm32f1 as a side-effect.

Adding support for other series (e.g. "stm32f2") should now be a
matter of filling in the contents of libmaple/<series>/ and
support/ld/stm32/<series>/ appropriately (along with moving the rest
of the nonportable code out of the libmaple core and into the STM32F1
series submodule).

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-04-11 16:56:52 -04:00
Marti Bolivar 3efa31376b Great renaming: use "series" instead of "family".
This is for greater consistency with the ST application notes, which
refer to migrating "across" series (e.g. F1 to F2), but compatibility
"within" a family (e.g. F1).

So:

- Move libmaple/stm32x/include/family to .../include/series/ and fix
  up includes appropriately.
- Refer to "family" headers as "series" headers in comments.
- Make similar "find and replace"-style changes to build system
  variable names and comments.
- Move support/ld/stm32/family to .../stm32/series.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-04-11 16:56:52 -04:00
Marti Bolivar 053ddb973e Tweak family-specific linker file layout.
Move
        support/ld/stm32/f1/performance/vector_symbols.inc
to
        support/ld/stm32/family/f1/performance/vector_symbols.inc

Creating directory "family" under support/ld/stm32 will allow parallel
directories (e.g. support/ld/stm32/mcu) to exist, which allows an
eventual linker script cleanup to go much more smoothly.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-04-11 16:56:50 -04:00
Marti Bolivar 3a80d1282b Fix linking and C runtime initialization on F1.
Reorder the .data and .rodata sections in common.inc. This seems
necessary to get the linker to place the data ROM disk and the pointer
to it in the right places.

Switch from long long to int in start_c.c. I have no idea why this
helps, but it does. F1 will crash if you don't do this. It will
probably slow things down unnecessarily on F2, but I don't care.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-04-11 16:56:50 -04:00
Marti Bolivar d70098ba26 Remove "CS3" prefix from libmaple symbol names.
We're no longer even marginally compatible with CS3, so it's
inappropriate to use that prefix in our names.

Rename:
    __cs3_stm32_vector_table -> __stm32_vector_table.
    __cs3_stack              -> __msp_init
    __cs3_reset              -> __exc_reset
    __cs3_start_c            -> start_c

Also add an MIT license header and assert LeafLabs copyright over
wirish/start.S and wirish/start_c.c.  These files are modified from
the original CodeSourcery versions, which were distributed under a
license that permits modifications to be distributed under a different
copyright and licensing terms than the originals.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-04-11 16:52:17 -04:00
Marti Bolivar 926710d872 Remove CS3-style initialization.
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>
2012-04-11 16:52:17 -04:00
Marti Bolivar 0348fe811c Make vector table symbols family-specific during linking.
- support/make/target-config.mk: add LD_FAMILY_PATH, the directory to
  search for STM32 family-specific link configuration files. For now,
  this is just a stub which points to support/ld/stm32/f1/performance,
  since that's all we currently support. We can add the logic to
  support different STM32 families here later.

- Makefile: Pass -L $(LD_FAMILY_PATH) to linker.

- Rename support/ld/names.inc to
  support/ld/stm32/f1/performance/vector_symbols.inc.

- common.inc: INCLUDE vector_symbols.inc instead of names.inc.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2011-11-15 02:49:38 -05: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 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 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 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 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 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
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 0713c12711 Function examples/test-session.cpp on Native 2011-02-10 17:50:26 -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
Perry Hung f37e717c8a Fix maple linker memory map for jtag target 2010-09-16 21:46:36 -04:00
bnewbold 800b8ca1c1 board-specifc linker scripts 2010-09-02 17:39:52 -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 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
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
Perry Hung 1a908d88b8 fix botched merge from linker-refactor 2010-05-28 22:52:53 -04:00