Using the Generate Object Code option in the Basic Stamp IDE.
Mike Cook
Posts: 829
Hopefully this does not sound too confusing………………….
Observation:· When using this option to generate an object code file (see attached for configuration), no matter what size the basic stamp code (BS2) is,· the file generated is 19,400 bytes.
Questions:·
Background:
Transmitting a 19,400 byte file @ 9600 baud, when the code is·less than·2K seems to be a bit wasteful. Trying to use off the shelf software and really don’t want to write a utility to extract just the code required. Hopefully I've missed an option that's built into the Basic Stamp IDE.
Thanks in Advance!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Mike
Observation:· When using this option to generate an object code file (see attached for configuration), no matter what size the basic stamp code (BS2) is,· the file generated is 19,400 bytes.
Questions:·
1. Is there any way to make this file smaller, without writing an utility to strip out just the object code?
2. If this is not an IDE bug, what is the logic behind having this large of a file?
3. Is there a document describing·the *.obj·file's structure?
I’ve looked through several documents and have not found the answer to this yet, unless I skimmed over it. I’ve loaded the file up in a HEX editor and have figured out what needs to be extracted, from this file, so this data can then be sent to a BS2. However I would like to skip this step.
2. If this is not an IDE bug, what is the logic behind having this large of a file?
3. Is there a document describing·the *.obj·file's structure?
I’ve looked through several documents and have not found the answer to this yet, unless I skimmed over it. I’ve loaded the file up in a HEX editor and have figured out what needs to be extracted, from this file, so this data can then be sent to a BS2. However I would like to skip this step.
Background:
1.·I would like to be able to use the current Basic Stamp IDE to modify code for a BS2 (Scribbler).·
2.·Then save the code as an *.obj file.
3.·Then transmit this file, via XMODEM, to a Propeller Chip configured with XBEE, XMODEM, SD, and an additional serial port connected directly to the BS2 (Scribbler)
2.·Then save the code as an *.obj file.
3.·Then transmit this file, via XMODEM, to a Propeller Chip configured with XBEE, XMODEM, SD, and an additional serial port connected directly to the BS2 (Scribbler)
Transmitting a 19,400 byte file @ 9600 baud, when the code is·less than·2K seems to be a bit wasteful. Trying to use off the shelf software and really don’t want to write a utility to extract just the code required. Hopefully I've missed an option that's built into the Basic Stamp IDE.
Thanks in Advance!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Mike
Comments
You know, you'll have to 'emulate' the programming cycle from the Propeller to the BS2, right? Including toggling the DTR line, etc.
Unless, you can figure out the software sufficiently that you can write a small 'loader' on the Scribbler (in PBasic) that will properly load the code tokens in the right places in eeprom, then 'GOTO' the starting location.
I think you're going to have to 'massage' the generated object code in any event.
Why do you want to go through all this trouble? Reprogramming the scribbler from scratch for everything you want it to do is a pretty stone-age approach. Is it not possible to program into the scribbler some 'primitives', then download to the scribbler a 'program' it should store in its eeprom which will tell it which 'primitives' to run? By "primitives" I mean "TurnLeft", "TurnRight", "Forward", "WaitAPeriod", "Stop".
Changing code on-the-fly is going to be a difficult proposition no matter what approach you take. You'll still want to minimize the necessary effort.
I have written a XMODEM receive routine for the Propeller Chip and it will receive the file using an XBEE radio and then save the file to a SD card. I could do the conversion on the Propeller (and will probably try that next), but was concerned with transmitting all the unnecessary stuff. The Scribbler is being used as a test platform and in all reality the code should not have to be updated too often. Working on a project along the lines of http://www.roboteducation.org , but would like to substitute a propeller processor for their ‘Fluke’ board.
Since this is a project that will ‘evolve’ over time I’m not quite sure of the end result!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Mike
Post Edited (Mike Cook) : 10/29/2008 9:33:18 PM GMT
It is a fixed size because 1)·it was decided that a 19k-sized file is of little effect on today's and future's storage system (hard drives, thumb drives, etc.) especially when, in most cases, they'd be integrated into a single executable that contains both the loader and the object data, and 2) it is much easier to implement a fixed-size object code reader/verifier, than a variable sized one.
There's no feature in the software to store it in any different format.
Here's the format for version 1.3 (of the object file: created by Stamp Editor v2.2.7 and later).
For your purposes, all you need to do is extract bytes from 943+, where byte 943 contains·the number of 18-byte packets (following it) that are valid code.· Simply transmit those 18-byte packets, in tact, to the Propeller Chip to have it download them.
Also, there should be no reason a Propeller Chip can't program a BASIC Stamp module; in fact, we've considered making in-house testers in the same way.
Take care,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--Jeff Martin
· Sr. Software Engineer
· Parallax, Inc.
Post Edited (Jeff Martin (Parallax)) : 11/3/2008 7:05:32 PM GMT
Thanks for the info!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Mike
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
In my case I used a BS2px to program a BS2. The BS2px would read a tokenized file from a datalogger, the file was a CSV file.
Without going into detail my biggest problem was getting the object code into the CSV file, seeing the format of the object file that Jeff Martin posted was really enlightening and I was able to modify a small utility program that I was using. The utility may be of no use to you but it has made my task of porting the obj over to the CSV 100 times easier.
If you care to check it out here it is, a requirement is the latest version of Microsoft .Net Framework V3.5 which can be downloaded at http://www.microsoft.com/downloads/details.aspx?FamilyId=333325FD-AE52-4E35-B531-508D977D32A6&displaylang=en
My usage was single slot programming so that is all the utility is capable of reading.
Jeff T.
Then you could develop a program that runs in, say, Slot 2, to receive that 2K file and write it in Slot 0 (or wherever) in the Stamp that was on the receiving end. The Slot 2 program could be "run" by a goody in Slot 0 that then got overwritten.
I'm just brainstorming, but is there any reason why that wouldn't work? It looks to me like it'd be extremely easy to do.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
· -- Carl, nn5i
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
· -- Carl, nn5i