From andrea.baldini at spesonline.com Fri Apr 15 08:57:57 2011 From: andrea.baldini at spesonline.com (Andrea Baldini) Date: Fri, 15 Apr 2011 10:57:57 +0200 Subject: unaligned userspace access Message-ID: <201104151057.57641.andrea.baldini@spesonline.com> Hi all, I'm working on a sh2a board and i tried to use your latest available toolchain (renesas-2010.09) to cross-compile the 2.6.35 kernel release. When i try to boot the kernel i get a "unaligned userspace access" error. What could it depend on? Regards Andrea From ams at codesourcery.com Fri Apr 15 10:49:21 2011 From: ams at codesourcery.com (Andrew Stubbs) Date: Fri, 15 Apr 2011 11:49:21 +0100 Subject: [superh-gnu-discuss] unaligned userspace access In-Reply-To: <201104151057.57641.andrea.baldini@spesonline.com> References: <201104151057.57641.andrea.baldini@spesonline.com> Message-ID: <4DA822B1.8030701@codesourcery.com> On 15/04/11 09:57, Andrea Baldini wrote: > I'm working on a sh2a board and i tried to use your latest available > toolchain (renesas-2010.09) to cross-compile the 2.6.35 kernel release. > When i try to boot the kernel i get a "unaligned userspace access" error. > What could it depend on? It's hard to say what could be causing that, exactly - in my experience, the 'unaligned access' it's detected is usually (but not necessarily) merely fallout from some other error. Unfortunately, that seems to be one of the most common failure mode I see. Just about any memory scribble or other kind of crash that leads to executing random memory as code can cause this exception. I have not tested a 2.6.35 kernel myself, but I've no reason to believe it shouldn't work. You could ask about the kernel support for you target at linux-sh at vger.kernel.org Presumably you're sure that the user space isn't causing the problem? Andrew From ams at codesourcery.com Fri Apr 15 14:57:35 2011 From: ams at codesourcery.com (Andrew Stubbs) Date: Fri, 15 Apr 2011 15:57:35 +0100 Subject: [superh-gnu-discuss] unaligned userspace access In-Reply-To: <201104151620.45345.andrea.baldini@spesonline.com> References: <201104151057.57641.andrea.baldini@spesonline.com> <4DA822B1.8030701@codesourcery.com> <201104151620.45345.andrea.baldini@spesonline.com> Message-ID: <4DA85CDF.6090500@codesourcery.com> On 15/04/11 15:20, Andrea Baldini wrote: > Thanks for the quick answer. > the kernel fails when it tries to execute the first userspace application > (that is the init script). it seems it can't execute the busybox binaries for > some reason... did any of you try to boot a kernel in the rsk 7203 board? > (if so which version? although, as you said, i don't think it is a problem of > the kernel release) Yes, we use that board. I'm not sure what version - I don't have physical access to the board as it is in a remote location. Did you build busybox with the same toolchain? You do need a busybox built with FDPIC to work on this target, of course. Andrew From andrea.baldini at spesonline.com Fri Apr 15 14:58:48 2011 From: andrea.baldini at spesonline.com (Andrea Baldini) Date: Fri, 15 Apr 2011 16:58:48 +0200 Subject: [superh-gnu-discuss] unaligned userspace access In-Reply-To: <4DA822B1.8030701@codesourcery.com> References: <201104151057.57641.andrea.baldini@spesonline.com> <4DA822B1.8030701@codesourcery.com> Message-ID: <201104151658.49097.andrea.baldini@spesonline.com> On Friday 15 April 2011 12:49:21 Andrew Stubbs wrote: > On 15/04/11 09:57, Andrea Baldini wrote: > > I'm working on a sh2a board and i tried to use your latest available > > toolchain (renesas-2010.09) to cross-compile the 2.6.35 kernel release. > > When i try to boot the kernel i get a "unaligned userspace access" error. > > What could it depend on? > > It's hard to say what could be causing that, exactly - in my experience, > the 'unaligned access' it's detected is usually (but not necessarily) > merely fallout from some other error. > > Unfortunately, that seems to be one of the most common failure mode I > see. Just about any memory scribble or other kind of crash that leads to > executing random memory as code can cause this exception. > > I have not tested a 2.6.35 kernel myself, but I've no reason to believe > it shouldn't work. You could ask about the kernel support for you target > at linux-sh at vger.kernel.org > > Presumably you're sure that the user space isn't causing the problem? > > Andrew Thanks for the quick answer. the kernel fails when it tries to execute the first userspace application (that is the init script). it seems it can't execute the busybox binaries for some reason... did any of you try to boot a kernel in the rsk 7203 board? (if so which version? although, as you said, i don't think it is a problem of the kernel release) thanks again Andrea From andrea.baldini at spesonline.com Fri Apr 15 15:18:04 2011 From: andrea.baldini at spesonline.com (Andrea Baldini) Date: Fri, 15 Apr 2011 17:18:04 +0200 Subject: [superh-gnu-discuss] unaligned userspace access In-Reply-To: <4DA85CDF.6090500@codesourcery.com> References: <201104151057.57641.andrea.baldini@spesonline.com> <201104151620.45345.andrea.baldini@spesonline.com> <4DA85CDF.6090500@codesourcery.com> Message-ID: <201104151718.04388.andrea.baldini@spesonline.com> On Friday 15 April 2011 16:57:35 Andrew Stubbs wrote: > On 15/04/11 15:20, Andrea Baldini wrote: > > Thanks for the quick answer. > > the kernel fails when it tries to execute the first userspace application > > (that is the init script). it seems it can't execute the busybox binaries > > for some reason... did any of you try to boot a kernel in the rsk 7203 > > board? (if so which version? although, as you said, i don't think it is > > a problem of the kernel release) > > Yes, we use that board. I'm not sure what version - I don't have > physical access to the board as it is in a remote location. > > Did you build busybox with the same toolchain? You do need a busybox > built with FDPIC to work on this target, of course. > > Andrew Yes, i built everything with the same toolchain. Regards Andrea From ams at codesourcery.com Fri Apr 15 15:25:04 2011 From: ams at codesourcery.com (Andrew Stubbs) Date: Fri, 15 Apr 2011 16:25:04 +0100 Subject: [superh-gnu-discuss] unaligned userspace access In-Reply-To: <201104151718.04388.andrea.baldini@spesonline.com> References: <201104151057.57641.andrea.baldini@spesonline.com> <201104151620.45345.andrea.baldini@spesonline.com> <4DA85CDF.6090500@codesourcery.com> <201104151718.04388.andrea.baldini@spesonline.com> Message-ID: <4DA86350.1090109@codesourcery.com> On 15/04/11 16:18, Andrea Baldini wrote: >> Did you build busybox with the same toolchain? You do need a busybox >> built with FDPIC to work on this target, of course. >> >> Andrew > > Yes, i built everything with the same toolchain. Did you build it statically linked or dynamically linked? (If you don't know 'file busybox' should tell you on most Linux distros.) If you built it to use dynamic libraries, how did you install the system libraries? Andrew From olaf at criseis.ruhr.de Fri Apr 15 15:49:17 2011 From: olaf at criseis.ruhr.de (Olaf Kaluza) Date: Fri, 15 Apr 2011 17:49:17 +0200 Subject: Compiler error for SH7045? Message-ID: <20110415154917.GB25680@criseis.ruhr.de> Hi everyone, I am using this compiler: olaf] ~/sources/SH7045/test1: sh2a-gcc --version sh2a-gcc (GCC) 4.5.1 I made my own testboard for an old SH2 (SH7045). It is working good! But only if I use the compile without optimization: CFLAGS = -O0 -m2 -Wfloat-equal -Wunused-variable -Wa,-L When I am using this: CFLAGS = -O2 -m2 -Wfloat-equal -Wunused-variable -Wa,-L or this: CFLAGS = -O1 -m2 -Wfloat-equal -Wunused-variable -Wa,-L I got an CPU Adress Error interrupt when using IRQ and the I am leaving the IRQ-Subroutine. For example I am using an empty irq-handler: void INT_CMT_CMI0(void) __attribute__((interrupt_handler)); void INT_CMT_CMI0(void) { } When I translate it with Optimiziation s,1 or 2 like this: sh2-gcc -O0 -m2 -c -o ticker.o ticker.c I got this: 37:ticker.c **** } 29 .loc 1 38 0 30 0004 6FE3 mov r14,r15 31 0006 6EF6 mov.l @r15+,r14 32 0008 002B rte 33 000a 0009 nop 34 .cfi_endproc 35 .LFE0: 36 .size _INT_CMT_CMI0, .-_INT_CMT_CMI0 37 .align 1 and everythink is okay. My program is working! but when I use this: sh2-gcc -O2 -m2 -c -o ticker.o ticker.c 37:ticker.c **** } 28 .loc 1 38 0 29 0004 6FE3 mov r14,r15 30 0006 002B rte 31 0008 6EF6 mov.l @r15+,r14 32 .cfi_endproc 33 .LFE0: 34 .size _INT_CMT_CMI0, .-_INT_CMT_CMI0 35 .align 1 on Line 30 or 31 my controller makes an exception to CPU-Adress error. Is this a compiler error? Is there a compiler switch I can use to avoid this problem? It is a little bit sad to develope a huge project with -O0. Olaf From ams at codesourcery.com Fri Apr 15 19:41:58 2011 From: ams at codesourcery.com (Andrew Stubbs) Date: Fri, 15 Apr 2011 20:41:58 +0100 Subject: [superh-gnu-discuss] Compiler error for SH7045? In-Reply-To: <20110415154917.GB25680@criseis.ruhr.de> References: <20110415154917.GB25680@criseis.ruhr.de> Message-ID: <4DA89F86.6090502@codesourcery.com> On 15/04/11 16:49, Olaf Kaluza wrote: > Is this a compiler error? Is there a compiler switch I can use to > avoid this problem? It is a little bit sad to develope a huge project > with -O0. Sorry Olaf, CodeSourcery toolchains only target SH-4A, SH4A-DSP, and SH-2A. It has not been configured or tested for other SH targets. If you require support for other SH targets please contact sales at codecourcery.com. However, I believe this probably is a compiler error. I'm not familiar enough with SH-2 to say why, but the problem appears to be related to the use of delay slots on that arch? On the other hand, it could be that some other part of your program changing the contents of the registers before they get to the code you quote. Sorry not to be more help. Andrew From ams at codesourcery.com Mon Apr 18 09:18:14 2011 From: ams at codesourcery.com (Andrew Stubbs) Date: Mon, 18 Apr 2011 10:18:14 +0100 Subject: [superh-gnu-discuss] Compiler error for SH7045? In-Reply-To: <4DA89F86.6090502@codesourcery.com> References: <20110415154917.GB25680@criseis.ruhr.de> <4DA89F86.6090502@codesourcery.com> Message-ID: <4DAC01D6.8070503@codesourcery.com> On 15/04/11 20:41, Andrew Stubbs wrote: > If you require support for other SH targets please contact > sales at codecourcery.com. That should of course be sales at codesourcery.com Andrew From psadhukhan at gmail.com Thu Apr 28 10:35:44 2011 From: psadhukhan at gmail.com (Prasanta Sadhukhan) Date: Thu, 28 Apr 2011 16:05:44 +0530 Subject: gcc flag: what to add Message-ID: Hi I have downloaded the http://www.codesourcery.com/sgpp/lite/superh/portal/subscription?@template=lite(GNU/Linux) SH toolchain and compiled a simple program for SH7712 chipset (which supports sh3/sh4 architecture) as below using sh-linux-gnu-gcc -m3 -Wa,--isa=sh3 but I am getting "Illegal Instruction" for printing "float" value. If I remove "float" usage then I can get the program to work I tried -m4-nofpu & other -m flags but to no avail #include void main() { int num=1; float flnum=1.0; if(*(char *)&num==1) printf("Little Endian %f\n",flnum); else printf("Big Endian %f\n",flnum); } Can you please suggest as to what gcc flags I need to use to make the program work. My original app use lots of float instructions -------------- next part -------------- An HTML attachment was scrubbed... URL: From ams at codesourcery.com Thu Apr 28 11:15:02 2011 From: ams at codesourcery.com (Andrew Stubbs) Date: Thu, 28 Apr 2011 12:15:02 +0100 Subject: [superh-gnu-discuss] gcc flag: what to add In-Reply-To: References: Message-ID: <4DB94C36.3030808@codesourcery.com> On 28/04/11 11:35, Prasanta Sadhukhan wrote: > using sh-linux-gnu-gcc -m3 -Wa,--isa=sh3 > > but I am getting "Illegal Instruction" for printing "float" value. If I > remove "float" usage then I can get the program to work Sorry, the CodeSourcery Lite toolchain currently only supports SH-4A. The options you mention do allow you to compile your own code for other architectures (although we don't test that it produces *good* code for them), but there are no corresponding libraries to link against, so you still get SH-4A code from there - hence the illegal instructions. If you revert back to the GCC 4.4 based Lite toolchain [1], you'll find that that supported SH4AL-DSP, which is essentially the same as -m4-nofpu, so you might get further with that. The other toolchain editions [2] still support SH4AL-DSP, and come with technical support. (You can try them for 30 days, free of charge.) If you would like CodeSourcery toolchains to support SH3, please contact sales at codesourcery.com. Hope that helps Andrew [1] http://www.codesourcery.com/sgpp/lite/superh/portal/subscription6790 [2] http://www.codesourcery.com/sgpp/editions.html From psadhukhan at gmail.com Fri Apr 29 07:47:28 2011 From: psadhukhan at gmail.com (Prasanta Sadhukhan) Date: Fri, 29 Apr 2011 13:17:28 +0530 Subject: [superh-gnu-discuss] gcc flag: what to add In-Reply-To: <4DB94C36.3030808@codesourcery.com> References: <4DB94C36.3030808@codesourcery.com> Message-ID: On Thu, Apr 28, 2011 at 4:45 PM, Andrew Stubbs wrote: > On 28/04/11 11:35, Prasanta Sadhukhan wrote: > >> using sh-linux-gnu-gcc -m3 -Wa,--isa=sh3 >> >> but I am getting "Illegal Instruction" for printing "float" value. If I >> remove "float" usage then I can get the program to work >> > > Sorry, the CodeSourcery Lite toolchain currently only supports SH-4A. > > The options you mention do allow you to compile your own code for other > architectures (although we don't test that it produces *good* code for > them), but there are no corresponding libraries to link against, so you > still get SH-4A code from there - hence the illegal instructions. > > If you revert back to the GCC 4.4 based Lite toolchain [1], you'll find > that that supported SH4AL-DSP, which is essentially the same as -m4-nofpu, > so you might get further with that. > > Thanks for the information. However, when I tried Sourcery G++ Lite 4.4-200 and compiled the program with -m4-nofpu I am still getting "Illegal instruction". [also tried with the above options] I guess -m4-nofpu generated code will still not run in SH7712 sh3 architecture, am I right? Can any of this lite toolchain in http://www.codesourcery.com/sgpp/lite/superh/portal/subscription6790generate code that will run in SH7712 sh3 chipset? The other toolchain editions [2] still support SH4AL-DSP, and come with > technical support. (You can try them for 30 days, free of charge.) > > If you would like CodeSourcery toolchains to support SH3, please contact > sales at codesourcery.com. > > Hope that helps > > Andrew > > [1] http://www.codesourcery.com/sgpp/lite/superh/portal/subscription6790 > [2] http://www.codesourcery.com/sgpp/editions.html > -------------- next part -------------- An HTML attachment was scrubbed... URL: