John Williams | 1 Jun 2009 07:37
Favicon

Re: Instructions for compiling uClibc?

Hi Chris,

On Sat, May 30, 2009 at 5:12 PM, Chris Ziomkowski <cziom@...> wrote:
> I am attempting to use petalinux-v0.30-rc1 in a project. I have been working
> on it for several months, and .40 was not available at the time. Upgrading
> would not be practical at the moment, so if you can reference the .30
> release in any response that would be ideal.

Are you using the 2.6 or 2.4 kernel?

> My current problem is that libc.a is not properly synchronized with the
> kernel system calls.  When I do an ls from busybox, I see all the file
> attributes returned as zero. When I place traps in the kernel, I can see the
> attributes are being properly returned.

Hmmm, very strange.

> When I attempted to start debugging uClibc to figure out what was going on,
> I realized that the code is actually using a precompiled libc.a from the
> toolchain. The source for uClibc is included in the distribution, but there
> are no make rules to actually recompile it.

> Can someone suggest the steps I need to take to recompile uClibc? Has anyone
> actually successfully done this for microblaze ? At the beginning of this
> project I did try and get the entire gcc toolchain to recompile from source,
> until I found out that gcc-4.3 won't actually build the cross compiler. At
> that point, I gave up and downloaded the precompiled binary. Apparently this
> already had libc.a and I didn't realize until now that uClibc was never
> built.

(Continue reading)

Steven J. Magnani | 1 Jun 2009 20:23

Re: microblaze-uclinux-elf2flt mistranslation

On Wed, 2009-05-27 at 11:04 -0400, Rod Campbell wrote:
> Hi Steve,
> 
> I ran into the same problem a year or so ago.  I posted this issue to 
> the group in June of 2008:
> http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/archive/2008/06/msg00108.html
> 
> I came to the same conclusions that you did.  Instead of spending a lot 
> of time trying to fix elf2flt, I developed a work-around:
> 
> * Take the same elf file that was used by elf2flt to generate the flat 
> executable and create a binary file with mb-objcopy.
> * Replace the .data section of the flat executable with the binary 
> file's version. 
> 
> I created a utility to do compare the 2 data sections and do the 
> replacement.  I often see a couple mismatches between the binary file's 
> data section and the flat file's.  I have this as part of every 
> microblaze compile.

OK, I tried something similar. I found that 'fixing' the flat data
section can actually break a program. Specifically, it looks like
'agetty' has a table of days of the week. In my build, the pointer to
"Fri" mistranslates as a pointer to "\r\n". A brute-force copy of the
ELF .data section to the FLT file fixes the corruption, but agetty then
fails to display a login prompt.

> 
> Here is a run of tail end of my compile script:
> mb-flthdr -p la5600
(Continue reading)

Steven J. Magnani | 1 Jun 2009 21:04

Re: microblaze-uclinux-elf2flt mistranslation

On Mon, 2009-06-01 at 13:23 -0500, Steven J. Magnani wrote:
> On Wed, 2009-05-27 at 11:04 -0400, Rod Campbell wrote:
> > Hi Steve,
> > 
> > I ran into the same problem a year or so ago.  I posted this issue to 
> > the group in June of 2008:
> > http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/archive/2008/06/msg00108.html
> > 
> > I came to the same conclusions that you did.  Instead of spending a lot 
> > of time trying to fix elf2flt, I developed a work-around:
> > 
> > * Take the same elf file that was used by elf2flt to generate the flat 
> > executable and create a binary file with mb-objcopy.
> > * Replace the .data section of the flat executable with the binary 
> > file's version. 
> > 
> > I created a utility to do compare the 2 data sections and do the 
> > replacement.  I often see a couple mismatches between the binary file's 
> > data section and the flat file's.  I have this as part of every 
> > microblaze compile.
> 
> OK, I tried something similar. I found that 'fixing' the flat data
> section can actually break a program. Specifically, it looks like
> 'agetty' has a table of days of the week. In my build, the pointer to
> "Fri" mistranslates as a pointer to "\r\n". A brute-force copy of the
> ELF .data section to the FLT file fixes the corruption, but agetty then
> fails to display a login prompt.

My bad. The 'dd' command I was using to patch the FLT file needed a
conv=notrunc. For the record, here is the script I use to do the
(Continue reading)

Steven.J.Magnani | 2 Jun 2009 02:54
Picon
Picon

[PATCH] microblaze: Fix unaligned accesses

Microblaze requires special handling of unaligned accesses.

Signed-off-by: Steven J. Magnani <steve@...>
---
There may be more efficient choices than byteshift, 
but access_ok is incorrect.

diff -uprN a/arch/microblaze/include/asm/unaligned.h b/arch/microblaze/include/asm/unaligned.h
--- a/arch/microblaze/include/asm/unaligned.h	2009-06-01 18:17:48.000000000 -0500
+++ b/arch/microblaze/include/asm/unaligned.h	2009-06-01 18:18:32.000000000 -0500
 <at>  <at>  -10,13 +10,14  <at>  <at> 
 #ifndef _ASM_MICROBLAZE_UNALIGNED_H
 #define _ASM_MICROBLAZE_UNALIGNED_H

