SlideShare a Scribd company logo
Compilers, assemblers, linkers, loaders, and programming issues For embedded Systems  Chris Gregg January 29, 2009
is programming for an embedded system different? Speed Size Correctness Portability Real-Time or not Other Hardware Considerations
How does one actually program an embedded system? Has this changed over the years?  Has there been significant progress? How does Ford program their Fuel Injection System computer? How does GE program their Microwave Ovens (and was this different 30 years ago?) How does Nikon program their digital SLR cameras? How does Apple/RIM/Microsoft program their iPhone/Blackberry/SmartPhone? How does a hobbyist program a Pic microprocessor? How does NASA program (and  reprogram ) the Mars Rover? How did James Gosling at Sun want his set-top boxes programmed? (How was the original 128K Macintosh programmed?)
Programming Languages Machine Code Assembly Code Higher Level Languages Fixed Rom, Ram, Firmware Compiled C , nesC, C++, Ada, Forth, etc. Interpreted (?) Perl, Python, Javascript Markup HTML, XML Java All Eventually End up as Machine Code
So you’ve chosen C.  Let’s Go! What does a programmer need to know about programming for an embedded system? She’d better know about the hardware. Purpose How data flows (to include getting the program onto the system, I/O), how to interface with sensors, actuators, etc. Whether there is an operating system, and how it runs programs Limitations: memory, speed, upgradability (firmware?) How are hardware errors handled? (think Mars Rover) Plan on debugging hardware issues… (Not so fast.)
So you’ve chosen C.  Let’s Go! What does a programmer need to know about programming for an embedded system? She’d better know about the software tools related to programming for the specific hardware. Is there a compiler/linker/assembler? (hopefully!) How is the memory addressed, what bit-level knowledge of the hardware is necessary, how does one access pins, etc.? How will debugging be managed? How will testing be done? What licensing needs to be organized (this can be tricky!) Does the software need to be portable? (using C is  probably  going to help you—see the second point above). (Not so fast.)
The Embedded Software Development Process Barr, M. & Massa, A. Oram, A.  (ed.)  Programming Embedded Systems in C and C++, 2nd Edition.  O'Reilly & Associates, Inc.,  2006  , p.55
The Tools Compiler: Translates human readable code into assembly language or opcodes for a particular processor (or possibly into machine-independent opcodes a la Java).  Produces an object file. Assembler: Translates assembly language into opcodes (it is really a compiler, too).  Also produces an object file. Linker: Organizes the object files, necessary libraries, and other data and produces a relocatable file.  Locator: Takes the relocatable file and information about the memory of the system and produces an executable. (By the way: gcc takes care of  all  of these functions at once)
The Tools: Embedded System Specifics All of the tools run on the host computer, not the embedded computer. Compiler: Has to know about the specific hardware (except in very trivial cases).  Should be able to optimize for size. Assembler: Produces “startup code”; not inserted automatically as in general purpose computers (i.e., the programmer needs to compile it independently). Linker: Needs the correct libraries (open source c libraries, such as  newlib , are available). Locator: Needs programmer input for information about memory. Bottom Line:  There can be a lot of extra work for the programmer, although certain systems (e.g. Pic programming) tools can automate most of it.
Moving the program onto the embedded system Remember, the program is written (and possibly run in an emulator) on a host computer, but it still needs to get onto the embedded system. Methods: Build/burn the program into the hardware (firmware or other flash memory) Bootloader: a bootloader resides on the embedded system and facilitates loading programs onto the system. Debug Monitor: The debug monitor is a more robust program on an embedded system that helps with debugging and other chores, and can include a bootloader as well.
Debugging Debugging embedded systems can be facilitated with a Debug Monitor, or through a remote debugger on the host computer. A serial link is normally set up, and the debugger acts more or less like a general purpose debugger. Emulators can be used to test the system without utilizing the actual hardware (but this has many caveats, and nothing beats testing on the real system). Software Simulators allow the programmer to debug completely on the host system, which can be quicker and can allow faster code turnaround. When it comes down to it, an oscilloscope and a multimeter can be your best friend for debugging.
Final Thoughts Programming for embedded systems has come a long way since the days of toggle switches, but it still involves greater programmer involvement in the hardware aspect of the system. There are many software tools built for embedded systems, and many embedded system hardware designers include debugging tools with the hardware. You had probably learn C (and a fair amount of assembly) to program embedded systems.
Final Thoughts Is this a necessary topic for an Embedded Systems class? Yes You’ve got to get your program onto the system some how, and flipping toggle switches doesn’t put food on the table any more. Hardware only does what you tell it to, via software. Discussion of the tradeoffs necessary to program an embedded system versus a GP system is a necessity.
6 Questions Discuss the steps needed to get a program from source code to executable in an embedded system, and the differences between similar steps on a general purpose system. What trade-offs are necessary when thinking about how you are going to program for an embedded system? Why is C generally considered a better language to program in for embedded systems than, say, Java or Perl?
6 Questions Name three different ways you might debug the code for your embedded system. Why is it imperative that an embedded system programmer know the details of the hardware that she is programming for?  Compare this to someone writing a Java applet for a web site. Talk about the role firmware plays in developing software for an embedded system.
Bibliography Barr, M. & Massa, A. Oram, A.  (ed.) Programming Embedded Systems in C and C++, 2nd Edition.  O'Reilly & Associates, Inc.,  2006   Wolfe, M. How compilers and tools differ for embedded systems.  2005 .  http://www.pgroup.com/lit/pgi_article_cases.pdf Gay, D.; Levis, P.; von Behren, R.; Welsh, M.; Brewer, E. & Culler, D. The nesC language: A holistic approach to networked embedded systems SIGPLAN Not., ACM,  2003 , 38 , 1-11  Williams, B.; Ingham, M.; Chung, S. & Elliott, P. Model-based programming of intelligent embedded systems and robotic space explorers Proceedings of the IEEE,  2003 , 91 , 212-237
Ad

