If you can find out how to set higher clock speeds on the Mac I'd be delighted to put that into my version of loadp2.
I presume you mean Baud settings ?
Yes, I meant baud rate.
DB: If I use both "-b 230400" and "-l 230400" everything seems to work
On that topic, I hope loadp2 has no issues with this "-b 3" and "-l 3" ?
For setting the serial baud rate loadp2 just passes the baud rate through to the OS. The loader baud rate also needs to be set in the P2 loader code, and that just uses the value after "-l" directly. So "-l 3" will probably set your download speed to 3 baud.
For setting the serial baud rate loadp2 just passes the baud rate through to the OS. The loader baud rate also needs to be set in the P2 loader code, and that just uses the value after "-l" directly. So "-l 3" will probably set your download speed to 3 baud.
That's all good then. The final actual baud depends on firmware, as mentioned above.
I've used a dual plane to produce 24MHz/M, for M < 367, so that '3' yields 8MBd. That's done because some drivers block at the PC side, and refuse large numbers...
I tried this on the Mac and it also works. I haven't gotten it to work with 2000000 baud though. Maybe 921600 should be made the default on the Mac?
loadp2 -t -b 230400 -l 921600 -p /dev/cu.usbserial-P2EEQXU test
Yes, it makes sense to use a default that is reliable and portable
What messages does 2Mbd give ? Does it try to download anything ?
I see a cryptic [ -b baud ] use baud rate (default is 115200) in some docs, and digging I see that is actually applied to the terminal after boot, so maybe that should be called terminal baud rate or user terminal baud rate ?
I do not see a Prop_Txt mode in loadp2 ? The DOCs say this mode is 2.25x faster :
Prop_Txt ... This format is 2.25x denser than hex, and so minimizes transmission size and time.
I'm not at home right now but I believe it was this:
loadp2 -t -b 230400 -l 230400 -p /dev/cu.usbserial-P2EEQXU test
I use several python scripts that call loadp2 with differing baud rates. Here's your C example compiling, loading and executing successfully on a P2ES from a MacBook Pro, running macOS Mojave 10.14.6:
$ fastspin -2 test.c -L ~/source/spin2cpp/include -o test.binary
$ loady3.py test.binary
Load my O2 Eval Board with a binary and setup a terminal.
Note: Always uses -b 230400 & -l 230400.
USAGE: loady.py [P2 binary filename]
loading test.binary ...
not an ELF file
( Entering terminal mode. Press Ctrl-] to exit. )
Hello, world!
The loady3.py script contains (among other things) this:
I tried this on the Mac and it also works. I haven't gotten it to work with 2000000 baud though. Maybe 921600 should be made the default on the Mac?
loadp2 -t -b 230400 -l 921600 -p /dev/cu.usbserial-P2EEQXU test
I have found that 2000000 can work on the MAC. I am using Yosemite 10.10.5 with some specific changes to loadp2 that I made a while back and discussed in the p2gcc thread. When I return from vacation I will try to collect them as a github request if Eric wants to get them integrated into loadp2. It also enabled the auto detect feature if I recall correctly.
I tried this on the Mac and it also works. I haven't gotten it to work with 2000000 baud though. Maybe 921600 should be made the default on the Mac?
loadp2 -t -b 230400 -l 921600 -p /dev/cu.usbserial-P2EEQXU test
I have found that 2000000 can work on the MAC. I am using Yosemite 10.10.5 with some specific changes to loadp2 that I made a while back and discussed in the p2gcc thread. When I return from vacation I will try to collect them as a github request if Eric wants to get them integrated into loadp2. It also enabled the auto detect feature if I recall correctly.
That sounds great! I was just going to integrate the auto-detect code from propeller-load but I won't bother if you already have that done.
I've published new releases (3.9.29) of fastspin and spin2gui. @ozpropdev and @Cluso99, the listing files should work better in this version. I've also fixed some Spin compatibility issues that affected Numbers.spin.
Most of the new features are in the BASIC language. Passing objects to functions works more smoothly now in BASIC, and there have been some other object cleanups. You can now declare classes inline like:
class counter
dim c as integer
sub increment()
c = c + 1
end sub
function get() as integer
return c
end function
end class
dim x as counter
(The old "class using" syntax still works of course, and still supports including Spin or C files as classes).
The C compiler also supports having methods inside structs, sort of a poor man's C++ class.
BASIC also has a simple form of function template for polymorphic programming. You can specify a function that takes any kind of argument and that will be specialized at compile time:
any(t) function twice(x as t) as t
return x+x
end function
print twice(10) ' prints 20
print twice(1.4) ' prints 2.8
print twice("abc") ' prints "abcabc"
These templates are BASIC only for now, but probably could be added to C as well (that's a low priority though... the compiler template support is actually there to support another language I'm thinking of adding as a longer term project).
These templates are BASIC only for now, but probably could be added to C as well (that's a low priority though... the compiler template support is actually there to support another language I'm thinking of adding as a longer term project).
Another language? Sounds intriguing. Is this an existing language you're planning to support or one you're designing yourself?
These templates are BASIC only for now, but probably could be added to C as well (that's a low priority though... the compiler template support is actually there to support another language I'm thinking of adding as a longer term project).
Another language? Sounds intriguing. Is this an existing language you're planning to support or one you're designing yourself?
I'd like to see if there's some subset of python that could be compiled. python in general is too dynamic to be efficiently compiled, but on the other hand many practical python programs don't rely on those dynamic features and could be compiled. So I was thinking that a python program like:
def twice(x):
return x+x
could be compiled into something like the BASIC template I posted above, and then specialized based on the type of arguments actually passed to the "twice" function. That depends on being able to deduce the types at compile time, but in many cases that should be possible.
These templates are BASIC only for now, but probably could be added to C as well (that's a low priority though... the compiler template support is actually there to support another language I'm thinking of adding as a longer term project).
Another language? Sounds intriguing. Is this an existing language you're planning to support or one you're designing yourself?
I'd like to see if there's some subset of python that could be compiled. python in general is too dynamic to be efficiently compiled, but on the other hand many practical python programs don't rely on those dynamic features and could be compiled. So I was thinking that a python program like:
def twice(x):
return x+x
could be compiled into something like the BASIC template I posted above, and then specialized based on the type of arguments actually passed to the "twice" function. That depends on being able to deduce the types at compile time, but in many cases that should be possible.
BASIC also has a simple form of function template for polymorphic programming. You can specify a function that takes any kind of argument and that will be specialized at compile time:
any(t) function twice(x as t) as t
return t+t
end function
print twice(10) ' prints 20
print twice(1.4) ' prints 2.8
print twice("abc") ' prints "abcabc"
These templates are BASIC only for now, but probably could be added to C as well (that's a low priority though... the compiler template support is actually there to support another language I'm thinking of adding as a longer term project).
That's impressively simple, and very student friendly. What is the code overhead cost of that flexibility ?
I'd like to see if there's some subset of python that could be compiled. python in general is too dynamic to be efficiently compiled, but on the other hand many practical python programs don't rely on those dynamic features and could be compiled. So I was thinking that a python program like:
def twice(x):
return x+x
could be compiled into something like the BASIC template I posted above, and then specialized based on the type of arguments actually passed to the "twice" function. That depends on being able to deduce the types at compile time, but in many cases that should be possible.
Sounds like a very appealing approach. Keep us posted.
BASIC also has a simple form of function template for polymorphic programming. You can specify a function that takes any kind of argument and that will be specialized at compile time:
any(t) function twice(x as t) as t
return t+t
end function
Whoops! There was a typo in my original post, that should have read "return x+x". Sorry about that (I've edited the post now).
That's impressively simple, and very student friendly. What is the code overhead cost of that flexibility ?
Each different type passed to "twice" creates a new function. So if "twice" gets used in different places with an integer, float, and string argument (as in the example above) we end up with three functions:
function twice__i4(x as integer) as integer
return x+x
end function
function twice__f4(x as single) as single
return x+x
end function
function twice__s(x as string) as string
return x+x
end function
For this particular example the integer version is simple enough that it'll be inlined automatically, so there's really no code overhead for it. But we will get new functions created for the float ("single") and string versions.
Once a specific version of the "twice" function is created (e.g. the "twice__s" version for strings) then it'll be re-used when further calls to "twice(string)" happen, so the overhead is only once per distinct type, not once per call.
Eric,
I've been using spingui/fastspin for the past 3 weeks. What a great suite of programs!
I really like the way the terminal program comes up automatically after downloading
I have found that the find/search section in the editor doesn't seem to work. Perhaps I don't understand the metrics behind it, so can you enlighten me please,
Thanks, Ray
Postedit...
Forgot to ask. How best to include a binary file (it has z80 instructions)?
I've seen this example..
I have found that the find/search section in the editor doesn't seem to work. Perhaps I don't understand the metrics behind it, so can you enlighten me please,
Hi Ray. Glad you're finding spin2gui useful!
It looks like there's a bug in the search menu command... it doesn't work unless you first click on the text window that you want to search in (that is, there's no default). If you load a file, click once on the window containing that file, and then do control-f (or select the menu entry) then it should bring up a dialog box asking what you want to search for, and it should work fine after that. (If you don't click on the window after loading the file it reports an error about missing tags).
Forgot to ask. How best to include a binary file (it has z80 instructions)?
I've seen this example..
framebuffer file "rose.gray"
Yes, fastspin should support the standard Spin FILE command to include binary data. Are you finding that it doesn't work for you? It's certainly possible that there's a bug there, although it does seem to work in many cases.
That'll be because those addresses in the .lst file are the file offset, not the symbol address. Well, except for the accompanying cog addresses that is.
I'll wait until you have the next final version ready as I cannot seem to get find/search working.
I'm just loving the compile/download/run/terminal as a single click
Meanwhile, I've noticed the "file save as" does not fill the box with the current filename. Is this an easy fix???
Sometimes I forget to close the terminal window before the next compile/etc. This prevents the running so is there any reason not to close the current terminal window and proceed? If not, is that a possibility?
BTW I am finding the editor a bit limited. Cannot tell you why. I just revert to using PropTool for anything but minor edits. Maybe it's just habit.
That would be a better output, and I'll try to tweak it to look more like that. The main thing is that the labels should have the correct addresses for the debugger, which they do now.
I'll wait until you have the next final version ready as I cannot seem to get find/search working.
What symptoms are you seeing? Does pressing ctrl-F in the window bring up the search box?
Meanwhile, I've noticed the "file save as" does not fill the box with the current filename. Is this an easy fix???
Good idea. I think you can just make a small change to src/gui.tcl to do this. All of the .tcl files are directly interpreted, so you don't need to recompile or anything, just change the .tcl file and restart spin2gui.exe. Here's the diff (I had to edit it slightly because the forum messes up @ signs, but those are only in the diff header so don't affect the actual code):
--- a/src/gui.tcl
+++ b/src/gui.tcl
@ @ -495,7 +495,15 @ @ proc saveFileAs {w} {
global BINFILE
global SpinTypes
global config
- set filename [tk_getSaveFile -filetypes $SpinTypes -defaultextension $config(spinext) -initialdir $config(lastdir) ]
+
+ if { [string length $filenames($w)] == 0 } {
+ set initdir $config(lastdir)
+ set initfilename ""
+ } else {
+ set initdir [file dirname $filenames($w)]
+ set initfilename [file tail $filenames($w)]
+ }
+ set filename [tk_getSaveFile -filetypes $SpinTypes -defaultextension $config(spinext) -initialdir $initdir -initialfile $initfilename ]
if { [string length $filename] == 0 } {
return
}
Sometimes I forget to close the terminal window before the next compile/etc. This prevents the running so is there any reason not to close the current terminal window and proceed? If not, is that a possibility?
I'm not sure about this. Sometimes people might have more than one Prop and be running code in one that should stay open?
BTW I am finding the editor a bit limited. Cannot tell you why. I just revert to using PropTool for anything but minor edits. Maybe it's just habit.
Oh, the editor is definitely very limited. It should be possible to use an external editor and just use spin2gui for the compile/run portion -- spin2gui checks regularly for changes to external files. That is, it should work fine to leave both spin2gui and some other editor open with the same file, and any changes in the other editor should be noticed by spin2gui. (Whether any changes spin2gui makes are noticed by the other editor depends on that editor, of course, but if you only make changes in the other editor and only use spin2gui for compile/run then you should be fine.)
spin2gui is really kind of a quick hack, and something like @Rayman's Spin tool or Visual Studio Code would probably be nicer as a GUI for fastspin.
Ctl-F brings up the search box but after i enter something and click next, nothing happens. But i have a version about 3 weeks old.
I’ll try editing the .tcl file.
Didn’t think about more than one prop. I am happy as is.
Yes, I’ve been keeping either PropTool or Notepad++ open and editing there. Don’t have VSCode on this laptop. I’ll be home at the end of the week so I’ll have my much faster pc with ssd
Ctl-F brings up the search box but after i enter something and click next, nothing happens. But i have a version about 3 weeks old.
Odd. For me it highlights (in yellow) the next instance of the thing I searched for, and as I hit "next" it cycles through them.
I did notice that if I search for something that's not in the file then nothing happens. Could that be what's hitting you? I'll add a "not found" dialog box, that should have been there from the beginning. (I used someone else's search and replace code and didn't notice that there was no message when the search term wasn't found.)
That would be a better output, and I'll try to tweak it to look more like that. The main thing is that the labels should have the correct addresses for the debugger, which they do now.
We could also provide a switch to explicitly dump labels (and any other debug information we can think of) into a file for the debugger. What format would be convenient for that?
Your list file is now:
HUB-address Cog-address hex |asm
I would prefer a csv file (semicolon or tab as delimiter) for easy tokenization:
HUB-address;Cog-address;hex;asm
A user would want to set a breakpoint in the sourcefile. For that I would need sourcefile-name and sourcefile-line, that I can find the address for the breakpoints.
sourcefile-name;sourcfile-line;HUB-address;Cog-address;hex;asm
Would that be doable?
Ctl-F brings up the search box but after i enter something and click next, nothing happens. But i have a version about 3 weeks old.
Odd. For me it highlights (in yellow) the next instance of the thing I searched for, and as I hit "next" it cycles through them.
I did notice that if I search for something that's not in the file then nothing happens. Could that be what's hitting you? I'll add a "not found" dialog box, that should have been there from the beginning. (I used someone else's search and replace code and didn't notice that there was no message when the search term wasn't found.)
Yes, the problem seems to be I didn't have ignore case selected and didn't realise it was not found because it is working now
Comments
That would make for a clearer file.
Yes, I meant baud rate.
For setting the serial baud rate loadp2 just passes the baud rate through to the OS. The loader baud rate also needs to be set in the P2 loader code, and that just uses the value after "-l" directly. So "-l 3" will probably set your download speed to 3 baud.
That's all good then. The final actual baud depends on firmware, as mentioned above.
I've used a dual plane to produce 24MHz/M, for M < 367, so that '3' yields 8MBd. That's done because some drivers block at the PC side, and refuse large numbers...
Yes, it makes sense to use a default that is reliable and portable
What messages does 2Mbd give ? Does it try to download anything ?
I see a cryptic [ -b baud ] use baud rate (default is 115200) in some docs, and digging I see that is actually applied to the terminal after boot, so maybe that should be called terminal baud rate or user terminal baud rate ?
I do not see a Prop_Txt mode in loadp2 ? The DOCs say this mode is 2.25x faster :
Prop_Txt ... This format is 2.25x denser than hex, and so minimizes transmission size and time.
The loady3.py script contains (among other things) this:
dgately
I have found that 2000000 can work on the MAC. I am using Yosemite 10.10.5 with some specific changes to loadp2 that I made a while back and discussed in the p2gcc thread. When I return from vacation I will try to collect them as a github request if Eric wants to get them integrated into loadp2. It also enabled the auto detect feature if I recall correctly.
Most of the new features are in the BASIC language. Passing objects to functions works more smoothly now in BASIC, and there have been some other object cleanups. You can now declare classes inline like: (The old "class using" syntax still works of course, and still supports including Spin or C files as classes).
The C compiler also supports having methods inside structs, sort of a poor man's C++ class.
BASIC also has a simple form of function template for polymorphic programming. You can specify a function that takes any kind of argument and that will be specialized at compile time:
These templates are BASIC only for now, but probably could be added to C as well (that's a low priority though... the compiler template support is actually there to support another language I'm thinking of adding as a longer term project).
I'd like to see if there's some subset of python that could be compiled. python in general is too dynamic to be efficiently compiled, but on the other hand many practical python programs don't rely on those dynamic features and could be compiled. So I was thinking that a python program like: could be compiled into something like the BASIC template I posted above, and then specialized based on the type of arguments actually passed to the "twice" function. That depends on being able to deduce the types at compile time, but in many cases that should be possible.
That's impressively simple, and very student friendly. What is the code overhead cost of that flexibility ?
Sounds like a very appealing approach. Keep us posted.
Each different type passed to "twice" creates a new function. So if "twice" gets used in different places with an integer, float, and string argument (as in the example above) we end up with three functions: For this particular example the integer version is simple enough that it'll be inlined automatically, so there's really no code overhead for it. But we will get new functions created for the float ("single") and string versions.
Once a specific version of the "twice" function is created (e.g. the "twice__s" version for strings) then it'll be re-used when further calls to "twice(string)" happen, so the overhead is only once per distinct type, not once per call.
I've been using spingui/fastspin for the past 3 weeks. What a great suite of programs!
I really like the way the terminal program comes up automatically after downloading
I have found that the find/search section in the editor doesn't seem to work. Perhaps I don't understand the metrics behind it, so can you enlighten me please,
Thanks, Ray
Postedit...
Forgot to ask. How best to include a binary file (it has z80 instructions)?
I've seen this example..
It looks like there's a bug in the search menu command... it doesn't work unless you first click on the text window that you want to search in (that is, there's no default). If you load a file, click once on the window containing that file, and then do control-f (or select the menu entry) then it should bring up a dialog box asking what you want to search for, and it should work fine after that. (If you don't click on the window after loading the file it reports an error about missing tags).
Yes, fastspin should support the standard Spin FILE command to include binary data. Are you finding that it doesn't work for you? It's certainly possible that there's a bug there, although it does seem to work in many cases.
Regards,
Eric
Yes. I’ve since tried the file insert and it works works fine.
It's all good now except for RES cog addresses don't increment.
Ah, I missed that one. Thanks for catching it!
Here's a binary that should have that fixed, along with a few other minor fixes. It's not a complete release yet so it's still marked as "beta".
Or am I wrong ?
I think you are right, here is another LST file which reports the start address / address of in the left most column, for reserved variables.
I'm just loving the compile/download/run/terminal as a single click
Meanwhile, I've noticed the "file save as" does not fill the box with the current filename. Is this an easy fix???
Sometimes I forget to close the terminal window before the next compile/etc. This prevents the running so is there any reason not to close the current terminal window and proceed? If not, is that a possibility?
BTW I am finding the editor a bit limited. Cannot tell you why. I just revert to using PropTool for anything but minor edits. Maybe it's just habit.
That would be a better output, and I'll try to tweak it to look more like that. The main thing is that the labels should have the correct addresses for the debugger, which they do now.
Thanks,
Eric
Good idea. I think you can just make a small change to src/gui.tcl to do this. All of the .tcl files are directly interpreted, so you don't need to recompile or anything, just change the .tcl file and restart spin2gui.exe. Here's the diff (I had to edit it slightly because the forum messes up @ signs, but those are only in the diff header so don't affect the actual code): I'm not sure about this. Sometimes people might have more than one Prop and be running code in one that should stay open?
Oh, the editor is definitely very limited. It should be possible to use an external editor and just use spin2gui for the compile/run portion -- spin2gui checks regularly for changes to external files. That is, it should work fine to leave both spin2gui and some other editor open with the same file, and any changes in the other editor should be noticed by spin2gui. (Whether any changes spin2gui makes are noticed by the other editor depends on that editor, of course, but if you only make changes in the other editor and only use spin2gui for compile/run then you should be fine.)
spin2gui is really kind of a quick hack, and something like @Rayman's Spin tool or Visual Studio Code would probably be nicer as a GUI for fastspin.
Ctl-F brings up the search box but after i enter something and click next, nothing happens. But i have a version about 3 weeks old.
I’ll try editing the .tcl file.
Didn’t think about more than one prop. I am happy as is.
Yes, I’ve been keeping either PropTool or Notepad++ open and editing there. Don’t have VSCode on this laptop. I’ll be home at the end of the week so I’ll have my much faster pc with ssd
I did notice that if I search for something that's not in the file then nothing happens. Could that be what's hitting you? I'll add a "not found" dialog box, that should have been there from the beginning. (I used someone else's search and replace code and didn't notice that there was no message when the search term wasn't found.)
HUB-address Cog-address hex |asm
I would prefer a csv file (semicolon or tab as delimiter) for easy tokenization:
HUB-address;Cog-address;hex;asm
A user would want to set a breakpoint in the sourcefile. For that I would need sourcefile-name and sourcefile-line, that I can find the address for the breakpoints.
sourcefile-name;sourcfile-line;HUB-address;Cog-address;hex;asm
Would that be doable?
Something like that: I'm still thinking about the labels...