瀏覽代碼

changed compiler optimization, fixed debug

SBird1337 7 年之前
父節點
當前提交
8be8a3160a
共有 2 個文件被更改,包括 20 次插入12 次删除
  1. 1
    1
      makefile
  2. 19
    11
      src/agb_debug/agb_debug.c

+ 1
- 1
makefile 查看文件

@@ -14,7 +14,7 @@ export PATH := $(realpath ../tools):$(PATH)
14 14
 
15 15
 DEFINES   := -DBPRE -DSOFTWARE_VERSION=0
16 16
 ASFLAGS   := -mthumb
17
-CFLAGS    := -mthumb -mthumb-interwork -g -mcpu=arm7tdmi -fno-inline -mlong-calls -march=armv4t -O3 -std=c99 -Wall -Wextra -Wunreachable-code -Isrc/include $(DEFINES)
17
+CFLAGS    := -mthumb -mthumb-interwork -g -mcpu=arm7tdmi -fno-inline -mlong-calls -march=armv4t -O0 -std=c99 -Wall -Wextra -Wunreachable-code -Isrc/include $(DEFINES)
18 18
 GRITFLAGS := -ftc -fa
19 19
 LDFLAGS   := -z muldefs
20 20
 BLDPATH   := object

+ 19
- 11
src/agb_debug/agb_debug.c 查看文件

@@ -34,7 +34,16 @@ void dprint(const char * sz)
34 34
 {
35 35
     __asm__ __volatile__(
36 36
         "mov r2, %0\n"
37
-        "ldr r0, =0xc0ded00d\n"
37
+        "mov r0, #0xC0\n"
38
+        "lsl r0, #0x8\n"
39
+        "mov r1, #0xDE\n"
40
+        "orr r0, r1\n"
41
+        "lsl r0, #0x8\n"
42
+        "mov r1, #0xD0\n"
43
+        "orr r0, r1\n"
44
+        "lsl r0, #8\n"
45
+        "mov r1, #0x0D\n"
46
+        "orr r0, r1\n"
38 47
         "mov r1, #0\n"
39 48
         "and r0, r0, r0\n":
40 49
         :
@@ -155,13 +164,12 @@ int mini_vsnprintf(char * buffer, u32 buffer_len,
155 164
 }
156 165
 
157 166
 void dprintf(const char * str, ...)
158
-    //---------------------------------------------------------------------------------
159
-    {
160
-        char* __outstr = malloc(256);
161
-        va_list args;
162
-        va_start(args, str);
163
-        mini_vsnprintf(__outstr, 256, str, args);
164
-        va_end(args);
165
-        dprint(__outstr);
166
-        free(__outstr);
167
-    }
167
+{
168
+    char* __outstr = malloc(256);
169
+    va_list args;
170
+    va_start(args, str);
171
+    mini_vsnprintf(__outstr, 256, str, args);
172
+    va_end(args);
173
+    dprint(__outstr);
174
+    free(__outstr);
175
+}