Chris, I assume that you did add the "initMRAM" near boot (right after the SPI init).  If not, you may have to do format the file system after doing it because it may have the size and the partition setup wrong otherwise.

73,

Burns Fisher, WB1FJ
AMSAT(R) Engineering -- Flight Software


On Sat, Apr 8, 2023 at 2:39 PM Corey Minyard <minyard@acm.org> wrote:
On Sat, Apr 08, 2023 at 02:19:29PM -0400, Chris Thompson wrote:
> I tried a simple example but I can't open a file.  Is there a volume name
> that I need to specify?  I presume you don't need to create a directory.

"/" should be the volume name, but maybe you need two of them?  I wasn't
sure from what the documentation said.

If you can open "//test_file", then that's what it is.

-corey

>
> Here is the code, but the open fails with "No such file or directory"
>
>    // TEST File System
>     char *test_string = "This is data";
>     int32_t fp;
>     printf("FS Test: Writing:\n");
>     fp = red_open("/test_file", RED_O_CREAT | RED_O_WRONLY);
>     if (fp != -1) {
>         printf("Writing string\n");
>         int32_t numOfBytesWritten = red_write(fp, test_string,
> strlen(test_string));
>         if (numOfBytesWritten == strlen(test_string)) {
>             printf("Success\n");
>         } else {
>             printf("Write returned: %d\n",numOfBytesWritten);
>             if (numOfBytesWritten == -1)
>                 printf("Unable to write to file: %s\n",
> red_strerror(red_errno));
>         }
>         int32_t rc = red_close(fp);
>         if (rc != 0) {
>             printf("Unable to close file: %s\n", red_strerror(red_errno));
>         }
>
>     } else {
>         printf("Unable to open file: %s\n", red_strerror(red_errno));
>     }
>
> Any thoughts?
>
> 73
> Chris
>
> On Fri, Apr 7, 2023 at 5:10 PM Burns Fisher (AMSAT) via pacsat-dev <
> pacsat-dev@amsat.org> wrote:
>
> > >I assumed that since this was ARM it was little endian.
> >
> > Yeah, I would have too.  But apparently ARM can go either way.  Turns out
> > that for some reason the automotive world seems to standardize on big
> > endian.  This has caused nothing but hassle on the TMS570 (the STM32L is
> > little).
> >
> >
> > -----------------------------------------------------------
> >
> > pacsat-dev mailing list -- pacsat-dev@amsat.org
> > View archives of this mailing list at
> > https://mailman.amsat.org/hyperkitty/list/pacsat-dev@amsat.org
> > To unsubscribe send an email to pacsat-dev-leave@amsat.org
> > Manage all of your AMSAT-NA mailing list preferences at
> > https://mailman.amsat.org
> >
>
>
> --
> Chris E. Thompson
> chrisethompson@gmail.com
> g0kla@arrl.net