Am Sonntag, 27. März 2011, um 16:26:59 schrieb Michael Olbrich:
> Hi,

Hi Michael,
Hi Marc,

thanks for your review (see comments below). Give me time to rework and 
evaluate the patch set. Than I will roll out a new patch set (V3).


Best regards,
Stephan


PS: currently I'm working on a MicroBlaze extension for OSELAS.Toolchain(). 
Where can I post my results? Here on this list?

>
> On Tue, Mar 15, 2011 at 06:59:29PM +0100, Stephan Linz wrote:
> > --snip--
> > diff --git a/platforms/kernel.in b/platforms/kernel.in
> > index 476bdde..0d8702e 100644
> > --- a/platforms/kernel.in
> > +++ b/platforms/kernel.in
> > @@ -83,6 +83,7 @@ config KERNEL_ARCH_STRING
> >     default "blackfin"              if ARCH_BLACKFIN
> >     default "m68k"                  if ARCH_M68K
> >     default "sparc"                 if ARCH_SPARC
> > +   default "microblaze"            if ARCH_MICROBLAZE
> >     default "mips"                  if ARCH_MIPS
> >     default "mips"                  if ARCH_MIPSEL
> >     default "cris"                  if ARCH_CRIS
> > @@ -142,11 +143,16 @@ choice
> >             help
> >              This is the target to get the kernel image as an raw 
> > uncompressed
> >              binary file.
> > +
> > +if KERNEL_ARCH_POWERPC || ARCH_MICROBLAZE
> > +
> >     config KERNEL_IMAGE_SIMPLE
> >             bool
> >             prompt "simpleImage"
> >             help
> >               Create a simple Image with embedded DTB
> > +endif
>
> Maybe some kernel expert can comment on this?
> mkl: what do you think?

I've fixed it (see other email).

>
> > --snip--
> > diff --git a/rules/post/ptxd_make_xilinx_bsp.make
> > b/rules/post/ptxd_make_xilinx_bsp.make new file mode 100644
> > index 0000000..325714e
> > --- /dev/null
> > +++ b/rules/post/ptxd_make_xilinx_bsp.make
> > @@ -0,0 +1,41 @@
> > +# -*-makefile-*-
> > +#
> > +# Copyright (C) 2011 by Stephan Linz <l...@li-pro.net>
> > +#
> > +# See CREDITS for details about who has contributed to this project.
> > +#
> > +# For further information about the PTXdist project and license
> > conditions +# see the README file.
> > +#
> > +
> > +ifeq ($(PTXCONF_ARCH_MICROBLAZE),y)
>
> I think you misunderstood my comment on this:
> "ifeq ($(PTXCONF_FOO),y)" and "ifdef PTXCONF_FOO" is the same for bool
> options and "ifdef" is usually what you want for tristate.
> And "ifdef PTXCONF_FOO" is more readable and used everywhere else.

You are right. It would be more readable. So I'll change all expressions.

>
> > +
> > +ifeq ($(PTXCONF_ARCH_MICROBLAZE_HAVE_XLBSP),y)
> > +$(STATEDIR)/u-boot.prepare: $(STATEDIR)/u-boot.xlbsp
> > +endif
> > +
> > +ifeq ($(PTXCONF_ARCH_MICROBLAZE_HAVE_XLBSP),y)
> > +$(STATEDIR)/kernel.prepare: $(STATEDIR)/kernel.xlbsp
> > +endif
> > +
> > +ifeq ($(PTXCONF_KERNEL_IMAGE_SIMPLE),y)
> > +SEL_ROOTFS-$(PTXCONF_IMAGE_KERNEL) += $(IMAGEDIR)/linuximage.ub
> > +endif
> > +
> > +$(IMAGEDIR)/linuximage.ub: $(KERNEL_IMAGE_PATH_y).ub
> > $(IMAGEDIR)/linuximage +    @echo -n "Creating '$(notdir $(@))' from
> > '$(notdir $(<))'..."
> > +   @install -m 644 "$(<)" "$(@)"
> > +   @echo "done."
>
> Hmmm, so "make" must be called with $(KERNEL_IMAGE) but you actually use
> $(KERNEL_IMAGE).ub, right?

Uh, it's more complex. The current kernel port for MicroBlaze supports only 
simple images --> make $(KERNEL_IMAGE). But besides the simple image always an 
U-Boot image will be generated parallel -->  $(KERNEL_IMAGE).ub

