Skip to contentSkip to conversation

Build and run xenomai 2.5.5.2 - linux-2.6.33 on imx27

Xenomai-help Fabrice Gasnier 2 participants 10 messages Mar 7, 2011 – Mar 8, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Dear all,

I'm currently evaluating xenomai 2.5.5.2 on a i.MX27 platform with adeos-ipipe-2.6.33-arm-1.18-01.patch.

I've encountred two issues for the time being (same with adeos-ipipe-2.6.33-arm-1.18-00.patch).

1°/ First one happens when building a 2.6.33.3 kernel (after xenomai prepare/configure/compile stage):

CC arch/arm/plat-mxc/time.o
arch/arm/plat-mxc/time.c: In function 'mxc_timer_init':
arch/arm/plat-mxc/time.c:400: error: 'TIM1_BASE_ADDR' undeclared (first use in this function) arch/arm/plat-mxc/time.c:400: error: (Each undeclared identifier is reported only once arch/arm/plat-mxc/time.c:400: error: for each function it appears in.) make[1]: *** [arch/arm/plat-mxc/time.o] Erreur 1
make: *** [arch/arm/plat-mxc] Erreur 2

I first tried 2.6.31 kernel that was compiling (patched with adeos-ipipe-2.6.31-arm-1.16-02.patch). Looking for differences lead me to patch my kernel with:

arch/arm/plat-mxc/time.c 2011-02-28 11:48:19.000000000 +0100 renamed from arch/arm/plat-mxc/time.c 2011-02-28 11:44:02.000000000 +0100 +7 -2
Index: linux-2.6.33.3/arch/arm/plat-mxc/time.c
===================================================================
@@ -395,12 +395,17 @@
     tsc_info.freq = clk_get_rate(timer_clk);
     mxc_min_delay = ((__ipipe_cpu_freq + 500000) / 1000000) ?: 1;
 
-    if (cpu_is_mx1() || cpu_is_mx2()) {
-#if defined(CONFIG_ARCH_MX1) || defined(CONFIG_ARCH_MX2)
+    if (cpu_is_mx1()) {
+#ifdef CONFIG_ARCH_MX1
         tsc_info.u.counter_paddr = (TIM1_BASE_ADDR + MX1_2_TCN);
         tsc_info.counter_vaddr =
             (unsigned long)(timer_base + MX1_2_TCN);
 #endif
+    } else if (cpu_is_mx2()) {
+#ifdef CONFIG_ARCH_MX2
+        tsc_info.u.counter_paddr = (GPT1_BASE_ADDR + MX1_2_TCN);
+        tsc_info.counter_vaddr = (unsigned long)(timer_base + MX1_2_TCN);
+#endif
     } else if (cpu_is_mx3()) {
 #ifdef CONFIG_ARCH_MX3
         tsc_info.u.counter_paddr = (GPT1_BASE_ADDR + MX3_TCN);

2°/ Second issue comes when trying to launch xeno-test:
[...]
[email protected]:~ /usr/xenomai/share/xenomai/testsuite/latency/run -- -sh -T 120 -t0 *
*
* Type ^C to stop this application.
*
*
== Sampling period: 1000 us
== Test mode: periodic user-mode task
== All results in microseconds
warming up...
Unhandled fault: external abort on non-linefetch (0x008) at 0x40021010 Bus error
[...]

Looking at that thread:
http://www.mail-archive.com/[email protected]
It appears a similar issue has already been fixed on an i.MX25 by clearing supervisor's protection bit.

So, I tried the following, that seem to fix the issue as well:

arch/arm/mach-mx2/devices.c 2011-03-02 17:44:08.000000000 +0100 renamed from arch/arm/mach-mx2/devices.c 2011-03-01 10:51:53.000000000 +0100 +13 -0
Index: linux-2.6.33.3/arch/arm/mach-mx2/devices.c
===================================================================
@@ -680,3 +680,16 @@
 {
     return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));
 }