Recommended

Embedded systems tools & peripherals
Embedded systems tools & peripherals
imtiazalijoono
 
Embedded System Tools ppt
Embedded System Tools ppt
Halai Hansika
 
Programming Fundamentals and Programming Languages Concepts
Programming Fundamentals and Programming Languages Concepts
imtiazalijoono
 
Lecture 5 - Structured Programming Language
Lecture 5 - Structured Programming Language
Md. Imran Hossain Showrov
 
Introduction of C Programming
Introduction of C Programming
Dr. Ranjan Kumar Mishra
 
Computer programming
Computer programming
Vincent Valenzuela
 
Cross compiling android applications
Cross compiling android applications
sai krishna
 
Intro To Programming Concepts
Intro To Programming Concepts
Jussi Pohjolainen
 
Description of programming language
Description of programming language
Sam Stratford
 
Programing language
Programing language
James Taylor
 
Ss ui lecture 1
Ss ui lecture 1
Avinash Kapse
 
Cmp2412 programming principles
Cmp2412 programming principles
NIKANOR THOMAS
 
Introduction to Computer Programming
Introduction to Computer Programming
Prof. Erwin Globio
 
Programming Languages / Translators
Programming Languages / Translators
Project Student
 
Introduction to Coding
Introduction to Coding
St. Petersburg College
 
La 5 Pl Translator
La 5 Pl Translator
Cma Mohd
 
Snug2007 Presentation
Snug2007 Presentation
clkalyan
 
GUIDE TO PROGRAMMING WITH PYTHON
GUIDE TO PROGRAMMING WITH PYTHON
Lebogang Modise
 
9781111530532 ppt ch01
9781111530532 ppt ch01
Terry Yoast
 
Basic Computer Programming
Basic Computer Programming
Allen de Castro
 
Programming Fundamentals lecture 2
Programming Fundamentals lecture 2
REHAN IJAZ
 
Language processor
Language processor
Muhammad Mudarrak
 
Algorithms - Introduction to computer programming
Algorithms - Introduction to computer programming
baabtra.com - No. 1 supplier of quality freshers
 
Types Of Coding Languages: A Complete Guide To Master Programming
Types Of Coding Languages: A Complete Guide To Master Programming
calltutors
 
Reverse code engineering
Reverse code engineering
Krishs Patil
 