quote from linux-2.6.31.13/arch/microblaze/boot/Makefile:
> $(obj)/simpleImage.%: vmlinux FORCE
>       $(call if_changed,cp,.unstrip)
>       $(call if_changed,objcopy)
>       $(call if_changed,uimage)               <<<-------------- the reason
>       $(call if_changed,strip)
>       @echo 'Kernel: $@ is ready' ' (#'`cat .version`')'

That's why the $(KERNEL_IMAGE).ub will be copied to $(IMAGEDIR)/linuximage.ub 
at all time (ifdef PTXCONF_ARCH_MICROBLAZE and PTXCONF_KERNEL_IMAGE_SIMPLE :).

>
> > +
> > +endif
> > +
> > +$(STATEDIR)/%.xlbsp: $(STATEDIR)/%.extract
> > +   @$(call targetinfo)
> > +   @$(call xilinx/bsp, $(PTX_MAP_TO_PACKAGE_$(*)),
> > $($(PTX_MAP_TO_PACKAGE_$(*))_DIR)) +        @$(call touch)
> > +
> > +xilinx/bsp = \
> > +   $(call world/env, $(1)) \
> > +   ptxd_make_xilinx_bsp
>
> xilinx/bsp is called with 2 arguments but only uses one?

Oops, you are right. I'll change it.

>
> > +
> > +# vim: syntax=make
> > diff --git a/rules/pre/Machine.make b/rules/pre/Machine.make
> > new file mode 100644
> > index 0000000..e6c9601
> > --- /dev/null
> > +++ b/rules/pre/Machine.make
> > @@ -0,0 +1,68 @@
> > +# -*-makefile-*-
> > +#
> > +# This file contains global machine/cpu dependent definitions.
> > +#
> > +# Copyright (C) 2011 by Stephan Linz <l...@li-pro.net>
> > +#
> > +# See CREDITS for details about who has contributed to this project.
> > +#
> > +# For further information about the PTXdist project and license
> > conditions +# see the README file.
> > +#
> > +
> > +#
> > -------------------------------------------------------------------------
> >--- +# Machine & CPU Defines (mainly SoftCPU)
> > +#
> > -------------------------------------------------------------------------
> >--- +
> > +#
> > +# Xilinx MicroBlaze, SoftCPU inside a FPGA
> > +#
> > +ifeq ($(PTXCONF_ARCH_MICROBLAZE),y)
> > +
> > +  # Use defines by Xilinx BSP (borrowed from Linux kernel)
> > +  ifeq ($(PTXCONF_ARCH_MICROBLAZE_HAVE_XLBSP),y)
> > +
> > +    # What CPU vesion are we building for, and crack it open
> > +    # as major.minor.rev
> > +    CPU_VER   := $(shell echo $(PTXCONF_XILINX_MICROBLAZE0_HW_VER))
> > +    CPU_MAJOR := $(shell echo $(CPU_VER) | cut -d '.' -f 1)
> > +    CPU_MINOR := $(shell echo $(CPU_VER) | cut -d '.' -f 2)
> > +    CPU_REV   := $(shell echo $(CPU_VER) | cut -d '.' -f 3)
> > +
> > +    export CPU_VER CPU_MAJOR CPU_MINOR CPU_REV
> > +
> > +    # Use cpu-related PTXCONF_ vars to set compile options.
> > +    # The various PTXCONF_XILINX cpu features options are integers
> > 0/1/2... +    # rather than bools y/n
> > +
> > +    # Work out HW multiplier support.  This is icky.
> > +    # 1. Spartan2 has no HW multipliers.
> > +    # 2. MicroBlaze v3.x always uses them, except in Spartan 2
> > +    # 3. All other FPGa/CPU ver combos, we can trust the PTXCONF_
> > settings +    ifeq (,$(findstring
> > spartan2,$(PTXCONF_XILINX_MICROBLAZE0_FAMILY)))
>
> are there really multiple matches or could you use:
> ifeq ($(call remove_quotes,$(PTXCONF_XILINX_MICROBLAZE0_FAMILY)),)

Hm? I think no. $(PTXCONF_XILINX_MICROBLAZE0_FAMILY) contains the specific 
FPGA family name and only 'spartan2' needs an special handling here. I have to 
use $(findstring ...). Is there an equivalent ptxdist funktion?

