Find the starting block of a file in the flash of an RP2040 #10036
Replies: 5 comments 2 replies
-
That does not sound feasible. The space used by a file is not guaranteed to be contiguous.You should instead use file methods like read, write, seek. |
Beta Was this translation helpful? Give feedback.
-
thanks, I thought there might be discontinuity problems, I'll try to use 'seek' 'read' 'write' statements even if they are not fast |
Beta Was this translation helpful? Give feedback.
-
The file methods may be s little bit slower, but they take care about all the flash specifics, like ensuring, that the flash is erased before writing to it, being able to write at arbitrary positions, and in case of LFS2, taking care of flash wearing. When attemtping raw flash access, you have to take care about that yourself. |
Beta Was this translation helpful? Give feedback.
-
Hello, thanks for your availability, if I can ask one last thing, if possible on a RP2040 with Micropython 1.19.1 with instruction ioctl(4, 0) it returns me a 768 block FAT with a 4Mb flash, I wanted to create two partitions, one main of 500 and a secondary of 268 blocks, in order to use the second one with the readblocks() writeblocks() instructions, but with the Flash() function I was unable to pass the parameters to size the partition as can be done on STM32 es: p1 = pyb.Flash(start=0, len=256*1024) Thanks to anyone who can help me. |
Beta Was this translation helpful? Give feedback.
-
Thanks, for now I'll try to use read and write to a file, thanks a lot for the help |
Beta Was this translation helpful? Give feedback.
-
hi, in a RP2040 I would like to use a file as virtual memory using the 'readblocks() and writeblocks()' instructions, however I would need to know the starting block of the file, there is a procedure to find the starting block of the file in Flash of the CPU? Thanks for the reply.
Beta Was this translation helpful? Give feedback.
All reactions