That last bin doesn’t include a filesystem library at all, that’s why it’s smaller. It’s using the loader’s filesystem API, which is why I asked you to update. I didn’t implement a check, so if you were to install the original loader it would crash.
This rules out issues with your code and shows that there’s a problem with the combination of SDFS and your card. I suspect that if you tried the previous bin (which uses SDFS) on another card it might work.
SDFS should only be used directly, never through fopen/fclose/etc. Looks like those leak memory.
SDFS sets up an InterruptIn for the Card Detect switch… which is not connected (pinName = NC) on the Pokitto. I don’t think InterruptIn was meant to be used with NC, I have seen it interfere with other interrupts.
Yes, that would be best.
Just make sure you use sdfs->open( "file.txt", O_RDONLY ) instead of fopen("/sd/file.txt", "r").
Okay so I’ve switched the card and it behaves like the emulator now, and I’ve also switched to using the SDFS directly. What I’ve noticed is that when I first list the files (select “open”), a sound is played, almost as if something’s overflowing somewhere Anyway it works except for writing files now. FileHandle->write() always returns -1, even though it sometimes does change the content of the card… it looks like it creates new files correctly (with O_CREAT… still returns -1), but overwriting existing files (with O_WRONLY) seems to overwrite all files to the same content (messes up the FAT table or something). Anyway I have to check my code again. Emulator seems to do the same things.
Oh god it seems to somehow be working, though that scary sound is making me nervous and emulator breaks on saving (according to above this should be a known bug). So let’s implement undo and this should be done.
In order to make this “IDE” I reworked the text editor so that it’s more forkable and you can make it into whatever you want. I’d like to ship this small LIL IDE along with it as an example.
I have it nicely in place now, it shows syntax errors in a popup window and sets the cursor on the position of the error. However I’m seeing a weird behavior of the LIL environment with one critical function (expr) and think it’s a bug, as on my PC the code works well. Rather than digging for the bug we might plug in a different language, such as LUA Lua.
I have to finish the undo system as well, so I may put this aside until then, but for the curious the code is always live here.
Never heard of it, but smaller sound better – considering it has to live along the editor. If you want, try to replace the LIL in my repo with it. I’d be glad if someone took care of it before I finish the PokiPad.