Browse Source

add openocd

master
Olaf Rempel 9 years ago
parent
commit
8dd67d29a0
4 changed files with 89 additions and 19 deletions
  1. 2
    0
      .gitignore
  2. 87
    19
      Makefile
  3. 0
    0
      download/.keep
  4. 0
    0
      source/.keep

+ 2
- 0
.gitignore View File

@@ -0,0 +1,2 @@
download/*
source/*

+ 87
- 19
Makefile View File

@@ -4,10 +4,12 @@ TOOLCHAIN=/opt/arm-toolchain
# build arch:
BUILDARCH=i686-linux-gnu

MAKEOPTS=-j4

# #####################################################################
# MAIN TARGETS (binutils, gcc, g++, newlib, gdb for arm7tdmi)
# #####################################################################
toolchain: binutils gcc newlib gdb
toolchain: binutils gcc newlib gdb openocd

# #####################################################################
BASE=$(shell /bin/pwd)
@@ -18,34 +20,53 @@ PATH:=$(PATH):$(TOOLCHAIN)/bin
WGET:=/usr/bin/wget --passive-ftp -nd

# #####################################################################
BINUTILS_VERSION=2.17
BINUTILS_VERSION=2.19.1
BINUTILS_PACKAGE=binutils-$(BINUTILS_VERSION).tar.bz2
BINUTILS_DOWNLOAD=http://www.gnuarm.com/$(BINUTILS_PACKAGE)
BINUTILS_DOWNLOAD=http://ftp.gnu.org/gnu/binutils/$(BINUTILS_PACKAGE)
BINUTILS_SOURCE=$(SOURCE)/binutils-$(BINUTILS_VERSION)
BINUTILS_BUILD=$(BINUTILS_SOURCE)-build

# #####################################################################
GCC_VERSION=4.1.1
GCC_VERSION=4.3.3
GCC_PACKAGE=gcc-$(GCC_VERSION).tar.bz2
GCC_DOWNLOAD=http://www.gnuarm.com/$(GCC_PACKAGE)
GCC_DOWNLOAD=http://ftp.gnu.org/gnu/gcc/gcc-$(GCC_VERSION)/$(GCC_PACKAGE)
GCC_SOURCE=$(SOURCE)/gcc-$(GCC_VERSION)
GCC_BUILD=$(GCC_SOURCE)-build

# #####################################################################
NEWLIB_VERSION=1.14.0
GMP_VERSION=4.3.0
GMP_PACKAGE=gmp-$(GMP_VERSION).tar.bz2
GMP_DOWNLOAD=http://ftp.gnu.org/gnu/gmp/$(GMP_PACKAGE)
GMP_SOURCE=$(GCC_SOURCE)/gmp-$(GMP_VERSION)

# #####################################################################
MPFR_VERSION=2.4.1
MPFR_PACKAGE=mpfr-$(MPFR_VERSION).tar.bz2
MPFR_DOWNLOAD=http://www.mpfr.org/mpfr-$(MPFR_VERSION)/$(MPFR_PACKAGE)
MPFR_SOURCE=$(GCC_SOURCE)/mpfr-$(MPFR_VERSION)

# #####################################################################
NEWLIB_VERSION=1.17.0
NEWLIB_PACKAGE=newlib-$(NEWLIB_VERSION).tar.gz
NEWLIB_DOWNLOAD=http://www.gnuarm.com/$(NEWLIB_PACKAGE)
NEWLIB_DOWNLOAD=ftp://sources.redhat.com/pub/newlib/$(NEWLIB_PACKAGE)
NEWLIB_SOURCE=$(SOURCE)/newlib-$(NEWLIB_VERSION)
NEWLIB_BUILD=$(NEWLIB_SOURCE)-build

# #####################################################################
GDB_VERSION=6.6
GDB_VERSION=6.8
GDB_PACKAGE=gdb-$(GDB_VERSION).tar.bz2
GDB_DOWNLOAD=http://ftp.gnu.org/gnu/gdb/$(GDB_PACKAGE)
GDB_SOURCE=$(SOURCE)/gdb-$(GDB_VERSION)
GDB_BUILD=$(GDB_SOURCE)-build

# #####################################################################
OOCD_VERSION=0.4.0
OOCD_PACKAGE=openocd-$(OOCD_VERSION).tar.bz2
OOCD_DOWNLOAD=http://downloads.sourceforge.net/project/openocd/openocd/$(OOCD_VERSION)/$(OOCD_PACKAGE)
OOCD_SOURCE=$(SOURCE)/openocd-$(OOCD_VERSION)
OOCD_BUILD=$(OOCD_SOURCE)-build

# #####################################################################
binutils: $(BINUTILS_BUILD)/.installed

$(DOWNLOADS)/$(BINUTILS_PACKAGE):
@@ -67,11 +88,11 @@ $(BINUTILS_BUILD)/.configured: $(BINUTILS_SOURCE)/.unpacked
touch $@

$(BINUTILS_BUILD)/.compiled: $(BINUTILS_BUILD)/.configured
make -C $(BINUTILS_BUILD) all
$(MAKE) -C $(BINUTILS_BUILD) $(MAKEOPTS) all
touch $@

$(BINUTILS_BUILD)/.installed: $(BINUTILS_BUILD)/.compiled
make -C $(BINUTILS_BUILD) install
$(MAKE) -C $(BINUTILS_BUILD) install
touch $@

# #####################################################################
@@ -84,7 +105,7 @@ $(GCC_SOURCE)/.unpacked: $(DOWNLOADS)/$(GCC_PACKAGE)
tar -C $(SOURCE) -xjf $^
touch $@

$(GCC_BUILD)/.configured: $(GCC_SOURCE)/.unpacked $(NEWLIB_SOURCE)/.unpacked
$(GCC_BUILD)/.configured: $(GCC_SOURCE)/.unpacked $(GMP_SOURCE)/.unpacked $(MPFR_SOURCE)/.unpacked $(NEWLIB_SOURCE)/.unpacked
mkdir -p $(GCC_BUILD)
(cd $(GCC_BUILD); $(GCC_SOURCE)/configure \
--build=$(BUILDARCH) --host=$(BUILDARCH) --target=arm-elf \
@@ -99,25 +120,43 @@ $(GCC_BUILD)/.configured: $(GCC_SOURCE)/.unpacked $(NEWLIB_SOURCE)/.unpacked
touch $@

$(GCC_BUILD)/.stage1.compiled: $(GCC_BUILD)/.configured $(BINUTILS_BUILD)/.installed
make -C $(GCC_BUILD) all-gcc
$(MAKE) -C $(GCC_BUILD) $(MAKEOPTS) all-gcc
touch $@

$(GCC_BUILD)/.stage1.installed: $(GCC_BUILD)/.stage1.compiled
make -C $(GCC_BUILD) install-gcc
$(MAKE) -C $(GCC_BUILD) install-gcc
touch $@

$(GCC_BUILD)/.stage2.compiled: $(GCC_BUILD)/.stage1.installed $(NEWLIB_BUILD)/.installed
make -C $(GCC_BUILD) all
$(MAKE) -C $(GCC_BUILD) $(MAKEOPTS) all
touch $@

$(GCC_BUILD)/.stage2.installed: $(GCC_BUILD)/.stage2.compiled
make -C $(GCC_BUILD) install
$(MAKE) -C $(GCC_BUILD) install
touch $@

$(GCC_BUILD)/.installed: $(GCC_BUILD)/.stage1.installed $(GCC_BUILD)/.stage2.installed
touch $@

# #####################################################################
$(DOWNLOADS)/$(GMP_PACKAGE):
$(WGET) -P $(DOWNLOADS) $(GMP_DOWNLOAD)

$(GMP_SOURCE)/.unpacked: $(DOWNLOADS)/$(GMP_PACKAGE) $(GCC_SOURCE)/.unpacked
tar -C $(GCC_SOURCE) -xjf $(DOWNLOADS)/$(GMP_PACKAGE)
ln -s gmp-$(GMP_VERSION) $(GCC_SOURCE)/gmp
touch $@

# #####################################################################
$(DOWNLOADS)/$(MPFR_PACKAGE):
$(WGET) -P $(DOWNLOADS) $(MPFR_DOWNLOAD)

$(MPFR_SOURCE)/.unpacked: $(DOWNLOADS)/$(MPFR_PACKAGE) $(GCC_SOURCE)/.unpacked
tar -C $(GCC_SOURCE) -xjf $(DOWNLOADS)/$(MPFR_PACKAGE)
ln -s mpfr-$(MPFR_VERSION) $(GCC_SOURCE)/mpfr
touch $@

# #####################################################################
newlib: $(NEWLIB_BUILD)/.installed

$(DOWNLOADS)/$(NEWLIB_PACKAGE):
@@ -139,11 +178,11 @@ $(NEWLIB_BUILD)/.configured: $(NEWLIB_SOURCE)/.unpacked $(GCC_BUILD)/.stage1.ins
touch $@

$(NEWLIB_BUILD)/.compiled: $(NEWLIB_BUILD)/.configured
make -C $(NEWLIB_BUILD) all
$(MAKE) -C $(NEWLIB_BUILD) $(MAKEOPTS) all
touch $@

$(NEWLIB_BUILD)/.installed: $(NEWLIB_BUILD)/.compiled
make -C $(NEWLIB_BUILD) install
$(MAKE) -C $(NEWLIB_BUILD) install
touch $@

# #####################################################################
@@ -168,9 +207,38 @@ $(GDB_BUILD)/.configured: $(GDB_SOURCE)/.unpacked $(GCC_BUILD)/.installed
touch $@

$(GDB_BUILD)/.compiled: $(GDB_BUILD)/.configured
make -C $(GDB_BUILD) all
$(MAKE) -C $(GDB_BUILD) $(MAKEOPTS) all
touch $@

$(GDB_BUILD)/.installed: $(GDB_BUILD)/.compiled
make -C $(GDB_BUILD) install
$(MAKE) -C $(GDB_BUILD) install
touch $@

# #####################################################################
openocd: $(OOCD_BUILD)/.installed

$(DOWNLOADS)/$(OOCD_PACKAGE):
$(WGET) -P $(DOWNLOADS) $(OOCD_DOWNLOAD)

$(OOCD_SOURCE)/.unpacked: $(DOWNLOADS)/$(OOCD_PACKAGE)
tar -C $(SOURCE) -xjf $^
touch $@

$(OOCD_BUILD)/.configured: $(OOCD_SOURCE)/.unpacked
mkdir -p $(OOCD_BUILD)
(cd $(OOCD_BUILD); $(OOCD_SOURCE)/configure \
--prefix=$(TOOLCHAIN) \
--disable-static \
--disable-doxygen-html \
--enable-parport \
--enable-ft2232_libftdi \
);
touch $@

$(OOCD_BUILD)/.compiled: $(OOCD_BUILD)/.configured
$(MAKE) -C $(OOCD_BUILD) $(MAKEOPTS) all
touch $@

$(OOCD_BUILD)/.installed: $(OOCD_BUILD)/.compiled
$(MAKE) -C $(OOCD_BUILD) install
touch $@

+ 0
- 0
download/.keep View File


+ 0
- 0
source/.keep View File


Loading…
Cancel
Save