UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Observer benh88
Observer
7,191 Views
Registered: ‎01-03-2013

Microblaze big endian support

Jump to solution

Hi There, 

 

I noticed that there is only little endian Microblaze support in the latest Petalinux (2013.04). Is there any plans to add this support back ? Is building my own little-endian support using Xilinx git gcc or Cross-ng a mammoth task or ..?  My biggest problem with the 12.12 release is that multithreaded applications are not very stable. 

 

Thanks, 

 

/Ben

0 Kudos
1 Solution

Accepted Solutions
Observer benh88
Observer
9,335 Views
Registered: ‎01-03-2013

Re: Microblaze big endian support

Jump to solution

Turns out it is a managable task. Here are the steps I went through, in case someone else is interested in doing the same thing.

 

Download the needed files from Xilinx Git Hub

 

git clone https://github.com/Xilinx/gcc
git clone https://github.com/Xilinx/gdb
git clone https://github.com/Xilinx/binutils
git clone https://github.com/Xilinx/crosstool-ng
git clone https://github.com/Xilinx/eglibc

 

set all of them to "xsdk_14.5" by running

 

git checkout xsdk_14.5 in each directory

 

Setup Crosstool-ng

 

cd crosstool-ng
./configure --prefix=/home/xilinx/crosstool-ng
make
make install
export PATH="${PATH}:/home/xilinx/crosstool-ng/bin


Create a place to work in

 

mkdir /home/xilinx/crosstool-work
ct-ng list-samples //Shows all available sample configs
ct-ng microblaze-xilinx-linux-gnu

ct-ng menuconfig //Set gcc, gdb, binutils and eglibc "Full paths" to the correct path. Also uncheck "Build a Multilib toolchain" under target options, otherwise eglibc build fails.

ct-ng build  //This takes a while, but produces a functional toolchain as far as I can tell

 

The build output will be in /home/xilinx/crosstool-ng/lib/tool-build

 

 

0 Kudos
8 Replies
Observer benh88
Observer
9,336 Views
Registered: ‎01-03-2013

Re: Microblaze big endian support

Jump to solution

Turns out it is a managable task. Here are the steps I went through, in case someone else is interested in doing the same thing.

 

Download the needed files from Xilinx Git Hub

 

git clone https://github.com/Xilinx/gcc
git clone https://github.com/Xilinx/gdb
git clone https://github.com/Xilinx/binutils
git clone https://github.com/Xilinx/crosstool-ng
git clone https://github.com/Xilinx/eglibc

 

set all of them to "xsdk_14.5" by running

 

git checkout xsdk_14.5 in each directory

 

Setup Crosstool-ng

 

cd crosstool-ng
./configure --prefix=/home/xilinx/crosstool-ng
make
make install
export PATH="${PATH}:/home/xilinx/crosstool-ng/bin


Create a place to work in

 

mkdir /home/xilinx/crosstool-work
ct-ng list-samples //Shows all available sample configs
ct-ng microblaze-xilinx-linux-gnu

ct-ng menuconfig //Set gcc, gdb, binutils and eglibc "Full paths" to the correct path. Also uncheck "Build a Multilib toolchain" under target options, otherwise eglibc build fails.

ct-ng build  //This takes a while, but produces a functional toolchain as far as I can tell

 

The build output will be in /home/xilinx/crosstool-ng/lib/tool-build

 

 

0 Kudos
Adventurer
Adventurer
7,169 Views
Registered: ‎03-19-2008

Re: Microblaze big endian support

Jump to solution

Dear Ben, thanks for sharing your tips.

 

I also experienced much instability in a threaded application running in petalinux (2.1, 2.2 and 12.12).

 

For the big endian version I almost resolved by using a patched cross compiler courtesy of michal simek as already stated in this other post.

http://forums.xilinx.com/t5/Embedded-Linux/Petalinux-12-12-threaded-program-instability-problem/m-p/297435#M5701

 

Now I am still encountering problems with the little endian one on petalinux 12.12.

When compiling (both the kernel and the application) against gcc 4.6.6 (from 2013.4) or 4.6.2 (from 12.12) the program runs for a few seconds and crashes almost instantly.

When compiling against patched gcc 4.1.2 (from the thread above) I can run it for quite longer (at least half a hour).

 

Now I am trying to build a toolchain as you suggest and see what happens.

I just wanted to know if you discovered something about thread instability with different version of petalinux / gcc.

 

Many thanks and best regards,

Giulio

0 Kudos
Observer benh88
Observer
7,158 Views
Registered: ‎01-03-2013

Re: Microblaze big endian support

Jump to solution

Hi Giulio !

 

My goal was to compile the same toolchain thats used in Petalinux 2013.4 for big endian to see if it made things better. So I followed the steps I described, then renamed the petalinux/tools/linux-i386/microblaze-xilinx-linux-gnu and created a symbolic link to the newly created toolchain. Then ran distclean in petalinux and compiled everything again. Turns out the eglibc libraries are copied from the toolchain directory to the romfs so that saves a little headache. However, I did not notice a difference in stability although I'm not 100% sure if its a bug in my software or not. I'm running a 5 thread C++ application and the crashes (segmentation faults) are somewhat random, but happens when calling pthread_mutex_lock quite frequently. I'm also using  posix timers & message queue system calls. Whats your application ? Have you been able to create a small app that shows the problem ?

 

