Formatted comments and stm32lx.s
authorTom de Boer <tom@tomdeboer.nl>
Mon, 9 May 2016 08:55:57 +0000 (10:55 +0200)
committerTom de Boer <tom@tomdeboer.nl>
Mon, 9 May 2016 08:55:57 +0000 (10:55 +0200)
flashloaders/stm32lx.s
src/common.c

index f162c88279bc45a0569e53e21949b40b538b6381..10e5644bffc303fa0b05c85cb6f594c729240bcd 100644 (file)
@@ -25,7 +25,7 @@
  ***************************************************************************/
 
 
-// Build : arm-eabi-gcc -c stm32lx.S
+// Build : arm-eabi-gcc -c stm32lx.s
     .text
     .syntax unified
     .cpu cortex-m3
@@ -36,7 +36,7 @@
 /*
     r0 - source address
     r1 - destination address
-    r2 - count
+    r2 - output, remaining word count
 */
 
     // Go to compare
index 456c0b173b77e346831a7968282d6a80d37147b4..a3ffda7e40d129ad5abce767070142bf3f8fbf1a 100644 (file)
@@ -1509,26 +1509,20 @@ int write_loader_to_sram(stlink_t *sl, stm32_addr_t* addr, size_t* size) {
     };
 
     static const uint8_t loader_code_stm32l[] = {
-
-       /* based on openocd.git/contrib/loaders/flash/stm32lx.S
-           r0, input, source addr
-           r1, input, dest addr
-           r2, input, word count
-           r2, output, remaining word count
-         */
-
-       0x00, 0xbf, // nop /* to make loader length % 4 = 0 */
-       0x04, 0xe0, // b test_done /* Go to compare */
-       //write_word
-       0x04, 0x68, // ldr r4, [r0] /* Load one word from address in r0 */
-       0x0c, 0x60, // str r4, [r1] /* Store the word to address in r1 */
-       0x04, 0x30, // adds r0, #4 /* Increment r0 */
-       0x04, 0x31, // adds r1, #4 /* Increment r1 */
-       0x01, 0x3a, // subs r2, #1 /* Decrement r2 */
-       //test_done:
-       0x00, 0x2a, // cmp r2, #0 /* Compare r2 to 0 */
-       0xf8, 0xd8, // bhi write_word /* Loop if above 0 */
-       0x00, 0xbe  // bkpt #0x00 /* Set breakpoint to exit */
+        // flashloaders/stm32lx.s
+
+        0x04, 0xe0, //     b test_done          ; Go to compare
+        // write_word:
+        0x04, 0x68, //     ldr      r4, [r0]    ; Load one word from address in r0
+        0x0c, 0x60, //     str      r4, [r1]    ; Store the word to address in r1
+        0x04, 0x30, //     adds     r0, #4      ; Increment r0
+        0x04, 0x31, //     adds     r1, #4      ; Increment r1
+        0x01, 0x3a, //     subs     r2, #1      ; Decrement r2
+        // test_done:
+        0x00, 0x2a, //     cmp      r2, #0      ; Compare r2 to 0
+        0xf8, 0xd8, //     bhi      write_word  ; Loop if above 0
+        0x00, 0xbe, //     bkpt     #0x00       ; Set breakpoint to exit
+        0x00, 0x00
     };
 
     static const uint8_t loader_code_stm32f4[] = {