+
+#ifdef CONFIG_IPIPE
+static int post_cpu_init(void)
+{
+    /* Allow userspace access through the
+     * peripheral access register (PAR).
+     */
+    if (cpu_is_mx27 ())
+        ipipe_mach_allow_uaccess(AIPI_BASE_ADDR, 3);
+    return 0;
+}
+postcore_initcall(post_cpu_init);
+#endif /* CONFIG_IPIPE */
arch/arm/plat-mxc/cpu.c 2011-03-02 09:38:28.000000000 +0100 renamed from arch/arm/plat-mxc/cpu.c 2011-03-01 15:11:57.000000000 +0100 +13 -0
Index: linux-2.6.33.3/arch/arm/plat-mxc/cpu.c
===================================================================
@@ -1,5 +1,6 @@
 #include <linux/module.h>
 #include <linux/io.h>
+#include <mach/hardware.h>
 
 unsigned int __mxc_cpu_type;
 EXPORT_SYMBOL(__mxc_cpu_type);
@@ -34,4 +35,16 @@
     aips_reg &= 0x00FFFFFF;
     __raw_writel(aips_reg, aips2 + 0x50);
 }
+
+#if defined(CONFIG_ARCH_MX1) || defined(CONFIG_ARCH_MX2)
+void ipipe_mach_allow_uaccess(unsigned long aipi_base_addr, unsigned long bit_num)
+{
+    u32 tmp;
+
+    tmp = __raw_readl(IO_ADDRESS(aipi_base_addr + 0x00000008));
+    __raw_writel(tmp & ~(1 << bit_num), IO_ADDRESS(aipi_base_addr + 0x00000008));
+
+}
+#endif
+
 #endif /* CONFIG_IPIPE */
arch/arm/plat-mxc/include/mach/common.h 2011-03-02 09:47:34.000000000 +0100 renamed from arch/arm/plat-mxc/include/mach/common.h 2011-03-01 15:14:35.000000000 +0100 +0 -0
Index: linux-2.6.33.3/arch/arm/plat-mxc/include/mach/common.h
===================================================================
@@ -47,6 +47,9 @@
 
 #ifdef CONFIG_IPIPE
 void ipipe_mach_allow_hwtimer_uaccess(unsigned long aips1, unsigned 

long aips2);
+#if defined(CONFIG_ARCH_MX1) || defined(CONFIG_ARCH_MX2)
+void ipipe_mach_allow_uaccess(unsigned long aipi_base_addr, unsigned long bit_num); +#endif
#endif

#endif

Could someone advise me on the modifications brought here? Do these modifications look like ok to you?

Thanks in advance,

Fabrice

#1 lore raw
Quoted 43 lines · Fabrice Gasnier

Dear all,

I'm currently evaluating xenomai 2.5.5.2 on a i.MX27 platform with adeos-ipipe-2.6.33-arm-1.18-01.patch.

I've encountred two issues for the time being (same with adeos-ipipe-2.6.33-arm-1.18-00.patch).

1°/ First one happens when building a 2.6.33.3 kernel (after xenomai prepare/configure/compile stage):

CC arch/arm/plat-mxc/time.o
arch/arm/plat-mxc/time.c: In function 'mxc_timer_init':
arch/arm/plat-mxc/time.c:400: error: 'TIM1_BASE_ADDR' undeclared (first use in this function)
arch/arm/plat-mxc/time.c:400: error: (Each undeclared identifier is reported only once
arch/arm/plat-mxc/time.c:400: error: for each function it appears in.) make[1]: *** [arch/arm/plat-mxc/time.o] Erreur 1
make: *** [arch/arm/plat-mxc] Erreur 2

I first tried 2.6.31 kernel that was compiling (patched with adeos-ipipe-2.6.31-arm-1.16-02.patch).
Looking for differences lead me to patch my kernel with:

Index: linux-2.6.33.3/arch/arm/plat-mxc/time.c
===================================================================
--- linux-2.6.33.3.orig/arch/arm/plat-mxc/time.c 2011-02-28
11:44:02.000000000 +0100
+++ linux-2.6.33.3/arch/arm/plat-mxc/time.c 2011-02-28
11:48:19.000000000 +0100

arch/arm/plat-mxc/time.c 2011-02-28 11:48:19.000000000 +0100 renamed from arch/arm/plat-mxc/time.c 2011-02-28 11:44:02.000000000 +0100 +2 -2
@@ -395,12 +395,17 @@
      tsc_info.freq = clk_get_rate(timer_clk);
      mxc_min_delay = ((__ipipe_cpu_freq + 500000) / 1000000) ?: 1;
 
-    if (cpu_is_mx1() || cpu_is_mx2()) {
-#if defined(CONFIG_ARCH_MX1) || defined(CONFIG_ARCH_MX2)
+    if (cpu_is_mx1()) {
+#ifdef CONFIG_ARCH_MX1
          tsc_info.u.counter_paddr = (TIM1_BASE_ADDR + MX1_2_TCN);
          tsc_info.counter_vaddr =

arch/arm/plat-mxc/time.c 2011-02-28 11:48:19.000000000 +0100 line 411

Quoted 10 lines
arch/arm/plat-mxc/time.c 2011-02-28 11:48:19.000000000 +0100 renamed from arch/arm/plat-mxc/time.c 2011-02-28 11:44:02.000000000 +0100 +5 -0
              (unsigned long)(timer_base + MX1_2_TCN);
  #endif
+    } else if (cpu_is_mx2()) {
+#ifdef CONFIG_ARCH_MX2
+        tsc_info.u.counter_paddr = (GPT1_BASE_ADDR + MX1_2_TCN);
+        tsc_info.counter_vaddr = (unsigned long)(timer_base + MX1_2_TCN);
+#endif
      } else if (cpu_is_mx3()) {
  #ifdef CONFIG_ARCH_MX3
          tsc_info.u.counter_paddr = (GPT1_BASE_ADDR + MX3_TCN);

Ok. I'll take this one.

Quoted 8 lines

#ifdef CONFIG_IPIPE
void ipipe_mach_allow_hwtimer_uaccess(unsigned long aips1, unsigned
long aips2);

(quoted diff) +2 -0
+#if defined(CONFIG_ARCH_MX1) || defined(CONFIG_ARCH_MX2)
+void ipipe_mach_allow_uaccess(unsigned long aipi_base_addr, unsigned 

long bit_num);
+#endif
#endif

Look the function above, you are adding a function which is already there, please reuse the same function, instead of duplicating it...

Signature · 1 line
					    Gilles.
#2 lore raw
Quoted 59 lines · Gilles Chanteperdrix
Quoted 44 lines · Fabrice Gasnier

Dear all,

I'm currently evaluating xenomai 2.5.5.2 on a i.MX27 platform with adeos-ipipe-2.6.33-arm-1.18-01.patch.

I've encountred two issues for the time being (same with adeos-ipipe-2.6.33-arm-1.18-00.patch).

1°/ First one happens when building a 2.6.33.3 kernel (after xenomai prepare/configure/compile stage):

CC arch/arm/plat-mxc/time.o
arch/arm/plat-mxc/time.c: In function 'mxc_timer_init':
arch/arm/plat-mxc/time.c:400: error: 'TIM1_BASE_ADDR' undeclared (first use in this function)
arch/arm/plat-mxc/time.c:400: error: (Each undeclared identifier is reported only once
arch/arm/plat-mxc/time.c:400: error: for each function it appears in.) make[1]: *** [arch/arm/plat-mxc/time.o] Erreur 1
make: *** [arch/arm/plat-mxc] Erreur 2

I first tried 2.6.31 kernel that was compiling (patched with adeos-ipipe-2.6.31-arm-1.16-02.patch).
Looking for differences lead me to patch my kernel with:

Index: linux-2.6.33.3/arch/arm/plat-mxc/time.c
===================================================================
--- linux-2.6.33.3.orig/arch/arm/plat-mxc/time.c 2011-02-28
11:44:02.000000000 +0100
+++ linux-2.6.33.3/arch/arm/plat-mxc/time.c 2011-02-28
11:48:19.000000000 +0100

arch/arm/plat-mxc/time.c 2011-02-28 11:48:19.000000000 +0100 renamed from arch/arm/plat-mxc/time.c 2011-02-28 11:44:02.000000000 +0100 +2 -2
@@ -395,12 +395,17 @@
       tsc_info.freq = clk_get_rate(timer_clk);
       mxc_min_delay = ((__ipipe_cpu_freq + 500000) / 1000000) ?: 1;
 
-    if (cpu_is_mx1() || cpu_is_mx2()) {
-#if defined(CONFIG_ARCH_MX1) || defined(CONFIG_ARCH_MX2)
+    if (cpu_is_mx1()) {
+#ifdef CONFIG_ARCH_MX1
           tsc_info.u.counter_paddr = (TIM1_BASE_ADDR + MX1_2_TCN);
           tsc_info.counter_vaddr =

arch/arm/plat-mxc/time.c 2011-02-28 11:48:19.000000000 +0100 line 411

Quoted 10 lines
arch/arm/plat-mxc/time.c 2011-02-28 11:48:19.000000000 +0100 renamed from arch/arm/plat-mxc/time.c 2011-02-28 11:44:02.000000000 +0100 +5 -0
               (unsigned long)(timer_base + MX1_2_TCN);
   #endif
+    } else if (cpu_is_mx2()) {
+#ifdef CONFIG_ARCH_MX2
+        tsc_info.u.counter_paddr = (GPT1_BASE_ADDR + MX1_2_TCN);
+        tsc_info.counter_vaddr = (unsigned long)(timer_base + MX1_2_TCN);
+#endif
       } else if (cpu_is_mx3()) {
   #ifdef CONFIG_ARCH_MX3
           tsc_info.u.counter_paddr = (GPT1_BASE_ADDR + MX3_TCN);

Ok. I'll take this one.

Quoted 13 lines
Quoted 9 lines

#ifdef CONFIG_IPIPE
void ipipe_mach_allow_hwtimer_uaccess(unsigned long aips1, unsigned
long aips2);

(quoted diff) +2 -0
+#if defined(CONFIG_ARCH_MX1) || defined(CONFIG_ARCH_MX2)
+void ipipe_mach_allow_uaccess(unsigned long aipi_base_addr, unsigned

long bit_num);
+#endif
#endif

Look the function above, you are adding a function which is already there, please reuse the same function, instead of duplicating it...

Not exactly the same, I'd be pleased to use it, but I didn't manage to get it working (yet?). It hangs everything when I try to use it. It seems there are differences beetween existing routine (used by i.MX25) and what is needed by i.MX27.
Having a look at datasheet for both products shows i.MX25 has an "AIPS" where i.MX27 has an "AIPI".
Mapping in both case seem to be slightly different (registers seems different). I'm quite confused.
This is why i created quite similar routine ...

In i.MX25 case:
__raw_writel(0x0, aips1 + 0x40);
__raw_writel(0x0, aips1 + 0x44);
__raw_writel(0x0, aips1 + 0x48);
__raw_writel(0x0, aips1 + 0x4C);

In i.MX27 case:
__raw_writel(tmp & ~(1 << bit_num), IO_ADDRESS(aipi_base_addr + 0x00000008));

This second alternative seem to work properly.

Please advise.

Thanks.

Fabrice

#3 lore raw
Quoted 90 lines · Fabrice Gasnier
Quoted 59 lines · Gilles Chanteperdrix
Quoted 44 lines · Fabrice Gasnier

Dear all,

I'm currently evaluating xenomai 2.5.5.2 on a i.MX27 platform with adeos-ipipe-2.6.33-arm-1.18-01.patch.

I've encountred two issues for the time being (same with adeos-ipipe-2.6.33-arm-1.18-00.patch).

1°/ First one happens when building a 2.6.33.3 kernel (after xenomai prepare/configure/compile stage):

CC arch/arm/plat-mxc/time.o
arch/arm/plat-mxc/time.c: In function 'mxc_timer_init':
arch/arm/plat-mxc/time.c:400: error: 'TIM1_BASE_ADDR' undeclared (first use in this function)
arch/arm/plat-mxc/time.c:400: error: (Each undeclared identifier is reported only once
arch/arm/plat-mxc/time.c:400: error: for each function it appears in.) make[1]: *** [arch/arm/plat-mxc/time.o] Erreur 1
make: *** [arch/arm/plat-mxc] Erreur 2

I first tried 2.6.31 kernel that was compiling (patched with adeos-ipipe-2.6.31-arm-1.16-02.patch).
Looking for differences lead me to patch my kernel with:

Index: linux-2.6.33.3/arch/arm/plat-mxc/time.c
===================================================================
--- linux-2.6.33.3.orig/arch/arm/plat-mxc/time.c 2011-02-28
11:44:02.000000000 +0100
+++ linux-2.6.33.3/arch/arm/plat-mxc/time.c 2011-02-28
11:48:19.000000000 +0100

arch/arm/plat-mxc/time.c 2011-02-28 11:48:19.000000000 +0100 renamed from arch/arm/plat-mxc/time.c 2011-02-28 11:44:02.000000000 +0100 +2 -2
@@ -395,12 +395,17 @@
       tsc_info.freq = clk_get_rate(timer_clk);
       mxc_min_delay = ((__ipipe_cpu_freq + 500000) / 1000000) ?: 1;
 
-    if (cpu_is_mx1() || cpu_is_mx2()) {
-#if defined(CONFIG_ARCH_MX1) || defined(CONFIG_ARCH_MX2)
+    if (cpu_is_mx1()) {
+#ifdef CONFIG_ARCH_MX1
           tsc_info.u.counter_paddr = (TIM1_BASE_ADDR + MX1_2_TCN);
           tsc_info.counter_vaddr =

arch/arm/plat-mxc/time.c 2011-02-28 11:48:19.000000000 +0100 line 411

Quoted 10 lines
arch/arm/plat-mxc/time.c 2011-02-28 11:48:19.000000000 +0100 renamed from arch/arm/plat-mxc/time.c 2011-02-28 11:44:02.000000000 +0100 +5 -0
               (unsigned long)(timer_base + MX1_2_TCN);
   #endif
+    } else if (cpu_is_mx2()) {
+#ifdef CONFIG_ARCH_MX2
+        tsc_info.u.counter_paddr = (GPT1_BASE_ADDR + MX1_2_TCN);
+        tsc_info.counter_vaddr = (unsigned long)(timer_base + MX1_2_TCN);
+#endif
       } else if (cpu_is_mx3()) {
   #ifdef CONFIG_ARCH_MX3
           tsc_info.u.counter_paddr = (GPT1_BASE_ADDR + MX3_TCN);

Ok. I'll take this one.

Quoted 13 lines
Quoted 9 lines

#ifdef CONFIG_IPIPE
void ipipe_mach_allow_hwtimer_uaccess(unsigned long aips1, unsigned
long aips2);

(quoted diff) +2 -0
+#if defined(CONFIG_ARCH_MX1) || defined(CONFIG_ARCH_MX2)
+void ipipe_mach_allow_uaccess(unsigned long aipi_base_addr, unsigned

long bit_num);
+#endif
#endif

Look the function above, you are adding a function which is already there, please reuse the same function, instead of duplicating it...

Not exactly the same, I'd be pleased to use it, but I didn't manage to get it working (yet?). It hangs everything when I try to use it. It seems there are differences beetween existing routine (used by i.MX25) and what is needed by i.MX27.
Having a look at datasheet for both products shows i.MX25 has an "AIPS" where i.MX27 has an "AIPI".
Mapping in both case seem to be slightly different (registers seems different). I'm quite confused.
This is why i created quite similar routine ...

In i.MX25 case:
__raw_writel(0x0, aips1 + 0x40);
__raw_writel(0x0, aips1 + 0x44);
__raw_writel(0x0, aips1 + 0x48);
__raw_writel(0x0, aips1 + 0x4C);

Quoted 5 lines

In i.MX27 case:
__raw_writel(tmp & ~(1 << bit_num), IO_ADDRESS(aipi_base_addr + 0x00000008));

This second alternative seem to work properly.

Just put an if in the function... if (cpu_is_mx27()) etc... Remember that the MXC code is supposed to be able to run on several boards at the same time.

Signature · 1 line
					    Gilles.
#5 lore raw

Hi,

Off course, I would try it. I cannot get access to it (403 Forbidden, You don't have permission to access /~gch/pub/adeos-ipipe-2.6.33-arm-1.18-02-rc1.patch on this server.)

Quoted 17 lines · Gilles Chanteperdrix
Quoted 5 lines · Fabrice Gasnier

Dear all,

I'm currently evaluating xenomai 2.5.5.2 on a i.MX27 platform with adeos-ipipe-2.6.33-arm-1.18-01.patch.

Could you try the following patch? Instead of
adeos-ipipe-2.6.33-arm-1.18-01.patch?

http://www.xenomai.org/~gch/pub/adeos-ipipe-2.6.33-arm-1.18-02-rc1.patch

It fixes things a bit differently.

Thanks in advance.

#6 lore raw
Quoted 6 lines · Fabrice Gasnier

Hi,

Off course, I would try it. I cannot get access to it (403 Forbidden, You don't have permission to access /~gch/pub/adeos-ipipe-2.6.33-arm-1.18-02-rc1.patch on this server.)

Sorry, please try again...

Signature · 1 line
                                                                Gilles.
#8 lore raw
In reply to Gilles Chanteperdrix

Fine,

This patch fixes both issues on 2.6.33 kernel! Thanks.
I'll let you know in case I detect something else.

Regarding 2.6.35 patch, I need to check more things as I don't use it for the moment. (no valuable config / board support yet). I quiclky tried it, but cannot boot it (yet). I'll give it some more tries and keep you informed.

Thanks again.
Fabrice

Quoted 17 lines · Gilles Chanteperdrix
Quoted 5 lines · Fabrice Gasnier

Dear all,

I'm currently evaluating xenomai 2.5.5.2 on a i.MX27 platform with adeos-ipipe-2.6.33-arm-1.18-01.patch.

Could you try the following patch? Instead of
adeos-ipipe-2.6.33-arm-1.18-01.patch?

http://www.xenomai.org/~gch/pub/adeos-ipipe-2.6.33-arm-1.18-02-rc1.patch

It fixes things a bit differently.

Thanks in advance.

#9 lore raw
Quoted 6 lines · Fabrice Gasnier

Fine,

This patch fixes both issues on 2.6.33 kernel! Thanks.
I'll let you know in case I detect something else.

Quoted 7 lines

Regarding 2.6.35 patch, I need to check more things as I don't use it for the moment. (no valuable config / board support yet). I quiclky tried it, but cannot boot it (yet). I'll give it some more tries and keep you informed.

Thanks again.
Fabrice

Ok. Forget it, the code in the 2.6.35 patch is the same anyway, and was build-tested on imx27. 2.5.6 will be released soon with both these patches.

Signature · 1 line
					    Gilles.