Problem to cross-compile Xenomai user-space support
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?
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"?
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,
#ifndef __NIOS2_H__
#define __NIOS2_H__
/*
* This file contains hardware information about the target platform. *
* This file is automatically generated. Do not modify. */
/* Input System: std_1s40 */
/* Target CPU: cpu */
/* Nios II Constants */
#define NIOS2_STATUS_PIE_MSK 0x1
#define NIOS2_STATUS_PIE_OFST 0
#define NIOS2_STATUS_U_MSK 0x2
#define NIOS2_STATUS_U_OFST 1
/*
* Outputting basic values from system.ptf.
*/
#define na_pll 0x008108c0
#define na_pll_clock_freq 50000000
#define na_ext_ram_bus_clock_freq 50000000
#define na_ext_flash 0000000000 #define na_ext_flash_size 0x00800000 #define na_ext_flash_end 0x00800000 #define na_ext_flash_clock_freq 50000000 #define na_ext_ram 0x02000000 #define na_ext_ram_size 0x00100000 #define na_ext_ram_end 0x02100000 #define na_ext_ram_clock_freq 50000000 #define na_onchip_ram_64_kbytes 0x02100000 #define na_onchip_ram_64_kbytes_size 0x00010000 #define na_onchip_ram_64_kbytes_end 0x02110000
#define na_onchip_ram_64_kbytes_clock_freq 50000000
#define na_onchip_ram_64_kbytes_s1 0x02100000
#define na_lan91c111 0x00800000
#define na_lan91c111_irq 7
#define na_lan91c111_clock_freq 50000000
#define na_sys_clk_timer 0x00810800
#define na_sys_clk_timer_irq 3
#define na_sys_clk_timer_clock_freq 50000000
#define na_jtag_uart 0x00810820
#define na_jtag_uart_irq 4
#define na_jtag_uart_clock_freq 50000000
#define na_uart1 0x00810840
#define na_uart1_irq 5
#define na_uart1_clock_freq 50000000
#define na_button_pio 0x00810830
#define na_button_pio_irq 6
#define na_button_pio_clock_freq 50000000
#define na_led_pio 0x00810880
#define na_led_pio_clock_freq 50000000
#define na_seven_seg_pio 0x00810890
#define na_seven_seg_pio_clock_freq 50000000
#define na_reconfig_request_pio 0x008108a0
#define na_reconfig_request_pio_clock_freq 50000000
#define na_sdram 0x01000000 #define na_sdram_size 0x01000000 #define na_sdram_end 0x02000000
#define na_sdram_clock_freq 50000000
#define na_sysid 0x00810828
#define na_sysid_clock_freq 50000000
#define na_lcd_display 0x008108b0
#define na_lcd_display_clock_freq 50000000
#define na_hrtimer 0x00810860
#define na_hrtimer_irq 1
#define na_hrtimer_clock_freq 50000000
#define na_hrclock 0x00810900
#define na_hrclock_irq 2
#define na_hrclock_clock_freq 50000000
#define na_uart_0 0x008108e0
#define na_uart_0_irq 8
#define na_uart_0_clock_freq 50000000
/* Executing ...scripts/nios2.h/altera_avalon_lan91c111.pm */
/* Redefining lan91c111 -> enet */
#undef na_lan91c111
#undef na_lan91c111_irq
#define na_enet 0x00800000
#define na_enet_irq 7
#define LAN91C111_REGISTERS_OFFSET 768
#define LAN91C111_DATA_BUS_WIDTH 32
/* Executing ...scripts/nios2.h/altera_avalon_timer.pm */
/* system timer input clock frequency */
#define nasys_clock_freq 50000000
#define nasys_clock_freq_1000 50000
/* Redefining sys_clk_timer -> timer0 */
#undef na_sys_clk_timer
#undef na_sys_clk_timer_irq
#define na_timer0 ((void *) 0x00810800)
#define na_timer0_irq 3
/* Executing ...scripts/nios2.h/altera_avalon_jtag_uart.pm */
/* No translation necessary for jtag_uart */
/* Executing ...scripts/nios2.h/altera_avalon_uart.pm */
/* Redefining uart1 -> uart0 */
#undef na_uart1
#undef na_uart1_irq
#define na_uart0 ((void **) 0x00810840)
#define na_uart0_irq 5
/* The default uart is always the first one found in the PTF file */ #define nasys_printf_uart na_uart0
/* Redefining uart_0 -> uart1 */
#undef na_uart_0
#undef na_uart_0_irq
#define na_uart1 ((void **) 0x008108e0)
#define na_uart1_irq 8
/* Executing ...scripts/nios2.h/altera_avalon_pio.pm */ #ifndef __ASSEMBLY__
#include <asm/pio_struct.h>
#endif
/* Casting base addresses to the appropriate structure */ #undef na_button_pio
#undef na_button_pio_irq
#define na_button_pio ((np_pio*) 0x00810830)
#define na_button_pio_irq 6
/* Casting base addresses to the appropriate structure */ #undef na_led_pio
#define na_led_pio ((np_pio*) 0x00810880)
/* Casting base addresses to the appropriate structure */ #undef na_seven_seg_pio
#define na_seven_seg_pio ((np_pio*) 0x00810890)
/* Casting base addresses to the appropriate structure */ #undef na_reconfig_request_pio
#define na_reconfig_request_pio ((np_pio*) 0x008108a0)
/* Executing ...scripts/nios2.h/altera_avalon_sysid.pm */
/* No translation necessary for sysid */
/*
* Basic System Information
*/
#define nasys_icache_size 4096
#define nasys_icache_line_size 32
#define nasys_dcache_size 0
#define nasys_dcache_line_size 0
#define nasys_program_mem na_sdram
#define nasys_program_mem_size na_sdram_size
#define nasys_program_mem_end na_sdram_end
#define na_cpu_clock_freq 50000000
#define CPU_RESET_ADDRESS 0000000000
#define CPU_EXCEPT_ADDRESS 0x01000020
#endif /* __NIOS2_H__ */
Le 31/03/2010 12:55, Chtourou Sonda a écrit :
Hi Chtourou,
Quoted 11 lines
Hi Patrice,
Quoted 3 lines
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 forsys_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 forsys_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.
Quoted 13 lines
Quoted 3 lines
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.
Quoted 7 lines
• Preset: custom. Writable period, readable snapshot, Start/Stop control bits.
Is it correct?
Quoted 2 lines
According to
errno.h, code -19 is ENODEV, please verify your timer configuration and respect naming conventionHere, you speek about "
sys_clock_timer"?
It is sys_clk_timer, sorry. I'll correct the typo error.
Patrice
Quoted 8 lines
Configuration of
sys_clock_timerwith the SoPC Builder:
• 32-bit timer.
• Timeout period: 10 ms.
• Preset: custom. Writable period, readable snapshot, Start/Stop control bits.Regards,
Signature · 13 lines
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:[email protected] + +----------------------------------------------------------------------+