>
> > +      ifeq ($(CPU_MAJOR),3)
> > +        CPUFLAGS-1 += -mno-xl-soft-mul
> > +      else
> > +        # USE_HW_MUL can be 0, 1, or 2, defining a heirarchy of HW Mul
> > support. +        CPUFLAGS-$(subst
> > 1,,$(PTXCONF_XILINX_MICROBLAZE0_USE_HW_MUL)) += -mxl-multiply-high +     
> >   CPUFLAGS-$(PTXCONF_XILINX_MICROBLAZE0_USE_HW_MUL) += -mno-xl-soft-mul +
> >      endif
> > +    endif
> > +    CPUFLAGS-$(PTXCONF_XILINX_MICROBLAZE0_USE_DIV) += -mno-xl-soft-div
> > +    CPUFLAGS-$(PTXCONF_XILINX_MICROBLAZE0_USE_BARREL) +=
> > -mxl-barrel-shift +   
> > CPUFLAGS-$(PTXCONF_XILINX_MICROBLAZE0_USE_PCMP_INSTR) +=
> > -mxl-pattern-compare +
> > +    ifeq ($(PTXCONF_HAS_HARDFLOAT),y)
> > +      CPUFLAGS-$(PTXCONF_XILINX_MICROBLAZE0_USE_FPU) += -mhard-float
> > +      CPUFLAGS-$(PTXCONF_XILINX_MICROBLAZE0_USE_FPU) +=
> > -mxl-float-convert +      CPUFLAGS-$(PTXCONF_XILINX_MICROBLAZE0_USE_FPU)
> > += -mxl-float-sqrt +    endif
> > +
> > +    CPUFLAGS-1 += -mcpu=v$(CPU_VER)
> > +
> > +    CPUFLAGS := $(CPUFLAGS-1) $(CPUFLAGS-2)
> > +
> > +  endif # PTXCONF_ARCH_MICROBLAZE_HAVE_XLBSP
> > +
> > +endif # PTXCONF_ARCH_MICROBLAZE
> > +
> > diff --git a/rules/pre/Rules.make b/rules/pre/Rules.make
> > index c531a50..85babcd 100644
> > --- a/rules/pre/Rules.make
> > +++ b/rules/pre/Rules.make
> > @@ -38,8 +38,8 @@ CROSS_PATH :=
> > $(PTXDIST_SYSROOT_CROSS)/bin:$(PTXDIST_SYSROOT_CROSS)/sbin:$$PATH #
> >  # Environment variables for the compiler
> >  #
> > -CROSS_CFLAGS                       := $(PTXCONF_TARGET_EXTRA_CFLAGS)
> > -CROSS_CXXFLAGS                     := $(PTXCONF_TARGET_EXTRA_CXXFLAGS)
> > +CROSS_CFLAGS                       := $(CPUFLAGS) 
> > $(PTXCONF_TARGET_EXTRA_CFLAGS)
> > +CROSS_CXXFLAGS                     := $(CPUFLAGS) 
> > $(PTXCONF_TARGET_EXTRA_CXXFLAGS)
> >  CROSS_CPPFLAGS                     := $(strip 
> > $(PTXCONF_TARGET_EXTRA_CPPFLAGS)
> > $(PTXDIST_CROSS_CPPFLAGS)) CROSS_LDFLAGS                    := $(strip
> > $(PTXCONF_TARGET_EXTRA_LDFLAGS)  $(PTXDIST_CROSS_LDFLAGS))
>
> I think you should be able to add $(CPUFLAGS) to $(PTXDIST_CROSS_CPPFLAGS)
> in Machine.make instead of modifying Rules.make.

I try it.

>
> > --snip--
> > > > diff --git a/scripts/lib/ptxd_make_xilinx_bsp.sh
> > b/scripts/lib/ptxd_make_xilinx_bsp.sh new file mode 100644
> > index 0000000..4e53a8b
> > --- /dev/null
> > +++ b/scripts/lib/ptxd_make_xilinx_bsp.sh
> > @@ -0,0 +1,136 @@
> > +#!/bin/bash
> > +#
> > +# Copyright (C) 2011 by Stephan Linz <l...@li-pro.net>
> > +#
> > +# See CREDITS for details about who has contributed to this project.
> > +#
> > +# For further information about the PTXdist project and license
> > conditions +# see the README file.
> > +#
> > +
> > +#
> > +# apply Xilinx BSP for U-Boot
> > +#
> > +ptxd_make_xilinx_bsp_apply_uboot()
> > +{
> > +    local ptx_xlbsp_uboot_cfg="$(ptxd_get_ptxconf
> > PTXCONF_U_BOOT_CONFIG)" +    local
> > pkg_xlbsp_uboot_files="${pkg_xlbsp_dir}/config.mk           \
> > +                            ${pkg_xlbsp_dir}/xparameters.h"
> > +    local pkg_xlbsp_uboot_file
> > +    local ptx_xlbsp_uboot_dir
> > +
> > +    # find ptx_xlbsp_uboot_dir
> > +    if ! ptxd_get_path
> > "${pkg_build_dir}/board/xilinx/${ptx_xlbsp_uboot_cfg%%_config}"; then
> > +   echo "xlbsp: ${pkg_xlbsp_apply}: no board path found"
> > +   return
> > +    fi
> > +    ptx_xlbsp_uboot_dir="${ptxd_reply}"
> > +
> > +    # apply files (remove old, link new)
> > +    echo "xlbsp: ${pkg_xlbsp_apply}: board '$(ptxd_print_path
> > "${ptx_xlbsp_uboot_dir:-<none>}")'" +    pushd "${ptx_xlbsp_uboot_dir}" >
> > /dev/null &&
> > +    for pkg_xlbsp_uboot_file in ${pkg_xlbsp_uboot_files}; do
> > +   echo "xlbsp: ${pkg_xlbsp_apply}: rm/ln '$(ptxd_print_path
> > "${pkg_xlbsp_uboot_file:-<none>}")'" +
> > +   local pkg_uboot_file="$(basename "${pkg_xlbsp_uboot_file}")" &&
> > +   rm -f ${pkg_uboot_file} &&
> > +   ln -s ${pkg_xlbsp_uboot_file} ${pkg_uboot_file}
>
> I think, with "ln -sf ..." you can avoid the "rm"

I try it.

>
> > +
> > +    done &&
> > +    popd > /dev/null
> > +}
> > +export -f ptxd_make_xilinx_bsp_apply_uboot
> > +
> > +#
> > +# apply Xilinx BSP for Linux kernel 2.6
> > +#
> > +ptxd_make_xilinx_bsp_apply_kernel()
> > +{
> > +    local ptx_xlbsp_kernel_arch="$(ptxd_get_ptxconf
> > PTXCONF_KERNEL_ARCH_STRING)" +    local
> > pkg_xlbsp_kernel24_files="${pkg_xlbsp_dir}/auto-config.in" +    local
> > pkg_xlbsp_kernel26_files="${pkg_xlbsp_dir}/Kconfig.auto" +    local
> > ptx_xlbsp_kernel_platform
> > +    local pkg_xlbsp_kernel_files
> > +    local pkg_xlbsp_kernel_file
> > +    local ptx_xlbsp_kernel_dir
> > +
> > +    # files and platform to use per version
> > +    case "${pkg_pkg}" in
> > +   linux-24*|linux-2.4*)
> > +       pkg_xlbsp_kernel_files=${pkg_xlbsp_kernel24_files};
> > +       ptx_xlbsp_kernel_platform="uclinux-auto";
> > +       ;;
> > +   linux-26*|linux-2.6*)
> > +       pkg_xlbsp_kernel_files=${pkg_xlbsp_kernel26_files};
> > +       ptx_xlbsp_kernel_platform="generic";
> > +       ;;
> > +   *)
> > +       echo "xlbsp: ${pkg_xlbsp_apply}: unsupported kernel version:
> > ${pkg_pkg##linux-}" +           return
> > +       ;;
> > +    esac
>
> Hmm, the rest of this function looks just like uboot. Maybe it can be
> shared?

I'll merge it together.

>
> > +
> > +    # find ptx_xlbsp_kernel_dir
> > +    if ! ptxd_get_path
> > "${pkg_build_dir}/arch/${ptx_xlbsp_kernel_arch}/platform/${ptx_xlbsp_kern
> >el_platform}"; then +        echo "xlbsp: ${pkg_xlbsp_apply}: no board path
> > found"
> > +   return
> > +    fi
> > +    ptx_xlbsp_kernel_dir="${ptxd_reply}"
> > +
> > +    # apply files (remove old, link new)
> > +    echo "xlbsp: ${pkg_xlbsp_apply}: board '$(ptxd_print_path
> > "${ptx_xlbsp_kernel_dir:-<none>}")'" +    pushd "${ptx_xlbsp_kernel_dir}"
> > > /dev/null &&
> > +    for pkg_xlbsp_kernel_file in ${pkg_xlbsp_kernel_files}; do
> > +   echo "xlbsp: ${pkg_xlbsp_apply}: rm/ln '$(ptxd_print_path
> > "${pkg_xlbsp_kernel_file:-<none>}")'" +
> > +   local pkg_kernel_file="$(basename "${pkg_xlbsp_kernel_file}")" &&
> > +   rm -f ${pkg_kernel_file} &&
> > +   ln -s ${pkg_xlbsp_kernel_file} ${pkg_kernel_file}
> > +
> > +    done &&
> > +    popd > /dev/null
> > +}
> > +export -f ptxd_make_xilinx_bsp_apply_kernel
> > +
> > +#
> > +# generic apply Xilinx BSP function
> > +#
> > +ptxd_make_xilinx_bsp_apply()
> > +{
> > +    local pkg_xlbsp_dir
> > +    local pkg_xlbsp_apply
> > +
> > +    ptxd_in_path PTXDIST_PATH_PLATFORMS_XLBSP || return
> > +    pkg_xlbsp_dir="${ptxd_reply}"
> > +
> > +    # files to use per package
> > +    case "${pkg_pkg}" in
> > +   u-boot*)
> > +       pkg_xlbsp_apply="uboot";
> > +       ;;
> > +   linux*)
> > +       pkg_xlbsp_apply="kernel";
> > +       ;;
>
>       *)
>           error handling
>           ;;
>
> this should fail for any other package

Yes, that's my intention. The XLBSP handling supports only Linux and U-Boot, 
till now. Future packages needs futuer development.

>
> > +    esac || return
> > +
> > +    echo "pkg_xlbsp_dir:     '$(ptxd_print_path
> > "${pkg_xlbsp_dir:-<none>}")'" +    echo "pkg_build_dir:    
> > '$(ptxd_print_path "${pkg_build_dir:-<none>}")'" +    echo
> > +
> > +    # apply Xilinx BSP per package if files are available
> > +    if [ -n "${pkg_xlbsp_apply}" ]; then
> > +   echo    "xlbsp: ${pkg_xlbsp_apply}: apply '$(ptxd_print_path
> > "${pkg_xlbsp_dir:-<none>}")'"
> > +   "ptxd_make_xilinx_bsp_apply_${pkg_xlbsp_apply}" || return
> > +   echo -e "xlbsp: ${pkg_xlbsp_apply}: done\n"
> > +    fi
> > +}
> > +export -f ptxd_make_xilinx_bsp_apply
> > +
> > +#
> > +# copy and adjust per package
> > +#
> > +ptxd_make_xilinx_bsp() {
> > +    ptxd_make_world_init || return
> > +    ptxd_make_xilinx_bsp_apply
> > +}
> > +export -f ptxd_make_xilinx_bsp
>
> no need for a separate function here, imho.

Hm, let's see what I can do ....


br,
Stephan

>
> Michael
>
> > --
> > 1.6.0.4
> >
> >
> > --
> > ptxdist mailing list
> > ptxdist@pengutronix.de
>
> --
> Pengutronix e.K.                           |                             |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |


-- 
Viele Grüße,
Stephan Linz
______________________________________________________________________________
MB-Ref: http://www.li-pro.de/xilinx_mb:mbref:start
OpenDCC: http://www.li-pro.net/opendcc.phtml
PC/M: http://www.li-pro.net/pcm.phtml
CDK4AVR: http://cdk4avr.sourceforge.net/
CDK4NIOS: http://cdk4nios.sourceforge.net/
CDK4MSP: http://cdk4msp.sourceforge.net/
CPM4L: http://download.opensuse.org/repositories/home:/rexut:/CPM4L

-- 
ptxdist mailing list
ptxdist@pengutronix.de

Reply via email to