Wednesday, October 27, 2010

Linux Network Programming


Notes from Embedded Linux Virtual Conference

1. Embedded Linux and Commercial RTOS are friends in the growing multi-core solution.
Consider a hypervisor so you can have both RTOS and Linux for user interface

Venders like Wind River and Green Hills have lightweight hypervisors that allow for mixing Linux and RTOS on different cores.

Also, during our panel discussion, most of the vendor talked about running an RTOS alongside Linux on a two-core chip.

2. Chat of footprint
ThreadX can be as small as 2KB

if you're targeting 16Kb RAM, then Linux is out of the question. Think uCOS/III, ThreadX, uVelocity, etc. if you really need an O/S.

Jim Turley (10/22/2010 3:45:35 AM):Minimum memory size for Linux is about 4 MB, according to our panelists.

in a prev company I was stuck with an in-house RTOS very limited ability. Installed a demo RTOS that had a remote debug system. That alone justified the purchase order. (this was 8/16-bit days)

Mike Anderson (10/22/2010 3:46:26 AM):I've gotten Linux down to 295K, but it was a very focused application. 2K is so small that even the tiny RTOS kernels may be too big.

John Carbone (10/22/2010 3:50:42 AM):@zahir - for 25 tasks (we call them "threads" but it's the same thing), each one uses about 164 bytes, so 4KB of RAM just for the Thread Control Blocks.

3. Chat of ucLinux
Bruce Christensen (10/22/2010 3:53:24 AM):@Dave M -- uClinux doesn't have an MMU so it doesn't support multi-threaded designs which eliminates some of the open source software out there. In some aspects it is easier though when working with an embedded system because addresses referred to in the code are 'real' addresses, not virtual

Lloyd Sargent (10/22/2010 3:54:15 AM):@Dave M Also you can't really use fork - there is a work-around but it can mean a lot of code rework

4. Chat of eCOS

Yanming Wu (10/22/2010 3:58:28 AM):eCos is also open source, like linux, any comments on eCos?

Mike Anderson (10/22/2010 4:02:25 AM):eCOS is a nice little platform, you see it most often these days ad the RedBoot boot loader.

erol ozkarsli (10/22/2010 4:04:44 AM):@mike is eCOS open source?
zahir parkar (10/22/2010 4:04:53 AM):@john Thanks
Mike Anderson (10/22/2010 4:05:01 AM):@erol: yes, covered by GPL

erol ozkarsli (10/22/2010 4:22:23 AM):@Yanming eCOS is not support luminary devices instead eCOScentric does

5. Firmware Upgrade with Embedded Linux
WanQiang(Quentin) YANG (10/22/2010 4:20:38 AM): Hi, what's the common way or is there common way to do firmware upgrade with embedded Linux? For our previous products without RTOS, firmware itself is able to reprogram the whole flash(ROM) with new firmware delievered via 3G modem.

Mike Anderson (10/22/2010 4:22:31 AM):@Wan: You could certainly do it that way. Boot firmware like UBoot could support that. But, I normally have a piece of firmware that I never allow the users to update so they can't brick the box. Then the O/S & filesystem are updated in flash via the boot firmware like you've done in the past

WanQiang(Quentin) YANG (10/22/2010 4:25:45 AM):Yeah, in our previous product, one piece of code, we call it bootloader, can never be upgraded, which stay same in a certain part of FLASH.
Raghavendra Reddy Desai (10/22/2010 4:28:20 AM):@ EROL :for cortex-M3 try using openICE EDS

WanQiang(Quentin) YANG (10/22/2010 4:28:40 AM):So, you reckon, I can do the same thing, get one level of boot loader before UBoot to manage the Embedded Linux upgrade for both Kernel and File System. Thanks. That'll be part of job outside of Linux Porting.

Mike Anderson (10/22/2010 4:29:25 AM):@Wan: Yes, that's what we've done many times in the past and that seems to work reliably. Good luck.

6. Chat of Real-time about Embedded Linux

Mike Anderson (10/22/2010 6:05:42 AM):Yes, that would be unfair. I've seen very good determinism from the RT-patched kernel.

Doug Gibbs (10/22/2010 6:07:21 AM):@Brett, the patch removes/replaces instances of the big lock. Mainline kernel is also removing them.

Mike Anderson (10/22/2010 6:07:28 AM):Absolutely. Real-time means being fast enough. Deterministic behavior is great, but the world is rarely deterministic. And, if you want real determinism, you have to be willing to disable your processor caches and SMP.
Nuno Felicio (10/22/2010 6:07:28 AM):an RT-patched kernel runs linux as a low priority task of an hard RTOS

Jose Luis Briz (10/22/2010 6:08:01 AM):@Sutton you have fully preemption. Without the RT patch, processes running kernel mode can't be preempted if holding a spin lock
Jason Wessel (10/22/2010 6:08:10 AM):Doug / Brett: It is more than that, an RT patched kernel converts nearly all the spin locks in the kernel into priority based mutexes.

Jason Wessel (10/22/2010 6:09:03 AM):Jose Luis Briz, in most cases that is true, some drivers do not play so nice and they are made RT safe with non-premptible locks.

Mike Anderson (10/22/2010 6:09:08 AM):@Nuno: actually, that is only one type of RT-Linux -- the sub- or co-kernel flavor RTAI and Xenomai are examples of that. But the RT-patched kernel (PREEMPT_RT) has determinism built into the kernel as a native feature.

Jose Luis Briz (10/22/2010 6:09:15 AM):@Sutton All interrupt serv.routines and softirqs are tasks, so they imply a context switch. And all spin locks are mutexes (the process blocks)

Nuno Felicio (10/22/2010 6:10:37 AM):@Mike yes but the RT- patched kernel only gives determinist arround 100 us or something like that, so its only soft real time

Don McFarland (10/22/2010 6:10:52 AM):having only used embedded Linux kernels that use MMUs (Coldfire processors), I was wondering if ucLinux does better in tight timing situations ?

Mike Anderson (10/22/2010 6:10:59 AM):That depends on your system requirements.

7. Chat of boot time about Embedded Linux
Don McFarland (10/22/2010 6:16:31 AM):one serious problem with embedded Linux w/MMU is the rediculous boot times - 1 1/2 minutes on one of our boards and 30 seconds on another of our boards - with CPU clock in excess of 100MHz on both boards

Dean Misenhimer (10/22/2010 6:17:41 AM):@don we just did a webinar on fast boot's not here in the show but you can find it on our website. Lots of good info in it

Dean Misenhimer (10/22/2010 6:13:24 AM):There is a white paper on real-time in our booth that may be helpful...It's a few years old, but still has some good info in it. Look in the general info section of our collateral.

Ron Wilson (10/22/2010 6:13:56 AM):@Dean: which booth is that?

Mike Anderson (10/22/2010 6:14:00 AM):

Dean Misenhimer (10/22/2010 6:14:12 AM):@ron Sorry...MontaVista

Dean Misenhimer (10/22/2010 6:18:48 AM):we also did a one second boot for a customer...cold power on to data display in 1.5 seconds, so it can be done...takes a lot of tuning

John Faith (10/22/2010 6:19:00 AM):Don: you might try running bootchart. See

Jose Luis Briz (10/22/2010 6:20:28 AM):@Brian PREEMPT_RT is only in the patc

Nuno Felicio (10/22/2010 6:22:50 AM):@Brian, with an mpu Linux can provide process isolation/protection

Don McFarland (10/22/2010 6:23:50 AM):Nuno - are you running the kernel out of the flash - with a one second boot I had to ask... because decompressing and loading the kernel before any code actually start running except for the boot loader, can take that long
Nuno Felicio (10/22/2010 6:23:55 AM):for example AT91SAM9G20 have mpu
Nuno Felicio (10/22/2010 6:24:04 AM):and runs the complete Linux
Nuno Felicio (10/22/2010 6:24:31 AM):@Don the kernel its not compressed
Nuno Felicio (10/22/2010 6:24:43 AM):@Don its faster

Don McFarland (10/22/2010 6:26:09 AM):@Nuno - understood - Ive never seen a Linux be able to load and initialize all of the device drivers in that time frame, even on a 3 GHz Intel CPU

Nuno Felicio (10/22/2010 6:27:51 AM):@Don in a PC its very hard to achieve very fast boot times, the PC is a horrible designed machine :), in a small board its more or less easy

