Newer compiler returns value of var2[0] instead of address ov var2.. Add var2[0]:=$deadbeef to objtest.spin2 and you got "deadbeef' as a result of test.bas.
Thank you for the simple example, @pik33 . The root cause of the problem was a change to the Spin2 language to make references "transparent". This affected an internal function used to implement the BASIC varptr operation. It should be fixed now in the current github repo.
@ersmith said:
Thank you for the simple example, @pik33 . The root cause of the problem was a change to the Spin2 language to make references "transparent". This affected an internal function used to implement the BASIC varptr operation. It should be fixed now in the current github repo.
The newest version works and compiles the interpreter.
fwrite() is broken in newest master. It reports zero written data but it does write one block full of 0x9e repeating. errno is zero.
EDIT: Err, no, it does report one block written.
EDIT2: Ah-ha! Just had a squiz at fwrite() in include/libc/stdio/fwrite.c and found the bug. Fixed with this:
Righty-ho, the 4-bit SD mode SD card driver is ready for inclusion.
I've zipped up the driver (sdsd.cc) and a speed tester program and my own instructions for installing it into the block driver tree. I've also included a modified version of newest fatfs_vfs.c that matches my install instructions.
PS: I haven't written any ioctl() programming instructions. There is hints in the tester's mounting function. At this stage the control codes (#70..72) are pulled out of thin air and only defined in the driver itself. I don't know if there is preferred numbering protocol or not.
In future I'm thinking TRIMming could be offered via ioctl() as well.
Eric,
On the Fcache allocation issue again, how about allowing adding of RES directives to specify trailing cogRAM needs? That would fix it for what I'm wanting.
And doing this would also solve a separate workaround where I've been using a bunch of enums to give labels to each of the preset parameter registers. They could be individual res 1 allocations instead. Much cleaner.
PS: Amusingly, the C compiler doesn't complain when I have RES directives. It doesn't work either.
EDIT: Ah, looking at the generated .lst file, I see RES is copied like a DAT LONG would be. That would need fixed along with whatever is causing the crash.
Yes, the default was reduced to fit, I think, the growing, but optional, byte-code VM. Compile using --fcache=256 to get it larger when compiling for native.
PS: It can go bigger than 256 but I'd hope you're not using more than that.
I managed to strip one long from the code (and then it fit) but this --fcache=256 will go to the command line. I don't use bytecode (yet?)
Edit: that was not a good idea. However, fcache=192 did the trick. fcache=256 seems to be too big and generated errors - code too big to fit in the cog
The program - a multiformat media player - is big, including an mp3 decoder. and several other objects.
dim v as class using "hg008.spin2"
dim rm as class using "usbnew.spin2"
dim tracker as class using "trackerplayer.spin2"
dim paula as class using "audio093b-8-sc.spin2"
dim sid as class using "sidcog8.spin2"
dim psram as class using "psram.spin2"
dim spc as class using "spccog.spin2"
dim a6502 as class using "a6502-1.spin2"
dim mp3 as class using "mp3.c"
I don't know what needs the space in the cog. My code that didn't fit in the has (about) 128 longs in it. Maybe the standard size is now 128
Reading the basic.md file, it looks like there is four ways to compile the Basic source code:
A predefined symbol is also generated for type of output being created:
-------------------------|------------- __OUTPUT_ASM__ | if PASM code is being generated __OUTPUT_BYTECODE__ | if bytecode is being generated __OUTPUT_C__ | if C code is being generated __OUTPUT_CPP__ | if C++ code is being generated
What's the chances you're compiling for byte-code?
Comments
There is a simple test code that shows the difference:
test.bas:
objtest.spin2:
Newer compilers print 0 while older print a non zero value
Newer compiler returns value of var2[0] instead of address ov var2.. Add
var2[0]:=$deadbeef
to objtest.spin2 and you got "deadbeef' as a result of test.bas.There is a difference in list files:
good:
bad:
that directed me to test if the program returns a value instead of the pointer.
Yet another test: the C compiler works as expected even in the newest compiler verson. The C test program
returns good values using
Version 7.0.0-beta2-v7.0.0-beta2-10-g7bc1389e Compiled on: Dec 8 2024
Only the Basic's varptr is affected.
Trying
print varptr(test2.var2(0))
- that doesn't help and still return 'deadbeef'Thank you for the simple example, @pik33 . The root cause of the problem was a change to the Spin2 language to make references "transparent". This affected an internal function used to implement the BASIC
varptr
operation. It should be fixed now in the current github repo.@ersmith Just noticed something odd when doing "Identify Serial Ports"...
When you do the similar "Identify Hardware" in Prop Tool, seems like the P2 reboots when done identifying.
The flexprop version seems to put the chip in some unknown state (at least to me).
Would it be better to have it reboot the P2 when done identifying?
@Rayman I think "Identify Serial Ports" fails if there's anything in the flash of the attached P2s. I should probably just remove it.
The newest version works and compiles the interpreter.
fwrite() is broken in newest master. It reports zero written data but it does write one block full of 0x9e repeating. errno is zero.
EDIT: Err, no, it does report one block written.
EDIT2: Ah-ha! Just had a squiz at fwrite() in
include/libc/stdio/fwrite.c
and found the bug. Fixed with this:And I see fread() is the same ... yep, all's good again.
Thanks, @evanh
Righty-ho, the 4-bit SD mode SD card driver is ready for inclusion.
I've zipped up the driver (
sdsd.cc
) and a speed tester program and my own instructions for installing it into the block driver tree. I've also included a modified version of newestfatfs_vfs.c
that matches my install instructions.PS: I haven't written any
ioctl()
programming instructions. There is hints in the tester's mounting function. At this stage the control codes (#70..72) are pulled out of thin air and only defined in the driver itself. I don't know if there is preferred numbering protocol or not.In future I'm thinking TRIMming could be offered via ioctl() as well.
Can exFat be enabled in FatFs now?
Seems that needed 64-bit integers last time this was asked, but seems we have these now?
ShouldWorkTM. Currently can't be set with external define though, need to edit ffconf.h to try it.
It would be nice to have that virtually unlimited file size...
Eric,
On the Fcache allocation issue again, how about allowing adding of RES directives to specify trailing cogRAM needs? That would fix it for what I'm wanting.
And doing this would also solve a separate workaround where I've been using a bunch of enums to give labels to each of the preset parameter registers. They could be individual
res 1
allocations instead. Much cleaner.PS: Amusingly, the C compiler doesn't complain when I have RES directives. It doesn't work either.
EDIT: Ah, looking at the generated .lst file, I see RES is copied like a DAT LONG would be. That would need fixed along with whatever is causing the crash.
EDIT2: Attached a test program.
Some glitches after a year gap in developing the player.
D:/Programowanie/P2-retromachine-2/Propeller/P2P16/player33.bas:1605: error: Inline assembly too large to fit in fcache
Did the fcache shrink? The player compiled earlier...
Yes, the default was reduced to fit, I think, the growing, but optional, byte-code VM. Compile using
--fcache=256
to get it larger when compiling for native.PS: It can go bigger than 256 but I'd hope you're not using more than that.
I managed to strip one long from the code (and then it fit) but this --fcache=256 will go to the command line. I don't use bytecode (yet?)
Edit: that was not a good idea. However, fcache=192 did the trick. fcache=256 seems to be too big and generated errors - code too big to fit in the cog
I can reserve up to 360 when compiling the SD card speed tester. I guess something else must also consume cogRAM then.
The program - a multiformat media player - is big, including an mp3 decoder. and several other objects.
I don't know what needs the space in the cog. My code that didn't fit in the has (about) 128 longs in it. Maybe the standard size is now 128
Reading the
basic.md
file, it looks like there is four ways to compile the Basic source code:What's the chances you're compiling for byte-code?
0
I tried the bytecode, it is way too slow for this program to run.