First implementation of file IO via libff in epicardium & pycarddium
NYI: ioctls
Merge request reports
Activity
- pycardium/modules/fat_file.c 0 → 100644
206 { 207 struct FatObject *o = NULL; 208 const char *mode_s = modeString; 209 int i; 210 int mode = 0; 211 212 //find free object to use 213 for (i = 0; i < EPIC_FAT_MAX_OPENED; ++i) { 214 if (s_openedObjects[i].type == FO_Nil) { 215 break; 216 } 217 } 218 if (i == EPIC_FAT_MAX_OPENED) { 219 return -fresult_to_errno_table[FR_TOO_MANY_OPEN_FILES]; 220 } 221 changed this line in version 3 of the diff
- pycardium/modules/fat_file.c 0 → 100644
164 case 'b': 165 type = &mp_type_fat_fileio; 166 break; 167 #endif 168 case 't': 169 type = &mp_type_fat_textio; 170 break; 171 } 172 } 173 174 pyb_file_obj_t *o = m_new_obj_with_finaliser(pyb_file_obj_t); 175 o->base.type = type; 176 177 const char *fname = mp_obj_str_get_str(args[0].u_obj); 178 int res = epic_open(fname, modeString); 179 if (1 || res < 0) { changed this line in version 3 of the diff
- Resolved by swym
As close() and flush() are NOPs at the moment, writing to a file will likely fail as the buffer is not flushed to the flash.
The internal flash has a page size of 4k while fatfs assumes a 512 byte sector. I'm not sure if it wise to change that, but it means that ff13 needs to emit a
CTRL_SYNC
ioctrl, which it does when closing a file, I guess.Edited by schneider
I tried to get an import working and tried this:
- Stubbed
mp_import_stat()
to always return MP_IMPORT_STAT_FILE - Removed
mp_lexer_new_from_file
- Set
MICROPY_VFS
andMICROPY_READER_VFS
- Added
extmod/vfs_reader.c
andextmod/vfs.c
Result:
>>> import foo.py Traceback (most recent call last): File "<stdin>", in <module> OSError: 1
Yeah, does not work that way ;)
- Stubbed
@swym showed me what is necessary for getting import working, IIRC it is actually not too difficult; the necessary parts can be ripped out of the VFS implementation for the most part. I guess we'll take a look this evening. I'm excited :)
added 1 commit
- 79704a51 - First implementation of file IO via libff in epicardium & pycarddium
added 1 commit
- d6d0ef31 - First implementation of file IO via libff in epicardium & pycarddium
added 9 commits
-
d6d0ef31...f54e3c0e - 8 commits from branch
card10:master
- 287ae82e - First implementation of file IO via libff in epicardium & pycarddium
-
d6d0ef31...f54e3c0e - 8 commits from branch