0% found this document useful (0 votes)
10 views49 pages

Unit 5

The document provides an overview of ARM7 architecture, detailing its features, working procedure with LPC2148 microcontroller, and components for embedded programs such as state machines, circular buffers, and queues. It also discusses various models for developing embedded systems programs, including sequential, event-driven, and test-driven development. Additionally, it explains the processes of assembly, linking, and loading in embedded systems, along with the ARM instruction set and its components.

Uploaded by

madhavigali41
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views49 pages

Unit 5

The document provides an overview of ARM7 architecture, detailing its features, working procedure with LPC2148 microcontroller, and components for embedded programs such as state machines, circular buffers, and queues. It also discusses various models for developing embedded systems programs, including sequential, event-driven, and test-driven development. Additionally, it explains the processes of assembly, linking, and loading in embedded systems, along with the ARM instruction set and its components.

Uploaded by

madhavigali41
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 49

1

1
1
ARM7 Architecture & Features
- ARM stand for “Advanced RISC (reduced instruction
set computer) machine”.
- ARM is a load store reducing instruction set computer
architecture.
- It means the core cannot directly operate with the
memory.
- All data operations must be done by registers with the
information which is located in the memory.
ARM7 Processor Block Diagram
Working Procedure

- The LPC2148 is a 16/32 bit ARM7 CPU.


- The temperature sensor LM35 is an analog
sensor.
- It is connected to the LPC2148
microcontroller analog channel.
- The slandered temperature values are pre-
programmed in the microcontroller.
Features of ARM7

- The ARM7 is a 16/32 – Bit bus.


- The static Ram is 40 kb.
- On-chip flash programmable memory is 512kb.
- It is a high speed controller 60 MHz operation.
- Two 10 bit ADC converters provide a total of 14
analog inputs.
- One 10- bit D/A converter.
Features of ARM7 Cont.....

- Two 32 bit timers/counters.


- 4- CCM (Capture Compare Modulation), 6 PWM,
Watchdog timer
- One RTC, 9 interrupts.
- One I2C protocol, SPI protocols, SSP protocol.
- Two UART serial communication protocols.
THANKYOU
In components for Embedded programs, we consider three
components that are commonly used in embedded software:

the state machine,


the circular buffer,
and the queue.

State machines are well suited to reactive systems such as user


interfaces;

Circular buffers and Queues are useful in digital signal processing.


State Machines
Inputs appear intermittently rather than
as periodic samples.
The reaction of most systems can be
characterized in terms of the input
received and the current state of the
system.
This leads naturally to a finite-state
machine style of describing the reactive
system’s behavior.
Example 1 Seat Belt Controller

The behavior we want to implement is a


simple seat belt controller.
The controller’s job is to turn on a buzzer if a
person sits in a seat and does not fasten the
seat belt within a fixed amount of time.
Seat Belt Controller system has three inputs and one output.

Input 1, sensor for the seat to know when a person has sat down.

Input 2, seat belt sensor that tells when the belt is fastened, and a
timer that goes off when the required time interval has elapsed.

The output is the buzzer.


State diagram that describes the seat belt controller’s behavior.
The idle state is in force when there is no
person in the seat.
When the person sits down, the machine
goes into the seated state and turns on the
timer.
If the timer goes off before the seat belt
is fastened, the machine goes into the
buzzer state.
If the seat belt goes on first, it enters the
belted state.
When the person leaves the seat, the
machine goes back to idle.
We will use a variable named state to
hold the current state of the machine and
a switch statement to determine what
action to take in each state.
Circular Buffers

Figure above illustrates how a circular buffer stores a subset of the


data stream.
The circular buffer is a data structure that
lets us handle streaming data in an
efficient way.

At each point in time, the algorithm


needs a subset of the data stream that
forms a window into the stream.
The window slides with time as we throw
out old values no longer needed and
add new values.

Because the size of the window does not


change, we can use a fixed-size buffer to
hold the current data.
Queues
Queues are also used in signal processing and event
processing.

Queues are used whenever data may arrive and


depart at somewhat unpredictable times.

