Commit 82e889ae1ebe47597bf87ace7b1937fa63d1aa44
receivedMon, 5. Dec 2022, 11:26:15 (by user sx)
Mon, 5 Dec 2022 10:26:15 +0000 (11:26 +0100)
authorManfred Steiner <sx@htl-kaindorf.at>
Mon, 5 Dec 2022 10:26:11 +0000 (11:26 +0100)
committerManfred Steiner <sx@htl-kaindorf.at>
Mon, 5 Dec 2022 10:26:11 +0000 (11:26 +0100)
4 files changed:
examples/simuc/Makefile
examples/simuc/src/main.cpp
examples/simuc/src/simavr/simavr.cpp
examples/simuc/src/simavr/simavr.h

index 91501cb158552edeca94e69934f81a62df4eb00f..e3ee48d512b2d1c4c3a57cb67c26ecdb41760f67 100644 (file)
@@ -51,7 +51,7 @@ ifeq ($(ARCH), arm-linux-gnueabihf)
        DEBARCH="armhf"
 endif
 
-DEBVERSION := 0.0.3~1
+DEBVERSION := 0.0.5~1
 DEBNAME := dpkg/htl-simuc_version_arch
 DEBSRC := dpkg/htl-simuc_version_arch
 DEBARCH := $(shell dpkg --print-architecture)
index fe2fe313fa8cc54c64aa16b61e6b343a68f9b590..575165b6223acce97d498b904bf3b6d45895b092 100644 (file)
@@ -8,7 +8,7 @@
 #include "simavr/simavr.h"
 
 void printHelp () {
-    printf("simuc V0.0.4 (%s,%s)\n", __DATE__, __TIME__);
+    printf("simuc V0.0.5 (%s,%s)\n", __DATE__, __TIME__);
     printf("usage: simuc [options] elf-file [elf-file ...]\n\n");
     printf("  available options (you can use file .simucinit instead):\n");
     printf("    --port ...         listining port for gdb (default 1234)\n");
@@ -200,7 +200,7 @@ int main (int argc, char **argv) {
         return 1;
     }
     printf("--------------------------------------------------------------------\n");
-    printf("available commands: i (interrupt), c (continue), s (stack), q (quit)\n");
+    printf("available commands: i (interrupt), c (continue), s (stack), r (reset), q (quit)\n");
     printf("--------------------------------------------------------------------\n");
     printf("init done - press key to start\n");
     getchar();
@@ -223,7 +223,7 @@ int main (int argc, char **argv) {
         // }
         
         if (getline(&line, &size, stdin) > 0) {
-            const char *commands[] = { "quit", "interrupt", "continue", "stack" };
+            const char *commands[] = { "quit", "interrupt", "continue", "stack", "reset" };
             try {
                 int foundIndex = -1;
                 int foundCnt = 0;
index ac15d1fc4f13249db4ddda9abfd8103d24fb787b..c3fc119c93625c3a19f88d96c9456b54808ae6f4 100644 (file)
@@ -507,7 +507,9 @@ bool SimAvr::sprintfLedStatus (char *s, size_t size, bool onlyOnChange) {
                                for (int i = 0; i < 4; i++) {
                                        int8_t nextLed = -1;
                                        if (ddra & (1 << i)) {
-                                               nextLed = porta & (1 << i) ? 0 : 1;
+                                               nextLed = porta & (1 << i) ? 0 : 1; // port output
+                                       } else {
+                                               nextLed = 0; // port input _> led is off
                                        }
                                        if (nextLed != led[i]) {
                                                change = 1;
@@ -605,7 +607,7 @@ void SimAvr::avrRun () {
 
                                                }
                                                printf(printHeader ? "\n" : "\n");
-                                               char s[20];
+                                               char s[80];
                                                sprintfLedStatus(s, sizeof(s), false);
                                                printf("   %s\n", s);
                                                break;
@@ -764,6 +766,13 @@ void SimAvr::avrRun () {
                                                break;
                                        }
 
+                                       case CommandReset: {
+                                               avr_reset(avr);
+                                               printf("RESET done -> PC=0x%04x, use command 'continue' to start!\n", avr->pc);
+                                               avr->state = cpu_Stopped;
+                                               break;
+                                       }
+
                                        default: break;
                                }
                                command = ReadyForNewCommand;
index 1f2090b3dfd931dfdc742d8c054f67eaa831da5e..0184f5b6a8d0bc9e2f5c34f49dbc34bb6a99527e 100644 (file)
@@ -60,7 +60,8 @@ typedef enum {
        CommandQuit,
        CommandInterrupt,
        CommandContinue,
-       CommandStack
+       CommandStack,
+       CommandReset
 } EnumSimAvrCommand;
 
 struct SimAvrStatus {