Xenomai on Freescale i.MX21 (ARM926J)
Subsystems (12)
Dear all,
We finally succeeded in the port of Xenomai on our Freescale i.MX21 board (ARM-926J); (The board used is the CSB535FS issued from Cogent with the BSP from Microcross)
To have further technical references, please see there: http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=i.MX_LITEKIT&parentCode=i.MX21&nodeId=0162468rH31143ZrDR
So, you will find two patches: the first one (patch-linux-2.6.14.imx21_1.0.0) is used to patch the Linux 2.6.14 for supporting the board. Then, the second one (adeos-ipipe-2.6.14-arm-imx21-0.1.00.patch) can be used against the imx21-enabled kernel for Xenomai, simply using the prepare-kernel.sh script. The patch was originally inspired from the Integrator/ARM11 patch; thanks to its author :-)
We will publish soon some results regarding the different latencies, but so far we measured about 2us between the IRQ and the timer reprogramming (at the ipipe level). The problem now is the jitter which is pretty high: about 1-2us, with some occasional peaks up to 5us. Having quite a few experience with this kind of board, we don't know if it comes from the code itself, or purely from the hardware. Any idea/suggestions would be welcome. For periodic tasks around 20us, everything works perfecly.
I don't know to what extent this (1 or 2) patch(es) can be integrated in the official distribution; but of course we are willing to make any adaptations to fulfill the requirements for that.
It's a first step; I hope it will help some other ARM9 developers and look forward to reading some feedbacks.
I profit to thank a lot the Xenomai team (Philippe, Jan, Gilles and the others) for their excellent work and support).
Kind regards
Daniel
arch/arm/Kconfig +2 -0
@@ -349,6 +349,8 @@ depends on SMP default "4" +source "kernel/ipipe/Kconfig" + config PREEMPT bool "Preemptible Kernel (EXPERIMENTAL)" depends on EXPERIMENTAL
/config_2.6.14_imx21_ipipe_cogent535fs +859 -0
859 lines not on this page · raw message
arch/arm/kernel/entry-armv.S +51 -2
106 lines not on this page · raw message
arch/arm/kernel/entry-common.S +29 -9
@@ -2,6 +2,7 @@ * linux/arch/arm/kernel/entry-common.S * * Copyright (C) 2000 Russell King + * Copyright (C) 2005 Stelian Pop. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as
@@ -20,13 +21,18 @@ * possible here, and this includes saving r0 back into the SVC * stack. */ +#ifdef CONFIG_IPIPE +__ipipe_ret_fast_syscall: + ldr r0, [sp, #S_R0+S_OFF] @ returned r0 + /* fall through */ +#endif ret_fast_syscall: disable_irq @ disable interrupts ldr r1, [tsk, #TI_FLAGS] tst r1, #_TIF_WORK_MASK bne fast_work_pending - @ fast_restore_user_regs +fast_restore_user_regs: ldr r1, [sp, #S_OFF + S_PSR] @ get calling cpsr ldr lr, [sp, #S_OFF + S_PC]! @ get pc msr spsr_cxsf, r1 @ save in spsr_svc
@@ -35,6 +41,13 @@ add sp, sp, #S_FRAME_SIZE - S_PC movs pc, lr @ return & move spsr_svc into cpsr +#ifdef CONFIG_IPIPE +__ipipe_fast_exit_syscall: + ldr r0, [sp, #S_R0+S_OFF] @ returned r0 + disable_irq @ disable interrupts + b fast_restore_user_regs +#endif /* CONFIG_IPIPE */ + /* * Ok, we need to do extra processing, enter the slow path. */
@@ -63,14 +76,7 @@ tst r1, #_TIF_WORK_MASK bne work_pending no_work_pending: - @ slow_restore_user_regs - ldr r1, [sp, #S_PSR] @ get calling cpsr - ldr lr, [sp, #S_PC]! @ get pc - msr spsr_cxsf, r1 @ save in spsr_svc - ldmdb sp, {r0 - lr}^ @ get calling r1 - lr - mov r0, r0 - add sp, sp, #S_FRAME_SIZE - S_PC - movs pc, lr @ return & move spsr_svc into cpsr + slow_restore_user_regs /* * This is how we return from a fork.
@@ -152,6 +158,17 @@ ldr ip, [tsk, #TI_FLAGS] @ check for syscall tracing bic scno, scno, #0xff000000 @ mask off SWI op-code eor scno, scno, #__NR_SYSCALL_BASE @ check OS number +#ifdef CONFIG_IPIPE + stmfd sp!, {r0-r3, ip} + add r1, sp, #S_OFF + add r1, r1, #20 + mov r0, scno + bl __ipipe_syscall_root + cmp r0, #0 + ldmfd sp!, {r0-r3, ip} + blt __ipipe_ret_fast_syscall + bgt __ipipe_fast_exit_syscall +#endif /* CONFIG_IPIPE */ adr tbl, sys_call_table @ load syscall table pointer tst ip, #_TIF_SYSCALL_TRACE @ are we tracing syscalls? bne __sys_trace
@@ -196,6 +213,9 @@ __cr_alignment: .word cr_alignment #endif +#ifdef CONFIG_IPIPE + .word __ipipe_syscall_root +#endif .type sys_call_table, #object ENTRY(sys_call_table)
arch/arm/kernel/entry-header.S +9 -0
@@ -67,6 +67,15 @@ #endif .endm + .macro slow_restore_user_regs + ldr r1, [sp, #S_PSR] @ get calling cpsr + ldr lr, [sp, #S_PC]! @ get pc + msr spsr_cxsf, r1 @ save in spsr_svc + ldmdb sp, {r0 - lr}^ @ get calling r1 - lr + mov r0, r0 + add sp, sp, #S_FRAME_SIZE - S_PC + movs pc, lr @ return & move spsr_svc into cpsr + .endm /* * These are the registers used in the syscall handler, and allow us to
arch/arm/kernel/ipipe-core.c +362 -0
362 lines not on this page · raw message
arch/arm/kernel/ipipe-root.c +451 -0
451 lines not on this page · raw message
arch/arm/kernel/irq.c +14 -2
@@ -20,6 +20,12 @@* * IRQ's are in fact implemented a bit like signal handlers for the kernel. * Naturally it's not a 1:1 relation, but there are similarities. +* +* April 2006 : +* Adapted to ARM9 i.MX21/CSB535FS board with Xenomai by S.Gerber, G.Boutillier and D.Rossier +* University of Applied Sciences Western Switzerland +* Reconfigurable & Embedded Digital Systems, REDS Institute +* */ #include <linux/config.h> #include <linux/kernel_stat.h>
@@ -54,10 +60,11 @@static int noirqdebug;static volatile unsigned long irq_err_count; -static DEFINE_SPINLOCK (irq_controller_lock); +DEFINE_SPINLOCK (irq_controller_lock);static LIST_HEAD (irq_pending);struct irqdesc irq_desc[NR_IRQS ]; +EXPORT_SYMBOL (irq_desc);void (*init_arch_irq)(void )__initdata =NULL ;/*
@@ -411,8 +418,9 @@/* * Acknowledge and clear the IRQ, but don't mask it. */ +#ifndef CONFIG_IPIPE desc->chip->ack (irq); - +#endif /* CONFIG_IPIPE */ /* * Mark the IRQ currently in progress. */
@@ -449,8 +457,10 @@* currently running. Delay it. */ desc->pending =1 ; +#ifndef CONFIG_IPIPE desc->chip->mask (irq); desc->chip->ack (irq); +#endif /* CONFIG_IPIPE */ }/*
@@ -467,7 +477,9 @@/* * Acknowledge, clear _AND_ disable the interrupt. */ +#ifndef CONFIG_IPIPE desc->chip->ack (irq); +#endif /* CONFIG_IPIPE */ if (likely (!desc->disable_depth)) {kstat_cpu (cpu).irqs[irq]++;
arch/arm/kernel/Makefile +1 -0
@@ -19,6 +19,7 @@ obj-$(CONFIG_ISA_DMA) += dma-isa.o obj-$(CONFIG_PCI) += bios32.o obj-$(CONFIG_SMP) += smp.o +obj-$(CONFIG_IPIPE) += ipipe-core.o ipipe-root.o obj-$(CONFIG_IWMMXT) += iwmmxt.o AFLAGS_iwmmxt.o := -Wa,-mcpu=iwmmxt
arch/arm/kernel/process.c +16 -2
@@ -7,6 +7,12 @@* This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. +* +* April 2006 : +* Adapted to ARM9 i.MX21/CSB535FS board with Xenomai by S.Gerber, G.Boutillier and D.Rossier +* University of Applied Sciences Western Switzerland +* Reconfigurable & Embedded Digital Systems, REDS Institute +* */ #include <stdarg.h>
@@ -85,12 +91,12 @@*/ void default_idle (void ) { -local_irq_disable (); +local_irq_disable_hw_cond ();if (!need_resched () && !hlt_counter) {timer_dyn_reprogram ();arch_idle (); } -local_irq_enable (); +local_irq_enable_hw_cond (); }/*
@@ -107,10 +113,18 @@void (*idle)(void ) = pm_idle;if (!idle) idle = default_idle; +ipipe_suspend_domain ();preempt_disable ();leds_event (led_idle_start);while (!need_resched ()) +/* +* Width idle -> latenca of interrupts + */ +#ifndef CONFIG_IPIPE idle (); +#else + ; +#endif leds_event (led_idle_end);preempt_enable ();schedule ();
arch/arm/kernel/ptrace.c +4 -0
@@ -494,6 +494,10 @@static int break_trap (struct pt_regs *regs,unsigned int instr) { + +if (ipipe_trap_notify (IPIPE_TRAP_BREAK ,regs)) +return 0 ; +ptrace_break (current, regs);return 0 ; }
arch/arm/kernel/traps.c +3 -0
@@ -298,6 +298,9 @@ }spin_unlock_irq (&undef_lock); +if (ipipe_trap_notify (IPIPE_TRAP_UNDEFINSTR ,regs)) +return ; +#ifdef CONFIG_DEBUG_USER if (user_debug &UDBG_UNDEFINED ) { printk(KERN_INFO "%s (%d): undefined instruction: pc=%p\n",
arch/arm/mach-integrator/core.c +110 -48
215 lines not on this page · raw message
arch/arm/mach-integrator/integrator_cp.c +7 -1
@@ -2,6 +2,7 @@* linux/arch/arm/mach-integrator/integrator_cp.c * * Copyright (C) 2003 Deep Blue Solutions Ltd +* Copyright (C) 2005 Stelian Pop. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
@@ -521,9 +522,14 @@#define TIMER_CTRL_IE (1 << 5)/* Interrupt Enable */ +#ifdef CONFIG_IPIPE +unsigned int __ipipe_mach_ticks_per_jiffy =1000000 * TICKS_PER_uSEC /HZ ; +EXPORT_SYMBOL (__ipipe_mach_ticks_per_jiffy); +#endif +static void __init intcp_timer_init (void ) { -integrator_time_init (1000000 /HZ ,TIMER_CTRL_IE ); +integrator_time_init (1000000 * TICKS_PER_uSEC /HZ ,TIMER_CTRL_IE ); }static struct sys_timer cp_timer = {
arch/arm/mach-imx21/irq.c +27 -0
@@ -23,6 +23,12 @@* 03/03/2004 Sascha Hauer <[email protected]> * Copied from the motorola bsp package and added gpio demux * interrupt handler +* +* April 2006 : +* Adapted to ARM9 i.MX21/CSB535FS board with Xenomai by S.Gerber, G.Boutillier and D.Rossier +* University of Applied Sciences Western Switzerland +* Reconfigurable & Embedded Digital Systems, REDS Institute +* */ #include <linux/init.h> extern int x1;
@@ -154,11 +160,18 @@ imx21_gpio_handler(unsigned int irq_unused, struct irqdesc *desc, struct pt_regs *regs) { +#ifdef CONFIG_IPIPE + struct irqdesc *desc_unused; +#endif unsigned int mask;unsigned int port;unsigned int irq_base;unsigned int irq =0 ; +#ifdef CONFIG_IPIPE + desc_unused = desc; +#endif +for (port =0 ; port <6 ; port++) {if (ISR (port) &IMR (port)) {break ;
@@ -179,6 +192,10 @@ desc++; mask >>=1 ; } + +#ifdef CONFIG_IPIPE + desc_unused->chip->unmask (irq_unused); +#endif }static struct irqchip imx21_gpio_chip = {
@@ -209,6 +226,16 @@IMR (4 ) =0 ;IMR (5 ) =0 ; +/* Define priorities for all interrupts lines */ +AITC_NIPRIORITY7 =0x00000000 ; +AITC_NIPRIORITY6 =0x00000000 ; +AITC_NIPRIORITY5 =0x00000000 ; +AITC_NIPRIORITY4 =0x00000000 ; +AITC_NIPRIORITY3 =0x00000f00 ; +AITC_NIPRIORITY2 =0x00000000 ; +AITC_NIPRIORITY1 =0x00000000 ; +AITC_NIPRIORITY0 =0x00000000 ; +for (irq =0 ; irq <IMX21_IRQS ; irq++) {set_irq_chip (irq, &imx21_internal_chip);set_irq_handler (irq, do_level_IRQ);
arch/arm/mach-imx21/time.c +158 -28
242 lines not on this page · raw message
arch/arm/mm/fault.c +16 -0
@@ -223,6 +223,9 @@struct mm_struct *mm;int fault, sig, code; +if (ipipe_trap_notify (IPIPE_TRAP_ACCESS ,regs)) +return 0 ; + tsk = current; mm = tsk->mm;
@@ -354,6 +357,9 @@ bad_area: tsk = current; +if (ipipe_trap_notify (IPIPE_TRAP_ACCESS ,regs)) +return 0 ; +do_bad_area (tsk, tsk->active_mm, addr, fsr, regs);return 0 ; }
@@ -366,6 +372,10 @@ do_sect_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs) { struct task_struct *tsk = current; + +if (ipipe_trap_notify (IPIPE_TRAP_SECTION ,regs)) +return 0 ; +do_bad_area (tsk, tsk->active_mm, addr, fsr, regs);return 0 ; }
@@ -376,6 +386,9 @@static int do_bad (unsigned long addr,unsigned int fsr,struct pt_regs *regs) { +if (ipipe_trap_notify (IPIPE_TRAP_DABT ,regs)) +return 0 ; +return 1 ; }
@@ -451,6 +464,9 @@if (!inf->fn (addr, fsr, regs))return ; +if (ipipe_trap_notify (IPIPE_TRAP_UNKNOWN ,regs)) +return ; +printk (KERN_ALERT "Unhandled fault: %s (0x%03x) at 0x%08lx\n" , inf->name, fsr, addr);
include/asm-arm/arch-integrator/entry-macro.S +5 -1
@@ -20,7 +20,11 @@ teq \irqstat, #0 ldreq \irqstat, [\base, #(INTEGRATOR_HDR_IC_OFFSET+IRQ_STATUS)] moveq \irqnr, #IRQ_CIC_START - +#ifdef CONFIG_IPIPE + tst \irqstat, #0x00000040 @ check IRQ_TIMERINT1 first + movne \irqnr, #6 + bne 1003f +#endif /* CONFIG_IPIPE */ 1001: tst \irqstat, #15 bne 1002f add \irqnr, \irqnr, #4
include/asm-arm/arch-integrator/platform.h +9 -2
@@ -26,13 +26,15 @@* NOTE: This is a multi-hosted header file for use with uHAL and * supported debuggers. * -* $Id: platform.s,v 1.32 2000/02/18 10:51:39 asims Exp $ +* $Id: platform.h,v 1.2 2006/01/03 17:02:33 rpm Exp $ * * ***********************************************************************/ #ifndef __address_h#define __address_h 1 +#include <linux/config.h> +/* ======================================================================== * Integrator definitions * ========================================================================
@@ -436,7 +438,7 @@* Timer definitions * * Only use timer 1 & 2 -* (both run at 24MHz and will need the clock divider set to 16). +* (both run at 1MHZ on /CP and at 24MHz on /AP) * * Timer 0 runs at bus frequency and therefore could vary and currently * uHAL can't handle that.
@@ -449,7 +451,12 @@#define MAX_TIMER 2#define MAX_PERIOD 699050 + +#ifdef CONFIG_ARCH_INTEGRATOR_CP +#define TICKS_PER_uSEC 1 +#else #define TICKS_PER_uSEC 24 +#endif /* * These are useconds NOT ticks.
include/asm-arm/arch-integrator/timex.h +2 -2
@@ -21,6 +21,6 @@*/ /* -* ?? +* Timer rate */ -#define CLOCK_TICK_RATE (50000000 / 16) +#define CLOCK_TICK_RATE (1000000)
include/asm-arm/arch-imx21/imx-regs.h +38 -11
101 lines not on this page · raw message
include/asm-arm/atomic.h +6 -6
@@ -110,10 +110,10 @@unsigned long flags;int val; -local_irq_save (flags); +local_irq_save_hw (flags); val = v->counter; v->counter = val += i; -local_irq_restore (flags); +local_irq_restore_hw (flags);return val; }
@@ -123,10 +123,10 @@unsigned long flags;int val; -local_irq_save (flags); +local_irq_save_hw (flags); val = v->counter; v->counter = val -= i; -local_irq_restore (flags); +local_irq_restore_hw (flags);return val; }
@@ -135,9 +135,9 @@ {unsigned long flags; -local_irq_save (flags); +local_irq_save_hw (flags); *addr &= ~mask; -local_irq_restore (flags); +local_irq_restore_hw (flags); }#endif /* __LINUX_ARM_ARCH__ */
include/asm-arm/bitops.h +12 -12
@@ -36,9 +36,9 @@ p += bit >>5 ; -local_irq_save (flags); +local_irq_save_hw (flags); *p |= mask; -local_irq_restore (flags); +local_irq_restore_hw (flags); }static inline void ____atomic_clear_bit (unsigned int bit,volatile unsigned long *p)
@@ -48,9 +48,9 @@ p += bit >>5 ; -local_irq_save (flags); +local_irq_save_hw (flags); *p &= ~mask; -local_irq_restore (flags); +local_irq_restore_hw (flags); }static inline void ____atomic_change_bit (unsigned int bit,volatile unsigned long *p)
@@ -60,9 +60,9 @@ p += bit >>5 ; -local_irq_save (flags); +local_irq_save_hw (flags); *p ^= mask; -local_irq_restore (flags); +local_irq_restore_hw (flags); } static inline int
@@ -74,10 +74,10 @@ p += bit >>5 ; -local_irq_save (flags); +local_irq_save_hw (flags); res = *p; *p = res | mask; -local_irq_restore (flags); +local_irq_restore_hw (flags);return res & mask; }
@@ -91,10 +91,10 @@ p += bit >>5 ; -local_irq_save (flags); +local_irq_save_hw (flags); res = *p; *p = res & ~mask; -local_irq_restore (flags); +local_irq_restore_hw (flags);return res & mask; }
@@ -108,10 +108,10 @@ p += bit >>5 ; -local_irq_save (flags); +local_irq_save_hw (flags); res = *p; *p = res ^ mask; -local_irq_restore (flags); +local_irq_restore_hw (flags);return res & mask; }
include/asm-arm/ipipe.h +169 -0
154 lines not on this page · raw message
include/asm-arm/mmu_context.h +10 -0
Lines of this file are not shown. View the raw message.
include/asm-arm/pgalloc.h +5 -0
Lines of this file are not shown. View the raw message.
include/asm-arm/system.h +56 -22
78 lines not on this page · raw message
include/linux/hardirq.h +13 -0
Lines of this file are not shown. View the raw message.
include/linux/ipipe.h +792 -0
792 lines not on this page · raw message
include/linux/preempt.h +38 -21
59 lines not on this page · raw message
include/linux/sched.h +9 -0
Lines of this file are not shown. View the raw message.
init/Kconfig +18 -0
Lines of this file are not shown. View the raw message.
init/main.c +7 -0
Lines of this file are not shown. View the raw message.
kernel/exit.c +1 -0
Lines of this file are not shown. View the raw message.
kernel/fork.c +8 -0
Lines of this file are not shown. View the raw message.
kernel/Makefile +3 -0
Lines of this file are not shown. View the raw message.
kernel/printk.c +73 -0
73 lines not on this page · raw message
kernel/sched.c +75 -1
76 lines not on this page · raw message
kernel/signal.c +1 -0
Lines of this file are not shown. View the raw message.
kernel/ipipe/core.c +827 -0
827 lines not on this page · raw message
kernel/ipipe/generic.c +397 -0
397 lines not on this page · raw message
kernel/ipipe/Kconfig +15 -0
Lines of this file are not shown. View the raw message.
kernel/ipipe/Makefile +3 -0
Lines of this file are not shown. View the raw message.
kernel/irq/handle.c +15 -0
Lines of this file are not shown. View the raw message.
lib/smp_processor_id.c +5 -0
Lines of this file are not shown. View the raw message.
lib/spinlock_debug.c +19 -0
Lines of this file are not shown. View the raw message.
mm/vmalloc.c +5 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
Quoted 6 lines · ROSSIER Daniel
Dear all,
We finally succeeded in the port of Xenomai on our Freescale i.MX21 board (ARM-926J); (The board used is the CSB535FS issued from Cogent with the BSP from Microcross)
Quoted 7 lines
To have further technical references, please see there: http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=i.MX_LITEKIT&parentCode=i.MX21&nodeId=0162468rH31143ZrDR
So, you will find two patches: the first one (patch-linux-2.6.14.imx21_1.0.0) is used to patch the Linux 2.6.14 for supporting the board. Then, the second one (adeos-ipipe-2.6.14-arm-imx21-0.1.00.patch) can be used against the imx21-enabled kernel for Xenomai, simply using the
prepare-kernel.shscript. The patch was originally inspired from the Integrator/ARM11 patch; thanks to its author :-)We will publish soon some results regarding the different latencies, but so far we measured about 2us between the IRQ and the timer reprogramming (at the ipipe level). The problem now is the jitter which is pretty high: about 1-2us, with some occasional peaks up to 5us. Having quite a few experience with this kind of board, we don't know if it comes from the code itself, or purely from the hardware. Any idea/suggestions would be welcome. For periodic tasks around 20us, everything works perfecly.
Those results are pretty impressive actually. Assuming that you compare those figures with those obtained from traditional standalone RTOS e.g. VxWorks on the same board, the critical difference with Xenomai is that Linux is competing for the hw resources, and for instance, happily trashes the cache under Xenomai's feet when scheduling its own tasks during Xeno's idle time. Additionally, Adeos adds a small overhead due to the interrupt virtualization, in exchange of real-time predictability for their delivery. Therefore, in this respect, 5 us does not look that bad already.
Are 20 us a measure of the worst-case interrupt latency (i.e. running latency -t2), or scheduling latency in user-space (i.e. running latency -t0)?
Quoted 1 line
I don't know to what extent this (1 or 2) patch(es) can be integrated in the official distribution;
but of course we are willing to make any adaptations to fulfill the requirements for that.
For the technical part, I guess that anyone interested in the ARM support for Adeos/Xenomai will review this code; I'll be one of these people, for sure. The usefulness of such contribution looks obvious to me.
For the non-technical part, a pre-requisite for adding code to the Adeos or Xenomai codebases is to properly identify it as coming from a legitimate source, so if you, as a submitter, can confirm that you may freely contribute it on behalf of the HEIG-VD (I guess?) or yourself, that's fine with us. Btw, at first glance, I did not find any additional GPL copyrights coming with your changes in the patches, it would be better to have them, so that we always know who contributed to what, as much as possible.
Quoted 5 lines
It's a first step; I hope it will help some other ARM9 developers and look forward to reading some feedbacks.
I profit to thank a lot the Xenomai team (Philippe, Jan, Gilles and the others) for their excellent work and support).
Xenomai exists because people participate in the Sisyphean task of making it better, like you just did. In other words, welcome to the band. Let's roll the rock.
Quoted 12 lines
Kind regards
Daniel
------------------------------------------------------------------------
_______________________________________________
Xenomai-core mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-core
Signature · 1 line
Philippe.
Quoted 6 lines
Quoted 5 lines · ROSSIER Daniel
Dear all,
We finally succeeded in the port of Xenomai on our Freescale i.MX21 board (ARM-926J); (The board used is the CSB535FS issued from Cogent with the BSP from Microcross)
Daniel,
thank you and congratulations for this great work!
I wonder how many man/hours have you spent to reach this goal ? TIA
/marco
Hi Marco,
Two of our soft/hard engineers (Sébastien Gerber & Guillaume Boutillier) have worked quite a lot over these last 6 months for this port.
These last weeks, they spent much work on measuring the response time (by means of a digital analyzer) and trying to move some piece of code and re-work out a bit the current patch in order to make the IRQ virtualization as clean as possible and to get very low latency. Thanks to them :-)
Daniel
-------- Message d'origine--------
De: Marco Cavallini [mailto:[email protected]]
Date: jeu. 20.04.2006 17:36
À: [email protected]
Cc: ROSSIER Daniel
Objet : Re: [Xenomai-core] Xenomai on Freescale i.MX21 (ARM926J)
Quoted 8 lines
Quoted 7 lines · ROSSIER Daniel
Dear all,
We finally succeeded in the port of Xenomai on our Freescale i.MX21 board (ARM-926J);
(The board used is the CSB535FS issued from Cogent with the BSP from Microcross)
Daniel,
thank you and congratulations for this great work!
I wonder how many man/hours have you spent to reach this goal ? TIA
/marco
Quoted 11 lines · ROSSIER Daniel
Hi Marco,
Two of our soft/hard engineers (Sébastien Gerber & Guillaume Boutillier) have worked quite a lot over these last 6 months for this port.
These last weeks, they spent much work on measuring the response time (by means of a digital analyzer) and trying to move some piece of code and re-work out a bit the current patch in order to make the IRQ virtualization as clean as possible and to get very low latency. Thanks to them :-)
I guess this significant effort was related to the fact that you were hunting nanoseconds, aren't you? Well, that's great! Can we hire you for other archs as well? ;) [I also have some weird ideas regarding micro-optimisations of the user space interface.]
Jan
Yes indeed; we actually intend to implement some interaction protocols between
the processor and an FPGA as realtime tasks for cryptographic operations. We
therefore try to have some minimal overhead.
Right now, we focus on the iMX21 proc. and since we're bound to some industrial projects,
we won't have much time to have a look at other archs, although we are, of course, very
interested in getting some feedback on other archs and we're ready to provide some help as much as we can. We stay in touch :-) (i look forward to having further details about your micro-optimisation approach in the user space; at the moment, we mainly work RT tasks in the kernel space for architectural reasons, but migrating the code to a more convenient execution environment in the user space definitively retains our attention).
By the way, I have a student who will work on an extension of LTTng (Linux trace toolkit) in order to support Xenomai, in the context of his diploma work. Examining the RT traces, filtering events, tracking RT activities in user/kernel space, detecting priority inversions, etc. are some interesting topics we're promoting in our Institute. Any ideas/suggestions about features and extensions to improve such visualization tools are also welcome :-) (we will publish everything as soon as we have some substantial results, but the student work is mainly on the second half of the Year at Montreal to the originator's premises).
Daniel
-------- Message d'origine--------
De: Jan Kiszka [mailto:[email protected]]
Date: ven. 21.04.2006 09:31
À: ROSSIER Daniel
Cc: [email protected]; [email protected]
Objet : Re: RE : [Xenomai-core] Xenomai on Freescale i.MX21 (ARM926J)
Quoted 11 lines · ROSSIER Daniel
Hi Marco,
Two of our soft/hard engineers (Sébastien Gerber & Guillaume Boutillier) have worked quite a lot over these last 6 months for this port.
These last weeks, they spent much work on measuring the response time (by means of a digital analyzer) and trying to move some piece of code and re-work out a bit the current patch in order to make the IRQ virtualization as clean as possible and to get very low latency. Thanks to them :-)
I guess this significant effort was related to the fact that you were hunting nanoseconds, aren't you? Well, that's great! Can we hire you for other archs as well? ;) [I also have some weird ideas regarding micro-optimisations of the user space interface.]
Jan
Philippe Gerum wrote:
Btw, at first glance, I did not find any additional
Quoted 1 line
GPL copyrights coming with your changes in the patches, it would be better to have them, so that we always know who contributed to what, as much as possible.
Ok, I was not searching for the right pattern, looking more closely to the source, I eventually found those copyright notices. Forget about this request, sorry for the noise.
Signature · 1 line
Philippe.
Hi Daniel,
Some comments about the Adeos patch for the i.MX21/CSB535FS board. The inlined patch has been rebuilt by diff'ing the vanilla Adeos 1.2-00 support with yours.
Quoted 24 lines
arch/arm/kernel/ipipe-core.c +7
-0@@ -22,6 +22,12 @@* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * Architecture-dependent I-PIPE core support for ARM. +* +* April 2006 : +* Adapted to ARM9 i.MX21/CSB535FS board with Xenomai by S.Gerber, G.Boutillier and D.Rossier +* University of Applied Sciences Western Switzerland +* Reconfigurable & Embedded Digital Systems, REDS Institute +* */ #include <linux/config.h> @@ -320,11 +326,19 @@ static void __ipipe_set_decr(void)int ipipe_tune_timer (unsigned long ns,int flags) {unsigned long x, ticks; +unsigned long us;if (flags &IPIPE_RESET_TIMER ) ticks = __ipipe_mach_ticks_per_jiffy;else {
arch/arm/kernel/ipipe-core.c static void __ipipe_set_decr(void) · line 342
Quoted 10 lines
arch/arm/kernel/ipipe-core.c +8
-1- ticks = ns * __ipipe_mach_ticks_per_jiffy / (1000000000 /HZ ); + +/* +* FIXME : Temporary convert ns to us. With nanosecondes we have a problem +* with overflow. +* ticks = ns * __ipipe_mach_ticks_per_jiffy / (1000000000 / HZ); +*/ + us = ns /1000 ; + ticks = ((us * __ipipe_mach_ticks_per_jiffy) /10000 );
This change is going to be wrong when CONFIG_HZ != 1000,
this is why HZ should remain in the picture. This said, the original expression looks overly complicated, something like the following should do without risking the overflow:
- ticks = ns * __ipipe_mach_ticks_per_jiffy / (1000000000 / HZ);
+ ticks = ns / (TICKS_PER_uSEC * 1000);
Quoted 21 lines
arch/arm/kernel/ipipe-core.c +0
-0if (ticks > __ipipe_mach_ticks_per_jiffy)return -EINVAL ;diff -uNrp
linux-2.6.14/arch/arm/kernel/process.clinux-2.6.14-heig/arch/arm/kernel/process.carch/arm/kernel/process.c +6
-0@@ -7,6 +7,12 @@* This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. +* +* April 2006 : +* Adapted to ARM9 i.MX21/CSB535FS board with Xenomai by S.Gerber, G.Boutillier and D.Rossier +* University of Applied Sciences Western Switzerland +* Reconfigurable & Embedded Digital Systems, REDS Institute +* */ #include <stdarg.h> @@ -111,7 +117,14 @@ void cpu_idle(void)preempt_disable ();
arch/arm/kernel/process.c void cpu_idle(void) · line 127
Quoted 10 lines
arch/arm/kernel/process.c +7
-0leds_event (led_idle_start);while (!need_resched ()) +/* +* Width idle -> latenca of interrupts + */ +#ifndef CONFIG_IPIPE idle (); +#else + ; +#endif
Ouch. It would be saner to implement the idle mode switch one could pass as a boot argument to the kernel (e.g. arch/i386/kernel/process.c), accepting "poll" or "default", instead of hard-wiring the poll mode.
init/Kconfig config STOP_MACHINE · line 507
Quoted 13 lines
arch/arm/kernel/process.c +0
-0leds_event (led_idle_end);preempt_enable ();schedule ();diff -uNrp linux-2.6.14/init/Kconfig linux-2.6.14-heig/init/Kconfig
init/Kconfig +3
-0@@ -502,3 +502,20 @@ config STOP_MACHINE help Need stop_machine() primitive. endmenu + +menu "Real-time sub-system" +
The Xenomai-related stuff does not belong to the Adeos patch.
Signature · 1 line
Philippe.