when variable amounts of data may arrive. A queue


is often referred to as an elastic buffer as illustrated
in Figure below.
THANKYOU
Models of programs in embedded system

In embedded systems, programs are typically designed and


implemented using various models to ensure efficient
development, testing, and maintenance.
Here are some common models used for developing
programs in embedded systems:

1. Sequential Model
2. Event-Driven Model
3. State-Based Model
4. Model-Driven Development (MDD)
5. Component-Based Model
6. Real-Time Model
7. Test-Driven Development (TDD)
1. Sequential Model

• In this model, the program is developed as a sequential set of


instructions executed one after the other.

• It is suitable for simple embedded systems with linear control


flow and straightforward tasks.

• Programming languages like C or assembly language are


often used for writing programs following the sequential
model.
2. Event-Driven Model

• In the event-driven model, the program responds to events or


interrupts generated by external stimuli or internal conditions.

• It is commonly used in systems where the timing of events is


unpredictable or asynchronous.

• Event-driven programming frameworks or real-time operating


systems (RTOS) provide mechanisms for event handling
and task scheduling.
3. State-Based Model

• The state-based model represents the behavior of the system as


a finite set of states and transitions between them.

• It is suitable for systems with complex behaviors or


multiple operating modes.

• State machines, state charts, or finite state automata are often


used to model the system's behavior, and the program's
logic is implemented using state transitions.
4. Model-Driven Development (MDD)

Model-driven development involves creating high-level


models of the system's behavior, architecture, and
requirements, and generating code automatically from
these models.

• It helps in improving productivity, reducing errors, and


maintaining consistency between different development
artifacts.

• Tools like MATLAB/Simulink, UML (Unified Modeling


Language), and domain-specific modeling languages DSMLs)
are commonly used for model-driven.
5. Component-Based Model

• In the component-based model, the program is


developed by assembling reusable software
components, each encapsulating specific
functionality or service.

• It promotes modularity, reusability, and


maintainability of the software, making it easier to
manage and extend.

• Component-based development frameworks,


middleware, and design patterns are used to
facilitate component integration and interaction.
6. Real-Time Model
• In real-time systems, programs must meet strict timing
constraints and respond to events within specified
deadlines.

Real-time scheduling algorithms, such as rate


monotonic scheduling (RMS) or earliest deadline first
(EDF), are used to ensure timely execution of tasks
and guarantee system responsiveness.

• Real-time operating systems (RTOS) provide services


and mechanisms for managing tasks, scheduling, and
resource allocation in real-time embedded systems.
7. Test-Driven Development (TDD)

• Test-driven development involves writing automated tests


for the program's functionality before writing the actual code.

• It helps in ensuring correctness, reliability, and maintainability


of the software, as well as driving the design through
incremental iterations.

• Unit testing frameworks, mock objects, and hardware-in-


the-loop (HIL) testing are commonly used techniques for
test-driven development in embedded systems.
These models provide different approaches and
methodologies for developing programs in embedded
systems, depending on the system requirements, complexity,
and constraints.

Choosing the appropriate model or combination of


models depends on factors such as project goals, resource
constraints, development environment, and team expertise
THANKYOU
Assembly, linking and loading
In embedded systems development, assembly, linking, and
loading are fundamental processes involved in translating source
code into executable programs that can run on the target
hardware. Here's a brief overview of each:
1. Assembly:
• Assembly language is a low-level programming
language that closely represents the machine code
instructions of the target processor.
• Programmers write code in assembly language using
mnemonics corresponding to specific machine
instructions and addressing modes.
• Assembly language provides direct control over the
hardware resources and is often used in embedded
systems programming for tasks requiring precise timing,
hardware manipulation, or performance optimization.
• Assembly language programs are typically saved in text files
with a .asm or .s extension.
2. Linking:

• Linking is the process of combining multiple object files


and libraries into a single executable program.

• During compilation, source code is translated into object


files containing machine code instructions and data.

• The linker resolves references between different


modules, such as function calls and variable accesses, by
replacing symbolic references with actual memory
addresses.
• Additionally, the linker may perform optimizations, such as
dead code elimination, code relocation, and symbol table
generation.
• The output of the linking process is an executable file or
binary image that can be loaded and executed on the target
hardware.
• Linker scripts or configuration files are often used to
specify memory layout, section placement, and other
linker options.
3. Loading:
• Loading is the process of transferring the executable
program from storage (e.g., disk, flash memory) into the
target system's memory for execution.
• In embedded systems, loading is typically performed by the
bootloader, firmware, or operating system.

• The loader reads the executable file from storage,


allocates memory for program code and data, and copies the
program image into the appropriate memory locations.
• It may also perform additional initialization tasks, such as
setting up interrupt vectors, initializing hardware
peripherals, and configuring system parameters.
• Once the loading process is complete, the program begins
execution from the entry point specified in the executable
file.
• These three processes—assembly, linking, and loading—are
essential steps in the software development workflow for
embedded systems, enabling developers to create efficient
and reliable programs that run on target hardware platforms.
• Each step requires careful attention to detail and optimization
to ensure the correct operation of the embedded system.
THANKYOU
ARM Instruction Set:
The ARM instruction set refers to the set of
instructions that the ARM (Advanced RISC Machine)
architecture can execute.
ARM is a type of Reduced Instruction Set Computing
(RISC) architecture, which means that it focuses on a
smaller number of simpler instructions that can be
executed very quickly.
▪ Data Processing Instructions
▪ Software Interrupt Instructions
▪ Program Status Register Instructions
▪ Coprocessor Instructions.
▪ Data Processing Instructions
They are move, arithmetic, logical, comparison and multiply
instructions.
▪ Operation Mnemonic Instructions with Meaning
▪ Software Interrupt Instructions
❖ Software Interrupt Instructions are a type of instruction in a
processor's instruction set that allows a program to intentionally
trigger an interrupt in the system.

❖ Software interrupts are generated by the software itself to


request a service from the operating system or to handle
specific tasks within the system.

❖ In ARM processors, the instruction to generate a software


interrupt is called the SWI (Software Interrupt) instruction,
also referred to as SVC (Supervisor Call) in later ARM
versions, especially in ARMv7 and ARMv8.
Example:

A typical ARM assembly code example of using the SWI


instruction might look like this:

MOV R0, #1 ; Set up argument for system call


SWI 0x1234 ; Trigger software interrupt with identifier
0x1234

In this example, the SWI instruction is used to trigger the


interrupt, and the system call identifier is 0x1234.
▪ Program Status Register Instructions
❖ The Program Status Register (PSR) in an ARM processor is a
special-purpose register that holds information about the current
state of the processor and the status of the ongoing program
execution.
❖ This information includes flags and control bits that influence
how the processor operates.
❖ In ARM architecture, there are two primary types of Program
Status Registers:
Current Program Status Register (CPSR)
Saved Program Status Register (SPSR)
Common PSR-related instructions:
1. MRS (Move to Register from CPSR/SPSR):
This instruction copies the contents of the CPSR (or SPSR)
to a general-purpose register.
Example:
MRS R0, CPSR ; Move the CPSR value into register R0

2. MSR (Move to CPSR/SPSR from Register):


This instruction is used to copy the value from a general-purpose
register into the CPSR (or SPSR).
It can be used to change flags in the CPSR (like setting or
clearing the condition flags), or it can switch the processor
mode.
Example:
MSR CPSR, R1 ; Move the value in register R1 to CPSR
▪ Coprocessor Instructions.
• ARM supports 16 coprocessors
• Coprocessor implemented in hardware, software or both
• Coprocessor contains instruction pipeline, instruction decoding
logic, handshake logic, register bank, special processing logic with
its own data path.

• It is also connected to data bus like ARM core processor


• Instructions in program memory are available for coprocessors
also.
• Works in conjunction with ARM core and process same instruction
stream as ARM, but executes only instructions meant for
coprocessor and ignores ARM and other coprocessor’s instructions
• 3 types of instructions: data processing, register transfer, memory
transfer
THANKYOU

You might also like