Used flash memory is not reported correctly #182

Open
opened 2025-08-22 16:38:38 +08:00 by sylvainpelissier · 2 comments
sylvainpelissier commented 2025-08-22 16:38:38 +08:00 (Migrated from github.com)

When using pico-fido-tool.py the used flash memory is not reported correctly when running on my Waveshare zero board, it is stuck to zero even if the number of files is reported correctly:

£python pico-fido-tool.py -p 1234 memory
Pico Fido Tool v1.10
Author: Pol Henarejos
Report bugs to https://github.com/polhenarejos/pico-fido/issues


Memory usage:
	Free: 1007.98 kilobytes (100.00%)
	Used: 0.00 kilobytes (0.00%)
	Total: 1007.98 kilobytes
	Flash size: 2048.00 kilobytes
	Files: 15

While debugging this problem I noticed that the used flash memory is reported correctly in emulation:

python pico-fido-tool.py -p 1234 memory
Pico Fido Tool v1.10
Author: Pol Henarejos
Report bugs to https://github.com/polhenarejos/pico-fido/issues


Memory usage:
	Free: 8175.16 kilobytes (99.99%)
	Used: 0.82 kilobytes (0.01%)
	Total: 8175.97 kilobytes
	Flash size: 8192.00 kilobytes
	Files: 7

It seems in pico-keys-sdk: 113e720fca/src/fs/file.c (L276) the variable last_base is not updated properly during the scan but I'm stuck debugging that on the board.

When using `pico-fido-tool.py` the used flash memory is not reported correctly when running on my Waveshare zero board, it is stuck to zero even if the number of files is reported correctly: ```bash £python pico-fido-tool.py -p 1234 memory Pico Fido Tool v1.10 Author: Pol Henarejos Report bugs to https://github.com/polhenarejos/pico-fido/issues Memory usage: Free: 1007.98 kilobytes (100.00%) Used: 0.00 kilobytes (0.00%) Total: 1007.98 kilobytes Flash size: 2048.00 kilobytes Files: 15 ``` While debugging this problem I noticed that the used flash memory is reported correctly in emulation: ```bash python pico-fido-tool.py -p 1234 memory Pico Fido Tool v1.10 Author: Pol Henarejos Report bugs to https://github.com/polhenarejos/pico-fido/issues Memory usage: Free: 8175.16 kilobytes (99.99%) Used: 0.82 kilobytes (0.01%) Total: 8175.97 kilobytes Flash size: 8192.00 kilobytes Files: 7 ``` It seems in pico-keys-sdk: https://github.com/polhenarejos/pico-keys-sdk/blob/113e720fcaaa6b9ca74d114bee1923bb2619ba3b/src/fs/file.c#L276 the variable `last_base` is not updated properly during the scan but I'm stuck debugging that on the board.
polhenarejos commented 2025-08-22 16:45:44 +08:00 (Migrated from github.com)

If last_base is not updated properly, then it wouldn't work at all. I tested it in my waveshare zero and works fine. Try generating more files, OTP, resident credentials, etc. to check whether it's a rounding problem.

If `last_base` is not updated properly, then it wouldn't work at all. I tested it in my waveshare zero and works fine. Try generating more files, OTP, resident credentials, etc. to check whether it's a rounding problem.
sylvainpelissier commented 2025-08-23 14:55:31 +08:00 (Migrated from github.com)

Yes I thought about the rounding issue so I printed the exact value in the script:

$ python pico-fido-tool.py -p 1234 memory
Pico Fido Tool v1.10
Author: Pol Henarejos
Report bugs to https://github.com/polhenarejos/pico-fido/issues


Memory usage:
	Free: 1007.98 kilobytes (100.00%)
	Free exact: 1032172
	Used: 0.00 kilobytes (0.00%)
	Used exact: 0
	Total: 1007.98 kilobytes
	Flash size 2048.00 kilobytes
	Files: 17

But it seems to be board specific since I tested on a RPI Pico 2 and the values were correct.

Yes I thought about the rounding issue so I printed the exact value in the script: ```bash $ python pico-fido-tool.py -p 1234 memory Pico Fido Tool v1.10 Author: Pol Henarejos Report bugs to https://github.com/polhenarejos/pico-fido/issues Memory usage: Free: 1007.98 kilobytes (100.00%) Free exact: 1032172 Used: 0.00 kilobytes (0.00%) Used exact: 0 Total: 1007.98 kilobytes Flash size 2048.00 kilobytes Files: 17 ``` But it seems to be board specific since I tested on a RPI Pico 2 and the values were correct.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dearsky/pico-fido#182