Shop OBEX P1 Docs P2 Docs Learn Events
Propgcc loader — Parallax Forums

Propgcc loader

Dr_AculaDr_Acula Posts: 5,484
edited 2013-04-10 03:55 in Propeller 1
I've been reading the specs on the propgcc loader http://code.google.com/p/propgcc/wiki/PropGccLoader and wondering about adding multipropeller support.

To download a file to a second propeller, the data needs to go through the first propeller. The big unknown with initial experiments was whether the PC side would be fast enough but it all appears to work fine. I'd love to see this incorporated into the propgcc loader if this is possible.

I wrote the initial code in xmodem because I already had code for that. One advantage of xmodem is error recovery, but the whole download process seems very reliable, so there probably isn't so much of a need for error checking. Xmodem still may be a good protocol though, as it breaks the program up into 128 byte chunks and this means there isn't a need for a huge data buffer on the master propeller and so the data transfer rate from the PC to the master then matches whatever speed the master is sending the data to the slave.

The first step is to send a small program written in spin to the master propeller. This handles the interface between the PC and slave propellers, and is ultimately overwritten once all the slave propellers have been programmed.

Three parameters need to be passed to the loader program and then onto the master propeller - the Rx pin number, the Tx pin number and the Reset pin number. One might connect a slave propeller to pins 0,1,2 and then a second slave propeller to pins 3,4,5, and so on.

At the moment the PC side program is written in vb.net and I am wondering if it could be incorporated into the propgcc loader?

If so, it would need maybe about 100 lines of code. There would maybe need to be another command line parameter, and then after that would come three numbers for the three pins. One would also pass all the usual parameters such as com port, name of file to send etc.

On the propeller side, the spin program is already working for xmodem. Maybe another protocol might be better? In any case it takes data coming down the serial port from the PC, issues a reset to the slave propeller and converts it to the protocol needed to program the slave.

Thoughts would be most appreciated!

Comments

  • David BetzDavid Betz Posts: 14,516
    edited 2013-04-09 19:04
    Dr_Acula wrote: »
    I've been reading the specs on the propgcc loader http://code.google.com/p/propgcc/wiki/PropGccLoader and wondering about adding multipropeller support.

    To download a file to a second propeller, the data needs to go through the first propeller. The big unknown with initial experiments was whether the PC side would be fast enough but it all appears to work fine. I'd love to see this incorporated into the propgcc loader if this is possible.

    I wrote the initial code in xmodem because I already had code for that. One advantage of xmodem is error recovery, but the whole download process seems very reliable, so there probably isn't so much of a need for error checking. Xmodem still may be a good protocol though, as it breaks the program up into 128 byte chunks and this means there isn't a need for a huge data buffer on the master propeller and so the data transfer rate from the PC to the master then matches whatever speed the master is sending the data to the slave.

    The first step is to send a small program written in spin to the master propeller. This handles the interface between the PC and slave propellers, and is ultimately overwritten once all the slave propellers have been programmed.

    Three parameters need to be passed to the loader program and then onto the master propeller - the Rx pin number, the Tx pin number and the Reset pin number. One might connect a slave propeller to pins 0,1,2 and then a second slave propeller to pins 3,4,5, and so on.

    At the moment the PC side program is written in vb.net and I am wondering if it could be incorporated into the propgcc loader?

    If so, it would need maybe about 100 lines of code. There would maybe need to be another command line parameter, and then after that would come three numbers for the three pins. One would also pass all the usual parameters such as com port, name of file to send etc.

    On the propeller side, the spin program is already working for xmodem. Maybe another protocol might be better? In any case it takes data coming down the serial port from the PC, issues a reset to the slave propeller and converts it to the protocol needed to program the slave.

    Thoughts would be most appreciated!
    propeller-load already uses xmodem-like packets with CRCs. The payload size is 1K though not 128 bytes.
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2013-04-09 19:39
    Even better!

    So it may not need much code at all.

    1) need to send a few setup data bytes eg "SLAVE PINS 0,1,2<CR>". One way to do this would be to have command line parameter that simply passes through the next text.
    2) need to send data as bytes on the serial port rather than the ?trinary code of a download. Proploader might already be able to do this.

    There may be parts of proploader that can do these sorts of things. If they can, then it may be easier to work on the propeller side and rewrite the spin code.

    Is the code of the propgcc loader open source?
  • jazzedjazzed Posts: 11,803
    edited 2013-04-09 20:39
    Dr_Acula wrote: »
    Is the code of the propgcc loader open source?

    It's supposed to be all open source. Some files are missing the MIT license though.
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2013-04-09 21:13
    Thanks jazzed. I'm hoping that by looking at the source I can get it down to only a few additions. Is the source in the 118mb propgcc download? (that opens to 7 folders; bin, include, lib, libexec, propeller-elf, propeller-load and share). I had a quick look but couldn't see it but maybe it is in a sub-folder?
  • jazzedjazzed Posts: 11,803
    edited 2013-04-09 21:54
    Dr_Acula wrote: »
    Thanks jazzed. I'm hoping that by looking at the source I can get it down to only a few additions. Is the source in the 118mb propgcc download? (that opens to 7 folders; bin, include, lib, libexec, propeller-elf, propeller-load and share). I had a quick look but couldn't see it but maybe it is in a sub-folder?

    LOL. Funny that the SimpleIDE package that includes PropellerGCC is 20MB smaller.

    The executable is there, but not the source. The source is here https://code.google.com/p/propgcc/source/browse/#hg%2Floader .... To get a full copy of the source, it is necessary to clone the repository.
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2013-04-09 22:07
    Thanks++ jazzed. This is just what I need :)

    In the packet.c program is very similar code to xmodem with NAK and ACK so I think I might be able to hack that.

    And I think there is a 'terminal' mode. If that does what I think it does, if it opens terminal mode after running, maybe I can use that to send commands to the program on the propeller.

    Thinking out loud:
    Run proploader and send my comms program
    Run proploader again in ?terminal mode and send some data for the slave pins
    Run proploader again in download mode, and proploader thinks it is sending a large file to the propeller sd card or something, but the program on the propeller is capturing the packets and instead sending them out to a slave propeller.

    Maybe maybe I can do this without modifying proploader at all?
  • David BetzDavid Betz Posts: 14,516
    edited 2013-04-10 03:55
    Dr_Acula wrote: »
    Is the code of the propgcc loader open source?
    Yes, it should have an MIT license. I'll have to update the source files to say that. Everything that we have written for PropGCC is released under the MIT license.
Sign In or Register to comment.