Shop OBEX P1 Docs P2 Docs Learn Events
Integrating TAQOZ with Spin2Gui/FastSpin - Success! — Parallax Forums

Integrating TAQOZ with Spin2Gui/FastSpin - Success!

msrobotsmsrobots Posts: 3,701
edited 2019-07-29 23:30 in Propeller 2
OK, @ersmith will need to go over this, it is working, but not as perfect as it should.

This is the first time of me working with a TCL file, so I kind of butchered it together. I was not able to resolve the current working directory so some files need to go exactly where Spin2Gui.exe is. Eric will be able to solve this, but right now it is like it is.

I am using Spin2Gui Version 3.9.27 Compiled on: May 27 2019 this is important because I changed gui.tcl in the src directory of Spin2Gui to add some commands to integrate TAQOZ. As said before Eric might need to make it nicer, but it works!

So I added 4 menu entries and 4 buttons. 'compile with TAQOZ', 'compile & run with TAQOZ', 'compile with TAQOZVGA', 'compile & run with TAQOZVGA'

With help from @"Peter Jakacki" I created two different TAQOZ images, one without VGA (TQ_TAQOZ.BIN) and needing the first 64K of Hub-Ram and a second one with VGA (TQ_TAQOZVGA.BIN) needing the first 297K and including a VGA buffer with bmp palette TAQOZ standard VGA running on COG7

The whole shebang works like this:

your Program needs to include either TQ_Driver.spin2 or TQ_DdriverVga.spin2 depending if you need VGA or not. And you have to click the right button in Spin2Gui depending on with VGA or not.

Then FastSpin will compile your Program with a different start address and link the created binary with the correct TAQOZ image creating a combined binary ready to run. TAQOZ starts in COG0 listens to a Mailbox and starts the FastSpin compiled binary in COG1.

If you use TAQOZVGA COG 7 runs the VGA driver inside of TAQOZ.

How to use this:

You need to copy

TQTAQOZ.BIN, TQ_TAQOZVGA.BIN, TQ_Run.spin2 and TQ_RunVga.spin2 right next to spin2gui.exe - Eric will be able to find a better place, but right now they have to be THERE.

and you need to overwrite your existing gui.tcl in the spin2gui src directory with my butchered one.

so rename gui.tct.txt to gui.tcl and overwrite the existing one in spin2gui\src

Then start Spin2Gui and you should see the new commands.

The driver to use it are TQ_Driver.spin2 and TQ_DriverVga.spin2. Both use Eric's std_text_routines.spinh so this file needs to be with them, you need to rename the file from std_text_routines.spinh.txt to std_text_routines.spinh. .

simple example using the non VGA TAQOZ so you need to click 'compile & run with TAQOZ'
'
' TQ_Test.spin2 compile with TAQOZ
'
CON
  oscmode = $010c3f04
  freq = 160_000_000
  baud = 230_400 
OBJ
  ser: "FullDuplexSerial2.spin2"
  tqz: "TQ_Driver.spin2"

