【Espruino】NO.xx NOTE

uC issues

Toolchains

Designed for industry

Often non-free/crippleware

Badly documented

Bad multiplatform support

vendor-dependent HAL

Debugging often hard or impossible without extra hardware

Silicon Erratas


Arduino

Arduino makes things better

But who hasn't used Serial.write(...) and Serial.read() for debugging?

Bad Multitasking

Not really low power


Scripting

If running in uC then no toolchain to install

Easy to inspect and change while running

Rapid development

Source code is on the device itself

Quick to tweak

Friendly - no segfaults

Instant - more fun!


Why JavaScript?

A little bit like C,simple syntax

Loads of people know it already

Huge amount of learning material

With browers and node.js,you can run JS end to end

JSON built-in

Event-based model


Events on Hardware

Matches real world interaction

A lot like interrupts - without any pain

Low overhead cooperative multi-tasking

Easy to combine different functionality

Plays well with REPLs

Power Saving - interpreter knows when it can go to sleep,and how deeply


Power Saving

Many projects benefit from battery power or even energy harvesting

Navie LED flash on a 700mAh Li-lon battery:

Raspberry Pi : 1-2 hours 

Arduino : 1-2 days

Espruino : ~6months

It's not easy. To wake up once a minute:

Start Low Speed Oscillator + Wait

Set up RTC

Set up Alarm

Set up interrupts

Turn off peripherals

Enter sleep mode

Re-initialise peripherals

In Espruino:

setInterval(function(){ ... },60000)


Why not use a desktop JavaScript engine?

Speed RAM NV Storage Power Draw 

Typical Desktop 2500MHz*4 4000000kBytes 1000000MBytes ~50W           

Typical ARM Mic 72MHz*1 8kBytes 0.125MBytes ~0.001W      

~1000000 times less RAM

~10000000 times less storage


So add more RAM...

More parts:more expensive, bigger, 10-100x more power draw

Tessel(32Mb RAM, no OS)

Raspberry Pi(512Mb + node.js)

BeagleBone(256Mb + node.js)

OpenWRT(~32Mb)

And many others...


On-chip RAM

On PC - read all RAM in ~1sec

On uC - read all RAM in ~0.001sec

Less of everything, but 1000x more CPU power per byte.


Espruino Software

Purpose Built JaveScript interpreter for uCs

Open Source, C

No operating System

Can run in less than 8KB RAM

Program using Terminal app

Multi-line editing, command history in chip

Serial or USB CDC


Not just JavaScript

Built-in libraries:

Standard String/Array/etc

Maths(includeing FFT)

Waveform IO

HTTP(CC3300 and WIZnet W5500)

Graphics (w.Bitmap and Vector fonts)

Use require('...') to get drivers for new devices



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值