SD card access, path/directory

Hi again,

I’m using a SD card on a WP8548 SDIO pins. The code i’m executing says it managed to create a file and write in it, but I don’t know where this file is!

Is there a common path for SD card on SDIO pins? How can I specify this path?

C code:

#include “legato.h”

COMPONENT_INIT
{
LE_INFO(“Hello, Vincent.”);
LE_INFO(“Test File Creation.”);
uint8_t write_buffer_tx ={0x54, 0x45, 0x53, 0x54, 0x32};
le_result_t res;
le_fs_FileRef_t fp;
size_t filesize;
res = le_fs_Open(“/test2.txt”, LE_FS_CREAT|LE_FS_RDWR|LE_FS_APPEND|LE_FS_SYNC , &fp);
if(res == LE_OK)
{
LE_INFO(“File Created Successfully.”);
}
else
{
LE_INFO(“File Creation Failed %d.”, res);
}
res = le_fs_Write(fp, write_buffer_tx, NUM_ARRAY_MEMBERS(write_buffer_tx));
if(res == LE_OK)
{
LE_INFO(“File Write Successful.”);
}
else
{
LE_INFO(“File Write Failed %d.”, res);
}
le_fs_Close(fp);
res = le_fs_GetSize(“/test2.txt”, &filesize);

if(res == LE_OK)
{
	LE_INFO("File Get Size Successful. size=%d", filesize);
}
else
{
	LE_INFO("File Get Size Failed %d.", res);
}

}

adef file:

sandboxed: true
version: 1.0.0
maxFileSystemBytes: 512K
start: manual

executables:
{
hellovincent = ( HelloVincentComponent )
}

processes:
{
envVars:
{
LE_LOG_LEVEL = DEBUG
}

run:
{
	( hellovincent )
}

faultAction: restart

}

requires:
{
device:
{
// Request read and write access to the SD card.
[rw] /dev/mmcblk0p1 /dev/mmcblk0p1
}

dir:
{
/mnt/userrw/sdcard /
}
}

Console output

Feb 25 13:22:39 | hellovincent[3083]/hellovincent_exe T=main | _main.c main() 60 | == Starting Event Processing Loop ==
Feb 25 13:22:39 | hellovincent[3083]/HelloVincentComponent T=main | HelloVincentComponent.c _HelloVincentComponent_COMPONENT_INIT() 5 | Hello, Vincent.
Feb 25 13:22:39 | hellovincent[3083]/HelloVincentComponent T=main | HelloVincentComponent.c _HelloVincentComponent_COMPONENT_INIT() 6 | Test File Creation.
Feb 25 13:22:39 | hellovincent[3083]/HelloVincentComponent T=main | HelloVincentComponent.c _HelloVincentComponent_COMPONENT_INIT() 14 | File Created Successfully.
Feb 25 13:22:39 | hellovincent[3083]/HelloVincentComponent T=main | HelloVincentComponent.c _HelloVincentComponent_COMPONENT_INIT() 23 | File Write Successful.
Feb 25 13:22:39 | hellovincent[3083]/HelloVincentComponent T=main | HelloVincentComponent.c _HelloVincentComponent_COMPONENT_INIT() 34 | File Get Size Successful. size=5

You can find the file by "find / -name “test2.txt” "

Hi jyijyi,

Where do I have to enter this command? (I’m working on developer studio, Windows native OS)

But even If I find this test2.txt file, I’d like to create it on the SD card. How can I achieve this operation?

Thanks,

You can enter in the console terminal.

1 Like

It found 4 occurences, certainly the results of my multiple attempts :slight_smile:

It seems to be local paths, how can I create this file in my SD card? Thanks

legato console

I think you should set the sandbox flag to be false.
When you open file pointer, please specify the absolute file path.

When running in unsanboxed mode it gives the same result (see below). I already tested it, which explains the different path found.

Do you know the absolute file path of the SD card?

legato console2

you need to mount the SD card first:

root@swi-mdm9x28-wp:~# ls /dev/mmc*
/dev/mmcblk0 /dev/mmcblk0p1
root@swi-mdm9x28-wp:~#
root@swi-mdm9x28-wp:~# mkdir -p /tmp/sdcard
root@swi-mdm9x28-wp:~#
root@swi-mdm9x28-wp:~# /bin/mount -t auto -o sync /dev/mmcblk0p1 “/tmp/sdcard”
root@swi-mdm9x28-wp:~#
root@swi-mdm9x28-wp:~# ls /tmp/sdcard/
DCIM LOST.DIR
LGBackup System Volume Information
root@swi-mdm9x28-wp:~#
root@swi-mdm9x28-wp:~# echo test > /tmp/sdcard/test.txt
root@swi-mdm9x28-wp:~#
root@swi-mdm9x28-wp:~# ls /tmp/sdcard/
DCIM System Volume Information
LGBackup test.txt
LOST.DIR

Thanks a lot jyijyi, you’re really helpful!

I did the commands to “mount” the SD card, it seems ok (see below)

legato console3

Then I did run the project again it created the text2.txt in a new folder, but unfortunately still outside the SD.

legato console4

two solutions:

  1. you can use system() API to copy the newly generated file to /tmp/sdcard
  2. you can use fopen() with absolute file path instead of le_fs_Open()

Please note that you need to set the sandbox flag to be false.

Ok, Here is the new project:

C file

#include “legato.h”
#include<stdio.h>

COMPONENT_INIT
{
LE_INFO(“Hello Vincent2!”);

FILE* demo;
char str[] = "Hello!";

// Creates a file "demo_file"
// with file acccess as write-plus mode
demo = fopen("demo.txt", "w+");

fwrite(str , 1 , sizeof(str) , demo);

// closes the file pointed by demo
fclose(demo);

if(demo == NULL)
{
	LE_INFO("File Creation Failed");
}
else
{
	LE_INFO("File Created Successfully");
}

}

adef

sandboxed: false
version: 1.0.0
maxFileSystemBytes: 512K
start: manual

executables:
{
hellovincent2 = ( HelloVincent2Component )
}

processes:
{
envVars:
{
LE_LOG_LEVEL = DEBUG
}

run:
{
	( hellovincent2 )
}

maxCoreDumpFileBytes: 512K
maxFileBytes: 512K

}

requires:
{
device:
{
// Request read and write access to the SD card.
[rw] /dev/mmcblk0p1 /dev/mmcblk0p1
}

dir:
{
/mnt/userrw/sdcard /
}
}


Demo.txt file is created but still outside SD card. Maybe the path isn’t correct in : demo = fopen(“demo.txt”, “w+”); ?

legato console5

have you tried to use absolute path here?
fopen(“demo.txt”, “w+”);

No, because… I don’t know it :sweat_smile:

Is it /mnt/userrw/sdcard / ?

didn’t you have mounted the SD card to /tmp/sdcard?

Ok so I change the previous fopen by: demo = fopen(“/tmp/sdcard/demo.txt”, “w+”);

Execution is aborted and the console says:

Blockquote

