Smaller, faster, lower-cost! Benefits of NXP ARM for embedded developers Dave Edwards CEO/CTO SOMNIUM® Technologies 11/09/2016

Presented at ENOVA Paris 2016 Thu 15th Sept in the NXP IoT Truck Room EUF-DES-T2250

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 1 Abstract

Time to market and development cost are driving factors in design

Yet many developers aren't aware of the benefits in using ARM technology, even in low-end resource constrained designs such as IoT edge nodes.

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 2 Contents

 Problems faced by embedded developers  An overview of ARM hardware  How can using an ARM based device help?  ARM microcontroller and system architecture overview  NXP ARM microcontroller overview  Performance and energy overview  An overview of ARM software  An overview of NXP software ecosystem  Software tools and choices available  Demonstrations of the features available with NXP microcontrollers.

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 3 Problems faced by embedded developers

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 4 Time to market is important

 Only 38% of projects are on time  62% of projects are late!  Every year its getting worse ...

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 5 Choose your microcontroller wisely

 Many chips are similar  Ecosystem is important  Not all ecosystems are equal ;-)

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 6 Engineering challenges

 Debugging is time consuming  Better debug tools are needed  Vendor supplied information is vital

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 7 How can using an ARM based device help?

 Customer benefits from choice, features, availability and quality  ARM's business model amortizes cost of complex design across many customers  Semiconductor vendor leverages to build hardware and software ecosystem  Tools providers leverage compatibility to support a huge range of devices SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 8 ARM microcontroller overview

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 9 ARM Cortex-M : architecture advantages

 Modern instruction set architecture and  First V7-M architecture device was Cortex-M3 announced in 2004  25 years younger than the 8051 architecture!  Designed to run high level C/C++  No need for assembly language = lower cost of software development  ARM Thumb®-2 technology has dense instruction encoding  Low gate count KL03 fits in the dimple of a golf ball! ● 1.9x1.6mm  Lower silicon cost ● 48MHz Cortex M4  Small form factor packaged parts ● 32KBytes ROM, 2K RAM ● 75 cents in quantities of 100,000  Powerful  Significantly higher performance than 8-bit/16-bit microcontrollers  Energy Efficient  Fast and efficient handling SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 10 ARM Cortex-M : huge range of choices available

 Processor performance versus features versus cost  20MHz .. 200MHz+  Simple microcontroller (M0/M0+) thru DSP capable microcontroller (M3/M4) and beyond  Single core to multi-core  Memory size versus requirements versus price versus energy required  As little as required: 8KBytes ROM/1KBytes RAM  As much (?) as required: 2MByte ROM/256KByte RAM and beyond  Wide range of peripherals and interfaces  Sensors, USB, , BLE  Highly integrated with great software enablement  Broadly compatibility instructions and source code  Can scale up (or down) your design as required  But ... beware of low-level system software differences

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 11 Range of processor cores available

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 13 Instruction set : clean superset from M0 upwards

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 14 Cortex M0 system architecture

Common across all Cortex-M Program trace ● M0 supports up to Doesn't require high end 32 interrupt sources debug adaptors ● 16 (M0), 15 (M0+) cycle interrupt latency ● Number of priorities can vary between devices

Typically: All devices have this at least 2..4 breakpoints Supports simple/low cost 0..2 watchpoints debug adaptors (can trigger things within PC range)

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 16 Cortex M4 system architecture

Same as Cortex M0 NVIC with: ● Up to 240 interrupt sources OPTIONAL ● 12 cycle interrupt latency Sophisticated trace ● Number of priorities and triggers can vary between devices BUT .. requires area, pins and high end debug adaptor

All devices have this Supports simple/low cost debug adaptors

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 17 NXP ARM-based microcontroller overview

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 18 Kinetis family - sensors and analog integration

High performance Low cost, small memory, Large memory small physical size Sensors and interfaces

KV10 is possibly the highest performance Cortex M0+ device available

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 19 LPC family - optimized for power and cost

