diff --git a/flashloaders/stm32f4lv.s b/flashloaders/stm32f4lv.s index 92f70fa..c338b98 100644 --- a/flashloaders/stm32f4lv.s +++ b/flashloaders/stm32f4lv.s @@ -7,19 +7,19 @@ mycopy: ldr r10, flash_off_sr add r10, r10, r12 -myloop: - # copy 1 byte each time and 4 times as one group - ldrb r3, [r0] - ldrb r4, [r0, #1] - ldrb r5, [r0, #2] - ldrb r6, [r0, #3] - strb r3, [r1] - strb r4, [r1, #1] - strb r5, [r1, #2] - strb r6, [r1, #3] + # original r2 indicates the count of 4 bytes need to copy, + # but we can only copy one byte each time. + # as we have no flash larger than 1GB, we do a little trick here. + ldr r3, =4 + mul r2, r2, r3 - add r0, r0, #4 - add r1, r1, #4 +myloop: + # copy 1 byte + ldrb r3, [r0] + strb r3, [r1] + + add r0, r0, #1 + add r1, r1, #1 # wait if FLASH_SR == 1 mywait: diff --git a/flashloaders/stm32f7lv.o b/flashloaders/stm32f7lv.o new file mode 100644 index 0000000..f71d5e6 Binary files /dev/null and b/flashloaders/stm32f7lv.o differ diff --git a/flashloaders/stm32f7lv.s b/flashloaders/stm32f7lv.s index 013b56f..55c9add 100644 --- a/flashloaders/stm32f7lv.s +++ b/flashloaders/stm32f7lv.s @@ -7,19 +7,19 @@ mycopy: ldr r10, flash_off_sr add r10, r10, r12 -myloop: - # copy 1 byte each time and 4 times as one group - ldrb r3, [r0] - ldrb r4, [r0, #1] - ldrb r5, [r0, #2] - ldrb r6, [r0, #3] - strb r3, [r1] - strb r4, [r1, #1] - strb r5, [r1, #2] - strb r6, [r1, #3] + # original r2 indicates the count of 4 bytes need to copy, + # but we can only copy one byte each time. + # as we have no flash larger than 1GB, we do a little trick here. + ldr r3, =4 + mul r2, r2, r3 - add r0, r0, #4 - add r1, r1, #4 +myloop: + # copy 1 byte + ldrb r3, [r0] + strb r3, [r1] + + add r0, r0, #1 + add r1, r1, #1 # memory barrier dsb sy