PDA

View Full Version : bstl on intel mac, how?



Tracy Allen
03-14-2012, 06:04 AM
Trying to run bstl on an intel mac, 10.6.7, from the terminal window.


Thomas-Allens-MacBook-Air:bst thomasallen$ ls
bst.app bstc.osx
bst_manual_0.04.pdf bstl.osx

If it can be done, what is the syntax? I can start the bst gui itself just fine with open bst.app.

I found rumors to the effect that .osx type of files don't work on Intel macs. But bst itself works fine and it seems like it would have the same basis.

avsa242
03-14-2012, 10:01 AM
Tracy,
I can't say firsthand whether files with an .osx suffix differ, or how, from .app suffix files, but assuming they are both executable, you would just type:



Thomas-Allens-MacBook-Air:bst thomasallen$ ./bstl.osx


along with whatever parameters bstl.osx requires (try ./bstl.osx -h for help).

Cheers,
Jesse

dgately
03-14-2012, 03:22 PM
Trying to run bstl on an intel mac, 10.6.7, from the terminal window.


Thomas-Allens-MacBook-Air:bst thomasallen$ ls
bst.app bstc.osx
bst_manual_0.04.pdf bstl.osx

If it can be done, what is the syntax? I can start the bst gui itself just fine with open bst.app.

I found rumors to the effect that .osx type of files don't work on Intel macs. But bst itself works fine and it seems like it would have the same basis.

".osx" is just the extension that identified the Mac OS X version of Brad's bstl program. The easiest way to tell if a command-line program will work on your Mac is to use the "file" command in the Terminal app, like this (you'll need to "cd" to the directory that contains "bstl.osx", first:

[myUser@myMac]$ file bstl.osx
bstl.osx: Mach-O universal binary with 2 architectures
bstl.osx (for architecture i386): Mach-O executable i386 <== the executable binary for Intel (32-bit)
bstl.osx (for architecture ppc): Mach-O executable ppc <== the executable for PPC (32-bit)

So, looks like bstl.osx will run on Intel and PPC based Macs!

If you want to know how to use the program, you can get usage data like this (again, you'll need to cd to the directory containing bstl.osx):

[myUser@myMac]$ ./bstl.osx -h <== "./" helps to execute the file from within it's containing directory!

For more details on the bstl loader program:

See page 2 of Brad's Manual for BST gives all of the detail on using bstl: http://www.fnarfbargle.com/bst/manual/



dgately

Tracy Allen
03-14-2012, 03:26 PM
Thanks! joy! It also wants the .osx extension:


Thomas-Allens-MacBook-Air:bst thomasallen$ ./bstl -h
-bash: ./bstl: No such file or directory

Thomas-Allens-MacBook-Air:bst thomasallen$ ./bstl.osx -h
Brads SpinTool Loader v0.05 - Copyright 2008,2009 All rights reserved
Compiled for i386 Darwin at 09:34:59 on 2009/07/03
Program Usage :- bstl (Options) <FileName>
-d <filename> - Serial device to use (Default /dev/tty.usbserial)
-p [123] - Program Mode
1 - Ram only (Default)
2 - Eeprom and shutdown
3 - Eeprom and Run
-f Load at high speed
-t Test mode (Undocumented)
-h - Show this help
Thomas-Allens-MacBook-Air:bst thomasallen$

Tracy Allen
03-14-2012, 04:09 PM
I was thrown off by the documentation in Brad's manual for bst, which suggests the straight syntax...

brad@bkmac:~$ bstc test.spin

Using the./bstl.osx syntax I was able to load a .eeprom file from the command line, but the binary (created from bst right before the .eeprom file) came back with a checksum error. Is there any advantage to one over the other?


Thomas-Allens-MacBook-Air:bst thomasallen$ ./bstl.osx rgb_led.binary
Brads SpinTool Loader v0.05 - Copyright 2008,2009 All rights reserved
Compiled for i386 Darwin at 09:34:59 on 2009/07/03
Found a USB Serial Device
Binary Checksum Invalid!

Thomas-Allens-MacBook-Air:bst thomasallen$ ls
bst.app bstc.osx rgb_led.binary
bst_manual_0.04.pdf bstl.osx rgb_led.eeprom

Thomas-Allens-MacBook-Air:bst thomasallen$ ./bstl.osx rgb_led.eeprom
Brads SpinTool Loader v0.05 - Copyright 2008,2009 All rights reserved
Compiled for i386 Darwin at 09:34:59 on 2009/07/03
Found a USB Serial Device
Propeller Version 1 Found!
Thomas-Allens-MacBook-Air:bst thomasallen$

Brian Riley
03-14-2012, 04:14 PM
Speaking of bST on an iMac. I have a mid-JUly 2011 iMac ( 2.5 GHZ 4 core I5 w 16 GB RAM) running the latest Lion (10.7.3) Does any one have BST running under Lion. I open bST and get the splash screen but no code window. I do a "new" or an 'open' and select a file and still get no code screen.

... inquiring (and frustrated) mind wants to know ;-)

mindrobots
03-14-2012, 04:34 PM
Brian,