-# ifdef __KERNEL__
+#ifdef __KERNEL__

-# include <linux/unaligned/access_ok.h>
-# include <linux/unaligned/generic.h>
+#include <linux/unaligned/le_byteshift.h>
+#include <linux/unaligned/be_byteshift.h>
+#include <linux/unaligned/generic.h>

-# define get_unaligned	__get_unaligned_be
-# define put_unaligned	__put_unaligned_be
+#define get_unaligned	__get_unaligned_be
+#define put_unaligned	__put_unaligned_be

-# endif	/* __KERNEL__ */
+#endif	/* __KERNEL__ */
(Continue reading)

Michal Simek | 2 Jun 2009 09:10
Favicon

Re: [PATCH] microblaze: Fix unaligned accesses

Hi,

John did the similar patch some month ago and it is in mmu and master branch
http://developer.petalogix.com/git/gitweb.cgi?p=linux-2.6-microblaze.git;a=commit;h=c6c26dce3f0944971c6bfb76e6667369bec3c210

I added his patch to for-linus too (+ change the commit message a little bit)
http://developer.petalogix.com/git/gitweb.cgi?p=linux-2.6-microblaze.git;a=commit;h=3447ef29a7f3b1fd0d8d58376950e695e04f6f8b

Do you have any reason why to include <linux/unaligned/be_byteshift.h> and use shifts instead of
struct? Do you have any investigation that shifts are faster?
Anyway one patch is there and we should do more tests and of course we can add this patch later in rc.

+ I wanted to sync header style with adding indentation. Please do not revert it.

Thanks,
Michal

Steven.J.Magnani@... wrote:
> Microblaze requires special handling of unaligned accesses.
> 
> Signed-off-by: Steven J. Magnani <steve@...>
> ---
> There may be more efficient choices than byteshift, 
> but access_ok is incorrect.
> 
> diff -uprN a/arch/microblaze/include/asm/unaligned.h b/arch/microblaze/include/asm/unaligned.h
> --- a/arch/microblaze/include/asm/unaligned.h	2009-06-01 18:17:48.000000000 -0500
> +++ b/arch/microblaze/include/asm/unaligned.h	2009-06-01 18:18:32.000000000 -0500
>  <at>  <at>  -10,13 +10,14  <at>  <at> 
>  #ifndef _ASM_MICROBLAZE_UNALIGNED_H
(Continue reading)

Steve Magnani | 2 Jun 2009 14:04

Re: [PATCH] microblaze: Fix unaligned accesses

Michal Simek <michal.simek@...> wrote:

> Hi,
> 
> John did the similar patch some month ago and it is in mmu and master
> branch
> http://developer.petalogix.com/git/gitweb.cgi?p=linux-2.6-microblaze.gi
> t;a=commit;h=c6c26dce3f0944971c6bfb76e6667369bec3c210
> 
> I added his patch to for-linus too (+ change the commit message a
> little bit)
> http://developer.petalogix.com/git/gitweb.cgi?p=linux-2.6-microblaze.gi
> t;a=commit;h=3447ef29a7f3b1fd0d8d58376950e695e04f6f8b
> 
> Do you have any reason why to include <linux/unaligned/be_byteshift.h>
> and use shifts instead of struct? 

I included only one of <be_byteshift.h> and <le_byteshift.h> and 
something wouldn't compile. The other arches seem to include something 
for both BE and LE so I followed suit.

> Do you have any investigation that shifts are faster?

No, although it occurred to me that performance could be platform-
dependent, based on whether the Microblaze is built with a barrel shifter 
or not. I expected that someone with more knowledge than I would critique 
the decision; my main goal was to point out the issue and set some kind 
of fix in motion.

> Anyway one patch is there and we should do more tests and of course we
(Continue reading)

Dan Miller | 2 Jun 2009 22:26
Favicon

First *real* PetaLinux build attempt

Okay, we finally got our project completely built, using Xilinx 11.1.  I'm using the mixed-build process, where we build on Windows XP, I map the target drive onto my Ubuntu 9.04 machine (which worked), and am now trying to build PetaLinux 0.40-rc3.

First I ran:
root <at> damien:/home/petalinux-v0.40-rc3/software/petalinux-dist# petalinux-new-platform -v Krommos -p ip3new -k 2.6 -m
New platform for Krommos ip3new successfully created
 Please use petalinux-copy-autoconfig tools with the same parameters (-v, -p)

Then I attempt copy autoconfig, but it fails:
root <at> damien:/home/petalinux-v0.40-rc3/software/petalinux-dist#
petalinux-copy-autoconfig -v Kromos -p ip3new -k 2.6 /media/petalinux/system.xmp
ERROR: Only single-cpu PetaLinux OS type supported.