Compiler, linker & loader
Compiler, linker & loader
Rajani Singh
 
Linkers
Linkers
Tech_MX
 
Slovenian Right of REVOLUTION & Political CORRUPTION
Slovenian Right of REVOLUTION & Political CORRUPTION
VogelDenise
 
Freedom and Responsibility
Freedom and Responsibility
Mike Ruangutai
 
Powering Informed Decisions - Strategic social listening
Powering Informed Decisions - Strategic social listening
Precise Brand Insight
 

More Related Content

What's hot (17)

Description of programming language
Description of programming language
Sam Stratford
 
Programing language
Programing language
James Taylor
 
Ss ui lecture 1
Ss ui lecture 1
Avinash Kapse
 
Cmp2412 programming principles
Cmp2412 programming principles
NIKANOR THOMAS
 
Introduction to Computer Programming
Introduction to Computer Programming
Prof. Erwin Globio
 
Programming Languages / Translators
Programming Languages / Translators
Project Student
 
Introduction to Coding
Introduction to Coding
St. Petersburg College
 
La 5 Pl Translator
La 5 Pl Translator
Cma Mohd
 
Snug2007 Presentation
Snug2007 Presentation
clkalyan
 
GUIDE TO PROGRAMMING WITH PYTHON
GUIDE TO PROGRAMMING WITH PYTHON
Lebogang Modise
 
9781111530532 ppt ch01
9781111530532 ppt ch01
Terry Yoast
 
Basic Computer Programming
Basic Computer Programming
Allen de Castro
 
Programming Fundamentals lecture 2
Programming Fundamentals lecture 2
REHAN IJAZ
 
Language processor
Language processor
Muhammad Mudarrak
 
Algorithms - Introduction to computer programming
Algorithms - Introduction to computer programming
baabtra.com - No. 1 supplier of quality freshers
 
Types Of Coding Languages: A Complete Guide To Master Programming
Types Of Coding Languages: A Complete Guide To Master Programming
calltutors
 
Reverse code engineering
Reverse code engineering
Krishs Patil
 
Description of programming language
Description of programming language
Sam Stratford
 
Programing language
Programing language
James Taylor
 
Cmp2412 programming principles
Cmp2412 programming principles
NIKANOR THOMAS
 
Introduction to Computer Programming
Introduction to Computer Programming
Prof. Erwin Globio
 
Programming Languages / Translators
Programming Languages / Translators
Project Student
 
La 5 Pl Translator
La 5 Pl Translator
Cma Mohd
 
Snug2007 Presentation
Snug2007 Presentation
clkalyan
 
GUIDE TO PROGRAMMING WITH PYTHON
GUIDE TO PROGRAMMING WITH PYTHON
Lebogang Modise
 
9781111530532 ppt ch01
9781111530532 ppt ch01
Terry Yoast
 
Basic Computer Programming
Basic Computer Programming
Allen de Castro
 
Programming Fundamentals lecture 2
Programming Fundamentals lecture 2
REHAN IJAZ
 
Types Of Coding Languages: A Complete Guide To Master Programming
Types Of Coding Languages: A Complete Guide To Master Programming
calltutors
 
Reverse code engineering
Reverse code engineering
Krishs Patil
 

Viewers also liked (20)

Compiler, linker & loader
Compiler, linker & loader
Rajani Singh
 
Linkers
Linkers
Tech_MX
 
Slovenian Right of REVOLUTION & Political CORRUPTION
Slovenian Right of REVOLUTION & Political CORRUPTION
VogelDenise
 
Freedom and Responsibility
Freedom and Responsibility
Mike Ruangutai
 
Powering Informed Decisions - Strategic social listening
Powering Informed Decisions - Strategic social listening
Precise Brand Insight
 
031816 - WORLD NEWS RELEASE (Bengali)
031816 - WORLD NEWS RELEASE (Bengali)
VogelDenise
 
031816 - WORLD NEWS RELEASE (Samoan)
031816 - WORLD NEWS RELEASE (Samoan)
VogelDenise
 
