Eric,Good news! After a day of programing and compiling, not once did I encounter the compilor errors that kept me beating my head against the wall. I do have a question, is it possible to preset the terminal only mode so that I can switch it on and observe the data out from the running prop?
Jim
Eric,Good news! After a day of programing and compiling, not once did I encounter the compilor errors that kept me beating my head against the wall. I do have a question, is it possible to preset the terminal only mode so that I can switch it on and observe the data out from the running prop?
Unfortunately on Linux any attempt to open a serial terminal raises DTR, which causes the Prop to reset. You'd have to have special P2 hardware that ignores DTR.
I'm pretty sure I tried the HUPCL flag (and all sorts of other variations). I even dug into the Linux kernel source code for the serial driver and (at the time at least) found that there was no way to defeat the reset on baud setting. But perhaps that's changed since then. If anyone has found a way to avoid DTR/RTS issues in LInux I'd like to hear.
Eric,
I am having a problem with the archive function in 5.9.25 beta. when I zip a file, the top object is not included. See the attached file: The main program (for which the file is named ) it shows all of the code from all the attached objects but the top file is missing.
Jim
It is there, but in a subdirectory. Maybe the compressor program used is a bit unusual, I note I need to use a dedicated compression/decompression program (KDE's Ark) to extract anything at all on my desktop.
@RS_Jim said:
Eric,
I am having a problem with the archive function in 5.9.25 beta. when I zip a file, the top object is not included. See the attached file: The main program (for which the file is named ) it shows all of the code from all the attached objects but the top file is missing.
Jim
It's the very first entry in the .zip file. It is a little unusual because it has an absolute path starting with /home/jim/Library/New_P2robot.
You might find it useful to keep all of your files in the same directory, rather than relying on setting library paths and pulling them in from there. It might reduce the number of version conflicts you seem to be having.
Eric,
is wordmove not a valid spin2 instruction? I get a compiler error "object called is not a function." I was trying wordmove(@destination,@source,ct)
Jim
edit: my error! I was using() instead of[]
I've released FlexProp 5.9.25 binaries on both Patreon and github. There are a lot of bug fixes (so it's worth updating to this version). Other changes include:
A way to force functions to be inlined
A new libc.spin2 for easier calling of C functions from Spin
An unmount command (UMOUNT) for BASIC
An option to create ZIP files from a project (this is still somewhat experimental)
An undocumented change is that anonymous objects are permitted in Spin2. This received no interest when I proposed it here on the forums, so probably nobody cares, but it made the libc.spin2
implementation much easier. It remains undocumented because I may change it in the future.
And of course the day after releasing 5.9.25 I found two significant bugs . So I've updated the release now to 5.9.26. Besides the bug fixes, there are now macros to make it easier to test for specific versions of FlexC / FlexSpin.
Eric
I went to install the upgrade and the attached screenshot is what happens when I do. I used the make file from the readme. Tried this several times always with the ending abort.
Jim
@RS_Jim said:
Eric
I went to install the upgrade and the attached screenshot is what happens when I do. I used the make file from the readme. Tried this several times always with the ending abort.
Jim
You should already have git installed on your Linux machine, don't you? If so, no need to install it again (and whatever problem you're having installing it is nothing to do with flexprop). As the README says, after the first installation you can skip the first 4 steps (the ones starting with sudo).
@ersmith
Is there a chance, that you would like to enhance the features for those "external" global cog variables?
Reason to ask is, that I still feel tempted some times to try again on this MC6809 Coco3 OS9 emulator written in C. For it's cpu registers it uses:
typedef union
{
unsigned short Reg;
struct
{
unsigned char lsb,msb;
} B;
} cpuregister;
This way the registers can be accessed as 8bit and as well as 16bit.
Just an idea....
Christof
Question:
As I am not working from a Linux command line. What is the best way to compile from multiple files using the FlexProp IDE?
Thanks a lot!
Christof
@"Christof Eb." said:
@ersmith
Is there a chance, that you would like to enhance the features for those "external" global cog variables?
I'd like to do that, but it may take some time to write the code for the cases where only part of the 32 bit registers are used (especially on P1 it's a pain to extract bytes from COG memory locations).
Question:
As I am not working from a Linux command line. What is the best way to compile from multiple files using the FlexProp IDE?
Unfortunately the IDE doesn't support project files or anything like that, so you'll have to either write a new file that #includes all the other files (which may not work if there are conflicting definitions), or else add __fromfile() declarations to the header files.
@ersmith What happens if two (or more) different cogs attempt to involk _gc_collect()? Will this result in a conflict? Does the collection process occur only for the vars/strings being used by the cog in which it is called, or does the collector act globally across all cogs and all heap objects?
@JRoark said:
@ersmith What happens if two (or more) different cogs attempt to involk _gc_collect()? Will this result in a conflict? Does the collection process occur only for the vars/strings being used by the cog in which it is called, or does the collector act globally across all cogs and all heap objects?
Memory could be recycled by a cog if there are no references within HUB or within the cog's own memory, so it's probably safest to do all memory allocation within the main cog; second safest is to always put allocated memory into a global variable or other shared resource.
@iseries said:
If I define a C function with character values does it push a long onto the stack or just the character since all variables end up in registers?
__builtin_alloca(siz) allocates from the stack. I use it all the time because the stack is all of spare hubRAM.
@iseries said:
Is there a way to get the current stack pointer so that I can do math on it to determine how much stack space I need for a recursive function?
You can call __getsp(), which returns the stack pointer; or for a more portable solution something like __builtin_alloca(1) would work.
If I define a C function with character values does it push a long onto the stack or just the character since all variables end up in registers?
Generally local variables take (at least) 4 bytes each regardless of how big they're declared. There can be exceptions for functions where all the locals have to be stack allocated, but that really kills performance so I wouldn't recommend it.
@ersmith Eric,
I downloaded the file that @JonnyMac attached to "how do I get a return array" post #12 on the pasm2 catagory. I tried to compile in flexprop to no avail. two errors crop up:
1 regexec
2 reg[]
I looked them up on "Hello Propeller" and they are commands that 1 initiate an isr pasam routine and 2 access a "res" in memory of thr isr. Can you suggest a work around, I would really like to try out Cgracy's isr for the adc. I tried to attach the file here but iPad not being cooperative.
edit: I moved to the computer and attached a file that quotes the REG function. Is there a work around or does this need to be a bug fix?
Thanks
Jim
REGEXEC is not supported by FlexSpin, and probably never will be supported. You'll have to find a different way to implement this. Probably the logic could be put into a small Spin2 function that is called periodically, or else the whole thing could be run in another COG.
@Ariba : Unfortunately there's a long-standing (and hard to fix) bug in FlexC causing problems when the same identifier is used for both a type name and variable name, and you've hit a variant of it where a type name is re-used as a class member. The work-around is simple, change the typedef'd enum from "base_type" to "base_type_t" and then use "base_type_t base_type" instead of "base_type base_type" near line 145 of defs.c.
Comments
OK, installed and running flexprop 5.9.25Beta. I will be watching for those errors.
Thanks
Jim
Forgot to thank you for the assist.
@Rayman
Same
Eric,Good news! After a day of programing and compiling, not once did I encounter the compilor errors that kept me beating my head against the wall. I do have a question, is it possible to preset the terminal only mode so that I can switch it on and observe the data out from the running prop?
Jim
Unfortunately on Linux any attempt to open a serial terminal raises DTR, which causes the Prop to reset. You'd have to have special P2 hardware that ignores DTR.
Allegedly you can configure the serial port to not do that: https://raspberrypi.stackexchange.com/questions/9695/disable-dtr-on-ttyusb0
I'm pretty sure I tried the HUPCL flag (and all sorts of other variations). I even dug into the Linux kernel source code for the serial driver and (at the time at least) found that there was no way to defeat the reset on baud setting. But perhaps that's changed since then. If anyone has found a way to avoid DTR/RTS issues in LInux I'd like to hear.
Ok, if I get the hupc command to work, is the terminal configured the same as my last call to compile and run?
Jim
Eric,
I am having a problem with the archive function in 5.9.25 beta. when I zip a file, the top object is not included. See the attached file: The main program (for which the file is named ) it shows all of the code from all the attached objects but the top file is missing.
Jim
It is there, but in a subdirectory. Maybe the compressor program used is a bit unusual, I note I need to use a dedicated compression/decompression program (KDE's Ark) to extract anything at all on my desktop.
It's the very first entry in the .zip file. It is a little unusual because it has an absolute path starting with /home/jim/Library/New_P2robot.
You might find it useful to keep all of your files in the same directory, rather than relying on setting library paths and pulling them in from there. It might reduce the number of version conflicts you seem to be having.
Eric,
is wordmove not a valid spin2 instruction? I get a compiler error "object called is not a function." I was trying wordmove(@destination,@source,ct)
Jim
edit: my error! I was using() instead of[]
I've released FlexProp 5.9.25 binaries on both Patreon and github. There are a lot of bug fixes (so it's worth updating to this version). Other changes include:
An undocumented change is that anonymous objects are permitted in Spin2. This received no interest when I proposed it here on the forums, so probably nobody cares, but it made the libc.spin2
implementation much easier. It remains undocumented because I may change it in the future.
And of course the day after releasing 5.9.25 I found two significant bugs . So I've updated the release now to 5.9.26. Besides the bug fixes, there are now macros to make it easier to test for specific versions of FlexC / FlexSpin.
Eric
I went to install the upgrade and the attached screenshot is what happens when I do. I used the make file from the readme. Tried this several times always with the ending abort.
Jim
You should already have git installed on your Linux machine, don't you? If so, no need to install it again (and whatever problem you're having installing it is nothing to do with flexprop). As the README says, after the first installation you can skip the first 4 steps (the ones starting with sudo).
Thanks Eric. After editing out the sudo lines, I was able to get the latest version installed and running.
So far no bugs that I have found.
Jim
@ersmith
Is there a chance, that you would like to enhance the features for those "external" global cog variables?
Reason to ask is, that I still feel tempted some times to try again on this MC6809 Coco3 OS9 emulator written in C. For it's cpu registers it uses:
This way the registers can be accessed as 8bit and as well as 16bit.
Just an idea....
Christof
From the readme_P2.txt of the MP3 Player:
I built it on the command line, in the examples/standalone directory, via:
flexspin -D_BAUD=2000000 -2 -I../../src -o mp3.binary main.c ../../src/bitstream.c ../../src/buffers.c ../../src/dct32.c ../../src/dequant.c ../../src/dqchan.c ../../src/huffman.c ../../src/hufftabs.c ../../src/imdct.c ../../src/mp3dec.c ../../src/mp3tabs.c ../../src/polyphase.c ../../src/scalfact.c ../../src/stproc.c ../../src/subband.c ../../src/trigtabs.c -DMPDEC_ALLOCATOR=malloc -DMPDEC_FREE=free -DMP3DEC_GENERIC
and then ran with
loadp2 mp3.binary -b2000000 -9.
Question:
As I am not working from a Linux command line. What is the best way to compile from multiple files using the FlexProp IDE?
Thanks a lot!
Christof
In IDE: commands->configure command
I'd like to do that, but it may take some time to write the code for the cases where only part of the 32 bit registers are used (especially on P1 it's a pain to extract bytes from COG memory locations).
Unfortunately the IDE doesn't support project files or anything like that, so you'll have to either write a new file that #includes all the other files (which may not work if there are conflicting definitions), or else add __fromfile() declarations to the header files.
@ersmith What happens if two (or more) different cogs attempt to involk _gc_collect()? Will this result in a conflict? Does the collection process occur only for the vars/strings being used by the cog in which it is called, or does the collector act globally across all cogs and all heap objects?
Memory could be recycled by a cog if there are no references within HUB or within the cog's own memory, so it's probably safest to do all memory allocation within the main cog; second safest is to always put allocated memory into a global variable or other shared resource.
Is there a way to get the current stack pointer so that I can do math on it to determine how much stack space I need for a recursive function?
If I define a C function with character values does it push a long onto the stack or just the character since all variables end up in registers?
Mike
__builtin_alloca(siz)
allocates from the stack. I use it all the time because the stack is all of spare hubRAM.You can call __getsp(), which returns the stack pointer; or for a more portable solution something like __builtin_alloca(1) would work.
Generally local variables take (at least) 4 bytes each regardless of how big they're declared. There can be exceptions for functions where all the locals have to be stack allocated, but that really kills performance so I wouldn't recommend it.
@ersmith Eric,
I downloaded the file that @JonnyMac attached to "how do I get a return array" post #12 on the pasm2 catagory. I tried to compile in flexprop to no avail. two errors crop up:
1 regexec
2 reg[]
I looked them up on "Hello Propeller" and they are commands that 1 initiate an isr pasam routine and 2 access a "res" in memory of thr isr. Can you suggest a work around, I would really like to try out Cgracy's isr for the adc. I tried to attach the file here but iPad not being cooperative.
edit: I moved to the computer and attached a file that quotes the REG function. Is there a work around or does this need to be a bug fix?
Thanks
Jim
REGEXEC is not supported by FlexSpin, and probably never will be supported. You'll have to find a different way to implement this. Probably the logic could be put into a small Spin2 function that is called periodically, or else the whole thing could be run in another COG.
Eric
I try to compile the C files in the attached ZIP.
I get this error:
You just need to compile p2rvcc.c, the other files get included.
Would be cool if this works on the P2, it's a little RISC-V compiler...
Andy
@Ariba : Unfortunately there's a long-standing (and hard to fix) bug in FlexC causing problems when the same identifier is used for both a type name and variable name, and you've hit a variant of it where a type name is re-used as a class member. The work-around is simple, change the typedef'd enum from "base_type" to "base_type_t" and then use "base_type_t base_type" instead of "base_type base_type" near line 145 of defs.c.
Thank you Eric
I will try that.