Tim Michals (10/22/2010 6:25:46 AM):From many RTOS Linux providers give the response, "You have to test your application to validate the timing will be met" That is a hard sell to management to spend money any comments?

Lloyd Sargent (10/22/2010 6:28:49 AM):@Tim In my 25 years (save for one company) it was ALWAYS a hard sell to get management to spend money to validate testing

Lloyd Sargent (10/22/2010 6:29:26 AM):@Tim Sorry, TIMING not TESTING

Saturday, October 23, 2010

Video Knowledge


Digital TV Resolution Standards
The three vertical scan line systems used in digital TV are 480p (480 lines vertically scanned in a progressive fashion), 720p (720 lines vertically scanned in a progressive fashion), and 1080i (1,080 lines scanned in an interlaced fashion).

NTSC is based on a 525-line, 60 fields/30 frames-per-second, at 60Hz system for transmission and display of video images.

PAL is the dominant format in the World for analog television broadcasting and video display and is based on a 625 line, 50 field/25 frames a second, 50HZ system.

Video format with horizontal resolution estimates:

Resolution (vertical, horizontal)
The number of scan lines, or vertical resolution, of NTSC/PAL/SECAM are constant in that all analog video recording and display equipment conforms to the above standards.

However, in addition to vertical scan lines, the amount of dots displayed within each line on the screen contributes to a factor known as horizontal resolution which can vary