BAKER DONELSON - Attorney Layoffs The SINKING OF A TERRORIST REGIME (AFRIKAANS)
BAKER DONELSON - Attorney Layoffs The SINKING OF A TERRORIST REGIME (AFRIKAANS)
VogelDenise
 
011817-PROJECT EXTENDING AFRICA (Portuguese)
011817-PROJECT EXTENDING AFRICA (Portuguese)
VogelDenise
 
062112 arabic (supreme court)
062112 arabic (supreme court)
VogelDenise
 
Consumo responsable
Consumo responsable
Jehi Alvarez
 
121515 - THANK YOU GIFT LIST FOR VDN DONATIONS
121515 - THANK YOU GIFT LIST FOR VDN DONATIONS
VogelDenise
 
092909 EMAIL TO OLYMPIC COMMITTEE (INDONESIAN)
092909 EMAIL TO OLYMPIC COMMITTEE (INDONESIAN)
VogelDenise
 
WHAT HAPPENED TO BLACK WALL STREET - Understanding HOW The Ku Klux Klan CARRY...
WHAT HAPPENED TO BLACK WALL STREET - Understanding HOW The Ku Klux Klan CARRY...
VogelDenise
 
091815 - TOWNSEND BANKRUPTCY HEARING (BENGALI)
091815 - TOWNSEND BANKRUPTCY HEARING (BENGALI)
VogelDenise
 
080515 - REQUEST TO VIEW DOCUMENTS - INTENT TO FILE COMPLAINT(S) WITH THE TOW...
080515 - REQUEST TO VIEW DOCUMENTS - INTENT TO FILE COMPLAINT(S) WITH THE TOW...
VogelDenise
 
062112 galician (supreme court)
062112 galician (supreme court)
VogelDenise
 
092909 EMAIL TO OLYMPIC COMMITTEE (SWEDISH)
092909 EMAIL TO OLYMPIC COMMITTEE (SWEDISH)
VogelDenise
 
072712 usa ku klux klan runned government - swahili
072712 usa ku klux klan runned government - swahili
VogelDenise
 
Compiler, linker & loader
Compiler, linker & loader
Rajani Singh
 
Slovenian Right of REVOLUTION & Political CORRUPTION
Slovenian Right of REVOLUTION & Political CORRUPTION
VogelDenise
 
Freedom and Responsibility
Freedom and Responsibility
Mike Ruangutai
 
Powering Informed Decisions - Strategic social listening
Powering Informed Decisions - Strategic social listening
Precise Brand Insight
 
031816 - WORLD NEWS RELEASE (Bengali)
031816 - WORLD NEWS RELEASE (Bengali)
VogelDenise
 
031816 - WORLD NEWS RELEASE (Samoan)
031816 - WORLD NEWS RELEASE (Samoan)
VogelDenise
 
BAKER DONELSON - Attorney Layoffs The SINKING OF A TERRORIST REGIME (AFRIKAANS)
BAKER DONELSON - Attorney Layoffs The SINKING OF A TERRORIST REGIME (AFRIKAANS)
VogelDenise
 
011817-PROJECT EXTENDING AFRICA (Portuguese)
011817-PROJECT EXTENDING AFRICA (Portuguese)
VogelDenise
 
062112 arabic (supreme court)
062112 arabic (supreme court)
VogelDenise
 
Consumo responsable
Consumo responsable
Jehi Alvarez
 
121515 - THANK YOU GIFT LIST FOR VDN DONATIONS
121515 - THANK YOU GIFT LIST FOR VDN DONATIONS
VogelDenise
 
092909 EMAIL TO OLYMPIC COMMITTEE (INDONESIAN)
092909 EMAIL TO OLYMPIC COMMITTEE (INDONESIAN)
VogelDenise
 
WHAT HAPPENED TO BLACK WALL STREET - Understanding HOW The Ku Klux Klan CARRY...
WHAT HAPPENED TO BLACK WALL STREET - Understanding HOW The Ku Klux Klan CARRY...
VogelDenise
 
091815 - TOWNSEND BANKRUPTCY HEARING (BENGALI)
091815 - TOWNSEND BANKRUPTCY HEARING (BENGALI)
VogelDenise
 
