challenges in embedded development

Post on 20-Nov-2014

458 Views

Category:

Documents

2 Downloads

Preview:

Click to see full reader

DESCRIPTION

SQABD Lightning Talks 3 www.sqabd.com

TRANSCRIPT

M. Kaisar Ul HaquePrincipal Software EngineerReliSource Technologies Ltd.

M. Kaisar Ul HaquePrincipal Software EngineerReliSource Technologies Ltd.

The Embedded Platform8 bit MCU (Microcontroller Unit)16 bit MCU32 bit MCU/ProcessorCosting, Physical Size, Power Consumption,

Computational Power, Resources (RAM, Program memory, Peripherals).

All architectures are currently popular, for example new 8 bit models comes out every few months!

Resource Constrains8 bit MCU, an example:

1 KB of RAM16 K instructions / Code Size / Program

memoryLimited peripherals

Resource Constrains (Contd.)“What makes ESW different [from other

software development] is resource constraints,” says Bob Iannucci, senior vice president and head of Nokia Research Center, Nokia's corporate research unit in Helsinki. Dr. Zhang agrees: “You have to think about space, power conservation and pixel constraints. You have to balance power, simplicity, footprint, cost and size.”

Code Sizelong SomeFunction(long a, long b){

long c = a * b;return c;

}

Code Size (Contd.)long SomeFunction(long a, long b){

long c = a * b;return c;

}

Assignments can be expensive!

Code Size (Contd.)uint16 SomeFunction(uint8 a, uint8 b){

uint16 c = a * b;return c;

}

Code Sizeuint16 SomeFunction(uint8 a, uint8 b){

uint16 c = a * b;return c;

}

Function calls can be expensive!•Next instruction (PC) is changed,•Stack frame is changed•Parameters are placed in stack (assignments)•Room made for return value•Room made for locals•Function code executes•Return value stored (assigned)•Stack frame changed / popped•Return value assigned as function’s value•PC is changed / popped

Code Size (Contd.)Macros are better in many casesBut not in all cases..

#define SomeFunction(a, b) ((a) * (b))x = SomeFunction(y, z);

Code Size (Contd.)Multiplications can be expensive..x = y * 8;x = y << 3;

Floating point operation can be expansive1.5 * 1.5 = 2.25 is more expansive than15 * 15 = 225

Code Size (Contd.)What machine code/instructions your code

generatesHow to minimize your codeSave every instruction you canHundreds of business logics can be difficult

to fit into the program memory (for example in 16k)

RAM SizeHow much RAM your code needs?How to minimize RAM utilization?Save every ‘bit’ you can.. Literally

RAM Size (Contd.)Many data types (int, long, float, double) can

be expensive!

long SomeFunction(long a, long b){

long c = a * b;return c;

}

RAM – Saving every ‘bit’uint8 a; //value range 1 to 50uint8 b; //value range 1 to 10

RAM – Saving every ‘bit’uint8 a; //value range 1 to 50uint8 b; //value range 1 to 10

typedef struct{

uint8 a: 6;uint8 b: 2;

} s_ab;s_ab ab; //takes 1 byte

PowerSleeping is better than working :)Some peripherals consume more powerHigh clock speed consumes more powerNeed to save as much uA as possibleLess utilization of power = more battery life

= less cost = better business = less batteries = greener world

Real-time IssuesSome communication timing must be

precise..Depended on the clock.. the clock doesn’t run

at the speed it should.. You asked for 2 MHz.. you got 1.4 MHz..

26uS

Expertise over ‘the Platform’Memory – Banks, AddressingPeripherals – Clock, WDT, IRQ, IO, LCD,

ADC, RTC, TBC, TimersCommunications - UART, I2C, SPISpec/Datasheet, User Manual, Instruction

set, C Language, Compiler, Assembler, Linker Docs

Cross-Platform ArchitectureCodes needs to support current and future

target platformsHardware abstraction layer is required to

separate platform specific and business codes.

Reusable modules is the keyChanges in a module needs to be tested over

all platforms

Shortage of DocumentsNot much example code from vendorNo example/help returned in GooglePlatform not yet released in the marketYou only have the documents provided by the

MCU vendor and those can have errors!

DebuggingLimited support of break pointsMany real-time scenarios are impossible to

debugNeed the right tools to debug

Collaboration“Any device we manufacture these days is

getting more and more complicated, with quite a bit of software and hardware integration,” says Woo-hyun Paik, president and chief technology advisor at LG Electronics in the United States. “You can't do it all by yourself.”

Testing, Testing.. TestingAccenture’s AJ Gupta. “Without a structured

approach to testing, a company cannot effectively match initial product requirements with specific testing activities and expected actual outcomes. This—coupled with the fact that many companies lack the robust tools necessary to adequately test today’s complex high-tech products— results in bugs that go uncaught before the product is shipped.”

top related