aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGareth McMullin2015-03-08 22:53:51 -0700
committerGareth McMullin2015-03-19 21:49:09 -0700
commit12e313dab9658ed41668a951b2a25160cafc208d (patch)
tree19de1dc7677e59167ae9cbbd8ff0cbf1fc00424e
parent41256e3c2ac211757ef4a3639075b1b5cab1a4f5 (diff)
Use for loop in STM32F1 stub and compile with -Os.
-rw-r--r--flashstub/stm32f1.c3
-rw-r--r--flashstub/stm32f1.stub2
2 files changed, 2 insertions, 3 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)
;
}
diff --git a/flashstub/stm32f1.stub b/flashstub/stm32f1.stub
index 428dbb0..7f2914c 100644
--- a/flashstub/stm32f1.stub
+++ b/flashstub/stm32f1.stub
@@ -1 +1 @@
-0x4613, 0xE010, 0x4A0D, 0x2401, 0x6014, 0x4602, 0x1C90, 0x460C, 0x1CA1, 0x8824, 0x8014, 0x3B02, 0xBF00, 0x4A09, 0x6812, 0xF002, 0x0201, 0x2A00, 0xD1F9, 0x2B00, 0xD1EC, 0x4B05, 0x681B, 0xF003, 0x0314, 0x2B00, 0xD000, 0xBE01, 0xBE00, 0xBF00, 0x2010, 0x4002, 0x200C, 0x4002, \ No newline at end of file
+0x2300, 0x4293, 0x4C09, 0xD20A, 0x4D09, 0x2601, 0x602E, 0x5ACD, 0x52C5, 0x6825, 0xF015, 0x0F01, 0xD1FB, 0x3302, 0xE7F1, 0x6823, 0xF013, 0x0F14, 0xD000, 0xBE01, 0xBE00, 0xBF00, 0x200C, 0x4002, 0x2010, 0x4002, \ No newline at end of file