080515 - REQUEST TO VIEW DOCUMENTS - INTENT TO FILE COMPLAINT(S) WITH THE TOW...
080515 - REQUEST TO VIEW DOCUMENTS - INTENT TO FILE COMPLAINT(S) WITH THE TOW...
VogelDenise
 
062112 galician (supreme court)
062112 galician (supreme court)
VogelDenise
 
092909 EMAIL TO OLYMPIC COMMITTEE (SWEDISH)
092909 EMAIL TO OLYMPIC COMMITTEE (SWEDISH)
VogelDenise
 
072712 usa ku klux klan runned government - swahili
072712 usa ku klux klan runned government - swahili
VogelDenise
 
Ad

Similar to Compilers programmingembedded (20)

Embedded programming Embedded programming (1).pptx
Embedded programming Embedded programming (1).pptx
lematadese670
 
Introduction to embedded c
Introduction to embedded c
Gokuldhev mony
 
Consider the following interrupting system. The active-edge inputs o.pdf
Consider the following interrupting system. The active-edge inputs o.pdf
fasttrackscardecors
 
Embedded systems
Embedded systems
PROVAB TECHNOSOFT PVT. LTD.
 
Embedded systems designUNIT 4 PART 2.pdf
Embedded systems designUNIT 4 PART 2.pdf
vmspraneeth
 
embeddedsystems-100429081552-phpapp01.pdf
embeddedsystems-100429081552-phpapp01.pdf
Ashwin180668
 
Embedded Programming..pnsnsjsejejwwjjwptx
Embedded Programming..pnsnsjsejejwwjjwptx
JayPatil347597
 
Module-3 embedded system firmware code.ppt
Module-3 embedded system firmware code.ppt
BEVARAVASUDEVAAP1813
 
Module-3 Embedded syatem firmware design.ppt
Module-3 Embedded syatem firmware design.ppt
BEVARAVASUDEVAAP1813
 
Embedded firmware
Embedded firmware
Joel P
 
C Programming For Embedded Systems
C Programming For Embedded Systems
Ganesh Samarthyam
 
lecture03_EmbeddedSoftware for Beginners
lecture03_EmbeddedSoftware for Beginners
MahmoudElsamanty
 
BWU_BTE_21_030_OE_EE702A.ppthhgggggggggg
BWU_BTE_21_030_OE_EE702A.ppthhgggggggggg
tusharjana065
 
Lecture 1 Introduction.pptx
Lecture 1 Introduction.pptx
Orchestra2
 
Embedded system
Embedded system
Vinod Srivastava
 
2e062d07-4a72-4792-af77-5e53147d4c81.pdf
2e062d07-4a72-4792-af77-5e53147d4c81.pdf
kimavathmukeshnaik
 
M.Tech Internet of Things Embeed Systems
M.Tech Internet of Things Embeed Systems
AvinashAvuthu2
 
Embedded c c++ programming fundamentals master
Embedded c c++ programming fundamentals master
Hossam Hassan
 
ECE-3567-Lecture-1-Spring-2025 for beginner
ECE-3567-Lecture-1-Spring-2025 for beginner
MahmoudElsamanty
 
Embedded_C-explanation of pointers C.pdf
Embedded_C-explanation of pointers C.pdf
RammohanBasavaraju1
 
Embedded programming Embedded programming (1).pptx
Embedded programming Embedded programming (1).pptx
lematadese670
 
Introduction to embedded c
Introduction to embedded c
Gokuldhev mony
 
Consider the following interrupting system. The active-edge inputs o.pdf
Consider the following interrupting system. The active-edge inputs o.pdf
fasttrackscardecors
 
Embedded systems designUNIT 4 PART 2.pdf
Embedded systems designUNIT 4 PART 2.pdf
vmspraneeth
 
embeddedsystems-100429081552-phpapp01.pdf
embeddedsystems-100429081552-phpapp01.pdf
Ashwin180668
 
Embedded Programming..pnsnsjsejejwwjjwptx
Embedded Programming..pnsnsjsejejwwjjwptx
JayPatil347597
 
Module-3 embedded system firmware code.ppt
Module-3 embedded system firmware code.ppt
BEVARAVASUDEVAAP1813
 
