-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flashfs Loop recording and initial erase #209
Flashfs Loop recording and initial erase #209
Conversation
This really needs to get tested with other FCs that have a NOR flash. |
I do not have any other FCs. Could you help test? |
Happy to test. |
You can test this PR build on master, or the following build which is essentially RF-4.4.x + #209 + #211 + #212 all together: |
This is an absolutely fantastic feature. Let's see if it works with BF boards. Most of them have a NOR flash. Also... the NOR chips are usually much smaller, so another question is if they should be fully erased at arming. |
If NOR flashes erase considerably faster in multi-block erase (or full chip erase) than serialized block erase -- I'm not sure if it's true --, it worth improve the erasing logic. Otherwise, the current logic provides enough flexibility for either full chip, 1/2 chip or whatever threshold erase. |
I have one BF board I can test on. https://www.jhemcu.com/e_productshow/?73-GF30F722-ICM-73.html How do I know if it has a NOR chip? |
https://github.com/rotorflight/rotorflight-firmware/blob/master/src/main/target/JHEF7DUAL/target.h#L125 This will be the most interesting one to test. |
I'm getting very confused:
It seems very unorganized. |
I doubt any BF board is using 16 Mbit chips. That's too small even for BF. |
Welcome to the world of BF |
Worst case NOR users get these advanced features disabled by default but they have nothing to lose. They have to figure out an acceptable arm delay v.s. log file size. Or the amount of sensor data to record (data rate) v.s. sector erase speed (background erase). |
I don't think we can leave this to end users to figure out. |
e65ca9c
to
4cfb987
Compare
When using loop mode, we will identify the "start of the data stream" (by empty region followed by filled region). Also the usable size is reduced to `full size - page size - buffer size`. (The - buffer size is for code simplicity). The original FLASHFS_FREE_BLOCK_SIZE is changed to page size to avoid misalignment. A new option blackbox_initial_erase is added to maintain a certain amount of free space upon record start. This also add (change) some cli cmds for diagnoses: flash_fill flash_verify flash_erase_sector flashfs_initial_erase
4cfb987
to
080dec0
Compare
Tested on flywing f405: it will take 15s to complete a 4MiB initial erase. All other functionalities are normal and uninterrupted. The recording won't start until the erase is complete. |
Well, that is a rather long time, but the user can choose not to do that. |
I am considering if the |
Change `initialEraseFreeSpace` to `....KiB` and update unit tests.
28e92d0 (Don't think it saves any byte though.) |
* flashfs: add flashfs loop support and initial erase When using loop mode, we will identify the "start of the data stream" (by empty region followed by filled region). Also the usable size is reduced to `full size - page size - buffer size`. (The - buffer size is for code simplicity). The original FLASHFS_FREE_BLOCK_SIZE is changed to page size to avoid misalignment. A new option blackbox_initial_erase is added to maintain a certain amount of free space upon record start. This also add (change) some cli cmds for diagnoses: flash_fill flash_verify flash_erase_sector flashfs_initial_erase * Initial erase: change param unit to KiB Change `initialEraseFreeSpace` to `....KiB` and update unit tests.
This PR implements: #126 bullet 1 and 2:
set blackbox_initial_erase = 8388608
(size in bytes) to turn it on, default is 0 (turned off).Both are tested on Flydragon and Matek G474Heli as my daily firmware