[Announcement] SDFileSystem available soon on Pokitto

theres no thing in pokitto api called NOPETITFATFS
but i tried #define POK_ENABLE_SD 0 and #define NOPETITFATFS just in case i missed something

Yes. And finally what should be done is to enable the possibility of using either PetitFatFS or SDFileSystem depending on the NOPETITFATFS flag. There is a small problem that needs to be sorted first.

The problem is that both PetitFATFS and SDFileSystem are based on ELMChanā€™s famous FatFS library

This means that the low-level hardware modules of PetitFATFS and SDFileSystem (mmc.c and so on) have functions with identical names. In order to make the ā€œswitchā€ from PetitFATFS to SDFileSystem, someone should do the work of isolating the low-level functions with #ifdef NOPETITFATFS ā€¦#endif so that in compilation we do not get problems with multple declarations. This is needed for the online mbed especially becaus - unlike with embitz- you can not choose which .c and .cpp source files are included in the compilation.

Phew.

Got that @Pharap & @adekto ? :wink:

ok so wich files do i rip out the library?

and shouldent it be #ifndef NOPETITFATFS around all the PetitFATFS stuff?

dam this library is used everywhere in the pokitto library and its ignoring the #ifndef NOPETITFATFS in the cpp files :confused:

do you need PetitFATFS?

also how do i import the latest version of the library into the mbed editor? i tried pulling from github but it cant seem to compile without explanation

@jonne @Pharap i have found the specific culprit and its wierd
i had to uncoment ever line in the core update and repluging the sd card in and out to find wen it wrote the file or not
it happens to be void Display::clear()
specificly memset((void*)m_scrbuf,c,j); inside the clear command

this is all i have figured out, so i assume some number in there is wrong

nevermind this did not fix it, it seems to help but now instead of always crashing its crashing half the time
i dont know what code is efecting it since it seems to be fine at the bigining first loop and even second time around but triggering it with a button just fails

Dont really understand whats happening butā€¦

Could it be that the button repeats to fast ? maybe its crashing because you are doing it hundreds of time?

already accounting for that with

 if(once){ once = false; 

i have been trying to figure this out for to long and have descended into madness, im going to try to do it all in pokittodisk or something, looking at the api code theres allot of wierd stuff going on
my only alternative is basically a rewrite

ah ok, just my two cents :smile:

Iā€™ve made an attempt at getting it work but I could only find where SDFileSystem is declared and I still havenā€™t got round to setting up an mbed account so Iā€™m not sure if my changes work.
Iā€™ll have to rely on others to test:

https://github.com/Pharap/PokittoLib/tree/sd-file-system-fix

mbed is a little anoying since you cant import that github as a library and get it to work
im not sure whats diferent between the mbed repo and the github repo but it just wont compile at all

on my end i deleted pff files and removed any function using it to get it to work, not the best but it seems to work
i tried #ifdef NOPETITFATFS but somehow it kept complaining about some functions not existing so something wierds going on there

I am just finishing up the loader V4. Once Iā€™ve got that done I will take a look. We (@NullMember and I) need the SDFileSystem in the music tracker project also.

2 Likes

If you donā€™t get time to read the commit:
Basically all I did was take all the .cpp files in Pokitto/POKITTO_LIBS/SDFileSystem/FATFileSystem/ChaN/ and put an #ifndef NOPETITFATFS #endif block around all the code (minus the large comments at the top).


Thatā€™s incredibly annoying.

you still have to deal with pokittodisk and part of the (now old) loader

I know. We will have to split the repository into subrepos. I do not like the idea, because the way git works is that repos within repos are not automatically pulled with git clone

Then we will have n amount of people asking why it wonā€™t compile

I think we definitely need to look into getting Pokitto code compiling in more common IDEs somehow, e.g. Visual Studio, VS Code, Eclipse or Netbeans.

Maybe not right now, but somewhere down the line.

It would mean finding out what commands EmBitz passes to GCC and finding out out how to reproduce that setup in different IDEs (and possibly checking the licences to make sure weā€™re complying with them).

I am pretty sure its not very complicated. GCC is very nice in that regard

Iā€™m getting

Error: Cannot open source input file "SDFileSystem.h": No such file or directory in "main.cpp", Line: 3, Col: 27

With Mbed onine :frowning:

My_settings.h

/* This is an example of how to set your own project settings 

To use

1. make a copy of this file by pressing right mouse button on top of this file 
in the mbed online compiler, then choose "Clone"

2. See that the copy is in the root of the project (where your main cpp files are), not inside the PokittoLib folder
Drag & drop to move if needed

3. rename the clone to "My_settings.h"

*/

#define PROJ_MODE13       1   // mode 13 graphics 110x88x256
#define PROJ_ENABLE_SOUND 1     // 0 = all sound functions disabled
#define PROJ_ENABLE_SYNTH 1
#define PROJ_SOUND_BUFFERED 1 // use buffered IRQ
#define NOPETITFATFS
#define PROJ_AUD_FREQ 11025//22050
#define PROJ_FPS 40