Real-Time patch on iMX51

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Real-Time patch on iMX51

2,904 Views
AndreasOrfanos
Contributor II

Dear IMX List,

 

I am quite happy to post to the imx community the Linux kernel real-time patch for IMX51 Freescale SoC,  version 2.6.31.12. I did some tests on IMX51 3DSTACK PDK  board and wrote a small report too. Please feel free to send your comments.

 

imx51rt-2.6.31.12.patch.bz2

 

tar fx linux-2.6.31.12.tar.bz2
mkdir output
cd linux-2.6.31.12
bunzip2 -c ../imx51rt-2.6.31.12.patch.bz2 | patch -p1
make O=../output mx51rt-3dpdk_defconfig
make O=../output uImage

 

Kind regards

Andreas

 

 

Hedera Innovations

Tags (1)
9 Replies

1,752 Views
rajansrivastava
NXP Employee
NXP Employee

Dear Andreas,

Did you get the latency, 58us (as you mentioned in your report), right after porting the RT patch and enabling FULL_PREEMPTION, or did you do some customizations in the kernel (configuration/code)?

Thanks,

Rajan

0 Kudos

1,752 Views
RobertSchwebel
Contributor IV

Andreas,

if you use the mainline kernel on the MX51, you can use the standard -rt patch set. MX51 is well supported in the mainline, although not as feature complete as in the FSL kernel.

Best regards,

Robert

0 Kudos

1,752 Views
AndreasOrfanos
Contributor II

Dear Simon,

 

I was quite busy this week, but I was planning to investigate the problem this weekend. Good to hear that you have made some good progress. If you have any fixes feel free to post them.

 

Best regards

Andreas

0 Kudos

1,752 Views
SimonScherzinge
Contributor I

Dear Andreas,

 

now, the patched linux-2.6.31.12 kernel is running on the i.MX51 evk.

I fixed the problem (last post) by deactivating the "MXC TVE TV Out Encoder".

After that, I had problems (kernel panic) with FEC and SD-Card driver.

For FEC, I fixed a bug in driver/net/fec.c and for SD-Card driver I inserted a special freescale card driver into driver/mmc.

 

Regards Simon

0 Kudos

1,752 Views
SimonScherzinge
Contributor I

Dear Andreas,