PUB demo | c
  clkset(oscmode, freq)
  ser.start(63, 62, 0, baud)
  'displayResponse
  ser.printf("\nrunning from $%x switched to_clkmode $%x _clkfreq %d - %dMhz\n", tqz#_MAILBOXIN+4, _clkmode, _clkfreq, _clkfreq/1000000)
  repeat
    ser.str(@menu)
    'ser.write(@menu, @entrynotvalid-@menu-1)
    c := ser.rx 
    case c
      49 : tqz.strCRflush("56 BLINK")
      50 : tqz.strCRflush("56 PIN MUTE")
      51 : tqz.strCRflush("57 BLINK")
      52 : tqz.strCRflush("57 PIN MUTE")
      53 : tqz.strCR("22 33 + .")
	   displayResponse
      54 : ser.str(@prompt)
	   ser.strin(@cmdline, 160)
	   ser.printf("\nsending %s to TAQOZ\n", @cmdline) 
	   tqz.strCR(@cmdline)
	   displayResponse
      other : ser.str(@entrynotvalid)

PRI displayResponse | c, w
  w := 30000
  repeat 
    if (c:=tqz.rxcheck)>-1
      w := 30000
      ser.tx(c)
      if c==13
        ser.tx(10)
    w--
  until w < 1 
DAT
menu	
	byte	13,10
	byte	"1 Test 1 - send 56 BLINK    - FLUSH RESPONSE",13,10
	byte	"2 Test 2 - send 56 PIN MUTE - FLUSH RESPONSE",13,10
	byte	"3 Test 3 - send 57 BLINK    - FLUSH RESPONSE",13,10
	byte	"4 Test 4 - send 57 PIN MUTE - FLUSH RESPONSE",13,10
	byte	"5 Test 5 - send 22 33 + .   - DISPLAY RESPONSE",13,10
	byte	"6 Test 6 - send commandline - DISPLAY RESPONSE",13,10,0
entrynotvalid	
	byte	13,10
	byte	"Entry not valid, try 1-6",13,10
	byte	0
prompt  byte	"enter cmd: " ,0
cmdline byte	0[160],0

I also included the created binary TQ_Test.binary you can just run the binary without changing anything in Spin2Gui...

Enjoy!

Mike

Comments

  • MJBMJB Posts: 1,235
    @msrobots
    congratulations - persistence pays of ;-)

    now learning to write nice Taqoz one or multi-liners ...

  • msrobotsmsrobots Posts: 3,701
    edited 2019-07-29 23:57
    OK @ersmith,I tried to put some driver into lib\spin (my FullDuplexSerial2.spin2) but it does not get found. Any tips why?

    and my problem with the pathes, I know you will cringe so to spare you the amount of what I butchered here is your doCompile
    proc doCompile {} {
        global config
        global BINFILE
        global filenames
        
        set status 0
        saveFilesForCompile
        set cmdstr [mapPercent $config(compilecmd)]
        set runcmd [list exec -ignorestderr]
        set runcmd [concat $runcmd $cmdstr]
        lappend runcmd 2>@1
        if {[catch $runcmd errout options]} {
    	set status 1
        }
        .bot.txt replace 1.0 end "$cmdstr\n"
        .bot.txt insert 2.0 $errout
        tagerrors .bot.txt
        if { $status != 0 } {
    	tk_messageBox -icon error -type ok -message "Compilation failed" -detail "see compiler output window for details"
    	set BINFILE ""
        } else {
    	set BINFILE [file rootname $filenames([.nb select])]
    	set BINFILE "$BINFILE.binary"
    	# load the listing if a listing window is open
    	if {[winfo exists .list]} {
    	    doListing
    	}
        }
        return $status
    }
    
    
    and here my butchered one to doCompileTaqoz
    proc doCompileTaqoz {} {
        global config
        global BINFILE
        global filenames
        
        set status 0
        saveFilesForCompile
        set cmdstr [mapPercent $config(compilecmd)]
        set cmdstr [concat $cmdstr " -H 0x10004 -E -o TQ_Link.binary"]  
        set runcmd [list exec -ignorestderr]
        set runcmd [concat $runcmd $cmdstr]
        lappend runcmd 2>@1
        if {[catch $runcmd errout options]} {
    	set status 1
        }
        .bot.txt replace 1.0 end "$cmdstr\n"
        .bot.txt insert 2.0 $errout
        tagerrors .bot.txt
        if { $status != 0 } {
    	tk_messageBox -icon error -type ok -message "Compilation failed" -detail "see compiler output window for details"
    	set BINFILE ""
        } else {
    	set BINFILE "TQ_Link.binary"
    	# load the listing if a listing window is open
    	if {[winfo exists .list]} {
    	    doListing
    	}
    	set status 0
    	set cmdstr [mapPercent $config(compilecmd)]
    	set BINFILE [file rootname $filenames([.nb select])]
    
    	set cmdstr [regsub $BINFILE $cmdstr "TQ_Run"]
    
    	set BINFILE "$BINFILE.binary"
    	set cmdstr [concat $cmdstr " -o "]  
    	set cmdstr [concat $cmdstr $BINFILE]  
    	set runcmd [list exec -ignorestderr]
    	set runcmd [concat $runcmd $cmdstr]
    	lappend runcmd 2>@1
    	if {[catch $runcmd errout options]} {
    	   set status 1
    	}
    	.bot.txt replace 1.0 end "$cmdstr\n"
    	.bot.txt insert 2.0 $errout
    	tagerrors .bot.txt
    	if { $status != 0 } {
    	    tk_messageBox -icon error -type ok -message "Compilation failed" -detail "see compiler output window for details"
    	    set BINFILE ""
    	} else {
    	    set BINFILE [file rootname $filenames([.nb select])]
    	    set BINFILE "$BINFILE.binary"
    	    # load the listing if a listing window is open
    	    if {[winfo exists .list]} {
    	        doListing
    	    }
            }
        }
    
        return $status
    }
    

    I basically compile the given source with added -Hxx -E and write to a file "TQ_Link.binary" with -o

    Then I compile TQ_Run witch basically just has two file entries to combine TAQOZ.BIN and TQ_Link.binary and save that with -o with the original file name and location.

    That works but requires TAQOZ.BIN, TAQOZVGA.BIN, TQ_Run.spin2 and TQ_RunVga.spin2 to be in the directory where spin2gui.exe is. And TQ_Link.binary as well as .lst get created there too.

    Please help me to get this nicer.

    what I would like is to have the TAQOZ.BIN, TAQOZVGA.BIN, TQ_Driver.spin2, TQ_DriverVga.spin2, TQ_Run.spin2 and TQ_RunVga.spin2 in lib\spin and TQ_Link.binary and lst created in the current project directory where the original source is, not next to spin2gui.

    That would make more sense.

    Mike
  • jmgjmg Posts: 15,140
    msrobots wrote: »
    ....
    The whole shebang works like this:

    your Program needs to include either TQ_Driver.spin2 or TQ_DdriverVga.spin2 depending if you need VGA or not. And you have to click the right button in Spin2Gui depending on with VGA or not.

    Then FastSpin will compile your Program with a different start address and link the created binary with the correct TAQOZ image creating a combined binary ready to run. TAQOZ starts in COG0 listens to a Mailbox and starts the FastSpin compiled binary in COG1.

    If you use TAQOZVGA COG 7 runs the VGA driver inside of TAQOZ.

    Cool, impressive.
    If I have followed this right, you have :

    COG0 : Loads and runs TAQOZ
    COG1 : Loads and runs FastSpin Binary ( can that be any of the FastSpin languages ? )
    COG7 : Hosts VGA, used by TAQOZ

    Interface is via terminal into COG1 which passes messages to TAQOZ running in COG0

  • msrobotsmsrobots Posts: 3,701
    edited 2019-07-30 00:04
    almost right.

    COG0 runs TAQOZ and starts at HUB 0
    COG1 runs user Program out of FastSpin at $10000 (w/o VGA) or $48800 (with VGA)
    Interface to TAQOZ is a Mailbox, presented as alike a terminal to - yes - all supported languages of FastSpin.

    We need no pins here.

    If using TAQOZVGA COG7 runs a videodriver if using TAQOZ the cog 7 is free.

    Mike
  • MJB wrote: »
    @msrobots
    congratulations - persistence pays of ;-)

    now learning to write nice Taqoz one or multi-liners ...

    Yes, I am German so persistence is something I was raised to do. One never gives up.

    And yes now the show begins. I need to write some one liners to make people interested in using it. I should concentrate on SD access first, because that will work with both drivers. But having VGA running now is tempting.

    Mike
  • Very nice, Mike! Thanks for doing this.

    It should be possible to put your Spin files in a directory like "include/taqoz" and include them as 'obj run: "taqoz/TQ_Run" '. I think the BIN files should be able to be handled the same way, but I'll have to check that -- it's not something I've tried. I've kind of got some other things going on right now but I'd like to take a look at what you've done soon.

    Cheers,
    Eric
  • ersmith wrote: »
    Very nice, Mike! Thanks for doing this.

    It should be possible to put your Spin files in a directory like "include/taqoz" and include them as 'obj run: "taqoz/TQ_Run" '. I think the BIN files should be able to be handled the same way, but I'll have to check that -- it's not something I've tried. I've kind of got some other things going on right now but I'd like to take a look at what you've done soon.

    Cheers,
    Eric

    Thanks Eric that gives me something to try.

    But why is SimpleSerial.spin found in lib\spin but FullDuplexSerial2.spin2 not found when I put it next to SimpleSerial.spin?

    Mike
  • msrobots wrote: »
    But why is SimpleSerial.spin found in lib\spin but FullDuplexSerial2.spin2 not found when I put it next to SimpleSerial.spin?

    Did you mean "include\spin"? Did you remember to put the "spin\" directory at the beginning? Also, the .spin2 extension is handled slightly differently from ".spin", so you might try changing the extension.

  • msrobotsmsrobots Posts: 3,701
    edited 2019-07-31 02:12
    h. OK. I did not put spin\ at the beginning, I do not need to do that with SimpleSerial.spin, will try.

    But this is not really important I just wanted to have FullDuplexSerila2.spin2 included into your standard edition, it is a nice driver for 2 ports and is behaving like your existing ones, except it has buffers in lut.

    completely independent of the TAQOZ stuff.

    There I am getting further, TQ_DriverVga.spin2 provides now all your std_serial routines for the VGA screen TAQOZ provides. Very cool.

    SO tqz.str("HI MIKE") works as well as
    tqz.printf("\nrunning from $%x switched to_clkmode $%x _clkfreq %d - %dMhz\n", tqz#_MAILBOXIN+4, _clkmode, _clkfreq, _clkfreq/1000000)
    tqz.str(@menu)
    this is fun.

    Mike
  • msrobotsmsrobots Posts: 3,701
    edited 2019-08-01 07:01
    OK guys I make it more easy to play with. Attached a Forth Fork of spin2gui named spin2guitqz containing my above mentioned changes to integrate Forth Taqoz with Spin2Gui/FastSpin

    Just unzip it next to your original spin2gui folder and nothing gets messed up.

    the second zip contains TQ_Test.spin2 a simple demo.

    This currently uses VGA on the P2 with the VGA board at pins 0-3

    working on it, but already nice.

    Mike
Sign In or Register to comment.