arch/avr32: Fix download of header files
authorMartin Guy <martinwguy@gmail.com>
Sun Mar 31 04:07:38 2013 +0000 (2013-03-31)
changeset 320374fd467be5aa
parent 3202 9aa33c435b0b
child 3204 2993e15fa6c5
arch/avr32: Fix download of header files

This patch fixes the download of the avr32 headers in crosstool-ng by
fetching them directly from Atmel's web site instead of the now-broken URL
given by the original author of the avr32-header-fetching modification,
who fetched them from a copy on his own, now-defunct server.

It also adds the necessary logic to extract from a zip file, as that is
how the headers are packaged.

To configure it for avr32 after launching ct-ng menuconfig in an empty
directory:

Paths and misc options ->
Shell to use as CONFIG_SHELL = sh
Target options ->
Target Architecture = avr32
Toolchain options ->
Tuple's alias = avr32
Binary utilities ->
binutils version = 2.18a
C compiler
gcc version = 4.2.2
C-library
newlib version = 1.17.0
Enable IOs on long long = yes
Enable IOs on floats and doubles = yes
Disable the syscalls supplied with newlib = yes

CONFIG_SHELL is necessary to get round the "fragment: command not
found" bug when binutils-2.18 is configured using bash.

Prepared against crosstool-ng mercurial trunk on 31 March 2012.

Signed-off-by: Martin Guy <martinwguy@gmail.com>
[yann.morin.1998@free.fr: update bundles sample accordingly]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Message-Id: <CAL4-wQrg_NQ7jm-NCADqeyQr9twyhtx42OUGNThP6gWeqZc=kw@mail.gmail.com>
Patchwork-Id: 232612
samples/avr32-unknown-none/crosstool.config
scripts/build/libc/newlib.sh
scripts/functions
     1.1 --- a/samples/avr32-unknown-none/crosstool.config	Thu Apr 11 15:24:46 2013 +0200
     1.2 +++ b/samples/avr32-unknown-none/crosstool.config	Sun Mar 31 04:07:38 2013 +0000
     1.3 @@ -1,4 +1,3 @@
     1.4 -CT_EXPERIMENTAL=y
     1.5  CT_LOCAL_TARBALLS_DIR="${HOME}/src"
     1.6  CT_SAVE_TARBALLS=y
     1.7  CT_CONFIG_SHELL_SH=y
     1.8 @@ -7,3 +6,6 @@
     1.9  CT_BINUTILS_V_2_18a=y
    1.10  CT_CC_V_4_2_2=y
    1.11  CT_LIBC_NEWLIB_V_1_17_0=y
    1.12 +CT_LIBC_NEWLIB_IO_LL=y
    1.13 +CT_LIBC_NEWLIB_IO_FLOAT=y
    1.14 +CT_LIBC_NEWLIB_DISABLE_SUPPLIED_SYSCALLS=y
     2.1 --- a/scripts/build/libc/newlib.sh	Thu Apr 11 15:24:46 2013 +0200
     2.2 +++ b/scripts/build/libc/newlib.sh	Sun Mar 31 04:07:38 2013 +0000
     2.3 @@ -6,11 +6,10 @@
     2.4  #
     2.5  
     2.6  do_libc_get() {
     2.7 -    local libc_src
     2.8 -    local avr32headers_src
     2.9 -
    2.10 -    libc_src="ftp://sourceware.org/pub/newlib"
    2.11 -    avr32headers_src="http://dev.doredevelopment.dk/avr32-toolchain/sources"
    2.12 +    local libc_src="ftp://sourceware.org/pub/newlib"
    2.13 +    local avr32headers_src="http://www.atmel.com/Images"
    2.14 +          avr32headers_base="avr-headers-3.2.3.970"    # used below
    2.15 +    local avr32headers_ext=".zip"
    2.16  
    2.17      if [ "${CT_LIBC_NEWLIB_CUSTOM}" = "y" ]; then
    2.18          CT_GetCustom "newlib" "${CT_LIBC_VERSION}"      \
    2.19 @@ -20,7 +19,7 @@
    2.20      fi # ! custom location
    2.21  
    2.22      if [ "${CT_ATMEL_AVR32_HEADERS}" = "y" ]; then
    2.23 -        CT_GetFile "avr32headers" ${avr32headers_src}
    2.24 +        CT_GetFile ${avr32headers_base} ${avr32headers_ext} ${avr32headers_src}
    2.25      fi
    2.26  }
    2.27  
    2.28 @@ -35,7 +34,9 @@
    2.29      CT_Patch "newlib" "${CT_LIBC_VERSION}"
    2.30  
    2.31      if [ "${CT_ATMEL_AVR32_HEADERS}" = "y" ]; then
    2.32 -        CT_Extract "avr32headers"
    2.33 +        # The avr32header zip file extracts to avr32/*.h
    2.34 +        # Put that in its directory, the same as normal tarballs
    2.35 +        CT_Extract ${avr32headers_base} -d ${CT_SRC_DIR}/${avr32headers_base}
    2.36      fi
    2.37  }
    2.38  
    2.39 @@ -49,8 +50,8 @@
    2.40  
    2.41          CT_DoLog EXTRA "Installing Atmel's AVR32 headers"
    2.42          CT_DoExecLog ALL mkdir -p "${CT_PREFIX_DIR}/${CT_TARGET}/include"
    2.43 -        CT_DoExecLog ALL cp -r "${CT_SRC_DIR}/avr32headers"     \
    2.44 -                               "${CT_PREFIX_DIR}/${CT_TARGET}/include/avr32"
    2.45 +        CT_DoExecLog ALL cp -r "${CT_SRC_DIR}/${avr32headers_base}/avr32"     \
    2.46 +                               "${CT_PREFIX_DIR}/${CT_TARGET}/include/"
    2.47  
    2.48          CT_EndStep
    2.49      fi
     3.1 --- a/scripts/functions	Thu Apr 11 15:24:46 2013 +0200
     3.2 +++ b/scripts/functions	Sun Mar 31 04:07:38 2013 +0000
     3.3 @@ -523,6 +523,7 @@
     3.4      printf ".tar.bz2\n"
     3.5      printf ".tar.gz\n.tgz\n"
     3.6      printf ".tar\n"
     3.7 +    printf ".zip\n"
     3.8  }
     3.9  
    3.10  # Get the file name extension of a component
    3.11 @@ -861,7 +862,7 @@
    3.12  # by the caller, that did a 'cd' into the correct path before calling us
    3.13  # and sets nochdir to 'nochdir'.
    3.14  # Note also that this function handles the git trees!
    3.15 -# Usage: CT_Extract <basename> [nochdir] [options]
    3.16 +# Usage: CT_Extract [nochdir] <basename> [options]
    3.17  # where 'options' are dependent on the source (eg. git branch/tag...)
    3.18  CT_Extract() {
    3.19      local nochdir="$1"
    3.20 @@ -926,6 +927,7 @@
    3.21          .tar.bz2)     bzip2 -dc "${full_file}" | CT_DoExecLog FILE tar "${tar_opts[@]}" -f -;;
    3.22          .tar.gz|.tgz) gzip -dc "${full_file}" | CT_DoExecLog FILE tar "${tar_opts[@]}" -f -;;
    3.23          .tar)         CT_DoExecLog FILE tar "${tar_opts[@]}" -f "${full_file}";;
    3.24 +        .zip)         CT_DoExecLog FILE unzip "${@}" "${full_file}";;
    3.25          /.git)        CT_ExtractGit "${basename}" "${@}";;
    3.26          *)            CT_DoLog WARN "Don't know how to handle '${basename}${ext}': unknown extension"
    3.27                        return 1