sorry for this long delay :-(.

Now I'm able to built a root filesystem for imx51evk.
I can boot my imx51 with a none realtime kernel.

But I can't boot the patched imx51 Realtime Kernel.

I did it as follow:
make ARCH=arm CROSS_COMPILE= 'HOSTCC=ccache /usr/bin/gcc -B/usr/bin/' imx51_defconfig
make ARCH=arm CROSS_COMPILE= 'HOSTCC=ccache /usr/bin/gcc -B/usr/bin/' zImage

There were three errors during build process. Therefore I changed the following:
- in arch/arm/Makefile at line 53 I changed "armv7-a" to "armv7a"
- in include/linux/regulator/machine.h at line 135 I added the variable const char *dev_name to the regulator_consumer_supply structur
- in arch/arm/mach-mx5/mx51_3stack.c at line 150 I changed "#if 0" to "#if 1" and I commented line 156 to 165 out

After successful built, I booted zImage with imx51evk and I get a Kernel panic as follow:

Uncompressing Linux............................................................................................................................
Linux version 2.6.31.12-rt21 (sischerzinger@pc574301) (gcc version 4.1.2) #24 PREEMPT RT Wed Sep 7 10:22:06 BST 2011                          
CPU: ARMv7 Processor [412fc085] revision 5 (ARMv7), cr=10c53c7f
CPU: VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
Machine: Freescale MX51 Babbage Board                  
Memory policy: ECC disabled, Data cache writeback                                                                                             
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 105664                                                                   
Kernel command line: noinitrd console=ttymxc0,115200 root=/dev/nfs nfsroot=172.17.20.2:/home/sischerzinger/Reiner/IMX51RT/rootfs rw ip=dhcp panic=10
PID hash table entries: 2048 (order: 11, 8192 bytes)   
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
Memory: 416MB = 416MB total 
Memory: 417480KB available (3908K code, 377K data, 132K init, 0K highmem)
Real-Time Preemption Support (C) 2004-2007 Ingo Molnar
Preemptible RCU implementation.                                                                          
NR_IRQS:368                                                                              
MXC IRQ initialized                                                  
MXC_Early serial console at MMIO 0x73fbc000 (options '115200')
console [ttymxc0] enabled                                                            
Console: colour dummy device 80x30
Calibrating delay loop... 799.53 BogoMIPS (lpj=3997696)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
regulator: core version 0.5
NET: Registered protocol family 16
i.MX IRAM pool: 128 KB@0xda840000

IRAM READY
CPU is i.MX51 Revision 3.0
MXC GPIO hardware
iomux_config_mux: Warning: iomux pin config changed, reg=f7ea8134,  prev=0x1 new=0x3
Using SDMA I.API                     
MXC DMA API initialized
bio: create slab <bio-0> at 0
SCSI subsystem initialized
CSPI: mxc_spi-0 probed
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
IPU DMFC NORMAL mode: 1(0~1), 5B(4,5), 5F(6,7)
Bluetooth: Core ver 2.15                                                                                                                      
NET: Registered protocol family 31                                                                                                            
Bluetooth: HCI device and connection manager initialized                       
Bluetooth: HCI socket layer initialized                                                                                                       
mc13892 Rev 2.0 FinVer 2 detected                                                                                                             
Initializing regulators for Babbage.                                                                                                          
regulator: SW1: 600 <--> 1375 mV                                                                                                              
regulator: SW2: 900 <--> 1850 mV                                                                                                              
regulator: SW3: 1100 <--> 1850 mV                                                                                                             
regulator: SW4: 1100 <--> 1850 mV                                                                                                             
regulator: SWBST: 0 mV                                                                                                                        
regulator: VIOHI: 0 mV                                                                                                                        
regulator: VPLL: 1050 <--> 1800 mV                                                                                                            
regulator: VDIG: 1650 mV                                                                                                                      
regulator: VSD: 1800 <--> 3150 mV                                                                                                             
regulator: VUSB2: 2400 <--> 2775 mV                                                                                                           
regulator: VVIDEO: 2775 mV                                                                                                                    
regulator: VAUDIO: 2300 <--> 3000 mV                                                                                                          
regulator: VCAM: 2500 <--> 3000 mV fast normal                       
regulator: VGEN1: 1200 mV                                                                                                                     
regulator: VGEN2: 1200 <--> 3150 mV                                                                                                           
regulator: VGEN3: 1800 <--> 2900 mV                                                                                                           
regulator: VUSB: 0 mV                                                                                                                         
regulator: GPO1: 0 mV                                                                                                                         
regulator: GPO2: 0 mV                                                                                                                         
regulator: GPO3: 0 mV                                                                                                                         
regulator: GPO4: 0 mV                                                                                                                         
Device spi1.0 probed                                                                                                                          
NET: Registered protocol family 2                                                                                                             
IP route cache hash table entries: 4096 (order: 2, 16384 bytes)                  
TCP established hash table entries: 16384 (order: 5, 131072 bytes)
TCP bind hash table entries: 16384 (order: 6, 458752 bytes)
TCP: Hash tables configured (established 16384 bind 16384)      
TCP reno registered                                                                                                                           
NET: Registered protocol family 1                                                                                                             
LPMode driver module loaded                                                                                                                   
Static Power Management for Freescale i.MX51                     
PM driver module loaded                                                                                                                       
sdram autogating driver module loaded                                                                                                         
Bus freq driver module loaded                                                                                                                 
DVI monitor is primary                                                                                                                        
mxc_dvfs_core_probe                                                                                                                           
mxc_dvfs_core_probe: failed to get gp regulator                                                                                               
DVFS driver module loaded                                                 
i.MXC CPU frequency driver                                                                                                                    
mxc_cpufreq_driver_init: failed to get gp regulator                                                                                           
mxc_dvfsper_probe: failed to get lp regulator                                                                                                 
DVFS PER driver module loaded                                                                                                                 
JFFS2 version 2.2. (NAND) �© 2001-2006 Red Hat, Inc.                  
msgmni has been set to 815                                                                                                                    
io scheduler noop registered                                                                                                                  
io scheduler anticipatory registered                                                                                                          
io scheduler deadline registered                                                                                                              
io scheduler cfq registered (default)                                                                                                         
fbcvt: 1024x768@60: CVT Name - .786M3                                  
mxc_ipu mxc_ipu: Channel already disabled 9                                      
mxc_ipu mxc_ipu: Channel already uninitialized 9                                  
IPU DMFC DP HIGH RESOLUTION: 1(0,1), 5B(2~5), 5F(6,7)                      
Console: switching to colour frame buffer device 128x48        
fbcvt: 1024x768@60: CVT Name - .786M3                                   
regulator: get() with no identifier                                                                                                           
Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = c0004000                                                                                          
[00000000] *pgd=00000000                                                                                                                      
Internal error: Oops: 805 [#1] PREEMPT                                                                                                        
Modules linked in:                                                                                                                            
CPU: 0    Not tainted  (2.6.31.12-rt21 #24)
PC is at rt_spin_lock_slowlock+0x64/0x234                          
LR is at clk_enable+0x20/0xa8                                                                                  
pc : [<c0314afc>]    lr : [<c003918c>]    psr: 60000093                                     
sp : d8023e60  ip : f7ed4070  fp : 00000000                                                                                                   
r10: c0425058  r9 : 00000000  r8 : 00000000                                                                                                   
r7 : c0420120  r6 : c044a998  r5 : 60000013  r4 : c041d740                   
r3 : 00000000  r2 : d8022000  r1 : d8021a40  r0 : d8022000             
Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
Control: 10c5387d  Table: 90004019  DAC: 00000017                       
Process swapper (pid: 1, stack limit = 0xd80222e8)                                 
Stack: (0xd8023e60 to 0xd8024000)                                                                                                             
3e60: 00000000 c0463d24 c0420128 00000000 d8022000 60000013 c044a998 c0420120
3e80: 00000000 c0314b48 c0420128 d8023e9c 00000000 c01b34e8 da80c000 c041d740
3ea0: c041d6fc c0463d80 c0420120 00000000 c0425058 c003918c 00000000 c041d784
3ec0: c041d6fc c0034258 c041cdb0 c041d784 c0420128 c003901c c041d784 c0039194
3ee0: c0420120 c0463d24 c0420128 c01b2108 c03a0ca0 c0420120 d80831b8 00000000
3f00: 00000000 00000001 c0420130 c0420128 c0436ba0 c0436ba0 c0436ba0 00000000
3f20: c043b1e0 c01d7b84 c0436ba0 c01d6dc8 c0420128 c0436ba0 c042015c c01d6ed4
3f40: 00000000 d8023f50 c01d6e74 c01d6208 d80087b0 d80315e8 d8023f54 c0436ba0
3f60: c0436ba0 d80eda60 c0017600 c01d67ac c03a0ca0 c0190ff0 c0436ba0 00000000
3f80: c044a2ac c0017600 00000000 00000000 00000000 c01d71d0 00000000 c002240c
3fa0: 00000000 c044a2ac c0017600 00000000 00000000 c00292ec c042bec8 c0079e78
3fc0: 00000000 32317c20 00000037 00000000 c002240c 00000000 00000000 00000000
3fe0: 00000000 00000000 00000000 c00086e8 00000000 c002a914 ffffffff 00000000
[<c0314afc>] (rt_spin_lock_slowlock+0x64/0x234) from [<c003918c>] (clk_enable+0x20/0xa8)
[<c003918c>] (clk_enable+0x20/0xa8) from [<c0034258>] (_clk_tve_enable+0x2c/0x54)
[<c0034258>] (_clk_tve_enable+0x2c/0x54) from [<c003901c>] (__clk_enable+0x54/0x64)
[<c003901c>] (__clk_enable+0x54/0x64) from [<c0039194>] (clk_enable+0x28/0xa8)
[<c0039194>] (clk_enable+0x28/0xa8) from [<c01b2108>] (tve_probe+0x1bc/0x408)
[<c01b2108>] (tve_probe+0x1bc/0x408) from [<c01d7b84>] (platform_drv_probe+0x1c/0x24)
[<c01d7b84>] (platform_drv_probe+0x1c/0x24) from [<c01d6dc8>] (driver_probe_device+0xb8/0x164)
[<c01d6dc8>] (driver_probe_device+0xb8/0x164) from [<c01d6ed4>] (__driver_attach+0x60/0x84)
[<c01d6ed4>] (__driver_attach+0x60/0x84) from [<c01d6208>] (bus_for_each_dev+0x48/0x80)
[<c01d6208>] (bus_for_each_dev+0x48/0x80) from [<c01d67ac>] (bus_add_driver+0xa0/0x224)
[<c01d67ac>] (bus_add_driver+0xa0/0x224) from [<c01d71d0>] (driver_register+0xac/0x134)
[<c01d71d0>] (driver_register+0xac/0x134) from [<c00292ec>] (do_one_initcall+0x5c/0x1a8)
[<c00292ec>] (do_one_initcall+0x5c/0x1a8) from [<c00086e8>] (kernel_init+0x94/0x12c)
[<c00086e8>] (kernel_init+0x94/0x12c) from [<c002a914>] (kernel_thread_exit+0x0/0x8)
Code: e3c33003 e1530001 1a000002 e3a03000 (e5833000)                                                
---[ end trace da227214a82491b7 ]---                                                                         
note: swapper[1] exited with preempt_count 1
Kernel panic - not syncing: Attempted to kill init!

I'm looking after this problem for a while.
Do you have any experience for this error?
Do you have a proposal how to fix this Kernel panic?

Regards Simon



Andreas Orfanos said:

Dear Simon,

Good to hear that you have managed to build the Linux kernel with Real-Time support successfully

If you need to build distros, one of the ways to do it is to use Yokto project, or openEmbedded.
There is a long learning curve to go in order to start working with those distro build platforms, but it is the mainstream and the way forward.
Please see links below:
http://www.yoctoproject.org/

Regards,

Andreas

 

 

 

0 Kudos

1,752 Views
AndreasOrfanos
Contributor II

Dear Simon,

Good to hear that you have managed to build the Linux kernel with Real-Time support successfully

If you need to build distros, one of the ways to do it is to use Yokto project, or openEmbedded.
There is a long learning curve to go in order to start working with those distro build platforms, but it is the mainstream and the way forward.
Please see links below:
http://www.yoctoproject.org/

Regards,

Andreas

0 Kudos

1,752 Views
SimonScherzinge
Contributor I
Dear Andreas,

The build process with
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- O=../output uImage
was successful. Thank you.

Now, I want to run that Kernel Image on the imx51 EVK.

Do I need also a root filesystem, with bin, lib, dev, ...?
Is there a way to build such a root filesystem?

In the past I used ltib (Linux Target Image Builder) to build the Board Support Package.
Ltib generated a rootfs directory, which contained for example the uImage and kernel modules which I did by myself.
The imx51 EVK was able to boot and work with this rootfs directory.

Now, I think I have to create the same environment with your patched linux-2.6.31.12 rt-kernel to be successful.
How can I do this?
Which is the best way?

I would be glad, if you can help a second time.

Regards Simon
0 Kudos

1,752 Views
AndreasOrfanos
Contributor II

Dear Simon,

 

Please try the toolchain IA32 GNU/Linux TAR from http://www.codesourcery.com/sgpp/lite/arm/portal/release1294

Follow the instructions how to install it from the codesourcery web site and then try:

 

make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- O=../output uImage

 

Regards,

Andreas

 

 


Simon Scherzinger said:

Dear Andreas,

 

your post sounds great.

I want to try the same, but I use the imx51 EVK.

Therefore, I configured the kernel with imx51_defconfig except of mx51rt-3dpdk_defconfig.

After that I start to build the kernel with

make ARCH=arm CROSS_COMPILE= 'HOSTCC=ccache /usr/bin/gcc -B/usr/bin/' O=../output uImage

But than occurs the following errors:

cc1: error: unrecognized command line option "-mlittle-endian"
cc1: error: unrecognized command line option "-mabi=aapcs-linux"
cc1: error: unrecognized command line option "-mno-thumb-interwork"

 

Or is there an other way to build a real-time system for imx51 EVK?

I'm new in this subject, so it would be very nice, if you can help me.

 

Regards

Simon

0 Kudos

1,752 Views
SimonScherzinge
Contributor I

Dear Andreas,

 

your post sounds great.

I want to try the same, but I use the imx51 EVK.

Therefore, I configured the kernel with imx51_defconfig except of mx51rt-3dpdk_defconfig.

After that I start to build the kernel with

make ARCH=arm CROSS_COMPILE= 'HOSTCC=ccache /usr/bin/gcc -B/usr/bin/' O=../output uImage

But than occurs the following errors:

cc1: error: unrecognized command line option "-mlittle-endian"
cc1: error: unrecognized command line option "-mabi=aapcs-linux"
cc1: error: unrecognized command line option "-mno-thumb-interwork"

 

Or is there an other way to build a real-time system for imx51 EVK?

I'm new in this subject, so it would be very nice, if you can help me.

 

Regards

Simon

0 Kudos