@ersmith said:
I've posted a .dmg file for Mac users to my Patreon page (https://www.patreon.com/totalspectrum). This is my first time signing a Mac application, and the process took much longer to figure out than I'd expected but hopefully this will make things easier for Mac users.
@ersmith said:
I've posted a .dmg file for Mac users to my Patreon page ( https://www.patreon.com/totalspectrum ). This is my first time signing a Mac application, and the process took much longer to figure out than I'd expected but hopefully this will make things easier for Mac users.
That link goes to a 404?
The forum software doesn't terminate the URL at ")" . Here it is again:
I've just started to use FlexProp and am having a little bit of a problem compiling some code....
I also have another question too following the code below related to my first problem.
function GetEnabled() as byte
'
GetEnabled = _CoreFlags1.bitfield(00000_00000)
'
end function
function GetVisible() as byte
'
GetVisible = _CoreFlags1.bitfield(00000_00001)
'
end function
`
When I compile the above I get the following errors
"D:/MY_PROJECT/flexprop/flexprop/bin/flexspin" -2 -l -D_BAUD=230400 -O1 --fixedreal -I "D:/MY_PROJECT/flexprop/flexprop/include" "E:/MY_PROJECT/Versions/FlexProp-1/clsJD_Fwk_CoreFlags1.bas"
Propeller Spin/PASM Compiler 'FlexSpin' (c) 2011-2021 Total Spectrum Software Inc.
Version 5.2.0 Compiled on: Feb 27 2021
E:/MY_PROJECT/Versions/FlexProp-1/clsJD_Fwk_CoreFlags1.bas:42: error: Unable to determine class type
E:/MY_PROJECT/Versions/FlexProp-1/clsJD_Fwk_CoreFlags1.bas:42: error: Method reference on non-class _CoreFlags1
E:/MY_PROJECT/Versions/FlexProp-1/clsJD_Fwk_CoreFlags1.bas:42: error: Expecting object for dereference of bitfield
E:/MY_PROJECT/Versions/FlexProp-1/clsJD_Fwk_CoreFlags1.bas:50: error: Unable to determine class type
E:/MY_PROJECT/Versions/FlexProp-1/clsJD_Fwk_CoreFlags1.bas:50: error: Method reference on non-class _CoreFlags1
E:/MY_PROJECT/Versions/FlexProp-1/clsJD_Fwk_CoreFlags1.bas:50: error: Expecting object for dereference of bitfield
I can only assume that the reason this is happening is because BITFIELD is not a supported keyword in basic?
So how should I address this?
1 - revert to spin ( This works for me as there are no string in this object and I'd like to use FlexProp for its string handling capability - So later I can mix n match the objects? Spin/Spin2/Basic)
2 - work around it using below scripts
`
'-> [Pri] GetByteBit
PRI GetByteBit(plByteAddr, pbBitPos) | tmpData
'
'-> Get Byte Bit
'Procedure: GetByteBit()
'Overview: This procedure reads and returns a specific bit in a byte (0-7)
'Inputs: plByteAddr - The address where the data byte can be found
' pbBitPos - Bit position in the data byte
'Outputs: tmpData - zero or one from the data byte at bit position specified
'
'-> Process request
tmpData := BYTE[plByteAddr]
RETURN ((tmpData & (1<<pbBitPos)) >> pbBitPos)
'
'End Pub
'-> [Pri] SetByteBit
PRI SetByteBit(plByteAddr, pbBitPos)
'
'-> Set Byte Bit
'Procedure: SetByteBit()
'Overview: This procedure sets the bit specified in a data byte (0-7)
'Inputs: plByteAddr - The address where the data byte can be found
' pbBitPos - Bit position in the data byte
'Outputs: None
'
'-> Process request '
BYTE[plByteAddr] := BYTE[plByteAddr] | (1<<pbBitPos)
'
'End Pub
'-> [Pri] ClrByteBit
PRI ClrByteBit(plByteAddr, pbBitPos)
'
'-> Clear Byte Bit
'Procedure: ClrByteBit()
'Overview: This procedure clears the bit specified in a data byte (0-7)
'Inputs: plByteAddr - The address where the data byte can be found
' pbBitPos - Bit position in the data byte
'Outputs: None
'
'-> Process request
BYTE[plByteAddr] := BYTE[plByteAddr] & (!(1<<pbBitPos))
'
'End Pub
`
SORRY for the formatting...
I DID use the forum CODE tag but I think its broke because everything is left aligned..
EDIT
Sorry I forgot my second question, which relates to the IDE code formatting...
Currently if I use ** Sub, Function, End If, If** etc... the code remains black
But If I use sub, function, end if, if etc... the code then becomes colored blue or whatever color...
Is there anyway I can change it so it accepts and colors the code keywords Capitalised?
I'm not familiar with the ".bitfield()" notation in BASIC... do you recall which version of BASIC has that?
I'd probably just use direct bit manipulations, something like:
const enabledMask = 0x01
const visibleMask = 0x02
...
Function GetEnabled() as Integer
return (_CoreFlags1 AND enabledMask) <> 0
End Function
Function GetVisible() as Integer
return (_CoreFlags1 AND visibleMask) <> 0
End Function
For your second question, the syntax highlighting is set up in flexprop\src\gui.tcl, in the function setSyntaxHighlightingBasic. To support keywords with just the first letter capitalized you'll have to change the lines like:
foreach i $keywordslower {
lappend keywordsupper [string toupper $i]
}
I'll add that to the next release, but it's easy for you to change locally. Depending on how you spell type words like "long" you may want to do the same kind of thing to $typewordsupper and $opwordsupper as well.
Is this because I am missing the debug() library file? Or just because this is only available on Propeller Tool?
How can I use the debug() function on Flexprop.
@Ramon : FlexProp does not support backticks in debug statements. It should have produced a warning instead of an error though, I'll fix that. But in the meantime you probably want to use the samples that come with FlexProp rather than the ones with Propeller Tool.
Some regular (non-backtick) debug statements like uhex() and sdec() are available in FlexProp.
Hi @ersmith . Do you know why this simple test code example below using RECV wouldn't work when I send serial data? All I get are zeroes back from the serial receiver. I'm using 5.1.0 of your flexspin compiler. Is assigning a variable from RECV known to be working yet?
I get this error:
Propeller Spin/PASM Compiler 'FlexSpin' (c) 2011-2021 Total Spectrum Software Inc.
Version 5.1.0 Compiled on: Mar 13 2021
testrecv.spin2
|-ers_fmt.spin2
|-SmartSerial.spin2
testrecv.spin2:13: error: Bad number of parameters in call to hex: expected 1 found 0
@rogloh : Sorry Roger, I thought I had fixed RECV in 5.1.0, but somehow the fix never made it to the repository . It's pushed up there now and will be in the next release.
Thanks for the bug report.
I'm preparing a Quick Byte to show how to use Visual Studio Code and FlexSpin. I have properly configured VSC with the JSON tasks, keymappings, etc. When I compile my sample code I receive this:
Propeller Spin/PASM Compiler 'FlexSpin' (c) 2011-2021 Total Spectrum Software Inc.
Version 5.0.8 Compiled on: Jan 24 2021
01_quadrature_demo.spin2
|-jm_fullduplexserial.spin2
|-|-jm_nstr.spin2
|-jm_ansi.spin2
01_quadrature_demo.p2asm
Done.
Program size is 4772 bytes
When I compile and download, I receive the following:
Executing task: & 'C:\Program Files\flexprop\bin\loadp2.exe' -b230400 01_quadrature_demo.binary -t
ERROR: got incorrect initial chksum: @@ (00 40 40)
The terminal process "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Command & 'C:\Program Files\flexprop\bin\loadp2.exe' -b230400 01_quadrature_demo.binary -t" terminated with exit code: 1.
Press any key to close the terminal.
I've attached the zip file (some of JonnyMac's code).
@"Ken Gracey" Does it work with FlexProp? That's a strange error. I'd guess it's a hardware issue... I may have seen something like that before, but was a long time ago. Maybe board needs more power?
@Rayman said:
@"Ken Gracey" Does it work with FlexProp? That's a strange error. I'd guess it's a hardware issue... I may have seen something like that before, but was a long time ago. Maybe board needs more power?
Same error on FlexProp. There must be something simple and wrong with my setup, especially if it works on yours.
I think I've seen this message occasionally before myself (on a Mac) but can't really recall what if anything I did to get rid of it. If an SD card is fitted to the P2 board try yanking that out perhaps...? Or yanking the USB cable and replacing and/or replugging it to re-enumate etc.
// every so often we get a 0 byte first before the checksum; if
// we do, throw it away
if (buffer[0] == 0 && buffer[2] == '@') {
buffer[0] = buffer[2];
rx_timeout((uint8_t *)&buffer[2], 1, 100);
}
if (buffer[0] != '@' || buffer[1] != '@') {
printf("ERROR: got incorrect initial chksum: %c%c%c (%02x %02x %02x)\n", buffer[0], buffer[1], buffer[2], buffer[0], buffer[1], buffer[2]);
promptexit(1);
}
It appears that you have been getting a 0 followed by two @'s which doesn't make sense as being possible in the logic above now, so are you using the latest 0.046 version of loadp2 Ken? It looks like Eric has made a recent change in that area to deal with this timeout and checked it into github 3 days ago.
@"Ken Gracey" as Roger said there's a recent fix to loadp2 to work around your issue (which seems to crop up sometimes on P2 Edge boards, I'm not sure why). You'll need loadp2 v046, which I've attached to this message. Not sure how to make this work with VSC, but in FlexProp just replace the flexprop\bin\loadp2.exe with the one from this zip file.
I'm surprised this is just showing up now, after all this time...
I don't think I've seen this issue before.
Did see strange things like this when I had power shorted to ground on a connected board though...
(I was surprised it did anything at all, but it did... )
Comments
There seems to be an issue with _lockrel(x) as it does not find it so I used _lockclr(x).
Mike
In waht context are you finding that issue?
That link goes to a 404?
The forum software doesn't terminate the URL at ")" . Here it is again:
https://www.patreon.com/totalspectrum
(It's also in my signature.)
Well yes, you need to put spaces around it. Alternatively, use an explicit hypelink like this:
[Link text](http://example.com/index.html)
This is the error I get with locks
testLock.c:45: error: unknown identifier _lockrel used in function call
testLock.c:45: error: Unknown symbol _lockrel
Mike
Ah, I see (or "C"). Thanks, Mike, I will add an alias from _lockrel to _lockclr.
I've just started to use FlexProp and am having a little bit of a problem compiling some code....
I also have another question too following the code below related to my first problem.
`
Class clsJD_Fwk_CoreFlags1
'
'
'-> [Definition] CoreFlags1
dim _CoreFlags1 as ubyte
'
'-> [Definition] CoreFlags1 Structure
'-> CoreFlags1 Object Structure
' bit0 Enabled (0=False/1=True)
' bit1 Visible (0=False/1=True)
' bit2 reserved
' bit3 reserved
' bits4 reserved
' bits5 reserved
' bits6 reserved
' bits7 reserved
function GetEnabled() as byte
'
GetEnabled = _CoreFlags1.bitfield(00000_00000)
'
end function
function GetVisible() as byte
'
GetVisible = _CoreFlags1.bitfield(00000_00001)
'
end function
`
When I compile the above I get the following errors
"D:/MY_PROJECT/flexprop/flexprop/bin/flexspin" -2 -l -D_BAUD=230400 -O1 --fixedreal -I "D:/MY_PROJECT/flexprop/flexprop/include" "E:/MY_PROJECT/Versions/FlexProp-1/clsJD_Fwk_CoreFlags1.bas"
Propeller Spin/PASM Compiler 'FlexSpin' (c) 2011-2021 Total Spectrum Software Inc.
Version 5.2.0 Compiled on: Feb 27 2021
E:/MY_PROJECT/Versions/FlexProp-1/clsJD_Fwk_CoreFlags1.bas:42: error: Unable to determine class type
E:/MY_PROJECT/Versions/FlexProp-1/clsJD_Fwk_CoreFlags1.bas:42: error: Method reference on non-class _CoreFlags1
E:/MY_PROJECT/Versions/FlexProp-1/clsJD_Fwk_CoreFlags1.bas:42: error: Expecting object for dereference of bitfield
E:/MY_PROJECT/Versions/FlexProp-1/clsJD_Fwk_CoreFlags1.bas:50: error: Unable to determine class type
E:/MY_PROJECT/Versions/FlexProp-1/clsJD_Fwk_CoreFlags1.bas:50: error: Method reference on non-class _CoreFlags1
E:/MY_PROJECT/Versions/FlexProp-1/clsJD_Fwk_CoreFlags1.bas:50: error: Expecting object for dereference of bitfield
I can only assume that the reason this is happening is because BITFIELD is not a supported keyword in basic?
So how should I address this?
1 - revert to spin ( This works for me as there are no string in this object and I'd like to use FlexProp for its string handling capability - So later I can mix n match the objects? Spin/Spin2/Basic)
2 - work around it using below scripts
`
'-> [Pri] GetByteBit
PRI GetByteBit(plByteAddr, pbBitPos) | tmpData
'
'-> Get Byte Bit
'Procedure: GetByteBit()
'Overview: This procedure reads and returns a specific bit in a byte (0-7)
'Inputs: plByteAddr - The address where the data byte can be found
' pbBitPos - Bit position in the data byte
'Outputs: tmpData - zero or one from the data byte at bit position specified
'
'-> Process request
tmpData := BYTE[plByteAddr]
RETURN ((tmpData & (1<<pbBitPos)) >> pbBitPos)
'
'End Pub
'-> [Pri] SetByteBit
PRI SetByteBit(plByteAddr, pbBitPos)
'
'-> Set Byte Bit
'Procedure: SetByteBit()
'Overview: This procedure sets the bit specified in a data byte (0-7)
'Inputs: plByteAddr - The address where the data byte can be found
' pbBitPos - Bit position in the data byte
'Outputs: None
'
'-> Process request '
BYTE[plByteAddr] := BYTE[plByteAddr] | (1<<pbBitPos)
'
'End Pub
'-> [Pri] ClrByteBit
PRI ClrByteBit(plByteAddr, pbBitPos)
'
'-> Clear Byte Bit
'Procedure: ClrByteBit()
'Overview: This procedure clears the bit specified in a data byte (0-7)
'Inputs: plByteAddr - The address where the data byte can be found
' pbBitPos - Bit position in the data byte
'Outputs: None
'
'-> Process request
BYTE[plByteAddr] := BYTE[plByteAddr] & (!(1<<pbBitPos))
'
'End Pub
`
SORRY for the formatting...
I DID use the forum CODE tag but I think its broke because everything is left aligned..
EDIT
Sorry I forgot my second question, which relates to the IDE code formatting...
Currently if I use ** Sub, Function, End If, If** etc... the code remains black
But If I use sub, function, end if, if etc... the code then becomes colored blue or whatever color...
Is there anyway I can change it so it accepts and colors the code keywords Capitalised?
Thanks.
I'm not familiar with the ".bitfield()" notation in BASIC... do you recall which version of BASIC has that?
I'd probably just use direct bit manipulations, something like:
For your second question, the syntax highlighting is set up in flexprop\src\gui.tcl, in the function setSyntaxHighlightingBasic. To support keywords with just the first letter capitalized you'll have to change the lines like:
to
I'll add that to the next release, but it's easy for you to change locally. Depending on how you spell type words like "long" you may want to do the same kind of thing to $typewordsupper and $opwordsupper as well.
Thank You for such a prompt resolution.
I should be able to mange the keywords change easy enough with your example above.
Sorry I meant (is it called) FlexBasic The basic in the Ide...
Cheers too for the masks on the bit state function...
Hello all,
Thank you Eric for Flexprop !
I am using the Propeller tool (v2.5.2) blinky example ('Hello Blinky.spin2') into Flexprop (v5.2). It reports error in the debug functions:
Is this because I am missing the debug() library file? Or just because this is only available on Propeller Tool?
How can I use the debug() function on Flexprop.
Here is an include file I made for use with Visual Code as it has code completion.
You have the Smart pins definitions built into the compiler and Visual Code can not see them so this include helps to resolve those items.
Mike
@Ramon : FlexProp does not support backticks in debug statements. It should have produced a warning instead of an error though, I'll fix that. But in the meantime you probably want to use the samples that come with FlexProp rather than the ones with Propeller Tool.
Some regular (non-backtick) debug statements like uhex() and sdec() are available in FlexProp.
Thanks, Mike, I'll add that to the distribution. What's the purpose of the "Sudo" in the first comment?
@RossH : Mike's smartpins.h has #defines for all of Chip's standard smartpin symbols. You may want to add this (or something like it) to Catalina.
"Sudo", Don't know, lost that brain cell some where. Have been using it now for several weeks.
Mike
Hi @ersmith . Do you know why this simple test code example below using RECV wouldn't work when I send serial data? All I get are zeroes back from the serial receiver. I'm using 5.1.0 of your flexspin compiler. Is assigning a variable from RECV known to be working yet?
All I get is zeroes back when I press keys in the terminal...
( Entering terminal mode. Press Ctrl-] to exit. )
test
got 00000000 got 00000000 got 00000000 got 00000000 got 00000000 got 00000000 got 00000000
Also if I simplify to this:
I get this error:
Propeller Spin/PASM Compiler 'FlexSpin' (c) 2011-2021 Total Spectrum Software Inc.
Version 5.1.0 Compiled on: Mar 13 2021
testrecv.spin2
|-ers_fmt.spin2
|-SmartSerial.spin2
testrecv.spin2:13: error: Bad number of parameters in call to hex: expected 1 found 0
Perhaps pseudo (false or not real, renamed in this case? i.e. pseudo-code) rather than sudo (Xnix super user do command)
@rogloh : Sorry Roger, I thought I had fixed RECV in 5.1.0, but somehow the fix never made it to the repository . It's pushed up there now and will be in the next release.
Thanks for the bug report.
Hello @ersmith
I'm preparing a Quick Byte to show how to use Visual Studio Code and FlexSpin. I have properly configured VSC with the JSON tasks, keymappings, etc. When I compile my sample code I receive this:
Propeller Spin/PASM Compiler 'FlexSpin' (c) 2011-2021 Total Spectrum Software Inc.
Version 5.0.8 Compiled on: Jan 24 2021
01_quadrature_demo.spin2
|-jm_fullduplexserial.spin2
|-|-jm_nstr.spin2
|-jm_ansi.spin2
01_quadrature_demo.p2asm
Done.
Program size is 4772 bytes
When I compile and download, I receive the following:
Executing task: & 'C:\Program Files\flexprop\bin\loadp2.exe' -b230400 01_quadrature_demo.binary -t
ERROR: got incorrect initial chksum: @@ (00 40 40)
The terminal process "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Command & 'C:\Program Files\flexprop\bin\loadp2.exe' -b230400 01_quadrature_demo.binary -t" terminated with exit code: 1.
Press any key to close the terminal.
I've attached the zip file (some of JonnyMac's code).
Thanks,
Ken Gracey
@"Ken Gracey" I just tried it and it worked (well, it didn't give any errors anyway)... Try this loadp2.
I attached the binary too. Compiled with FlexProp: Version 5.0.8 Compiled on: Jan 24 2021
Thanks @Rayman - I replaced my loadp2.exe and still receive the following error about checksum:
ERROR: got incorrect initial chksum: @@ (00 40 40)
I'm not sure what the error means - maybe the compiled test and downloaded binary don't match in size or some other value?
Ken Gracey
@"Ken Gracey" Does it work with FlexProp? That's a strange error. I'd guess it's a hardware issue... I may have seen something like that before, but was a long time ago. Maybe board needs more power?
Same error on FlexProp. There must be something simple and wrong with my setup, especially if it works on yours.
Ken Gracey
I was using an eval board with nothing connected to it...
Hope you figure it out!
I think I've seen this message occasionally before myself (on a Mac) but can't really recall what if anything I did to get rid of it. If an SD card is fitted to the P2 board try yanking that out perhaps...? Or yanking the USB cable and replacing and/or replugging it to re-enumate etc.
>
Ah! Thanks. I figured someone would do this eventually. I will look at adding them to Catalina and issue an update.
Ross.
Just looked at the (latest) loadp2 code:
It appears that you have been getting a 0 followed by two @'s which doesn't make sense as being possible in the logic above now, so are you using the latest 0.046 version of loadp2 Ken? It looks like Eric has made a recent change in that area to deal with this timeout and checked it into github 3 days ago.
@"Ken Gracey" as Roger said there's a recent fix to loadp2 to work around your issue (which seems to crop up sometimes on P2 Edge boards, I'm not sure why). You'll need loadp2 v046, which I've attached to this message. Not sure how to make this work with VSC, but in FlexProp just replace the flexprop\bin\loadp2.exe with the one from this zip file.
I'm surprised this is just showing up now, after all this time...
I don't think I've seen this issue before.
Did see strange things like this when I had power shorted to ground on a connected board though...
(I was surprised it did anything at all, but it did... )