From 92f26f252d16a65cf394a5cde73899a471cba3fc Mon Sep 17 00:00:00 2001 From: Roberto Hexsel <roberto@inf.ufpr.br> Date: Tue, 19 May 2015 13:50:35 -0300 Subject: [PATCH] two fixes to UART experiments --- cMIPS/include/handlers.s | 19 +++++++++++-------- cMIPS/tests/extCounter.c | 3 +-- cMIPS/tests/uarttx.c | 2 +- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/cMIPS/include/handlers.s b/cMIPS/include/handlers.s index b063e41..e39b4c2 100644 --- a/cMIPS/include/handlers.s +++ b/cMIPS/include/handlers.s @@ -12,6 +12,7 @@ .bss .align 2 + .set noreorder .global _counter_val # accumulate number of interrupts .comm _counter_val 4 .comm _counter_saves 8*4 # area to save up to 8 registers @@ -31,9 +32,10 @@ extCounter: #---------------------------------- # save additional registers - # la $k1, _counter_saves - # sw $a0, 0*4($k1) - # sw $a1, 1*4($k1) + # lui $k1, %hi(_counter_saves) + # ori $k1, $k1, %lo(_counter_saves) + # sw $a0, 0*4($k1) + # sw $a1, 1*4($k1) #---------------------------------- lui $k1, %hi(HW_counter_value) @@ -48,10 +50,11 @@ extCounter: sw $k1,0($k0) #---------------------------------- - # and then restore same registers - # la $k1, _counter_saves - # lw $a0, 0*4($k1) - # lw $a1, 1*4($k1) + # and then restore those same registers + # lui $k1, %hi(_counter_saves) + # ori $k1, $k1, %lo(_counter_saves) + # lw $a0, 0*4($k1) + # lw $a1, 1*4($k1) #---------------------------------- mfc0 $k0, cop0_STATUS # Read STATUS register @@ -69,6 +72,7 @@ extCounter: .bss .align 2 + .set noreorder .global rx_queue,rx_hd,rx_tl # reception queue and pointers .comm rx_queue 16 .comm rx_hd 4 @@ -201,4 +205,3 @@ cmips_delay: nop .end cmips_delay #---------------------------------------------------------------- - \ No newline at end of file diff --git a/cMIPS/tests/extCounter.c b/cMIPS/tests/extCounter.c index 1b4e373..75a0b62 100644 --- a/cMIPS/tests/extCounter.c +++ b/cMIPS/tests/extCounter.c @@ -14,13 +14,12 @@ void main(void) { int i, increased, new, old, newValue; newValue = CNT_VALUE; - startCounter(newValue, 0); // no interrupts for (i=0; i < N; i++) { // repeat N rounds print(i); // print number of round newValue = CNT_VALUE + (i<<3); - startCounter(newValue, 0); // num cycles increases with i + startCounter(newValue, 0); // num cycles increases with i, no interrupts increased = TRUE; old = 0; diff --git a/cMIPS/tests/uarttx.c b/cMIPS/tests/uarttx.c index 36a44e9..ba59e25 100644 --- a/cMIPS/tests/uarttx.c +++ b/cMIPS/tests/uarttx.c @@ -44,7 +44,7 @@ typedef struct serial { #define LONG_STRING 1 #if LONG_STRING -char *dog = "\n\tthe quick brown fox jumps over the lazy dog\n"; +char *dog = "\tthe quick brown fox jumps over the lazy dog"; char s[32]; #else char s[32]; // = "123"; -- GitLab