softprise
CONSULTING OÜ
www.softprise.net
Linux on MCUs: from marginal to mainstream? Vitaly Wool Softprise - - PowerPoint PPT Presentation
softprise CONSULTING O Linux on MCUs: from marginal to mainstream? Vitaly Wool Softprise Consulting O 2015 www.softprise.net softprise CONSULTING O Microcontrollers Key features Tight integration of components Low power
CONSULTING OÜ
www.softprise.net
CONSULTING OÜ
www.softprise.net
– Tight integration of components – Low power consumption – Low price – Very limited RAM and persistent storage
– Automation – Digital Signal Processing (DSP) – “Internet of things” – Automotive
CONSULTING OÜ
www.softprise.net
Free software and tools Bigger footprint POSIX-compliant Longer boot-up times Portable and extensible Stronger requirements on hardware Many top-notch developers No/few commercial distributions Very strong community The Linux community is skeptical about MCUs
CONSULTING OÜ
www.softprise.net
– Works on many MCUs – Presumes external (D)RAM
– Kernel XIP – Userspace XIP – Compress data sections even in XIP kernel
CONSULTING OÜ
www.softprise.net
– But the MCU should be powerful enough
– e. g. from EmCraft
– EmCraft Linux distribution works out of the box
– With large enough SRAM – And with large enough tweaking
CONSULTING OÜ
www.softprise.net
– Forward port required
– Support for other microcontrollers – Compile out redundant/unnecessary parts
– .data section compression as a part of xipImage build – Select best compression algorithm
CONSULTING OÜ
www.softprise.net
Leveraging community support Possible know-how exposure Maintenance cost reduction Will have to play by the rules New features become available Possibly bigger footprint new/better compiler and tools Large one-time effort
CONSULTING OÜ
www.softprise.net
– linux-tiny git as a base for forward porting – Emcraft's implementation to port
– Use standard clock framework – Creating proper defconfig
– Forward port mostly complete – The code will be made available soon – 840k .text, 132k .rodata, 86k .data (BT, no TCP/IP) – Further optimization highly desirable
CONSULTING OÜ
www.softprise.net
– Implement dictionary?
– Add compile-time option to only select what's needed
– Too complex page allocation for CONFIG_SLOB
– Too hard to optimize, try picoTCP instead
CONSULTING OÜ
www.softprise.net
– (for f in `cat object-file-list`; do echo Analyzing $f; arm-none-eabi-objdump -h $f | grep “\b0 .text”)
– Configure/compile out completely – Partially compile out – Partially rewrite
CONSULTING OÜ
www.softprise.net
– Compile out printks below certain priority level – “dictionarize” format strings
Desired Actual 2000 4000 6000 8000 10000 12000 rewrite compile-out
CONSULTING OÜ
www.softprise.net
– Userspace depends a lot on ProcFS presence – Switching ProcFS off is not an option
– Expected savings up to 10k – Careful selection needed
Desired Actual 2000 4000 6000 8000 10000 12000 rewrite compile-out
CONSULTING OÜ
www.softprise.net
– Most of them are hard to compile out
– Make it depend on MMU – Saves 4k
– Saves <1k
Desired Actual 2000 4000 6000 8000 10000 12000 rewrite compile-out
CONSULTING OÜ
www.softprise.net
– kernel/exit.o: 4k .text – kernel/signal.o: 9k .text – kernel/sys.o: 7k .text
– kernel/irq/spurious.o: 1k
– kernel/time/ntp.o: 2k
– kernel/time/timekeeping.o: 8k
Desired Actual 2000 4000 6000 8000 10000 12000 rewrite compile-out
CONSULTING OÜ
www.softprise.net
– Use picoTCP instead
slide
– 2k saved
– 3k saved – Impact to be estimated
Desired Actual 130000 132000 134000 136000 138000 140000 142000 144000 rewrite compile-out
CONSULTING OÜ
www.softprise.net
– Maxime Vincent, Altran
– No Makefiles publicly available
– Only IPv4 – ~40k binary code added
– e. g. no rtnetlink
CONSULTING OÜ
www.softprise.net
2.6.35 based linux-tiny original linux-tiny optimized p.3 + picoTCP 200000 400000 600000 800000 1000000 1200000 .data .rodata .text
CONSULTING OÜ
www.softprise.net
2.6.35 based linux-tiny original linux-tiny optimized p.3 + picoTCP 200000 400000 600000 800000 1000000 1200000 .data .rodata .text
CONSULTING OÜ
www.softprise.net
linux-tiny/arm-none-eabi linux-tiny/arm-uclinux 200000 400000 600000 800000 1000000 1200000 .data .rodata .text
– From CodeSourcery – 4.4.1 based
– 4.7.4 based
CONSULTING OÜ
www.softprise.net
– One of the biggest uplifting concerns is not valid – Even better results with the new toolchain
– XIP with compression
– e. g. boot-up time improvements
CONSULTING OÜ
www.softprise.net