All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrice Kadionik <kadionik@domain.hid>
To: Chtourou Sonda <chtourou_sonda@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] Problem to cross-compile Xenomai user-space support
Date: Thu, 01 Apr 2010 12:49:56 +0200	[thread overview]
Message-ID: <4BB47A54.1040806@domain.hid> (raw)
In-Reply-To: <763864.6829.qm@domain.hid>

[-- Attachment #1: Type: text/plain, Size: 5914 bytes --]

Le 31/03/2010 12:55, Chtourou Sonda a écrit :

Hi Chtourou,

> Hi Patrice,
>> OK. Please, verify first that you can boot µClinux without Xenomai on 
>> your board with the 2 extra hrtimer and hrclock peripherals.
>> There is no priority on IRQ with NIOS.
>>
> So, If I have understood, I could put:
> IRO = 7 for hrtimer
> IRQ = 8 for hrclock
> IRQ = 1 for sys_clk_timer
> with  this configuration µClinux without Xenomai with the 2 extra 
> hrtimer and hrclock peripherals can boot  on the board .
> But I'm wondering why with the first configuration (IRO = 1 for 
> hrtimer,IRQ = 2 for hrclock and IRQ = 3 for sys_clk_timer), it didn't 
> boot?
>
**Huan Fang 
(https://mail.gna.org/public/xenomai-help/2010-04/msg00013.html) has 
detected the problem.
I have done some investigations.

For recall,
- From the HW point of view, when you build your SoPC system with SOPC 
Builder tool in Quartus II, you add different peripherals (Altera 
peripheral and your own peripherals). After that you lanch a generate 
command. At this, it creates a .ptf (and now a .sopc) file. This file is 
an ASCII file (in a synthax like XML), a declarative file that gives all 
informations for HDL synthesis. After that, you compile (a synthesis) 
your SoPC system that gives the .sof file for programming your Altera FPGA.
- From the SW point of view, when you do a "$ make vendor_hwselect 
SYSPTF=your_ptf_file.ptf", you generate (through Perl scripts) a nios2.h 
file under  .../uClinux-dist/linux-2.6.x/include/asm-nios2 directory 
that translates the .ptf file into .h file with #define declarations.

The sys_clk_timer must be the Linux timer even with the 2 Xenomai extra 
timers. sys_cllk_timer is renamed in the nios2.h as timer0:
/* Redefining sys_clk_timer -> timer0 */
#undef na_sys_clk_timer
#undef na_sys_clk_timer_irq

#define na_timer0                                  ((void *) 0xXXXXXXXX)
#define na_timer0_irq                                                  Y

The Perl script (altera_avalon_timer.pm) used by the "make 
vendor_hwselect" command parses the .ptf file and takes the first 
encountered timer as Linux timer! So, if it is not the sys_clk_timer 
(hrtimer or hrclock or your own timer...), it will be bad and you can't 
boot.

How can you have sys_clk_timer as the first timer in your .ptf file?
If you change the order in the graphical view under SOPC builder, it 
doesn't care.
The order of the peripherals in the generated .ptf file is their 
creation order.
So, you MUST first create in SOPC Builder sys_clk_timer and then the 2 
other timers for Xenomai hrtimer and hrclock.
If you are note sure, delete all timers in the SoPC, save the SoPC and 
create finally in the right order the 3 timers.

If all is OK, you must have in the nios2.h something like:
/* Redefining sys_clk_timer -> timer0 */
#undef na_sys_clk_timer
#undef na_sys_clk_timer_irq

#define na_timer0                                  ((void *) 0xXXXXXXXX)
#define na_timer0_irq                                                  Y

Another verification is when you generate your SoPC system. The traces 
during SoPC generation with SOPC Builder gives the order in the .ptf 
file. For example, a good example:
# 2010.03.31 22:06:55 (*) Running Generator Program for ext_flash
# 2010.03.31 22:06:57 (*) Running Generator Program for ext_ram
# 2010.03.31 22:06:58 (*) Running Generator Program for onchip_ram_64_kbytes
# 2010.03.31 22:06:59 (*) Running Generator Program for sys_clk_timer
. . .
# 2010.03.31 22:07:05 (*) Running Generator Program for hrclock
. . .
# 2010.03.31 22:07:18 (*) Running Generator Program for uart_0
# 2010.03.31 22:07:21 (*) Running Generator Program for hrtimer
# 2010.03.31 22:07:22 (*) Running Generator Program for std_1s10_clock_0

So verify this point, it should be your problem.
>> Please verify that you have correctly enabled all the right options 
>> under SOPC builder for hrtimer and hrclock.
>> Because we have flexibility in HW configuration with SoPC, we must be 
>> more careful.
>>
> Configuration of hrtimer with the SoPC Builder:
> • Timer: 32 bits.
> • Timeout period: 1 µs.
> • Preset : custom. Writable period, readable snapshot, Start/Stop 
> control bits.
>
> Configuration of hrclock with the SoPC Builder:
> in the snapshot mode. Its configuration with the SoPC Builder tool is:
> • 64-bit timer.
> • Timeout period: 5 clocks. clock=20 ns (100 ns). The timer 
> functionality is not used by Xenomai.
>
> • Preset: custom. Writable period, readable snapshot, Start/Stop 
> control bits.
>
> Is it correct?
>> According to errno.h, code -19  is ENODEV, please verify your timer 
>> configuration and respect naming convention
>>
> Here, you speek about "sys_clock_timer"?
>
It is sys_clk_timer, sorry. I'll correct the typo error.

Patrice
> Configuration of sys_clock_timer with the SoPC Builder:
> • 32-bit timer.
> • Timeout period: 10 ms.
> • Preset: custom. Writable period, readable snapshot, Start/Stop 
> control bits.
>
> Regards,
>
>


-- 
Patrice Kadionik. F6KQH / F4CUQ
-----------

+----------------------------------------------------------------------+
+"Tout doit etre aussi simple que possible, pas seulement plus simple" +
+----------------------------------------------------------------------+
+ Patrice Kadionik             http://www.enseirb.fr/~kadionik         +
+ IMS Laboratory               http://www.ims-bordeaux.fr/             +
+ ENSEIRB                      http://www.enseirb.fr                   +
+ PO BOX 99                    fax   : +33 5.56.37.20.23               +
+ 33402 TALENCE Cedex          voice : +33 5.56.84.23.47               +
+ FRANCE                       mailto:patrice.kadionik@domain.hid +
+----------------------------------------------------------------------+


[-- Attachment #2: Type: text/html, Size: 10677 bytes --]

  reply	other threads:[~2010-04-01 10:49 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-31 10:55 [Xenomai-help] Problem to cross-compile Xenomai user-space support Chtourou Sonda
2010-04-01 10:49 ` Patrice Kadionik [this message]
  -- strict thread matches above, loose matches on Subject: below --
2010-03-30 15:40 Chtourou Sonda
2010-03-30 16:45 ` Patrice Kadionik
2010-03-25 20:24 Chtourou Sonda
2010-03-28 13:26 ` Patrice Kadionik
2010-03-29 22:20   ` Huan Fang
2010-03-29 22:23     ` Gilles Chanteperdrix
2010-03-30  9:05       ` Patrice Kadionik
2010-03-30  9:14         ` Gilles Chanteperdrix
2010-03-30  9:40           ` Patrice Kadionik
2010-03-30  9:40         ` Gilles Chanteperdrix
2010-03-30  9:46           ` Patrice Kadionik
2010-03-30 10:46             ` Gilles Chanteperdrix
2010-03-30 15:00               ` Patrice Kadionik
2010-03-30  8:37     ` Patrice Kadionik
2010-03-30 17:37       ` Huan Fang
2010-03-30 17:48         ` Patrice Kadionik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BB47A54.1040806@domain.hid \
    --to=kadionik@domain.hid \
    --cc=chtourou_sonda@domain.hid \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.