Module-3 Embedded syatem firmware design.ppt
Module-3 Embedded syatem firmware design.ppt
BEVARAVASUDEVAAP1813
 
Embedded firmware
Embedded firmware
Joel P
 
C Programming For Embedded Systems
C Programming For Embedded Systems
Ganesh Samarthyam
 
lecture03_EmbeddedSoftware for Beginners
lecture03_EmbeddedSoftware for Beginners
MahmoudElsamanty
 
BWU_BTE_21_030_OE_EE702A.ppthhgggggggggg
BWU_BTE_21_030_OE_EE702A.ppthhgggggggggg
tusharjana065
 
Lecture 1 Introduction.pptx
Lecture 1 Introduction.pptx
Orchestra2
 
2e062d07-4a72-4792-af77-5e53147d4c81.pdf
2e062d07-4a72-4792-af77-5e53147d4c81.pdf
kimavathmukeshnaik
 
M.Tech Internet of Things Embeed Systems
M.Tech Internet of Things Embeed Systems
AvinashAvuthu2
 
Embedded c c++ programming fundamentals master
Embedded c c++ programming fundamentals master
Hossam Hassan
 
ECE-3567-Lecture-1-Spring-2025 for beginner
ECE-3567-Lecture-1-Spring-2025 for beginner
MahmoudElsamanty
 
Embedded_C-explanation of pointers C.pdf
Embedded_C-explanation of pointers C.pdf
RammohanBasavaraju1
 
Ad

Recently uploaded (20)

Lessons Learned from Developing Secure AI Workflows.pdf
Lessons Learned from Developing Secure AI Workflows.pdf
Priyanka Aash
 
PyCon SG 25 - Firecracker Made Easy with Python.pdf
PyCon SG 25 - Firecracker Made Easy with Python.pdf
Muhammad Yuga Nugraha
 
OpenPOWER Foundation & Open-Source Core Innovations
OpenPOWER Foundation & Open-Source Core Innovations
IBM
 
UserCon Belgium: Honey, VMware increased my bill
UserCon Belgium: Honey, VMware increased my bill
stijn40
 
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
 
2025_06_18 - OpenMetadata Community Meeting.pdf
2025_06_18 - OpenMetadata Community Meeting.pdf
OpenMetadata
 
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance
 
9-1-1 Addressing: End-to-End Automation Using FME
9-1-1 Addressing: End-to-End Automation Using FME
Safe Software
 
Securing AI - There Is No Try, Only Do!.pdf
Securing AI - There Is No Try, Only Do!.pdf
Priyanka Aash
 
Cluster-Based Multi-Objective Metamorphic Test Case Pair Selection for Deep N...
Cluster-Based Multi-Objective Metamorphic Test Case Pair Selection for Deep N...
janeliewang985
 
AI vs Human Writing: Can You Tell the Difference?
AI vs Human Writing: Can You Tell the Difference?
Shashi Sathyanarayana, Ph.D
 
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Alliance
 
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik
 
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
revolcs10
 
Wenn alles versagt - IBM Tape schützt, was zählt! Und besonders mit dem neust...
Wenn alles versagt - IBM Tape schützt, was zählt! Und besonders mit dem neust...
Josef Weingand
 
Curietech AI in action - Accelerate MuleSoft development
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
 
You are not excused! How to avoid security blind spots on the way to production
You are not excused! How to avoid security blind spots on the way to production
Michele Leroux Bustamante
 
Python Conference Singapore - 19 Jun 2025
Python Conference Singapore - 19 Jun 2025
ninefyi
 
“Key Requirements to Successfully Implement Generative AI in Edge Devices—Opt...
“Key Requirements to Successfully Implement Generative AI in Edge Devices—Opt...
Edge AI and Vision Alliance
 
MuleSoft for AgentForce : Topic Center and API Catalog
MuleSoft for AgentForce : Topic Center and API Catalog
shyamraj55
 
Lessons Learned from Developing Secure AI Workflows.pdf
Lessons Learned from Developing Secure AI Workflows.pdf
Priyanka Aash
 