Have you heard anything from Xilinx regarding this ? Are they acknowledging this as a problem ? To me it seems very strange that application stability is still a problem after all these years... If its not stable then its essentially worthless for any professional use as far I am concerned. 

 

Its good to know I'm not the only one seeing these problems. Thanks for you time and input

 

Regards, 

 

/Ben

0 Kudos
Adventurer
Adventurer
7,148 Views
Registered: ‎03-19-2008

Re: Microblaze big endian support

Jump to solution

Hi Ben,

 

In the past I used a simple threaded application that was just accessing I/O locations on the PLB bus (toggling leds) and doing some printfs (in attachment). I could reach crashes on the sp605 evaluation board with the prebuilt bsp and on my custom hw. (the memory mapped area in the mmu.c file has to be changed accordingly to the real address and printfs must be enabled by commenting the define).

 

Michal fixed the 4.1.2 toolchain that exhibited some locking mechanism problems and I must say it became very stable after that (my application was running fine for days, whilst it was usually crashing in seconds or minutes before).

 

If you would like to try aswell I was using the patched crosscompiler in petalinux sdk 12.12 (i still have do adapt myself to 2013.04 since they changed quite a bit of things). And I described the changes needed to use it in this other post.

http://forums.xilinx.com/t5/Embedded-Linux/Petalinux-12-12-threaded-program-instability-problem/m-p/297435#M5701

 

I am quite confident that it may work for you, too. And if this is the case it would be good if those fixed could reach the upstream. I am still investigating about the stability of the little endian cross-compiler. I'll post any update.

 

Please keep me updated aswell.

 

I agree with you, anyway. A stable system is a must to build reliable applications on top of it and a multi-threaded application is a quite common approach (maybe not so elegant) in the embedded world.

 

NOTE

I have encountered problems with timers in the past and dropped their usage (I was using the signal system call).

Maybe you would like to try to change the program to do without them (e.g. by using fake timers in sw)

http://forums.xilinx.com/t5/Embedded-Linux/Linux-timer-crash-on-Petalinux-SDK/m-p/208645#M3835

0 Kudos
Observer benh88
Observer
7,138 Views
Registered: ‎01-03-2013

Re: Microblaze big endian support

Jump to solution

Hello again Giulio ! 

 

Thanks for sharing you experiences ! I'll definitely give the patched toolchain a try, but to me its very strange that they keep releasing new software that still doesnt work over a year (Jan 2012) after the patch was created. The fact that no-one from Xilinx is jumping in this thread and saying anything about it is a bad sign to me. I tried the timer-test code from the second thread you posted and that still crashes, so maybe the problem I'm seeing is with the timers.. Which my application uses quite frequently. I'll work on faking it in software. Thanks a lot for the tip ! 

 

Given the fact that xilinx still has not fixed this, I'm suspecting it requires a ton of resources so I'll work on work-arounds instead.

 

Have a great day, 

 

/Ben

0 Kudos
Adventurer
Adventurer
7,122 Views
Registered: ‎03-19-2008

Re: Microblaze big endian support

Jump to solution

Hi Ben. Good luck.

Yes, I am quite confident you will end up with a working solution.

 

An official comment would be really appreciated, but for the meantime I think that adopting workarounds is still acceptable.

For me I am sticking with petalinux 12.12 and the patched gcc 4.1.2, at least for microblaze (big and little endian).

I'll probably use upcoming sdk for zynq.

 

Thanks for your feedbacks.

Have a great day, too.

Giulio

0 Kudos
Observer benh88
Observer
7,117 Views
Registered: ‎01-03-2013

Re: Microblaze big endian support

Jump to solution

Quick update. Turns out the C++ application runs significantly better when not running it in GDB. However I am seeing a very strange problem where after calling a certain function, I can no longer access any local (stack) variables anymore (SIGSEGV). Also, calling return() yields the same results. Tell-tale sign of stack corruption, but I examined the stack before and after the function call but it looks identical. Very strange. Moving the variables to the heap makes it work. I'm hoping I printed the stack correctly 

 

register int stackp asm("r1"); //R1 is the microblaze stack pointer 

intp = (int *) stackp;

for (i = 0; i <= 0x50; i++)
{
printf("A: 0x%08x Val: 0x%08x\n", (int) &intp[i], intp[i]);
}

 

Anyway, thanks and have a great weekend

 

/Ben

0 Kudos
Observer benh88
Observer
7,106 Views
Registered: ‎01-03-2013

Re: Microblaze big endian support

Jump to solution

Turns out the last problem was a memcpy bug where the size paramter passed in was bigger than the destination. Anyway, the application runs quite well now. No problems seen. So if you are looking to run multithreaded C++ applications with timers, semaphores and message queues there is hope.

0 Kudos