Developing Software for Embedded Systems

Posted by NETRA PRIYA DARSHINI K on September 29, 2018

Embedded system

It is a computer hardware, software, other parts designed to perform a specific function component within larger system - in cars, air/spacecraft.

Embedded software in almost every electronic devices like;.. watches, VCR's, cellular phones, microwaves, thermostats and each embedded system is unique, with specialized
hardware and specialized software.
Developing Software for Embedded Systems
- Steps involved in preparing embedded software similar to general programming
- Follow five steps in Software Design Process
- Use Spiral Model
- Decide on programming language (C) 
- Know capabilities/limitations of processor/compiler
Main difference is that target hardware platform is unique
- Leads to additional software complexity
- Software Engineer must be aware of software build process
Embedded Software Development Process
Software development is performed on a host computer
- Compiler, Assembler, Linker, Locator, Debugger 
- Produces executable binary image that will run on Target Embedded System
Programming Embedded Systems
Embedded Systems Programming requires a more complex software build process 
- Target hardware platform consists of
- Target hardware (processor, memory, I/O) 
- Run time environment (Operating System/Kernel)
Target hardware platform contains only what is needed for final deployment
- Target hardware platform does not contain development tools (editor, compiler, debugger) 
- Target hardware platform is different from development platform 
- Development platform, called the Host Computer, is typically a general purpose computer 
- Host computer runs compiler, assembler, linker, locator to create a binary image that will run on the target embedded system 
Process for Developing Embedded Software
To develop software for a General Purpose Computer 
- Create source file 
- Type in C code 
- Build: compile and link 
- Execute: load and run 
To develop software for an embedded system 
- Create source file (on Host) 
- Type in C code (on Host) 
- Compile/Assemble: translate into machine code (on Host) 
- Link: combine all object files and libraries, resolve all symbols (on Host) 
- Locate: assign memory addresses to code and data (on Host) 
- Download: copy executable image into Target processor memory 
- Execute: reset Target processor
Compiling Embedded Systems
- Compiler translates program written in human-readable language into machine language 
- Source Code --> Object file 
- Object file is binary file that contains set of machine-language instructions (opcodes) and data resulting from language translation process 
Machine-language instructions are specific to a particular processor 
- Can the host computers compiler be used to compile a program to run on the target computer? 
- A Native-compiler runs on a computer platform and produces code for that same computer platform 
- A Cross-compiler runs on one computer platform and produces code for another computer platform.
Assemblers/Interpreters for Embedded Systems
- In some cases, a compiler is not used 
- Assembler performs one-to-one translation from human-readable assembly language mnemonics to equivalent machine-language opcodes 
Interpreter constantly runs and interprets source code as a set of directives 
- Performs syntax checking as program is typed in 
- Result is slow performance - can be ~1000x slower than an equivalent compiled language 
- Interactive capability provides more feedback -- easier to learn
Handyboard Interpreter
- Handyboard runs a C interpreter called Interactive C 
- C code is compiled into custom language 
- Custom language is interpreted by p-code 
- In interactive mode, syntax checked in IC console window 
                           E.g., To clear HB screen, type in following line: printf (“\n”); 
Linking Embedded Systems
- The Linker combines object files (from compiler) and resolves variable and function references 
- Source code may be contained in >1 file, which must be combined 
- Resolve variables which may be referenced in one file and defined in another file 
- Resolve calls to library functions, like sqrt 
- May include operating system ï Linker creates a relocatable version of the program 
- Program is complete, except no memory addresses assigned 
Locating Embedded Systems
- A Locator is the tool that performs the conversion from relocatable program to executable binary image 
- The Locator assigns physical memory addresses to code and data sections within the relocatable program 
- The Locator produces a binary memory image that can be loaded into the target ROM 
- In contrast, On General Purpose Computers, the operating system assigns the addresses at load time
Downloading and Executing Your Program 
- Once a program has been successfully compiled, linked, and located, it must be moved to the target platform 
- Download the binary image to the embedded system 
- Executable binary image is transferred and loaded into a memory device on target board 
- Can be loaded into ROM via a device programmer, which burns a chip that is then re-inserted into the embedded system 
- Handyboard must be put into bootstrap download mode first, then data can be transferred via serial port into memory 
- Your program will then execute when you reset the processor, or apply power to the embedded system 
Review Process for Developing Embedded Software
- To develop software for an embedded system 
- Create source file (on Host) – Type in C code (on Host) 
- Compile/Assemble: translate into machine code (on Host) 
- Link: combine all object files and libraries, resolve all symbols (on Host) 
- Locate: assign memory addresses to code and data (on Host) 
- Download: copy executable image into Target processor memory – Execute: reset Target processor 
Process for Developing Handyboard Software 
- To develop software for the Handyboard 
- Create source file (on Host) 
- Type in C code (on Host) 
- Download file: 
» Compile: translate into custom interpreted language (on Host) 
» Locate: assign memory locations (on Host) 
» Download: transfer interpreted language via serial board to HB 
- Execute: 
» Reset HB which runs “main” function 
» P-code interprets custom language
Debugging Embedded Software
- Now that the software has been downloaded to the target processor, how do we know if it is working? 
- Run-time errors are not as obvious ñ Most embedded systems do not have a screen 
- When a program fails, usually causes the processor to crash or lock-up 
- Logic errors 
- If program runs, is it performing the correct steps? 


Nama Anda
New Johny WussUpdated: September 29, 2018
CB