27
M. Kaisar Ul Haque Principal Software Engineer ReliSource Technologies Ltd.

Challenges in Embedded Development

  • Upload
    sqabd

  • View
    462

  • Download
    2

Embed Size (px)

DESCRIPTION

SQABD Lightning Talks 3 www.sqabd.com

Citation preview

Page 1: Challenges in Embedded Development

M. Kaisar Ul HaquePrincipal Software EngineerReliSource Technologies Ltd.

Page 2: Challenges in Embedded Development

M. Kaisar Ul HaquePrincipal Software EngineerReliSource Technologies Ltd.

Page 3: Challenges in Embedded Development

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!

Page 4: Challenges in Embedded Development
Page 5: Challenges in Embedded Development

Resource Constrains8 bit MCU, an example:

1 KB of RAM16 K instructions / Code Size / Program

memoryLimited peripherals

Page 6: Challenges in Embedded Development

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.”

Page 7: Challenges in Embedded Development

Code Sizelong SomeFunction(long a, long b){

long c = a * b;return c;

}

Page 8: Challenges in Embedded Development

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

long c = a * b;return c;

}

Assignments can be expensive!

Page 9: Challenges in Embedded Development

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

uint16 c = a * b;return c;

}

Page 10: Challenges in Embedded Development

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

Page 11: Challenges in Embedded Development

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

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

Page 12: Challenges in Embedded Development

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

Page 13: Challenges in Embedded Development

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)

Page 14: Challenges in Embedded Development

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

Page 15: Challenges in Embedded Development

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;

}

Page 16: Challenges in Embedded Development

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

Page 17: Challenges in Embedded Development

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

Page 18: Challenges in Embedded Development

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

Page 19: Challenges in Embedded Development

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

Page 20: Challenges in Embedded Development

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

Page 21: Challenges in Embedded Development

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

Page 22: Challenges in Embedded Development

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!

Page 23: Challenges in Embedded Development

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

debugNeed the right tools to debug

Page 24: Challenges in Embedded Development

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.”

Page 25: Challenges in Embedded Development

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.”

Page 26: Challenges in Embedded Development
Page 27: Challenges in Embedded Development