From 56fed878171c025811269c86c2a4d2a23c97aeff Mon Sep 17 00:00:00 2001
From: Davids Paskevics <davip00@mi.fu-berlin.de>
Date: Mon, 22 May 2023 18:42:49 +0200
Subject: [PATCH] Use custom MDK fork for now

---
 .gitmodules   |  3 ++-
 Makefile      |  2 +-
 README.md     |  1 +
 mdk           |  2 +-
 src/nothing.c | 15 ++++++---------
 5 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/.gitmodules b/.gitmodules
index 45d0761..addcfba 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,4 @@
 [submodule "mdk"]
 	path = mdk
-	url = https://github.com/cpq/mdk
+	url = https://git.imp.fu-berlin.de/projekt-telematik-ss23-qemu/mdk
+	branch = emulator-hack
diff --git a/Makefile b/Makefile
index 9ca0abd..b4c7501 100644
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,7 @@ SOURCES 	= src/nothing.c
 # Comment this line out if you prefer building in docker
 TOOLCHAIN	= riscv32-unknown-elf
 
-EXTRA_CFLAGS ?=
+EXTRA_CFLAGS ?= -Og -g
 EXTRA_LINKFLAGS ?=
 
 include mdk/esp32c3/build.mk
diff --git a/README.md b/README.md
index ba6e9b4..279a55e 100644
--- a/README.md
+++ b/README.md
@@ -3,6 +3,7 @@ This repository contains small demo programs for the ESP32-C3, used to validate
 They're built against [mdk](https://github.com/cpq/mdk), as this allows finer control
 over what hardware features exactly are required, enabling gradual emulator development.
 
+We have patched the SDK slightly. Our fork is [here](https://git.imp.fu-berlin.de/projekt-telematik-ss23-qemu/mdk).
 
 ## Getting started
 
diff --git a/mdk b/mdk
index e2c1d4e..f197453 160000
--- a/mdk
+++ b/mdk
@@ -1 +1 @@
-Subproject commit e2c1d4e4bd9b152dfa32b48a7c0ae5f5a8b8276d
+Subproject commit f197453a15a3130ca62b8ccbb6af65a78942d9e5
diff --git a/src/nothing.c b/src/nothing.c
index 55e0a40..226a2a3 100644
--- a/src/nothing.c
+++ b/src/nothing.c
@@ -1,13 +1,10 @@
-/*
-This sample program is simply meant to prove that code is executed.
-Asides from MDK's init functions, nothing is done.
-*/
-
 #include <mdk.h>
 
 int main(void) {
-  for (;;) {
-  }
+    for (;;) {
+        // So compiler doesn't optimize out the loop
+        __asm__ volatile("nop");
+    }
 
-  return 0;
-}
\ No newline at end of file
+    return 0;
+}
-- 
GitLab