0% found this document useful (0 votes)
73 views8 pages

Special Topics For Embedded Systems: (Balancing Memory Usage, Speed, Performance)

This document discusses balancing memory usage, speed, and performance in embedded systems. It provides three methods for initializing variables that use different amounts of ROM memory and have different execution times. It also describes how to set up an IAR workbench project to generate output files that allow checking memory allocations and comparing the performance of code snippets.

Uploaded by

Srikanth Ksvk
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)
73 views8 pages

Special Topics For Embedded Systems: (Balancing Memory Usage, Speed, Performance)

This document discusses balancing memory usage, speed, and performance in embedded systems. It provides three methods for initializing variables that use different amounts of ROM memory and have different execution times. It also describes how to set up an IAR workbench project to generate output files that allow checking memory allocations and comparing the performance of code snippets.

Uploaded by

Srikanth Ksvk
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/ 8

Special Topics for

Embedded Systems
(Balancing memory usage, speed,
performance)

Saving Memory Space

RAM and ROM are not interchangeable design


your software accordingly
RAM

Recall memory allocations for chars and ints 2x the


RAM needed!
Compiler/linker attempts to conserve RAM, cannot for
structs
Some compilers dont allocate if not used

Optimizing ROM
ROM Need to Initialize Variables

Initialization Method 1

Initialization Method 2

ROM: 0x16 Bytes

ROM: 0x22 Bytes

Initialization Method 3 ROM: 0x26 Bytes

Balancing ROM and Speed

Consider three different snippets of code that store


values to an array of 10 elements

Fastest? Smallest? Largest?

IAR Workbench - Setup

batterylife.c
Use the simulator, 2013.
Must cause linker to generate output information

Project->Options->C/C+ Compiler...Output tab...check


Generate Debug Information
Project->Options->C/C+ Compiler...List tab...select
Output List File
Project->Options->Assembler ...Output tab...check
Generate Debug Information

Checking Mem and Performance

After compiling, open the MAP file for memory


size allocations
Start debugger, then launch profiler

View->Profiling
Must enable the profiler (Left-most power button)
Run program and then check values
ROM Size (bytes)

sample1()
sample2()
sample3()

Execution time (cycles)

You might also like