I've never seen this message before, has anyone else??  I can't imagine that that we've built multiple cpus into our project!!  What does this mean?

Dan Miller

Steven.J.Magnani | 2 Jun 2009 22:35
Picon
Picon

[PATCH] microblaze: Fix level interrupt ACKing

Level interrupts need to be ack'd in the unmask handler, as in powerpc. 
Among other issues, this bug caused the system clock to appear to run at 
double-speed.

Signed-off-by: Steven J. Magnani <steve@...>
---
diff -uprN a/arch/microblaze/kernel/intc.c b/arch/microblaze/kernel/intc.c
--- a/arch/microblaze/kernel/intc.c	2009-06-02 15:26:28.000000000 -0500
+++ b/arch/microblaze/kernel/intc.c	2009-06-02 15:27:39.000000000 -0500
 <at>  <at>  -41,8 +41,16  <at>  <at>  unsigned int nr_irq;

 static void intc_enable_or_unmask(unsigned int irq)
 {
+	unsigned long mask = 1 << irq;
 	pr_debug("enable_or_unmask: %d\n", irq);
-	out_be32(INTC_BASE + SIE, 1 << irq);
+	out_be32(INTC_BASE + SIE, mask);
+
+	/* ack level irqs because they can't be acked during
+	 * ack function since the handle_level_irq function
+	 * acks the irq before calling the interrupt handler
+	 */
+	if (irq_desc[irq].status & IRQ_LEVEL)
+		out_be32(INTC_BASE + IAR, mask);
 }

 static void intc_disable_or_mask(unsigned int irq)

Dan Miller | 2 Jun 2009 22:38
Favicon

Re: First *real* PetaLinux build attempt

And disregard the "Krommos" typo in the first line, I made an error copy/pasting.  I actually created the project with "Kromos", same as I used in the copy-autoconfig line.  Sorry for the confusion.

Dan Miller

Dan Miller wrote:
Okay, we finally got our project completely built, using Xilinx 11.1.  I'm using the mixed-build process, where we build on Windows XP, I map the target drive onto my Ubuntu 9.04 machine (which worked), and am now trying to build PetaLinux 0.40-rc3.

First I ran:
root <at> damien:/home/petalinux-v0.40-rc3/software/petalinux-dist# petalinux-new-platform -v Krommos -p ip3new -k 2.6 -m
New platform for Krommos ip3new successfully created
 Please use petalinux-copy-autoconfig tools with the same parameters (-v, -p)

Then I attempt copy autoconfig, but it fails:
root <at> damien:/home/petalinux-v0.40-rc3/software/petalinux-dist#
petalinux-copy-autoconfig -v Kromos -p ip3new -k 2.6 /media/petalinux/system.xmp
ERROR: Only single-cpu PetaLinux OS type supported.

I've never seen this message before, has anyone else??  I can't imagine that that we've built multiple cpus into our project!!  What does this mean?

Dan Miller

___________________________ microblaze-uclinux mailing list microblaze-uclinux-rVRm/Wmeqae7NGdpmJTKYQ@public.gmane.org Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/

John Williams | 3 Jun 2009 00:30
Favicon

Re: First *real* PetaLinux build attempt

Hi Dan,

On Wed, Jun 3, 2009 at 6:26 AM, Dan Miller <dan@...> wrote:
> Okay, we finally got our project completely built, using Xilinx 11.1.  I'm
> using the mixed-build process, where we build on Windows XP, I map the
> target drive onto my Ubuntu 9.04 machine (which worked), and am now trying
> to build PetaLinux 0.40-rc3.
>
> First I ran:
> root <at> damien:/home/petalinux-v0.40-rc3/software/petalinux-dist#
> petalinux-new-platform -v Krommos -p ip3new -k 2.6 -m
> New platform for Krommos ip3new successfully created
>  Please use petalinux-copy-autoconfig tools with the same parameters (-v,
> -p)
>
> Then I attempt copy autoconfig, but it fails:
> root <at> damien:/home/petalinux-v0.40-rc3/software/petalinux-dist#
> petalinux-copy-autoconfig -v Kromos -p ip3new -k 2.6
> /media/petalinux/system.xmp
> ERROR: Only single-cpu PetaLinux OS type supported.
>
> I've never seen this message before, has anyone else??  I can't imagine that
> that we've built multiple cpus into our project!!  What does this mean?

What option do you have for "PARAMETER OS_NAME="?  It should be "petalinux".

We used to get this error if you had an old but commented out "OS"
fragment in your MSS file.  But, for quite some time now, the script
disregards comment blocks in MSS.

Just post your MSS file and we'll have a look.

Regards,

John
--

-- 
John Williams, PhD, B.Eng, B.IT
PetaLogix - Linux Solutions for a Reconfigurable World
w: www.petalogix.com  p: +61-7-30090663  f: +61-7-30090663


Gmane