All are Cortex M4 based LPC8xx : ● Many single core devices ● low power ● Some LPC43xx & LPC5xxx ● space efficient devices are dual core Cortex ● low-pin count M4 and a Cortex M0+ ● great for 8/16 -bit migration

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 20 Measuring energy consumption

 SOMNIUM are members of the EEMBC® Automotive Subcommittee and use their industry standard benchmarks.  We measure energy, measured to the uJ using the high accuracy EEMBC EnergyMonitor™  EEMBC CoreMark™ is used to demonstrate the usable performance of a processor system running typical algorithms including list processing (to stress test data accesses), matrix manipulation (to stress test and mathematical operations, and state machines (to stress test complex control flows).

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 21 Wide range of performance and energy options

Extreme performance Higher energy Higher performance More expensive Baseline device Lower energy ● Good performance More expensive ● Low energy consumption ● Low cost

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 23 ARM software ecosystem overview

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 25 CMSIS

 Cortex Microcontroller Software Interface Standard

 Some components are supported by silicon vendors  Other components are not supported by silicon vendors  Available from ARM , and from some software tools vendors  Be aware ...  Some implementations of some features are NULL  Implementations vary (features, bugs etc.)  Are you using the “official” silicon vendor version?  There is no standards compliance procedure

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 26 What's in CMSIS?

Not widely used?

Generally supplied Used in evaluation board pre-compiled OpenOCD debug probes. No publicly available Segger & PEMicro are test suite significantly faster and more robust

Some parts are “essential” Some parts are obsoleted by vendor-specific APIs

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 27 CMSIS files

Originated by ARM For a given Cortex device ( = 0, 3, 4, 7) core_cm.h global declarations and definitions, function protoypes core_cm.c global definitions (functions and data) Originated by silicon vendor For a given e.g. MK64F12 system_.h device specific definitions (memory mapped registers etc.) system_.c device specific function definitions (sometimes vector table is supplied as .s file) .h device specific definitions (registers etc.)

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 28 NXP microcontroller software ecosystem overview

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 29 NXP Kinetis: Kinetis SDK v2: CMSIS “and more”

Not like CMSIS: Pre-integrated with industry No concept of separate HAL standard RTOS and driver layers

Minimal implementation (use Kinetis-specific Peripheral drivers instead)

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 31 Kinetis Expert: web based SDK creator

● Select components and export source code ● New tool to configure pins etc. ● Check everything is correctly setup

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 32 Kinetis Design Studio (KDS) - free of charge Eclipse IDE + GNU tools

 SOMNIUM Technologies worked with Freescale to produce KDS  Windows, & MacOSX hosts  Vanilla code generation and debug

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 33 NXP LPC: LPCOpen: CMSIS “and more”

Flexible configurations and High quality free of charge middleware mostly “compliant” CMSIS-CORE Different APIs to Kinetis equivalents

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 34 LPCXpresso - Eclipse IDE + GNU tools

 Free of charge (256KByte codesize limit)  Windows, Linux & MacOSX hosts  Vanilla code generation  Advanced trace

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 35 NXP software enablement summary

 Separate software enablement for Kinetis and LPC devices Both Kinetis and LPC have their own history A few compatibility “bumps” along the way  Kinetis Design Studio and LPCXpresso are similar but different  Both have vanilla GNU tools, Eclipse IDE platform  Both are free (for initial versions)  Different user interface and project formats  LPCXpresso has more debug features  3rd party tools are available : SOMNIUM DRT Tight integration with NXP enablement  Can import existing Kinetis and LPC projects with no source code changes  Compatible with historical Kinetis and LPC enablement  And current/future enablement  Also supports a wider range of devices SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 36 SOMNIUM® DRT - Professional C/C++ development environment

Save memory Save energy smaller ROM/RAM device, lower cost designs higher quality design, reduce lifetime costs

Increase performance Save money more features, “do more with less” faster time to market, optimize BOM costs

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 37 DRT supports the latest C/C++ standards

SOMNIUM “vanilla” DRT GNU products C standards C: ISO/IEC 9899:2011 (known as C11) yes ? no C99 yes yes ?

GNU99 yes yes no

C90 yes yes yes

C89 yes yes yes

C++ standards C++14 yes ? no C++11 yes yes no

C++03 yes yes yes

C++ exception handling yes no (Newlib only) ?

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 38 Rigorous approach to correctness & quality

 To our best knowledge no other tools vendors apply this rigour  Tests are applied on-host (simulated) and on-target (real silicon)  Tested to destruction ! Flash ROM wears out after ~2 months of our testing  3 axis testing : size and performance and energy  DejaGNU tests: GNU compatibility conformance  SolidSands SuperTest: C/C++ standard conformance and functional correctness  Over 136,000 individual tests per Cortex-M variant (~4 hours on-host run time)  NULLSTONE for C: optimization test suite  Almost 40,000 individual tests (over 48 hours run time if using one board at a time)  EEMBC® Autobench™ and CoreMark™  Over 3,000 examples and demos from our semiconductor partners  SOMNIUM proprietary test suite  Well placed for future certification (e.g. ISO26262)  Moving forwards not backwards  Full regression testing to ensure each release is better than the last SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 39 SOMNIUM® DRT : The professional C/C++ development environment

 Advanced Eclipse based IDE  Ease of use enhancements  Best in class debug and trace  Windows and Linux hosted, MacOSX (coming soon)

 Advanced C/C++ code generation  Patented resequencing optimizations  Smaller, faster, more energy efficient code  No source code changes required

 Technical support  Direct from SOMNIUM's customer engineering team  Regular product updates and new features

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 40 SOMNIUM® DRT - GNU compatible with added benefits Software enablement is supplied as GNU compatible source code

Free of charge tools use "vanilla" GNU Commercial tools also use "vanilla" GNU

SOMNIUM® DRT is the only product which offers GNU compatibility with advanced code generation SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 41 DRT recognizes that memory is the bottleneck

It dominates performance and cost

SOMNIUM® DRT optimizes for the whole system

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 42 Benchmark proven: Smaller, faster, lower energy EEMBC® CoreMark® built with DRT Up to 29% energy saving Up to 38% higher performance Up to 12% ROM saving Up to 21% RAM saving

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 43 Small memory footprint for C execution

Hardware initialization before main () and “Empty” C program int main (int argc, char *argv[]) { while (1) {}; return 0; } Kinetis Cortex M0+ example (KL46Z) LPC Cortex M0+ example (LPC824) ROM RAM DRT saving DRT saving KBytes (% and bytes) KBytes (% and bytes) ROM RAM DRT 1.5 n/a n/a 0.1 n/a n/a DRT saving DRT saving KDS3 Nano 2.4 59% 908 0.6 314% 440 KBytes (% and bytes) KBytes (% and bytes) KDS3 Newlib 3.9 164% 2504 1.5 1009% 1412 DRT 0.6 n/a n/a 0.1 n/a n/a CW10.6 Nano 2.5 66% 1004 0.6 317% 444 LPCX Nano 1.0 72% 424 0.1 -3% -4 CW10.6 Newlib 4.5 201% 3064 1.5 1009% 1412 CW10.6 EWL 5.0 238% 3632 4.1 2863% 4008 LPCX RedLib 2.6 359% 2112 1.1 691% 968 DRT significantly reduces ROM/ROM footprint a huge impact on usability of small memory low-cost devices

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 44 Real world middleware demos

Kinetis “Attach” demo (MKL26Z128) Kinetis Sensor Fusion Library (FRDM-KL46) Uses Sensor Fusion & EGUI middleware Uses Sensor Fusion middleware Attach V1 Demo @ Os : doesn't fit with KDS3 Nano ROM RAM ROM RAM KBytes DRT saving KBytes DRT saving KBytes DRT saving KBytes DRT saving DRT 123.5 n/a 13.5 n/a KDS3 Nano 128.4 4% 13.4 0% “Out of box” Optimized for speed @ O3 KDS3 Newlib 137.3 11% 15.4 15% DRT 39.7 n/a n/a n/a KDS3 Nano 21% 8448 0% Attach V2 Demo @ -Os : features cut so KDS3 Nano just fits 47.9 ROM RAM CW10.6 Nano 43.2 9% 3617 -2% KBytes DRT saving KBytes DRT saving Optimized for size @ Os DRT 122.0 n/a 14.9 n/a DRT 35.2 n/a n/a n/a KDS3 Nano 127.0 3% 14.9 0% KDS3 Nano 38.1 8% 2952 0% KDS3 Newlib 144.8 17% 17.0 26% Only DRT can fit into a 128KByte device DRT significantly reduces ROM usage other tools need the more expensive when optimizing for size 256KByte varient and when optimizing for speed

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 45 Unique project importers

 Import and automatic conversion from  Atmel START (GPDSC format)  KDS 2  KDS 3x  CodeWarrior for MCUs 10.6 (GNU projects)  CodeWarrior for MCUs (non GNU projects)  LPCXpresso  Atollic TrueSTUDIO (STM32CubeMX)

 Coming soon  SW4STM32  STM32 CubeMX custom “SOMNIUM DRT” format 

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 46 Leading edge debug features

 Live viewing of memory/variables – no need to breakpoint!

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 47 Leading edge debug features

 MTB trace on Cortex M0+ (auto configured, full debug features)

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 48 Leading edge debug features

 Fault diagnosis – extract and decode, navigate source code

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 49 SOMNIUM® DRT Cortex-M IDE

Wide range of host support  Windows and Linux, Mac OSX (coming soon) Wide range of target support

Single User Fixed Perpetual license $2,500 €2,100  Any one user at a time, on a fixed machine  One SOMNIUM portal account Three User Floating Perpetual license $6,000 €5,200  Any three users at a time, on a any machine  Three SOMNIUM portal accounts 12 months support and updates included  Annual renewal for 20% of purchase price

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 50 Summary

Choosing the right microcontroller and the right tools is critical Make the right choice and you can save time, money and get the best results!

 ARM devices  Competitive cost, features and energy  Wide range of devices  Great choice - cost, performance, energy, features  Strong ecosystem support from NXP  SOMNIUM DRT - the professional C/C++ IDE  Offers real advantages to developers  Save time, money, get best results  Only solution to provide GNU compatibility and benefits  High quality technical support

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 51 Please get in touch for more information [email protected]

Demos running on Booth F120

Free of charge trials of SOMNIUM DRT are available http://www.somniumtech.com/product-selector

SOMN-MS-0051 Copyright © 2016 SOMNIUM® Technologies Limited 52