-
Notifications
You must be signed in to change notification settings - Fork 42
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
Evaluate compressing the wifi firmware #4
Comments
It would be great if a compressed version of the firmware could be sent over SPI to the 43439, so it's faster to copy. But I don't think that's possible, the base firmware on that chip doesn't support any compression. So the benefit would just be smaller firmware (which is still a good benefit). As for runtime overhead, I don't think it will be much. The time for downloading the firmware is dominated by the SPI transfer. |
MicroPython includes a decent gunzip implementation, but for good compression it requires a lot of RAM for the decompression dictionary. One would need to tune the dictionary window size to trade off compression size and RAM usage. |
I think @peterharperuk meant to pre-compress the firmware files before including them into the build and then de-compressing them on-the-fly directly buffer-by-buffer before sending them via SPI to the cyw-chip (instead of doing the compression on the uC before sending. That would also not reduce the firmware size). So the RAM usage needed for compression doesn't matter much since it's on a PC, not the uC. Here are some compression numbers (file size in byte - file name):
with Most of the formats can be decompressed on the rp2040 (excluding xz, see https://github.com/kripton/rp2040-compressiontest), however I would personally chose zopfli for the offline/pre-compression and the existing gunzip to decompress on the rp2040 right before sending the file over SPI |
The driver calls cyw43_wifi_firmware_details to get details of the firware binary. This is defined in wifi_firmware_43439.h which could in theory be replaced at build time. If CYW43_STREAM_FIRMWARE is true, cyw43_stream_wifi_firmware_start is called to start streaming firmware. cyw43_stream_wifi_firmware_next is called repeatedly to load 64 byte blocks of firmware data to be sent to the wifi chip. cyw43_stream_wifi_firmware_end is called at the end of the process. Firmware is now decompressed from a gzip file using these methods. See cyw43_decompress_wifi_firmware_start etc. Fixes georgerobotics#4
The driver calls cyw43_wifi_firmware_details to get details of the firware binary. This is defined in wifi_firmware_43439.h which could in theory be replaced at build time. If CYW43_STREAM_FIRMWARE is true, cyw43_stream_wifi_firmware_start is called to start streaming firmware. cyw43_stream_wifi_firmware_next is called repeatedly to load 64 byte blocks of firmware data to be sent to the wifi chip. cyw43_stream_wifi_firmware_end is called at the end of the process. Firmware is now decompressed from a gzip file using these methods. See cyw43_decompress_wifi_firmware_start etc. Fixes georgerobotics#4
Refactor the driver to call wifi_fw_funcs to get functions to load firmware data. If CYW43_DECOMPRESS_FIRMWARE is true it will load gzip compressed firmware using uzlib. The driver calls cyw43_wifi_firmware_details to get details of the firware. Fixes georgerobotics#4
Refactor the driver to call wifi_fw_funcs to get functions to load firmware data. If CYW43_DECOMPRESS_FIRMWARE is true it will load gzip compressed firmware using uzlib. The driver calls cyw43_wifi_firmware_details to get details of the firware. Fixes georgerobotics#4
Refactor the driver to call wifi_fw_funcs to get functions to load firmware data. If CYW43_DECOMPRESS_FIRMWARE is true it will load gzip compressed firmware using uzlib. The driver calls cyw43_wifi_firmware_details to get details of the firmware. Fixes georgerobotics#4
Refactor the driver to call wifi_fw_funcs to get functions to load firmware data. If CYW43_DECOMPRESS_FIRMWARE is true it will load gzip compressed firmware using uzlib. The driver calls cyw43_wifi_firmware_details to get details of the firmware. Fixes georgerobotics#4
Refactor the driver to call wifi_fw_funcs to get functions to load firmware data. If CYW43_DECOMPRESS_FIRMWARE is true it will load gzip compressed firmware using uzlib. The driver calls cyw43_wifi_firmware_details to get details of the firmware. Fixes georgerobotics#4
Refactor the driver to call wifi_fw_funcs to get functions to load firmware data. If CYW43_DECOMPRESS_FIRMWARE is true it will load gzip compressed firmware using uzlib. The driver calls cyw43_wifi_firmware_details to get details of the firmware. Fixes georgerobotics#4
Refactor the driver to call wifi_fw_funcs to get functions to load firmware data. If CYW43_DECOMPRESS_FIRMWARE is true it will load gzip compressed firmware using uzlib. The driver calls cyw43_wifi_firmware_details to get details of the firmware. Fixes georgerobotics#4
Refactor the driver to call wifi_fw_funcs to get functions to load firmware data. If CYW43_DECOMPRESS_FIRMWARE is true it will load gzip compressed firmware using uzlib. The driver calls cyw43_wifi_firmware_details to get details of the firmware. Fixes georgerobotics#4
Refactor the driver to call wifi_fw_funcs to get functions to load firmware data. If CYW43_DECOMPRESS_FIRMWARE is true it will load gzip compressed firmware using uzlib. The driver calls cyw43_wifi_firmware_details to get details of the firmware. Fixes georgerobotics#4
It looks like we could save ~85KB of flash memory if we compressed the wifi firmware binary. Evaluate if the code size, run time overhead is worth it.
The text was updated successfully, but these errors were encountered: