mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-07-23 23:11:28 -04:00
Add Checksums to Firmware & External App images (#1809)
* Pad image to 1MB and add simple checksum * Test code to verify firmware checksum * Comment out unneeded zlib * Add files via upload * Print space remaining in ROM * Append checksum to external apps too * Check external app checksums when loading * Is it 2024 already?! * Validate firmware checksum before flashing * Add files via upload * Added flash error warning to nav screen * Clang * Replaced some hard-coded values with #defines * Check FW checksum before USB serial flash too * Add files via upload
This commit is contained in:
parent
2d98c5d311
commit
6a6c6d6502
13 changed files with 179 additions and 13 deletions
|
@ -32,6 +32,7 @@
|
|||
#include "string_format.hpp"
|
||||
#include "ui_styles.hpp"
|
||||
#include "ui_painter.hpp"
|
||||
#include "ui_flash_utility.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "rtc_time.hpp"
|
||||
|
||||
|
@ -1051,6 +1052,9 @@ bool debug_dump() {
|
|||
pmem_dump_file.write_line("Ext APPS version req'd: 0x" + to_string_hex(VERSION_MD5));
|
||||
pmem_dump_file.write_line("GCC version: " + to_string_dec_int(__GNUC__) + "." + to_string_dec_int(__GNUC_MINOR__) + "." + to_string_dec_int(__GNUC_PATCHLEVEL__));
|
||||
|
||||
// firmware checksum
|
||||
pmem_dump_file.write_line("Firmware calculated checksum: 0x" + to_string_hex(simple_checksum(FLASH_STARTING_ADDRESS, FLASH_ROM_SIZE), 8));
|
||||
|
||||
// write persistent memory
|
||||
pmem_dump_file.write_line("\n[Persistent Memory]");
|
||||
|
||||
|
|
|
@ -235,3 +235,10 @@ std::string join(char c, std::initializer_list<std::string_view> strings) {
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
uint32_t simple_checksum(uint32_t buffer_address, uint32_t length) {
|
||||
uint32_t checksum = 0;
|
||||
for (uint32_t i = 0; i < length; i += 4)
|
||||
checksum += *(uint32_t*)(buffer_address + i);
|
||||
return checksum;
|
||||
}
|
|
@ -217,4 +217,6 @@ struct range_t {
|
|||
|
||||
std::string join(char c, std::initializer_list<std::string_view> strings);
|
||||
|
||||
uint32_t simple_checksum(uint32_t buffer_address, uint32_t length);
|
||||
|
||||
#endif /*__UTILITY_H__*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue