Thanks dgately for the Spin equivalent of test1.x. There is one more component missing, PASM. I wonder if there is a PASM professional that could donate a pure PASM version for test1.x. Just to see the code size difference and coding efficiency.
The FlexBasic and FlexC code size was exactly the same, while the Spin version came in at less than half the code size. I wonder if the PASM version would come in even less than the Spin version, in code size.
In FlexGUI, so far, we have three choices for comparison, FlexC, FlexBasic, and Spin. Since test1.bas and test1.c come in at the same size, it seems like FlexBasic is the most desirable, for simplicity to work with, so far. The Spin version, comes in with a smaller code size, but it is a little bit more involved, code wise.
The FlaxBasic and FlexC versions are using the full printf functionality (even if you use simpletools.h print()). The spin one is not.
Also, dgately, is your spin one compiled with FlexGui (fastspin) or with proptool/pnut?
Both of these will factor in to the final file size. Especially if the spin size is from compiling with proptool/pnut since those produce bytecode and FlexGui produces PASM.
I just took a look at dgately hello.spin program, and I did not notice, at first look, the printf(). When did that get added.
Also I noticed in the /spin folder, std_text_routines.spinh, but I am not seeing how this file gets added to hello.spin. I do not see it being called in the OBJ.
I also just recompiled hello.spin with full optimization, and got a 188 byte reduction, in code size.
If some of the existing Spin device drivers get cleaned up, as they are added to FlexGUI, I might have to reconsider Spin.
Also I noticed in the /spin folder, std_text_routines.spinh, but I am not seeing how this file gets added to hello.spin. I do not see it being called in the OBJ.
I started to play around with flexBasic, and I am having a lot of trouble to get this to work.
Thanks
Ray
dim ser as class using "FullDuplexSerial.spin"
open ser(0, 1, 0, 115200) as #2
print #2, "hello, world"
"E:/flexgui/bin/fastspin" -D_BAUD=115200 -l -O2 -I "E:/flexgui/include" "E:/programs/flexc/basic/test1.bas"
Propeller Spin/PASM Compiler 'FastSpin' (c) 2011-2020 Total Spectrum Software Inc.
Version 4.2.1 Compiled on: Jun 7 2020
test1.bas
|-FullDuplexSerial.spin
E:/programs/flexc/basic/test1.bas:5: error: Object called is not a function
child process exited abnormally
Finished at Thu Jun 11 14:17:07 2020
I started to play around with flexBasic, and I am having a lot of trouble to get this to work.
Thanks
Ray
dim ser as class using "FullDuplexSerial.spin"
open ser(0, 1, 0, 115200) as #2
print #2, "hello, world"
"E:/flexgui/bin/fastspin" -D_BAUD=115200 -l -O2 -I "E:/flexgui/include" "E:/programs/flexc/basic/test1.bas"
Propeller Spin/PASM Compiler 'FastSpin' (c) 2011-2020 Total Spectrum Software Inc.
Version 4.2.1 Compiled on: Jun 7 2020
test1.bas
|-FullDuplexSerial.spin
E:/programs/flexc/basic/test1.bas:5: error: Object called is not a function
child process exited abnormally
Finished at Thu Jun 11 14:17:07 2020
I've never used FlexBASIC but my guess is that you need to do this:
"E:/flexgui/bin/fastspin" -D_BAUD=115200 -l -O2 -I "E:/flexgui/include" "E:/programs/flexc/basic/test1.bas"
Propeller Spin/PASM Compiler 'FastSpin' (c) 2011-2020 Total Spectrum Software Inc.
Version 4.2.1 Compiled on: Jun 7 2020
test1.bas
|-FullDuplexSerial.spin
E:/programs/flexc/basic/test1.bas:5: error: syntax error, unexpected open, expecting identifier or program
child process exited abnormally
Finished at Thu Jun 11 14:35:07 2020
You have to set up the serial device explicitly (OPEN doesn't know what methods are needed for that, it's designed to work with any objects not just FullDuplexSerial) and then use SendRecvDevice() to pass pointers to methods for transmit, receive, and close:
ser.start(31, 30, 0, 115_200)
open SendRecvDevice(@ser.tx, @ser.rx, @ser.stop) as #2
If your particular serial driver doesn't have a "stop" or "close" method you can pass "nil" in its place.
There's a brief discussion of this in the BASIC manual under OPEN, and examples in LED_Matrix/bdemo.bas and vga/basdemo.bas (although these are both for P2, the principles are the same for P1).
Thanks Eric, I thought this was going to be easy to do, but it looks like a little more complicated than I would like. When I use FreeBasic open com, it seemed to be very straight forward and easy.
Now I will try FlexC, just to see if it gets any easier.
Having two lines instead of one isn't really *that* complicated. In any case you don't have to use the "open" if you don't want to, you can always just treat the object the same way you do in Spin (use ser.start, ser.tx, etc. directly). You only need "open as #2" if you want to use BASIC commands like "print #2".
This works, now is there a more functional(more commands) serial program that has been made available for FlexBasic. I think there was an ExtendedFullDuplexSerial.spin, but that only added a few more commands.
dim ser as class using "FullDuplexSerial.spin"
rem open ser(0, 1, 0, 115200) as #2
rem print #2, "hello, world"
ser.start(0, 1, 0, 115200)
ser.tx(128)
pausems 150
ser.tx(131)
pausems 3000
ser.tx(128)
This program seems to work, except, it is having a problem in the terminal screen. Since this is a user IO program, when I type in a command, a lot of times the character that gets presented, on the screen, is garbled. Not sure if is a problem with 'input' command or the terminal program itself. This is occurring quite often.
Ray
' test1.bas
' June 11, 2020
'
dim ser as class using "efds.spin"
ser.start(0, 1, 0, 115200)
dim inBuff as string
print "Type 'help' for Sytem Menu."
do
print "> ";
input inBuff
if inBuff = "passive" then
crPassive
else if inBuff = "safe" then
crSafe
else if inBuff = "help" then
crMenu
else if inBuff = "crquit" then
crQuit
else
print "Invalid Command!"
end if
loop
''''''''''''''''''''''''''''''
sub crPassive
ser.tx(128)
end sub
sub crSafe
ser.tx(131)
end sub
sub crQuit
crPassive
ser.tx(173)
end sub
sub crMenu
print " System Menu"
print "help - Show this menu."
print "safe - CR2 safe mode."
print "passive - CR2 passive mode."
end sub
This program also gets garbled characters in the terminal screen, when keying in. I thought maybe it was just the FlexBasic program, but it is also occurring in FlexC program.
I was trying to implement reboot() in FlexC:
#define reboot() __builtin_propeller_clkset(0x80)
and I get the error below. This particular #define works in SimpleIDE, but for some reason it does not want to work in FlexC.
Ray
"E:/flexgui/bin/fastspin" -D_BAUD=115200 -l -O2 -I "E:/flexgui/include" "E:/programs/flexc/test1n/test1n.c"
Propeller Spin/PASM Compiler 'FastSpin' (c) 2011-2020 Total Spectrum Software Inc.
Version 4.2.1 Compiled on: Jun 7 2020
test1n.c
|-efds.spin
|-|-FullDuplexSerial.spin
getStr.c
fmt.c
safe_gets.c
posixio.c
bufio.c
errno.c
strcmp.c
E:/programs/flexc/test1n/test1n.c:70: error: unknown identifier __builtin_propeller_clkset used in function call
E:/programs/flexc/test1n/test1n.c:70: error: Unknown symbol __builtin_propeller_clkset
child process exited abnormally
Finished at Mon Jun 15 08:45:38 2020
@Rsadeika : Ray, I've uploaded a beta version of flexgui/fastspin 4.2.2 to my Patreon page. It's got _reboot() fixed and handles serial input better on the P1.
I did a quick test of the new FlexC, and it looks like, so far, it is working as expected, it reboots and no garbled characters, thanks.
It was quite a while back, when I asked you about the possibility of implementing CMM mode, and you said maybe down the road at some point you may do it. Have you come down the road far enough that you will consider implementing CMM mode?
I am starting to give up on SimpleIDE, it would be nice if FlecC started to work more like SimpleIDE, and CMM was one of the reasons I was hanging on.
I am experimenting with FlexBASIC and telnet. The program below compiles fine and I get the '> ' on the Tera Term terminal screen. When I type in 'test' I am not getting the "You typed test" on the Tera Term terminal screen. Is input waiting for some kind of termination char other than CR or LF?
With the new FlexGUI I pinned the application to the task bar, and it shows a Geany icon, is that your new icon or did Windows do that.
Ray
' cr2net.bas
'
' June 28, 2020
dim telnet as class using "efds.spin"
telnet.start(31, 30, 0, 115200)
open SendRecvDevice(@telnet.tx, @telnet.rx, @telnet.stop) as #2
dim inBuff as string
telnet.str("Here we are.")
telnet.tx(10)
do
print #2, "> ";
input inBuff
if inBuff = "test" then
print #2,"You typed test"
end if
loop
dim telnet as class using "efds.spin"
telnet.start(31, 30, 0, 115200)
open SendRecvDevice(@telnet.tx, @telnet.rx, @telnet.stop) as #2
dim inBuff$ as string ' note: inBuff($)
telnet.str("Here we are.")
telnet.tx(10)
do
input "> ", inBuff$
if inBuff$ = "test" then
print "You typed test"
end if
loop
( Entering terminal mode. Press Ctrl-] to exit. )
> test
You typed test
>
Hi,
I try to compile a C program for P1 with 4.2.3 and get several:
error: fit 496 failed: pc is xxx (513 or 658)
I tried all the compiler options. Can you totally switch off the fcache?
Does this happen when the program is too large?
Many thanks!
Well, it's a problem when the program is too "complicated" (has many local variables and/or constants that must be stored in COG memory), which usually means it's too large. You can switch off fcache with "--fcache=0", that might help.
Having many strings in a program is often one of the problems associated with this; on P1 all large constants (including string addresses) are stored in COG memory. This only affects literal strings, not strings kept in variables. I think I know how I might be able to change this using a pair of MOVD/MOVS instructions to load the address instead of keeping it in registers, but I haven't had a chance to try this yet.
I am experimenting with FlexBASIC and telnet. The program below compiles fine and I get the '> ' on the Tera Term terminal screen. When I type in 'test' I am not getting the "You typed test" on the Tera Term terminal screen. Is input waiting for some kind of termination char other than CR or LF?
In your code you've got "input inBuff" rather than "input #2 inBuff". Did you want to read from the serial (input) or the telnet (input #2)? I'm guessing probably the latter.
With the new FlexGUI I pinned the application to the task bar, and it shows a Geany icon, is that your new icon or did Windows do that.
Huh, that's weird, For me it's a feather icon (for the Tcl interpreter). Not sure why Windows would do that to you!
You asked earlier about CMM. I did try to create a compressed mode a while ago, but I couldn't get it to work properly and I just haven't had time to get back to it.
Hi,
I try to compile a C program for P1 with 4.2.3 and get several:
error: fit 496 failed: pc is xxx (513 or 658)
I tried all the compiler options. Can you totally switch off the fcache?
Does this happen when the program is too large?
Many thanks!
Well, it's a problem when the program is too "complicated" (has many local variables and/or constants that must be stored in COG memory), which usually means it's too large. You can switch off fcache with "--fcache=0", that might help.
Having many strings in a program is often one of the problems associated with this; on P1 all large constants (including string addresses) are stored in COG memory. This only affects literal strings, not strings kept in variables. I think I know how I might be able to change this using a pair of MOVD/MOVS instructions to load the address instead of keeping it in registers, but I haven't had a chance to try this yet.
Regards,
Eric
- Thank you for the informations. - In this case the problem is the number of constants in cog ram. I had been just curious, if I could compile a program out of the box. - Well, yes, CMM and other workarounds would be nice.
What I find really good, is the checkbox to use a different editor. It is not necessary to reinvent these things. I use Notepad++ or Geany.
In your code you've got "input inBuff" rather than "input #2 inBuff".
I want to capture input from the telnet terminal. When I compile, I get an error for "input #2 inBuff".
I want to expand this program to work with my robot project. I want to be able to connect to the robot via WiFi at any time. Since FlexGUI does not have an accessible stand alone terminal, the telnet connection is the next best option, I think.
Ray
' cr2net.bas
'
' June 28, 2020
dim telnet as class using "efds.spin"
telnet.start(31, 30, 0, 115200)
open SendRecvDevice(@telnet.tx, @telnet.rx, @telnet.stop) as #2
dim inBuff as string
telnet.str("Here we are.")
telnet.tx(10)
do
print #2, "> ";
input #2 inBuff
if inBuff = "test" then
print #2, "You typed test"
else
print #2, "Invalid Command!"
end if
loop
"D:/flexgui/bin/fastspin" -D_BAUD=115200 -l -O2 -I "D:/flexgui/include" "D:/programs/flexgui/flexbasic/cr2net/cr2net.bas"
Propeller Spin/PASM Compiler 'FastSpin' (c) 2011-2020 Total Spectrum Software Inc.
Version 4.2.3 Compiled on: Jun 27 2020
cr2net.bas
|-efds.spin
|-|-FullDuplexSerial.spin /programs/flexgui/flexbasic/cr2net/cr2net.bas:18: error: syntax error, unexpected '#'
child process exited abnormally
Finished at Mon Jun 29 07:28:32 2020
Comments
hello.spin
Program size is 3072 bytes
The FlexBasic and FlexC code size was exactly the same, while the Spin version came in at less than half the code size. I wonder if the PASM version would come in even less than the Spin version, in code size.
In FlexGUI, so far, we have three choices for comparison, FlexC, FlexBasic, and Spin. Since test1.bas and test1.c come in at the same size, it seems like FlexBasic is the most desirable, for simplicity to work with, so far. The Spin version, comes in with a smaller code size, but it is a little bit more involved, code wise.
Ray
Also, dgately, is your spin one compiled with FlexGui (fastspin) or with proptool/pnut?
Both of these will factor in to the final file size. Especially if the spin size is from compiling with proptool/pnut since those produce bytecode and FlexGui produces PASM.
Yes, compiled with FlexGui (Fastspin)!
Also I noticed in the /spin folder, std_text_routines.spinh, but I am not seeing how this file gets added to hello.spin. I do not see it being called in the OBJ.
I also just recompiled hello.spin with full optimization, and got a 188 byte reduction, in code size.
If some of the existing Spin device drivers get cleaned up, as they are added to FlexGUI, I might have to reconsider Spin.
Ray
Thanks
Ray
Ray
There's a brief discussion of this in the BASIC manual under OPEN, and examples in LED_Matrix/bdemo.bas and vga/basdemo.bas (although these are both for P2, the principles are the same for P1).
Now I will try FlexC, just to see if it gets any easier.
Ray
Ray
Ray
#define reboot() __builtin_propeller_clkset(0x80)
and I get the error below. This particular #define works in SimpleIDE, but for some reason it does not want to work in FlexC.
Ray
Ray
It was quite a while back, when I asked you about the possibility of implementing CMM mode, and you said maybe down the road at some point you may do it. Have you come down the road far enough that you will consider implementing CMM mode?
I am starting to give up on SimpleIDE, it would be nice if FlecC started to work more like SimpleIDE, and CMM was one of the reasons I was hanging on.
Ray
I try to compile a C program for P1 with 4.2.3 and get several:
error: fit 496 failed: pc is xxx (513 or 658)
I tried all the compiler options. Can you totally switch off the fcache?
Does this happen when the program is too large?
Many thanks!
With the new FlexGUI I pinned the application to the task bar, and it shows a Geany icon, is that your new icon or did Windows do that.
Ray
dgately
Well, it's a problem when the program is too "complicated" (has many local variables and/or constants that must be stored in COG memory), which usually means it's too large. You can switch off fcache with "--fcache=0", that might help.
Having many strings in a program is often one of the problems associated with this; on P1 all large constants (including string addresses) are stored in COG memory. This only affects literal strings, not strings kept in variables. I think I know how I might be able to change this using a pair of MOVD/MOVS instructions to load the address instead of keeping it in registers, but I haven't had a chance to try this yet.
Regards,
Eric
In your code you've got "input inBuff" rather than "input #2 inBuff". Did you want to read from the serial (input) or the telnet (input #2)? I'm guessing probably the latter.
Huh, that's weird, For me it's a feather icon (for the Tcl interpreter). Not sure why Windows would do that to you!
You asked earlier about CMM. I did try to create a compressed mode a while ago, but I couldn't get it to work properly and I just haven't had time to get back to it.
Regards,
Eric
- Thank you for the informations. - In this case the problem is the number of constants in cog ram. I had been just curious, if I could compile a program out of the box. - Well, yes, CMM and other workarounds would be nice.
What I find really good, is the checkbox to use a different editor. It is not necessary to reinvent these things. I use Notepad++ or Geany.
Regards Christof
I want to expand this program to work with my robot project. I want to be able to connect to the robot via WiFi at any time. Since FlexGUI does not have an accessible stand alone terminal, the telnet connection is the next best option, I think.
Ray