Bitlash 2.0 RC2 is Available for Download

Hello all:

I've posted an updated version of Bitlash at http://bitlash.net. Bitlash 2.0 RC2 is available at the links below.

This release fixes a bug in RC1 which broke function definitions in some cases. Characters after the closing } of a function definition triggered a bug
which incorrectly measured the function text. Extra characters stored with the function caused it to fail when called.

See RELEASE notes for details. All users are advised to upgrade to this version to avoid (at least some) puzzling debugging experiences.

Bitlash is an open source interpreted language shell and embedded programming environment for Arduino. The Bitlash shell runs entirely on the Arduino and supports many of the familiar Arduino functions. Bitlash interprets commands you type on the serial port or send from your favorite PC-side programming environment.

Version 2.0 of Bitlash offers improved compatibility with C syntax, an upgrade to the macro system to allow true functions with arguments and return values to be defined in the Bitlash language and stored in EEPROM, and many other small improvements.

For more:

Download: http://bitlash.net/wiki/_media/bitlash-2.0-rc2.zip
Release announcement: http://bitlash.net/wiki/start
Documentation index: http://bitlash.net/wiki/docindex

Happy hacking,

-br
http://entropymouse.com

Hello Bill,

I'm trying Bitlash 2.0 RC2 on my Arduino BT (ATmega168 CPU).

My intention is to set up the ArduinoBT so that I can connect to it and interact with Bitlash via the standard RFCOMM channel.

Unfortunately, I was not able to get the demo sketch (bitlash-demo.pde) to upload: it aborts with a 'sketch too big' error. It could be that I haven't spotted something obvious..

I made the following change:

initBitlash(115200);

This is due to the ArduinoBT communicating at 115200 bps with the WT11 Bluetooth module.

My guess is that with the 2K bootloader in the ArduinoBT, there isn't enough room for Bitlash - I didn't realise there was so little space available.

Thanks,

Lex.

I think so to. Don't remember how big the ATmega168 CPU is but it might work better on a later model with more memory.

The ATmega168 has 16Kbytes of flash, and the current Arduino BT uses an ATmega328: double the storage, with 32K; this would be fine for Bitlash.

I've had mine for some time (a couple of years, perhaps) and have yet to do anything much with it, other than simple test apps. It's a pity that the CPU is not replaceable.

Lex

Thanks for the heads up. I believe that it is possible that 2.0 might be squeezed into running on the '168, but haven't tried yet.

Here is some low hanging fruit that might get a sufficiently motivated person moving in the right direction; I'll take a more detailed look before the 2.0 final.

To save a little PROGMEM, you can nuke the contents of cmd_help in src/bitlash-cmd.c. Leave the function there and all will compile.

You are likely to find the free ram is very tight. Reduce "vstacklen" at line 265 in src/bitlash-parser.c from 64 to perhaps 32. Complex expressions and call chains with arguments will run out of space earlier with this smaller working stack, but it might be enough for your purposes.

I would love to hear about the results of experiments, and will put this on the 2.0 "investigate" list.

Thanks,

-br

http://entropymouse.com

Hello Bill,

Thank you for your reply. I have applied the changes that you specified and have cut a few more bytes by shortening the banner and removing a few functions: func_setBaud, since to change the rate will lose the RFCOMM connection on the Arduino BT - and func_random, since it was the first one that I saw :slight_smile:

Binary sketch size: 14320 bytes (of a 14336 byte maximum)

Bitlash now runs, but it's not very friendly. Still, it works.

Attached: unified diff of my not-very-subtle changes. (whoops.. a space crept into the USE_PARSEREDUCE #ifdef, which I uncommented and then commented again).

Lex

diffs.txt (2.72 KB)

Lex, that is superb and fast work. Thanks especially for the diffs.

What do you get in response to "print free()" at the prompt? Wondering how much RAM trouble it is in from the get-go.

Also, say a little more about "not friendly". Maybe there are more tuning opportunities.

Best,

-br

http://entropymouse.com

May I add that '168 users (or anyone up against the wall for RAM) can quickly claw back 60 bytes of RAM by changing STRVALSIZE from 140 back to 80 at line 423 in src/bitlash.h

-br

http://entropymouse.com

Thanks, Bill - I'll try the STRVALSIZE tip.

In answer to your enquiry:

> print free()
133

Only 133 bytes! This was still enough for me to define some simple functions, such as flashing an LED and setting output pin modes - this sort of thing:

function led_on {d8=0;};
function led_off {d8=1;};

function startup {pinmode (8,1); d8=1; pinmode (5,1); a5=0;};

function toggle {d8=!d8};
function connect { print "Hello from Arduino!"; };
function flash10 { i=0; while (i++<10) { print i,; toggle(); print " ",; delay(250);}; print;};

The 'connect' function should output 'Hello from Arduino!' when the WT11 receives an incoming RFCOMM connection; I have not tested this yet.

I have connected an LED (and series resistor) to pins 5 and 8 (8 = cathode, 5 = anode) so that pin d8 switches it on and off by reverse-biasing it, and PWM pin 5 adjusts the duty cycle (I was following your tutorial, from the manual).

When I said that I'd made Bitlash 'less friendly', I meant that due to the help text having been removed, hints were not available - and I nabbed a few bytes from the version text, too.

Lex