MOVING INTO ARM EMBEDDED LINUX DEVELOPMENT
Welcome
Joe Nicholson Software consultant & embedded developer Rufilla Ltd. www.rufilla.com
[email protected]
“Moving Into”
This topic can take some time to get started with A fast way of getting to a basecamp
“ARM”
Excellent platform for Embedded Linux ARM Cortex-A8 based TI System
On Chip Very few additional components required, true embedded system Powerful Uses very little power
“Embedded Linux”
Brief history of Linux What the difference is: Desktop/Embedded Why put Linux inside devices?
“Development”
Specific focus on application development No longer need to make a distro or understand the kernel to get started… Wide
range of training boards available Range of pre-built embedded Linuxes available
So, need to know how to use it NOT
how to build it
Using DS-5
From ARM Combines all the tools required for development in a single installation Runs under Windows No
need to learn Desktop Linux
Go
straight in!
At the end of this session you will..
Get an overview of Embedded Linux Get a bird’s eye view of DS-5 Go through the simplest example – flashing a light!
Origins of Linux
HANDS UP ALL C PROGRAMMERS! …You
think!
are more closely linked with Linux than you
Origins of Linux
Linux is a Unix-Like OS Unix is old Bell Labs, 1969 Ken Thompson, PDP-7 Originally coded in Assembler Ken Thompson was also designer of programming language B
Origins of Linux
Dennis Ritchie Colleague
of Ken Thompson Took Ken’s B and created C
By 1973 Unix was rewritten in C First
portable operating system
Unix and Linux have stayed in C A
gift for embedded developers
Linux - A Free Unix
Linux is actually composed of two major components: GNU
part Linux part
Some therefore have called it GNU/Linux But
it mainly just tends to be called Linux
The GNU Part
Richard Stallman Worked
1983 – GNU Operating System “GNU’s
at MIT’s AI laboratory Not Unix!”
Created the GPL Free
software licence Protect the freedom and openness of the source code
Created ALMOST all of a UNIX system
Almost, but not quite…
GNU created: Compilers,
linkers, debuggers Command shell Unix programming tools etc., etc.
Missed one important part Kernel
– The core interface to hardware, scheduler, etc. This bit is running late…
Linux
1991 - Linus Torvalds Student
at University of Helsinki Working on a terminal emulator to access Unix servers at the University Kept developing this… “suddenly realised” he’d essentially written an operating system kernel
Embedded Linux
Linux almost entirely in C So
portable Ported to a wide range of processors
Originally in high-end embedded space Headless
PCs File servers, etc.
Needs memory management unit (MMU) µClinux
attempt to create a version without this requirement
Embedded Linux (2)
Needs megabytes of memory to run Requirements have become easier to achieve
Greater demands on embedded devices
Play MP3s Connect to servers or devices using TCP/IP
System On Chips
Single chip systems capable of running embedded Linux
…Now Is The Time!
Why Embedded Linux?
No licence fees or royalties An inexpensive means of incorporating advanced features:
TCP/IP, FTP, telnet, Web servers, SSL encryption
Tools are: Often standard Rugged and secure Tested and supported by a wide community
Similar components for RTOS kind can be nonstandard and very expensive
Embedded Linux Advantages
Mature Unix
Linux Embedded Linux
Sophisticated Extensible 100,000s
projects
Many
work out of the box cross compiled onto embedded platform
Community Hundreds
of thousands of developers Often talk direct to the key developer
Embedded Linux: The Challenge
HARD to get started!
Challenges: Thousands
of differing approaches Many, many tools Desktop Linux normally required as development platform Linux command line interface complex though sophisticated Culture which can focus on detail
Enter ARM DS-5
Tools by ARM… firmly in embedded space DS-5 first Embedded Linux offering
DS-5 Advantages
ARM approach Embedded Linux from an embedded developer’s viewpoint Complete
development package Single Windows installation Simulator Debugger Example programs to try out-of-the-box
I consider this attitude refreshing in Embedded Linux space
So, What is DS-5?
Combination of open source tools and ARM’s own Main components are all standard GCC
compiler
Running
under Windows using Cygwin
Eclipse
IDE GDB debugger, with ARM front end
ARM Profiler
Version of DS-5
Downloading and Installing
Downloading and Installing
Main DS-5 Features
IDE Compiler Debugger Simulator Profiler
Menu Bar Toolbars
Editor
Views
Views
Perspective s
Debugger
Simulator
Gnometris example running under simulator
Profiler
Target Hardware
DS-5 is compatible with: A
range of ARM-based system-on-chip devices. A range of prototype boards and development platforms.
A Typical Development Path
Out-of-the-box Linux development with DS-5 Dev board with out-of-the-box Linux distro E.g.
Emtrion
Develop product on dev board Use in prototype Use in final unit If
low volume or high value
A Typical Development Path (2)
Base hardware on board or reference design Some changes Alter kernel board support Rufilla
An Example: Hello GPIO
Let’s flash an LED! Use the kernel GPIO driver We need to look at a concept…
“Everything in Linux is A File”
…everything?
So, programs are files?
That’s how you see them, yes.
So how do I light an LED?
Yep, obviously.
And… device drivers are files?
Yes.
You write the state of the LED to a file.
What?! A real file? That’s just WEIRD!
No, but it looks like one: it’s a virtual file in a virtual filesystem, in this case sysfs.
Setting the state of an LED static void set_led_state(int led_state) { /* fd_led: File handle for LED's brightness file */ int fd_led; /* led_val: The value to write to the brightness file */ char led_val = '0'; /* Open the LED's brightness file in binary for writing */ if ((fd_led = open("/sys/class/gpio/gpio40/value", O_WRONLY)) == -1) { printf("Cannot open LED brightness file.\n"); exit(1); } /* Set the state of the pin */ led_val = led_state ? '1' : '0'; /* Write this to the brightness file */ write(fd_led, &led_val, sizeof(char)); close(fd_led); }
Let’s Do This
Let’s Do This (2)
Let’s Do This (3)
Summary
Embedded Linux is relevant NOW DS-5 Provides a clear path for development
Thank you for coming!
Any questions?