aboutsummaryrefslogtreecommitdiff
path: root/flashstub/stm32f1.c
diff options
context:
space:
mode:
authorGareth McMullin2015-03-08 22:53:51 -0700
committerGareth McMullin2015-03-19 21:49:09 -0700
commit12e313dab9658ed41668a951b2a25160cafc208d (patch)
tree19de1dc7677e59167ae9cbbd8ff0cbf1fc00424e /flashstub/stm32f1.c
parent41256e3c2ac211757ef4a3639075b1b5cab1a4f5 (diff)
Use for loop in STM32F1 stub and compile with -Os.
Diffstat (limited to 'flashstub/stm32f1.c')
-rw-r--r--flashstub/stm32f1.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/flashstub/stm32f1.c b/flashstub/stm32f1.c
index 2268eee..f9ba0a1 100644
--- a/flashstub/stm32f1.c
+++ b/flashstub/stm32f1.c
@@ -25,10 +25,9 @@
void __attribute__((naked))
stm32f1_flash_write_stub(uint16_t *dest, uint16_t *src, uint32_t size)
{
- while (size) {
+ for (int i; i < size; i += 2) {
FLASH_CR = FLASH_CR_PG;
*dest++ = *src++;
- size -= 2;
while (FLASH_SR & FLASH_SR_BSY)
;
}