From 83aef192e447c800cba6f4dbde8a450a4f8581a5 Mon Sep 17 00:00:00 2001 From: Jacques Comeaux Date: Mon, 1 Jul 2024 12:16:02 -0500 Subject: Use in-house CRC32 computation for boot sector --- misc/crc.s | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 misc/crc.s (limited to 'misc/crc.s') diff --git a/misc/crc.s b/misc/crc.s new file mode 100644 index 0000000..03c0ce2 --- /dev/null +++ b/misc/crc.s @@ -0,0 +1,24 @@ +.syntax unified +.cpu cortex-m0plus +.thumb + +.type CRC32, %function +.global CRC32 + +// R0 = input addr +// R1 = length +CRC32: LDR R5, =0x04C11DB7 + LDR R4, =0xFFFFFFFF +10: LDR R2, [R0] + REV R2, R2; + EORS R4, R2 + MOVS R3, 32 +20: LSLS R4, 1 + BCC 30f + EORS R4, R5 +30: SUBS R3, 1 + BNE 20b + ADDS R0, 4 + SUBS R1, 1 + BNE 10b + BX LR -- cgit v1.2.3