Canadian build for AVR

jonsmirl@gmail.com jonsmirl@gmail.com
Tue Jul 2 21:19:00 GMT 2013


I believe this is the Makefile for building the compiler....

#
# Copyright (C) 2008 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=gcc
PKG_VERSION:=4.7.2
PKG_RELEASE:=1
PATCH_DIR=$(TOPDIR)/toolchain/gcc/patches/4.7.2
PKG_SOURCE_URL:=@GNU/gcc/gcc-$(PKG_VERSION)

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_MD5SUM:=
PKG_BUILD_DEPENDS:=+gmp +mpc +mpfr

include $(INCLUDE_DIR)/package.mk

SEP:=,
TARGET_LANGUAGES:="c$(if $(CONFIG_INSTALL_LIBSTDCPP),$(SEP)c++)$(if
$(CONFIG_INSTALL_LIBGCJ),$(SEP)java)"
EXTRA_TARGET=$(if $(CONFIG_EXTRA_TARGET_ARCH),--enable-biarch
--enable-targets=$(call
qstrip,$(CONFIG_EXTRA_TARGET_ARCH_NAME))-linux-uclibc)

define Package/gcc
  SECTION:=devel
  CATEGORY:=Development
  TITLE:=gcc
  DEPENDS:=@NO_STRIP
endef

define Package/gcc/description
build a native toolchain for compiling on target
endef

define Build/Prepare
$(call Build/Prepare/Default)
$(SED) 's,\(version_string.. = "[0-9\.]*\).*\(";\),\1
(OpenWrt-2.0)\2,' $(PKG_BUILD_DIR)/gcc/version.c
$(SED) 's,\(bug_report_url.. =
"\).*\(";\),\1<URL:https://dev.openwrt.org/>\2,'
$(PKG_BUILD_DIR)/gcc/version.c
(cd $(PKG_BUILD_DIR); autoreconf;);
(cd $(PKG_BUILD_DIR)/libstdc++-v3; autoconf;);
$(SED) 's,gcc_no_link=yes,gcc_no_link=no,'
$(PKG_BUILD_DIR)/libstdc++-v3/configure
endef

define Build/Configure
(cd $(PKG_BUILD_DIR); rm -f config.cache; \
SHELL="$(BASH)" \
$(TARGET_CONFIGURE_OPTS) \
$(PKG_BUILD_DIR)/configure \
$(TARGET_CONFIGURE_ARGS) \
--build=$(GNU_HOST_NAME) \
--host=mipsel \
--target=avr \
--enable-languages=$(TARGET_LANGUAGES) \
       --enable-shared \
        --with-system-zlib \
       --enable-long-long \
       --enable-nls \
--disable-shared \
       --without-included-gettext \
--disable-libssp \
$(EXTRA_TARGET) \
$(call qstrip,$(CONFIG_EXTRA_GCC_CONFIG_OPTIONS)) \
);
endef

define Build/Compile
export SHELL="$(BASH)"; $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) \
DESTDIR="$(PKG_INSTALL_DIR)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE_ARGS)
all-gcc install
# Set up the symlinks to enable lying about target name.
set -e; \
(cd $(TOOLCHAIN_DIR); \
ln -sf $(REAL_GNU_TARGET_NAME) $(GNU_TARGET_NAME); \
cd bin; \
for app in $(REAL_GNU_TARGET_NAME)-* ; do \
ln -sf $$$${app} \
$(GNU_TARGET_NAME)$$$${app##$(REAL_GNU_TARGET_NAME)}; \
done; \
);
endef

define Package/gcc/install
$(INSTALL_DIR) $(1)/usr/lib/
cp -r $(PKG_INSTALL_DIR)/* $(1)
cp -r $(TOOLCHAIN_DIR)/include $(1)/usr/
cp $(TOOLCHAIN_DIR)/lib/crt* $(1)/usr/lib/
cp $(TOOLCHAIN_DIR)/lib/libc.so $(1)/usr/lib/
endef

$(eval $(call BuildPackage,gcc))

On Tue, Jul 2, 2013 at 5:16 PM, jonsmirl@gmail.com <jonsmirl@gmail.com> wrote:
> On Tue, Jul 2, 2013 at 3:15 PM, Trevor Woerner <twoerner@gmail.com> wrote:
>> Hi Jon,
>>
>> On Fri, May 10, 2013 at 11:32 PM, jonsmirl@gmail.com <jonsmirl@gmail.com> wrote:
>>>> On Fri, May 10, 2013 at 9:26 AM, Ben Greenfield <ben@cogs.com> wrote:
>>>> There isn't AVR8 support in crosstool-ng. But gcc supports it. I am
>>>> trying to put together my own makefiles to build it without
>>>> crosstool-ng support.
>
> I did get this working. But we started working on something else and
> I've seem to have lost the Makefiles. The idea was to make a dev
> environment for the new Arduino Yun. I did get the compiler and
> libraries built and they did work on a MIPS CPU with only 32MB RAM.
>
> In general everything works if you do it from a 32b host. Something is
> messed up in gcc when doing cross 64b-32b-8b. The messed up bit is in
> the 64b-32b part. 32b-32b-8b works.  I seem to recall moving to a very
> recent gcc and this problem went away.
>
> There is also a path that is wrong is wrong in the gcc Makefile when
> building one of the libraries. It builds the library in gcc instead of
> gcc/target. Then later steps can't find the library. The Makefile is
> missing something like $(TARGET) in the path construction.
>
> So in general you don't need to do anything special except to fix that
> path in the Makefile. Fixing it is fairly obvious, the build will stop
> saying it can't find the library.
>
> I was building these inside of OpenWRT so the Makefile were specific
> to that environment.
>
>
>
>>>>
>>>>> If you did get it working I would love an overall description of your environment and workflow.
>>
>> I was just wondering if you were interested in making your
>> procedure/makefiles available? Is there any reason your method
>> couldn't be added to ct-ng?
>>
>> Best regards,
>>     Trevor
>
>
>
> --
> Jon Smirl
> jonsmirl@gmail.com



-- 
Jon Smirl
jonsmirl@gmail.com

--
For unsubscribe information see http://sourceware.org/lists.html#faq



More information about the crossgcc mailing list