Embedded Objective-C
Shotaro “Fantom” Uchida
Who am I?
• I am Java Enthusiast so far...
– USB EHCI stack in Java
– TCP/IP in Java
– IEEE802.11 in Java
– ZigBee in Java
– OAuth 2.0 in Java
– XModem in Java
• I do everything (Hardware/Software) for Java
• 仕事下さい。よろしくお願いします。
But today...
Objective-C
#import "XYZPerson.h"
@implementation XYZPerson
- (void)sayHello {
NSLog(@"Hello, World!");
}
@end
Arduino
#import "XYZPerson.h"
@implementation XYZPerson
- (void)sayHello {
NSLog(@"Hello, World!");
}
@end
If I could...
Existing Solutions
Language
Bare-Metal C
Arduino Java-like
mbed C++
JavaME JavaME
Tessel JavaScript
Why not Objective-C ???
Is ObjC Proprietary?
How different?
Java
Java
C++ Runtime
JVM
C++
C Runtime
C
ObjC Runtime
Smalltalk-like
C++ Objective-C
5 Reasons Why Objective-C is the
Best
• C++ sucks.
• You can use “Pure C” anytime anywhere.
• It also means that you can use assembly
anytime.
• Powerful object-oriented language, but still
faster than Java.
• And C++ sucks.
Disadvantages
• Large memory footprint
– Classes are loaded at init array calls.
– No “class-loader” system.
– Needs to manage all method symbols i.e.
selectors.
• Message lookup
“Big 3” ObjC Runtime
Compiler Modern-ObjC Cons
Apple Clang Yes iOS/OSX only
libobjc GCC, Clang No Out-dated
No “Foundation”
GNUStep GCC, Clang Yes (w/ Clang) Out-dated
Huge
Another newer runtime “ObjFW”
• Lightweight
– < 1MB
• Portable
– Multi-platform includes Apple devices
– Works with PSP, Wii, and NintendoDS !
• Modern-ObjC
• Clang supported
– -fobjc-runtime=objfw
– Don't stop the support of ObjFW!! Plz!!
• Github
– https://github.com/Midar/objfw
Requirements to run ObjFW
• Still, you need 1MB+ RAM
– External RAM, typically
– Bootloader
• 1MB+ Flash
• “Fast enough” processor
Silabs EFM32 Wonder Gecko
• Cortex-M4F@48MHz
• External Bus Interface
– Up to 4x256MB
– Support code execution via I/D bus
• Ultra low power
• SDK with big memory!
– 4MB PSRAM
– 16MB Nor Flash
It works!!
• Ubuntu 14.04
• Eclipse Kepler
– With debugging!!
• Clang/LLVM 3.5 (trunk)
– Some nice major updates for ARM ;)
• ObjFW 0.8-dev
• Need some workaround...
– Read my blog: http://xmaker.mx/archives/14
What's Next?
• Threading support
– CMSIS-RTOS (RTX)
– Free RTOS
• Socket support
– lwIP
• File support
• Hardware APIs
ObjC
Powered
ObjArduino
Relese Date: When It's Done

Embedded Objective-C

  • 1.
  • 2.
    Who am I? •I am Java Enthusiast so far... – USB EHCI stack in Java – TCP/IP in Java – IEEE802.11 in Java – ZigBee in Java – OAuth 2.0 in Java – XModem in Java • I do everything (Hardware/Software) for Java • 仕事下さい。よろしくお願いします。 But today...
  • 3.
    Objective-C #import "XYZPerson.h" @implementation XYZPerson -(void)sayHello { NSLog(@"Hello, World!"); } @end
  • 4.
  • 5.
    #import "XYZPerson.h" @implementation XYZPerson -(void)sayHello { NSLog(@"Hello, World!"); } @end If I could...
  • 6.
    Existing Solutions Language Bare-Metal C ArduinoJava-like mbed C++ JavaME JavaME Tessel JavaScript Why not Objective-C ???
  • 7.
  • 8.
    How different? Java Java C++ Runtime JVM C++ CRuntime C ObjC Runtime Smalltalk-like C++ Objective-C
  • 9.
    5 Reasons WhyObjective-C is the Best • C++ sucks. • You can use “Pure C” anytime anywhere. • It also means that you can use assembly anytime. • Powerful object-oriented language, but still faster than Java. • And C++ sucks.
  • 10.
    Disadvantages • Large memoryfootprint – Classes are loaded at init array calls. – No “class-loader” system. – Needs to manage all method symbols i.e. selectors. • Message lookup
  • 11.
    “Big 3” ObjCRuntime Compiler Modern-ObjC Cons Apple Clang Yes iOS/OSX only libobjc GCC, Clang No Out-dated No “Foundation” GNUStep GCC, Clang Yes (w/ Clang) Out-dated Huge
  • 12.
    Another newer runtime“ObjFW” • Lightweight – < 1MB • Portable – Multi-platform includes Apple devices – Works with PSP, Wii, and NintendoDS ! • Modern-ObjC • Clang supported – -fobjc-runtime=objfw – Don't stop the support of ObjFW!! Plz!! • Github – https://github.com/Midar/objfw
  • 13.
    Requirements to runObjFW • Still, you need 1MB+ RAM – External RAM, typically – Bootloader • 1MB+ Flash • “Fast enough” processor
  • 14.
    Silabs EFM32 WonderGecko • Cortex-M4F@48MHz • External Bus Interface – Up to 4x256MB – Support code execution via I/D bus • Ultra low power • SDK with big memory! – 4MB PSRAM – 16MB Nor Flash
  • 15.
    It works!! • Ubuntu14.04 • Eclipse Kepler – With debugging!! • Clang/LLVM 3.5 (trunk) – Some nice major updates for ARM ;) • ObjFW 0.8-dev • Need some workaround... – Read my blog: http://xmaker.mx/archives/14
  • 18.
    What's Next? • Threadingsupport – CMSIS-RTOS (RTX) – Free RTOS • Socket support – lwIP • File support • Hardware APIs
  • 19.