I've tried BST on my 2011 mac-mini with Lion and it acted strangely. Problems with sizing bars on windows and lost focus on some controls. I need to try it again (from home) so I can post some details. I also need to check if I'm on 10.7.3

I got distracted since I last tried it. :smile:

dgately
03-14-2012, 04:40 PM
Speaking of bST on an iMac. I have a mid-JUly 2011 iMac ( 2.5 GHZ 4 core I5 w 16 GB RAM) running the latest Lion (10.7.3) Does any one have BST running under Lion. I open bST and get the splash screen but no code window. I do a "new" or an 'open' and select a file and still get no code screen.

... inquiring (and frustrated) mind wants to know ;-)

I use BST on Lion, daily...

Did you follow the instructions at: http://propeller.wikispaces.com/Propeller+Font ? This is what helped me, the first time I used BST...

Also, page 12 of the BST manual warns:

OSX and Linux users must download a modified version of the Propeller font. I can't stress this enough, thefont supplied with the Parallax Propeller Tool is BROKEN on Linux and OSX. If you install it by mistake, it willcause all sorts of horrible things to occur that are hard to debug. Please install the correct font. The locationof the correct font is kept up to date here : http://propeller.wikispaces.com/Propeller+Font.
OSX users can install the font simply by double clicking on it and clicking the “Install” button.
Linux users have to figure out where their particular distribution installs the fonts! On an Ubuntu system, theare located in ~/.fonts. The easy install is to copy the modified Propeller.ttf there and to log out and back inagain.




To debug (a bit) your problem, try launching the application from the command-line in the Terminal app (this example assumes that BST is in the Mac's Applications directory):


[myUser@myMac]$ /Applications/bst.app/Contents/MacOS/bst.osx

This should show any errors in launching the app! Else, look in the console application's log window for errors

dgately
03-14-2012, 04:50 PM
I was thrown off by the documentation in Brad's manual for bst, which suggests the straight syntax...

brad@bkmac:~$ bstc test.spin

Using the./bstl.osx syntax I was able to load a .eeprom file from the command line, but the binary (created from bst right before the .eeprom file) came back with a checksum error. Is there any advantage to one over the other?


Thomas-Allens-MacBook-Air:bst thomasallen$ ./bstl.osx rgb_led.binary
Brads SpinTool Loader v0.05 - Copyright 2008,2009 All rights reserved
Compiled for i386 Darwin at 09:34:59 on 2009/07/03
Found a USB Serial Device
Binary Checksum Invalid!

Thomas-Allens-MacBook-Air:bst thomasallen$ ls
bst.app bstc.osx rgb_led.binary
bst_manual_0.04.pdf bstl.osx rgb_led.eeprom

Thomas-Allens-MacBook-Air:bst thomasallen$ ./bstl.osx rgb_led.eeprom
Brads SpinTool Loader v0.05 - Copyright 2008,2009 All rights reserved
Compiled for i386 Darwin at 09:34:59 on 2009/07/03
Found a USB Serial Device
Propeller Version 1 Found!
Thomas-Allens-MacBook-Air:bst thomasallen$

Not sure, but I notice that the usage info expects a "-p 3" for an Eeprom load and run. Odd that your Eeprom load worked, but your binary (supposed to be the default) did not because of the checksum error. Try "-p 1" when you load the binary version...

You may want to run the command-line bstc with a "-b" option to compile and create a binary. Then match that to the binary created by the BST app.


dgately

Tracy Allen
03-14-2012, 05:45 PM
The -p2 does not refer to the file to be loaded. It refers to what happens to the file once the propeller has it loaded into RAM. The default is for it to run from RAM, but the -p2 causes it to burn into the Prop EEPROM and then run.

I did what you suggested and it did compile from the command line, into a binary which then loaded successfully using bstl.

Thomas-Allens-MacBook-Air:bst thomasallen$ ./bstc.osx rgb_led.spin -b
Brads Spin Tool Compiler v0.15.3 - Copyright 2008,2009 All rights reserved
Compiled for i386 Darwin at 08:17:49 on 2009/07/20
Loading Object rgb_led
Program size is 240 longs
Compiled 40 Lines of Code in 0.004 Seconds

Thomas-Allens-MacBook-Air:bst thomasallen$ ls
bst.app bstl.osx rgb_led.spin
bst_manual_0.04.pdf rgb_led.binary rgb_led_bst.binary
bstc.osx rgb_led.eeprom rgb_led_bst2.binary

Thomas-Allens-MacBook-Air:bst thomasallen$ ./bstl.osx rgb_led.binary
Brads SpinTool Loader v0.05 - Copyright 2008,2009 All rights reserved
Compiled for i386 Darwin at 09:34:59 on 2009/07/03
Found a USB Serial Device
Propeller Version 1 Found!

Thomas-Allens-MacBook-Air:bst thomasallen$ ./bstl.osx rgb_led.binary -p2
Brads SpinTool Loader v0.05 - Copyright 2008,2009 All rights reserved
Compiled for i386 Darwin at 09:34:59 on 2009/07/03
Found a USB Serial Device
Propeller Version 1 Found!
Thomas-Allens-MacBook-Air:bst thomasallen$

The last syntax did load successfully to prop EEPROM.

There must have been some problem with the original binary that I had created from the bst GUI, a fluke in the way I did it, because I went back to the GUI and did it again, and this time it's binary worked fine. Hex dumps of the good and bad file were very different.

Incidentally, the binary file for this small test program is 244 bytes long, and from $30 to $F0 corresponds exactly to the compiler output. The eeprom file is a full 32kbytes long, most of it filled with $00.

dgately
03-14-2012, 05:59 PM
Incidentally, the binary file for this small test program was 244 bytes long, whereas the eeprom file was a full 32kbytes long, most of it filled with $00.

Yes, the Eeprom is always created with a size of 32K bytes!

Tracy Allen
03-14-2012, 06:42 PM
The goal here is to have a downloader on the Mac (and Linux) that is easy to use for sending firmware, no SD available. Similar to Jon's recent thread (http://forums.parallax.com/showthread.php?138191-Downloader). Is there a good way to attach the terminal geekiness to an icon that can be attached to an email for a simple click and run?

dgately
03-14-2012, 08:45 PM
The goal here is to have a downloader on the Mac (and Linux) that is easy to use for sending firmware, no SD available. Similar to Jon's recent thread (http://forums.parallax.com/showthread.php?138191-Downloader). Is there a good way to attach the terminal geekiness to an icon that can be attached to an email for a simple click and run?


Probably many better ways to do this, but here's a simple script (AppleScript) that could help:



on run

set theFile to choose file with prompt "Select the Eeprom file to load"
set theUnixPath to POSIX path of theFile
do shell script ("'/PathToYourBSTProgramFiles/bstl.osx' -p3 " & theUnixPath)

end run


This is an AppleScript. Open the AppleScript Editor, found in the Utilities directory on your Mac and paste the above code into the editor window. Change the "PathToYourBSTProgramFiles" to the path to where you keep the bst programs. Save this as an application or a script. With a bit more time, I'll describe a more automated way to to make this work from an email-attached file, but this is a start...

I chose this script as a simple-to-explain solution. A much better solution would be to put the script and the Eeprom file into a single bundle that you can double-click to load the file to your prop (I'll work on that!)

dgately

mindrobots
03-14-2012, 10:04 PM
Curiouser and curiouser, I guess I hadn't tried bst since the latest upgrade to 10.7.3

It starts up and gives me a menu bar...I can open things up, compile them and it works fine....I just NEVER see the main window. It's off hiding to the left someplace.

The only way to see it is to tell bst to show all windows. It looks great then but as soon as I click anywhere on it, it rushes off to the left to disappear.

I'll have to play more when I have more time.

SRLM
03-14-2012, 10:22 PM
Just in case it is helpful, here is the script that I use on Ubuntu Linux for compiling, downloading, and opening a terminal:




#!/bin/bash

#This script will compile, download, and open a terminal
#If any errors are encountered then it will stop at the appropriate point.

echo
echo

bstc.linux -f -p0 -L lib src/source.spin > output.txt
cat output.txt

grep -q "Error" output.txt
if [ $? -eq 0 ]; then
echo Found Error!
else
echo ----------------------------------------------------------
echo No compiler errors...

grep -q "No Propeller detected on" output.txt
if [ $? -eq 0 ]; then
echo Could not find Propeller chip...
else

echo
echo
echo To exit picocom, type C-A the C-X
echo

picocom -b 57600 /dev/ttyUSB0
fi
fi

Tracy Allen
03-15-2012, 03:37 AM
Wow, fun, that applescript did its duty as a app! Double clicking it on the desktop brought up the file selection dialog, and then, upon choosing a Prop binary, it successfully uploaded to the Prop eeprom and ran.

90589

(I see there is a misprint in the bst documentation where it says the options for -p are 0,1,3, but that should be 1,2,3, from ram/run to ram/eeprom/run.)

There is this as well as other promising options available. It's nice to get a little handle on the Mac inner workings. I really liked hypercard scripting back in the day, and I was sad when that went away.

I don't have a Linux machine at the moment but one of the people working on the project will be know more about that.

dgately
03-15-2012, 02:26 PM
Wow, fun, that applescript did its duty as a app! Double clicking it on the desktop brought up the file selection dialog, and then, upon choosing a Prop binary, it successfully uploaded to the Prop eeprom and ran.

There is this as well as other promising options available. It's nice to get a little handle on the Mac inner workings. I really liked hypercard scripting back in the day, and I was sad when that went away.

Yes, Hypercard was fun. The core of how it worked became AppleScript, but its simplicity was never replaced. I actually got a similar result to the AppleScript above using Automator which is on every Mac as well. It was more difficult to explain, so I decided to use the AppleScript example.

Something that I did not explore was to create a "smart" folder where any binary or eeprom file dropped on it would be loaded onto the prop. This could be done in either AppleScript or Automator.

For Linux, I'm a lot less "informed" on the how to do it. But, am fairly certain that a script similar to SRLM's could be created as double-clickable, as well!

dgately