Feb 26 09:54:36 | hellovincent2[1392]/HelloVincent2Component T=main | HelloVincent2Component.c _HelloVincent2Component_COMPONENT_INIT() 6 | Hello Vincent2!
Feb 26 09:54:36 | hellovincent2[1392] | | PROCESS: 1392 ,TID 1392
Feb 26 09:54:36 | hellovincent2[1392] | | SIGNAL: 11, ADDR (nil), AT 0xb6d899e8 SI_CODE 0x00000001
Feb 26 09:54:36 | hellovincent2[1392] | | ILLEGAL ADDRESS (nil)
Feb 26 09:54:36 | hellovincent2[1392] | | LEGATO VERSION
Feb 26 09:54:36 | hellovincent2[1392] | | 18.06.4_a2b118ed13919cebd20f9d71e8810748_modified
Feb 26 09:54:36 | hellovincent2[1392] | |
Feb 26 09:54:36 | hellovincent2[1392] | | PROCESS COMMAND LINE
Feb 26 09:54:36 | hellovincent2[1392] | | hellovincent2
Feb 26 09:54:36 | hellovincent2[1392] | |
Feb 26 09:54:36 | hellovincent2[1392] | | PROCESS MAP
Feb 26 09:54:36 | hellovincent2[1392] | | b6d2d000-b6e55000 r-xp 00000000 fe:00 753 /lib/libc-2.24.so
Feb 26 09:54:36 | hellovincent2[1392] | | b6e55000-b6e64000 —p 00128000 fe:00 753 /lib/libc-2.24.so
Feb 26 09:54:36 | hellovincent2[1392] | | b6e64000-b6e66000 r–p 00127000 fe:00 753 /lib/libc-2.24.so
Feb 26 09:54:36 | hellovincent2[1392] | | b6e66000-b6e68000 rw-p 00129000 fe:00 753 /lib/libc-2.24.so
Feb 26 09:54:36 | hellovincent2[1392] | | b6e68000-b6e6a000 rw-p 00000000 00:00 0
Feb 26 09:54:36 | hellovincent2[1392] | | b6e6a000-b6ed8000 r-xp 00000000 fe:00 762 /lib/libm-2.24.so
Feb 26 09:54:36 | hellovincent2[1392] | | b6ed8000-b6ee7000 —p 0006e000 fe:00 762 /lib/libm-2.24.so
Feb 26 09:54:36 | hellovincent2[1392] | | b6ee7000-b6ee8000 r–p 0006d000 fe:00 762 /lib/libm-2.24.so
Feb 26 09:54:36 | hellovincent2[1392] | | b6ee8000-b6ee9000 rw-p 0006e000 fe:00 762 /lib/libm-2.24.so
Feb 26 09:54:36 | hellovincent2[1392] | | b6ee9000-b6eeb000 r-xp 00000000 fe:00 759 /lib/libdl-2.24.so
Feb 26 09:54:36 | hellovincent2[1392] | | b6eeb000-b6efa000 —p 00002000 fe:00 759 /lib/libdl-2.24.so
Feb 26 09:54:36 | hellovincent2[1392] | | b6efa000-b6efb000 r–p 00001000 fe:00 759 /lib/libdl-2.24.so
Feb 26 09:54:36 | hellovincent2[1392] | | b6efb000-b6efc000 rw-p 00002000 fe:00 759 /lib/libdl-2.24.so
Feb 26 09:54:36 | hellovincent2[1392] | | b6efc000-b6f02000 r-xp 00000000 fe:00 778 /lib/librt-2.24.so
Feb 26 09:54:36 | hellovincent2[1392] | | b6f02000-b6f11000 —p 00006000 fe:00 778 /lib/librt-2.24.so
Feb 26 09:54:36 | hellovincent2[1392] | | b6f11000-b6f12000 r–p 00005000 fe:00 778 /lib/librt-2.24.so
Feb 26 09:54:36 | hellovincent2[1392] | | b6f12000-b6f13000 rw-p 00006000 fe:00 778 /lib/librt-2.24.so
Feb 26 09:54:36 | hellovincent2[1392] | | b6f13000-b6f29000 r-xp 00000000 fe:00 774 /lib/libpthread-2.24.so
Feb 26 09:54:36 | hellovincent2[1392] | | b6f29000-b6f38000 —p 00016000 fe:00 774 /lib/libpthread-2.24.so
Feb 26 09:54:36 | hellovincent2[1392] | | b6f38000-b6f39000 r–p 00015000 fe:00 774 /lib/libpthread-2.24.so
Feb 26 09:54:36 | hellovincent2[1392] | | b6f39000-b6f3a000 rw-p 00016000 fe:00 774 /lib/libpthread-2.24.so
Feb 26 09:54:36 | hellovincent2[1392] | | b6f3a000-b6f3c000 rw-p 00000000 00:00 0
Feb 26 09:54:36 | hellovincent2[1392] | | b6f3c000-b6f8c000 r-xp 00000000 fe:02 398 /mnt/legato/system/lib/liblegato.so
Feb 26 09:54:36 | hellovincent2[1392] | | b6f8c000-b6f8d000 rw-p 00050000 fe:02 398 /mnt/legato/system/lib/liblegato.so
Feb 26 09:54:36 | hellovincent2[1392] | | b6f8d000-b6f8e000 r-xp 00000000 f4:01 26337 /legato/apps/2bcadb7bba790ad49e74e132c6d7fe7c/read-only/lib/libComponent_HelloVincent2Component.so
Feb 26 09:54:36 | hellovincent2[1392] | | b6f8e000-b6f9d000 —p 00001000 f4:01 26337 /legato/apps/2bcadb7bba790ad49e74e132c6d7fe7c/read-only/lib/libComponent_HelloVincent2Component.so
Feb 26 09:54:36 | hellovincent2[1392] | | b6f9d000-b6f9e000 rw-p 00000000 f4:01 26337 /legato/apps/2bcadb7bba790ad49e74e132c6d7fe7c/read-only/lib/libComponent_HelloVincent2Component.so
Feb 26 09:54:36 | hellovincent2[1392] | | b6f9e000-b6fbe000 r-xp 00000000 fe:00 745 /lib/ld-2.24.so
Feb 26 09:54:36 | hellovincent2[1392] | | b6fc5000-b6fc7000 rw-p 00000000 00:00 0
Feb 26 09:54:36 | hellovincent2[1392] | | b6fca000-b6fcc000 rw-p 00000000 00:00 0
Feb 26 09:54:36 | hellovincent2[1392] | | b6fcc000-b6fcd000 r-xp 00000000 00:00 0 [sigpage]
Feb 26 09:54:36 | hellovincent2[1392] | | b6fcd000-b6fce000 r–p 0001f000 fe:00 745 /lib/ld-2.24.so
Feb 26 09:54:36 | hellovincent2[1392] | | b6fce000-b6fcf000 rw-p 00020000 fe:00 745 /lib/ld-2.24.so
Feb 26 09:54:36 | hellovincent2[1392] | | b6fcf000-b6fd0000 r-xp 00000000 f4:01 26333 /legato/apps/2bcadb7bba790ad49e74e132c6d7fe7c/read-only/bin/hellovincent2
Feb 26 09:54:36 | hellovincent2[1392] | | b6fe0000-b6fe1000 rw-p 00001000 f4:01 26333 /legato/apps/2bcadb7bba790ad49e74e132c6d7fe7c/read-only/bin/hellovincent2
Feb 26 09:54:36 | hellovincent2[1392] | | b6fe1000-b7002000 rw-p 00000000 00:00 0 [heap]
Feb 26 09:54:36 | hellovincent2[1392] | | bebd2000-bebf3000 rw-p 00000000 00:00 0 [stack]
Feb 26 09:54:36 | hellovincent2[1392] | | ffff0000-ffff1000 r-xp 00000000 00:00 0 [vectors]
Feb 26 09:54:36 | hellovincent2[1392] | | BACKTRACE
Feb 26 09:54:36 | hellovincent2[1392] | | PC at b6d899e8
Feb 26 09:54:36 | hellovincent2[1392] | | LR at b6f8d87c [0xbebf26ec]
Feb 26 09:54:36 | hellovincent2[1392] | | LR at b6f4f6fc [0xbebf2ab4]
Feb 26 09:54:36 | hellovincent2[1392] | | LR at b6f50b38 [0xbebf2ad4]
Feb 26 09:54:36 | hellovincent2[1392] | | LR at b6fcfd10 [0xbebf2cf4]
Feb 26 09:54:36 | hellovincent2[1392] | | LR at b6d44a7c [0xbebf2d1c]
Feb 26 09:54:36 | hellovincent2[1392] | | r0 bebf2a9c r1 00000001 r2 00000007 r3 00000000 r4 00000000 r5 00000007
Feb 26 09:54:36 | hellovincent2[1392] | | r6 00000000 r7 bebf2ae8 r8 b6fe55f8 r9 00000004 r10 b6f8c12c cpsr 20060010
Feb 26 09:54:36 | hellovincent2[1392] | | fp bebf2ab4 ip b6d899d0 sp bebf2a60 lr b6f8d87c pc b6d899e8
Feb 26 09:54:36 | hellovincent2[1392] | | STACK bebf2a60, FRAME bebf2ab4
Feb 26 09:54:36 | hellovincent2[1392] | | bebf29e0: ffffffff 00000000 b6d36eb0 b6fcb848 00000160 00000000 00000005 00000000
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2a00: 00000000 00000002 0000002d 0000003d 0000005b b6f8dad1 b6ffcc08 b6f8d000
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2a20: 00010d08 b6fc5880 00000000 00000001 00000004 b6f8c12c bebf2ab4 b6fad830
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2a40: b6fcbc80 00000001 00000001 00000000 00000001 b6d36eb0 b6f9dcf0 b6fe55f8
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2a60: 00000000 bebf2ae8 b6fe55f8 b6f9dcf0 b6fe55f8 00000000 bebf2ae8 b6fe55f8
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2a80: 00000004 b6f8d87c b6f8db28 00000006 b6f8dac0 bebf2ac0 00000008 6c6c6548
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2aa0: 0000216f 00000000 b6fe2a4c b6fe2a4c bebf2ad4 b6f4f6fc 00000000 00000000
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2ac0: 00000001 bebf2ae8 b6fe55f8 00000004 bebf2cf4 b6f50b38 bebf2b90 b6df9950
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2ae0: b6e66144 b6f8c12c 00000001 00001ffc 00000000 00000000 0000008c 00000000
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2b00: 00000000 2829c02d b6fcacd8 b6fe4108 b6f8c9dc b6f85624 bebf2b5c b6f61a78
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2b20: bebf2bc4 b6fa8478 b6e64f44 00000024 00000036 00000009 0000001a 00000001
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2b40: 00000078 00000003 00000038 00000000 00000000 b6fe5980 00000000 00000007
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2b60: b6f3ffa8 00000000 b6fcab20 00000001 b6fcab20 bebf2be0 b6f3d338 000002bb
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2b80: bebf2be4 b6fa7ebc 00000001 b6f3ffa8 000002bb b6f402a8 b6fcab20 bebf2be4
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2ba0: bebf2be0 b6fcfda4 b6fcfe3c b6f402a8 b6f3d3f8 bcdb29c5 05e6d94e b6fcf58c
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2bc0: b6fcf354 bebf2c50 b6fce000 004e2000 aaaaaaab 00000000 b6ffcb0c 00000009
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2be0: 00000000 00000000 676e6973 bcdb29c5 b6fceb10 00000000 bebf2c50 b6fcf58c
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2c00: bebf2c58 bebf2cc4 bebf2cac b6fa8478 bebf2c58 b6fceab4 00000002 00000000
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2c20: 00000001 00000000 00000001 b6fce958 00000000 00000000 00000000 00000000
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2c40: 00000000 00000000 b6fceb10 b6fce958 ffffffff 00000000 b6f3ffa8 b6fcab20
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2c60: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2c80: 00000000 00000000 00000000 b6fcf000 00011170 b6fc5880 00000000 00000001
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2ca0: 00000000 b6fe0134 bebf2d1c b6fad830 00000000 00000001 00000001 00000000
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2cc0: 00000000 b6f3ffa8 b6fe0134 00000000 b6fcf96c 00000000 00000000 b6fb4884
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2ce0: b6e66ba4 00000000 00000000 00000000 bebf2d1c b6fcfd10 b6fcfe3c 0000003c
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2d00: b6fcfe0c 00000000 bebf2e74 00000001 00000000 b6fcfd34 00000000 b6d44a7c
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2d20: b6e66400 bebf2e74 00000001 b6fcfc18 b6fcf2d4 bebf2dc0 adeca2c0 a587c5d4
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2d40: b6fcfd34 00000000 b6fcf96c 00000000 00000000 00000000 b6fe0134 00000000
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2d60: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2d80: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2da0: 00000000 b6f4f114 b6f8d7a0 00000000 00000000 b6fb4884 b6fceb10 b6fce958
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2dc0: ffffffff 00000000 b6d39000 b6fcb848 00000001 00000001 b6f8c12c 00000000
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2de0: b6f9dbe0 b6f4f310 00000000 b6f4f114 bebf2e0c b6f5098c b6f9dcf0 b6fcf000
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2e00: 00011158 b6fc5880 00000000 00000001 00000000 b6fe0134 00000000 b6fad830
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2e20: b6fcbc40 00000001 00000001 00000000 00000000 b6d39000 00000000 00000000
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2e40: 00000000 00000000 00000000 b6fb4884 00000000 00000000 b6fcf96c 00000000
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2e60: 00000000 b6fcf9b0 b6fcfd94 b6fae8c0 bebf2e74 bebf2f39 00000000 bebf2f47
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2e80: bebf2f5a 00000000 00000010 0001b0d7 00000006 00001000 00000011 00000064
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2ea0: 00000003 b6fcf034 00000004 00000020 00000005 00000008 00000007 74f6e000
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2ec0: 00000008 00000000 00000009 b6fcf96c 0000000b 00000000 0000000c 00000000
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2ee0: 0000000d 00000000 0000000e 00000000 00000017 00000000 00000019 bebf2f25
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2f00: 0000001f bebf2fb5 0000000f bebf2f35 00000000 00000000 00000000 00000000
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2f20: 00000000 b8f26b00 538fe00c 4f3f0413 b41a2ec6 6c37769f 6c656800 69766f6c
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2f40: 6e65636e 4c003274 4f4c5f45 454c5f47 3d4c4556 55424544 41500047 2f3d4854
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2f60: 6167656c 732f6f74 65747379 632f736d 65727275 612f746e 2f737070 6c6c6548
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2f80: 6e69566f 746e6563 65722f32 6f2d6461 2f796c6e 3a6e6962 7273752f 636f6c2f
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2fa0: 622f6c61 2f3a6e69 2f727375 3a6e6962 6e69622f 656c2f00 6f746167 7379732f
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2fc0: 736d6574 7275632f 746e6572 7070612f 65482f73 566f6c6c 65636e69 2f32746e
Feb 26 09:54:36 | hellovincent2[1392] | | bebf2fe0: 64616572 6c6e6f2d 69622f79 65682f6e 766f6c6c 65636e69 0032746e 00000000
Feb 26 09:54:36 | hellovincent2[1392] | | […]
Feb 26 09:54:36 | hellovincent2[1392] | | Abort while dumping the stack
Feb 26 09:54:36 | hellovincent2[1392] | | DONE
Feb 26 09:54:36 | supervisor[639]/supervisor T=main | proc.c proc_SigChildHandler() 2049 | Process ‘hellovincent2’ (PID: 1392) has exited due to signal 11 (Segmentation fault).
Feb 26 09:54:37 | supervisor[639]/supervisor T=main | app.c app_SigChildHandler() 3480 | Process ‘hellovincent2’ in app ‘HelloVincent2’ faulted: Ignored.
Feb 26 09:54:37 | _appStopClient[1394]/framework T=main | LE_FILENAME CreateSocket() 550 | Socket opened as standard i/o file descriptor 2!
Feb 26 09:54:37 | supervisor[639]/supervisor T=main | apps.c DeactivateAppContainer() 374 | Application ‘HelloVincent2’ has stopped.

how about using system() API?

system(“cp /legato/systems/current/appsWriteable/HelloVincent2/demo.txt /tmp/sdcard” );

Actually it works with demo = fopen(“/tmp/sdcard/demo.txt”, “w+”); !!

I just didn’t understand that I had to do the “mount” instructions before executing the app… :slightly_smiling_face:

Is there a way to include these mount instructions in my HelloVincentComponent.c file?

Use system() API to mount it

Thanks again, jyijyi.

Sorry for the newbie question but I know nothing about system() API function and did not find anything (syntax, arguments, etc.) on legato API guide :sleepy:

This is linux API, not related to legato.
system(“/bin/mount -t auto -o sync /dev/mmcblk0p1 "/tmp/sdcard"”);