From ca2901c1a59422d81b519c79c619586d051f32d1 Mon Sep 17 00:00:00 2001
From: cnlohr <lohr85@gmail.com>
Date: Mon, 13 Mar 2023 04:09:44 -0400
Subject: [PATCH] Update notes and show a small assmebly example.

---
 examples/run_from_ram/run_from_ram.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/examples/run_from_ram/run_from_ram.c b/examples/run_from_ram/run_from_ram.c
index 07ecee1..8ece215 100644
--- a/examples/run_from_ram/run_from_ram.c
+++ b/examples/run_from_ram/run_from_ram.c
@@ -35,7 +35,6 @@ void RamFunction()
 		GPIOD->BSHR = (1<<16) | (1<<(16+4)); // Turn off GPIODs
 		GPIOC->BSHR = (1<<16);
 		Delay_Ms( 250 );
-		count++;
 
 		// But we turbo through twiddling a pin.
 		
@@ -46,14 +45,14 @@ void RamFunction()
 			c.nop\n\
 			c.sw a0, 0(a2)\n\
 			c.sw a1, 0(a2)\n\
-			c.sw a0, 0(a2) /* Writing out takes 2 cycles from what I can tell*/ \n\
-			c.addi a3, 1   /* Insert this for comparative timing,  it's 1 cycle */ \n\
+			c.sw a0, 0(a2)       /* Writing out takes 2 cycles from what I can tell*/ \n\
+			c.addi %[count], 1   /* Insert this for comparative timing,  it's 1 cycle */ \n\
 			c.sw a1, 0(a2)\n\
 			c.sw a0, 0(a2)\n\
 			c.sw a1, 0(a2)\n\
 			c.sw a0, 0(a2)\n\
 			c.sw a1, 0(a2)\n\
-			" : : : "a0", "a1", "a2", "a3" );
+			" : [count]"+r"(count) : : "a0", "a1", "a2" );
 	}
 }
 
-- 
GitLab