-VHS/VHS-C 220 - 240 lines
-S-VHS/S-VHSC 400 lines
-DVD-R/-RW/+R/+RW 250 - 400+ lines (Depends on recording mode and compression used)
-miniDV 400 - 520 lines
-Analog TV Broadcast 330 lines
-Analog Cable TV 330 lines
-Standard Digital Cable
330 - 500 lines (Depends on original source of the signal and compression used in downloading to the cable box)
-Commercial DVD Up to 540 lines
-BETA 250 lines
-8mm 250 - 280 lines
-SuperBETA 270 - 280 lines
-Laserdisc 400 - 425 lines
-Hi8 380 - 440 lines
-Digital 8 400 - 500 lines
-microMV 500 lines
-ED BETA 500 lines

Thursday, October 14, 2010

pipe command


GNU Make Notes


9 How to Run make

A makefile that says how to recompile a program can be used in more than one way. The simplest use is to recompile every file that is out of date. Usually, makefiles are written so that if you run make with no arguments, it does just that.

But you might want to update only some of the files; you might want to use a different compiler or different compiler options; you might want just to find out which files are out of date without changing them.

By giving arguments when you run make, you can do any of these things and many others.

Save GNU make result into a text file - divert output

$make 2>&1 | tee build-log.txt

Sunday, October 10, 2010

Eclipse Usage and shortcut


CTRL+L go to line number

ISSUE: eclipse overlaps the location of another project [1]

---My solution-----
If it's under , then must tick 'using default workspace', and just give the directory name 'LIQGateWay_Dnp3_Porint' as the project name, then it won't report "...eclipse overlaps the location of another project..." as it happened when you untick using default workspace, but still choose folder under .

---Other suggestions----
ONE: Check file '/home/q.yang/EclipseCDT/qywkspace/LIQGateWay_Dnp3_Porting/.metadata'
TWO: Check file '/.metadata/plugins/org.eclipse.core.resources/.projects'
Workaround the problem:
1. Go to "%ECLIPSE_HOME%\configuration\.settings" and delete the workspace listed at the key RECENT_WORKSPACES
2. Restart Eclipse, go to File>Switch Workspace>Other... and select your workspace dir again
3. Now I could create new projects as always

Friday, October 1, 2010

Access Window's shared drive from Linux.


[root@QuentinFedoraHome q.yang]# mount -t cifs //$/ ./mnt_photo_son/ -o username=GeorgeYANG,password=xxxx,domain=workgroup

[q.yang@QuentinFedoraHome ~]$ cat
mount -t cifs //$/ ./mnt_Acer_DataSada/ -o username=GeorgeYANG,password=xxxx,domain=workgroup,uid=q.yang