Python RapidSolutionInEmbeddedLinux v0.2
Python RapidSolutionInEmbeddedLinux v0.2
A rapid solution on
embedded Linux
Tran Duc Hong
About
My names Tran Duc Hong
Working in Embedded field for 04 years.
Technical leader in Embedded Linux at FPT Embedded
Software Company.
Consultant in F1-Sattlite. Its the first satellite which is the first
satellite investigated by domestic company.
Email me if you have any interested in: hongtd2k@gmail.com
Agenda
C/C++ on Embedded Linux
Whys Python?
Idea
Solution
Comparison
Python vs. C/C++
Python vs. Ruby, Tcl/Tk, Perl
Real project
QnA
Performance utilize
Change platforms, a lot of work must be done.
and much more
Thus, we need expertise guys, even for developing some
application not for low-level.
Whys Python?
Language is very simple.
Extensible
Write our own module on C/C++ then use on Python code.
Embeddable
Embed Python within C/C++ programs to give 'scripting' capabilities
Extensive Libraries
8354 open source packages from Python Package Index. (Counted on
01-Dec-2009)
Whys Python?
Python syntax
Exception handling
x = int(raw_input("Please enter
an integer: "))
if x < 0:
x = 0
print Negative changed to
zero
elif x == 0:
print Zero
elif x == 1:
print Single
else: print More
while True:
try:
x =
int(raw_input("Please
enter a number: "))
break
except ValueError:
print "Oops! That was
no valid number. Try
again...
Class definition
class MyClass:
"""A simple example class"""
i = 12345
def f(self):
return 'hello world'
Real solution
Python + C/C++ + Real-time application interface
(RTAI)
Python: Simple, powerful, easy to represent logic activities.
C/C++ : Access directly to peripherals, kernel. Bit & memory
manipulation.
RTAI : Suitable for any modules require timing, precious in 0.05ms.
User
layer
Kernel
layer
Shell scripts
Python apps(.py)
LCD
Keyboard
LCD
Keyboard
Camera
USB
Camera
USB
Logic
represent
entity
C/C++
module
User layer
Driver
Kernel
Comparison
Python vs. Perl, Tcl/Tk
More complex than Python
Big footprint
Consume a lot of memory and CPU time
Real project
Use on some router embedded device
CPU: Intel xScale 500Mhz, Memory: 256MB, Flash: 512MB
Test result
Environment
CPU: Cirrus EP9301, Core ARM9TDMI 200Mhz, Memory: 128MB,
Flash: 128MB
Have many kind of peripherals such as GPIO, ADC, I2C, SPI,
1Wire, RS232, etc.
Using Linux 2.4.25 non Real-time patched.
Use on F1-sattlite project.
Constraints
Some module required strictly timing, such as Morse generator
(signal timing, 0.05ms precision )
Safety is the most concerning.
Rapid to develop prototype and testing.
Easy to debug for developer.
QnA