14
14
#include <fs/littlefs.h>
15
15
#include <storage/flash_map.h>
16
16
17
+ /*
18
+ * FIXME: The Zephyr always overrides uintptr_t as long int, which causes type size mismatch with
19
+ * 32bit tools that may define PRIuPTR as "u".
20
+ * See: include/toolchain/zephyr_stdint.h.
21
+ * The UINTPTR_T_CAST should be replaced with cast to uintptr_t when this thing gets fixed.
22
+ */
23
+ #undef PRIuPTR
24
+ #define PRIuPTR "lu"
25
+ #define UINTPTR_T_CAST (t ) ((unsigned long)(t))
26
+
17
27
/* Matches LFS_NAME_MAX */
18
28
#define MAX_PATH_LEN 255
19
29
@@ -73,8 +83,8 @@ void main(void)
73
83
!(FSTAB_ENTRY_DT_MOUNT_FLAGS (PARTITION_NODE ) & FS_MOUNT_FLAG_AUTOMOUNT )
74
84
rc = fs_mount (mp );
75
85
if (rc < 0 ) {
76
- printk ("FAIL: mount id %u at %s: %d\n" ,
77
- ( unsigned int ) mp -> storage_dev , mp -> mnt_point ,
86
+ printk ("FAIL: mount id %" PRIuPTR " at %s: %d\n" ,
87
+ UINTPTR_T_CAST ( mp -> storage_dev ) , mp -> mnt_point ,
78
88
rc );
79
89
return ;
80
90
}
@@ -100,7 +110,7 @@ void main(void)
100
110
rc = fs_stat (fname , & dirent );
101
111
printk ("%s stat: %d\n" , fname , rc );
102
112
if (rc >= 0 ) {
103
- printk ("\tfn '%s' siz %u \n" , dirent .name , dirent .size );
113
+ printk ("\tfn '%s' size %zu \n" , dirent .name , dirent .size );
104
114
}
105
115
106
116
struct fs_file_t file ;
@@ -149,7 +159,7 @@ void main(void)
149
159
printk ("End of files\n" );
150
160
break ;
151
161
}
152
- printk (" %c %u %s\n" ,
162
+ printk (" %c %zu %s\n" ,
153
163
(ent .type == FS_DIR_ENTRY_FILE ) ? 'F' : 'D' ,
154
164
ent .size ,
155
165
ent .name );
0 commit comments