PyCon SG 25 - Firecracker Made Easy with Python.pdf
PyCon SG 25 - Firecracker Made Easy with Python.pdf
Muhammad Yuga Nugraha
 
OpenPOWER Foundation & Open-Source Core Innovations
OpenPOWER Foundation & Open-Source Core Innovations
IBM
 
UserCon Belgium: Honey, VMware increased my bill
UserCon Belgium: Honey, VMware increased my bill
stijn40
 
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
 
2025_06_18 - OpenMetadata Community Meeting.pdf
2025_06_18 - OpenMetadata Community Meeting.pdf
OpenMetadata
 
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance
 
9-1-1 Addressing: End-to-End Automation Using FME
9-1-1 Addressing: End-to-End Automation Using FME
Safe Software
 
Securing AI - There Is No Try, Only Do!.pdf
Securing AI - There Is No Try, Only Do!.pdf
Priyanka Aash
 
Cluster-Based Multi-Objective Metamorphic Test Case Pair Selection for Deep N...
Cluster-Based Multi-Objective Metamorphic Test Case Pair Selection for Deep N...
janeliewang985
 
AI vs Human Writing: Can You Tell the Difference?
AI vs Human Writing: Can You Tell the Difference?
Shashi Sathyanarayana, Ph.D
 
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Alliance
 
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik
 
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
revolcs10
 
Wenn alles versagt - IBM Tape schützt, was zählt! Und besonders mit dem neust...
Wenn alles versagt - IBM Tape schützt, was zählt! Und besonders mit dem neust...
Josef Weingand
 
Curietech AI in action - Accelerate MuleSoft development
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
 
You are not excused! How to avoid security blind spots on the way to production
You are not excused! How to avoid security blind spots on the way to production
Michele Leroux Bustamante
 
Python Conference Singapore - 19 Jun 2025
Python Conference Singapore - 19 Jun 2025
ninefyi
 
“Key Requirements to Successfully Implement Generative AI in Edge Devices—Opt...
“Key Requirements to Successfully Implement Generative AI in Edge Devices—Opt...
Edge AI and Vision Alliance
 
MuleSoft for AgentForce : Topic Center and API Catalog
MuleSoft for AgentForce : Topic Center and API Catalog
shyamraj55
 

Compilers programmingembedded

  • 1. Compilers, assemblers, linkers, loaders, and programming issues For embedded Systems Chris Gregg January 29, 2009
  • 2. is programming for an embedded system different? Speed Size Correctness Portability Real-Time or not Other Hardware Considerations
  • 3. How does one actually program an embedded system? Has this changed over the years? Has there been significant progress? How does Ford program their Fuel Injection System computer? How does GE program their Microwave Ovens (and was this different 30 years ago?) How does Nikon program their digital SLR cameras? How does Apple/RIM/Microsoft program their iPhone/Blackberry/SmartPhone? How does a hobbyist program a Pic microprocessor? How does NASA program (and reprogram ) the Mars Rover? How did James Gosling at Sun want his set-top boxes programmed? (How was the original 128K Macintosh programmed?)
  • 4. Programming Languages Machine Code Assembly Code Higher Level Languages Fixed Rom, Ram, Firmware Compiled C , nesC, C++, Ada, Forth, etc. Interpreted (?) Perl, Python, Javascript Markup HTML, XML Java All Eventually End up as Machine Code
  • 5. So you’ve chosen C. Let’s Go! What does a programmer need to know about programming for an embedded system? She’d better know about the hardware. Purpose How data flows (to include getting the program onto the system, I/O), how to interface with sensors, actuators, etc. Whether there is an operating system, and how it runs programs Limitations: memory, speed, upgradability (firmware?) How are hardware errors handled? (think Mars Rover) Plan on debugging hardware issues… (Not so fast.)
  • 6. So you’ve chosen C. Let’s Go! What does a programmer need to know about programming for an embedded system? She’d better know about the software tools related to programming for the specific hardware. Is there a compiler/linker/assembler? (hopefully!) How is the memory addressed, what bit-level knowledge of the hardware is necessary, how does one access pins, etc.? How will debugging be managed? How will testing be done? What licensing needs to be organized (this can be tricky!) Does the software need to be portable? (using C is probably going to help you—see the second point above). (Not so fast.)
  • 7. The Embedded Software Development Process Barr, M. & Massa, A. Oram, A. (ed.) Programming Embedded Systems in C and C++, 2nd Edition. O'Reilly & Associates, Inc., 2006 , p.55
  • 8. The Tools Compiler: Translates human readable code into assembly language or opcodes for a particular processor (or possibly into machine-independent opcodes a la Java). Produces an object file. Assembler: Translates assembly language into opcodes (it is really a compiler, too). Also produces an object file. Linker: Organizes the object files, necessary libraries, and other data and produces a relocatable file. Locator: Takes the relocatable file and information about the memory of the system and produces an executable. (By the way: gcc takes care of all of these functions at once)
  • 9. The Tools: Embedded System Specifics All of the tools run on the host computer, not the embedded computer. Compiler: Has to know about the specific hardware (except in very trivial cases). Should be able to optimize for size. Assembler: Produces “startup code”; not inserted automatically as in general purpose computers (i.e., the programmer needs to compile it independently). Linker: Needs the correct libraries (open source c libraries, such as newlib , are available). Locator: Needs programmer input for information about memory. Bottom Line: There can be a lot of extra work for the programmer, although certain systems (e.g. Pic programming) tools can automate most of it.
  • 10. Moving the program onto the embedded system Remember, the program is written (and possibly run in an emulator) on a host computer, but it still needs to get onto the embedded system. Methods: Build/burn the program into the hardware (firmware or other flash memory) Bootloader: a bootloader resides on the embedded system and facilitates loading programs onto the system. Debug Monitor: The debug monitor is a more robust program on an embedded system that helps with debugging and other chores, and can include a bootloader as well.
  • 11. Debugging Debugging embedded systems can be facilitated with a Debug Monitor, or through a remote debugger on the host computer. A serial link is normally set up, and the debugger acts more or less like a general purpose debugger. Emulators can be used to test the system without utilizing the actual hardware (but this has many caveats, and nothing beats testing on the real system). Software Simulators allow the programmer to debug completely on the host system, which can be quicker and can allow faster code turnaround. When it comes down to it, an oscilloscope and a multimeter can be your best friend for debugging.
  • 12. Final Thoughts Programming for embedded systems has come a long way since the days of toggle switches, but it still involves greater programmer involvement in the hardware aspect of the system. There are many software tools built for embedded systems, and many embedded system hardware designers include debugging tools with the hardware. You had probably learn C (and a fair amount of assembly) to program embedded systems.
  • 13. Final Thoughts Is this a necessary topic for an Embedded Systems class? Yes You’ve got to get your program onto the system some how, and flipping toggle switches doesn’t put food on the table any more. Hardware only does what you tell it to, via software. Discussion of the tradeoffs necessary to program an embedded system versus a GP system is a necessity.
  • 14. 6 Questions Discuss the steps needed to get a program from source code to executable in an embedded system, and the differences between similar steps on a general purpose system. What trade-offs are necessary when thinking about how you are going to program for an embedded system? Why is C generally considered a better language to program in for embedded systems than, say, Java or Perl?
  • 15. 6 Questions Name three different ways you might debug the code for your embedded system. Why is it imperative that an embedded system programmer know the details of the hardware that she is programming for? Compare this to someone writing a Java applet for a web site. Talk about the role firmware plays in developing software for an embedded system.
  • 16. Bibliography Barr, M. & Massa, A. Oram, A. (ed.) Programming Embedded Systems in C and C++, 2nd Edition. O'Reilly & Associates, Inc., 2006 Wolfe, M. How compilers and tools differ for embedded systems. 2005 . http://www.pgroup.com/lit/pgi_article_cases.pdf Gay, D.; Levis, P.; von Behren, R.; Welsh, M.; Brewer, E. & Culler, D. The nesC language: A holistic approach to networked embedded systems SIGPLAN Not., ACM, 2003 , 38 , 1-11 Williams, B.; Ingham, M.; Chung, S. & Elliott, P. Model-based programming of intelligent embedded systems and robotic space explorers Proceedings of the IEEE, 2003 , 91 , 212-237