|
@@ -26,20 +26,14 @@
|
26
|
26
|
#include "log.h"
|
27
|
27
|
#include "debug_disk.h"
|
28
|
28
|
|
|
29
|
+#ifdef DEBUG_DISK_WRITE_SOURCES
|
29
|
30
|
#include "pack_data.h"
|
|
31
|
+#endif // DEBUG_DISK_WRITE_SOURCES
|
30
|
32
|
|
31
|
33
|
static FATFS fs;
|
32
|
34
|
static bool mounted = false;
|
33
|
35
|
|
34
|
|
-void debug_disk_init(void) {
|
35
|
|
- if (debug_disk_mount() != 0) {
|
36
|
|
- debug("error mounting disk");
|
37
|
|
- return;
|
38
|
|
- }
|
39
|
|
-
|
40
|
|
- // maximum length: 11 bytes
|
41
|
|
- f_setlabel("DEBUG DISK");
|
42
|
|
-
|
|
36
|
+static void write_readme(void) {
|
43
|
37
|
FIL file;
|
44
|
38
|
FRESULT res = f_open(&file, "README.md", FA_CREATE_ALWAYS | FA_WRITE);
|
45
|
39
|
if (res != FR_OK) {
|
|
@@ -66,8 +60,12 @@ void debug_disk_init(void) {
|
66
|
60
|
debug("error: f_close returned %d", res);
|
67
|
61
|
}
|
68
|
62
|
}
|
|
63
|
+}
|
69
|
64
|
|
70
|
|
- res = f_open(&file, "src.tar.xz", FA_CREATE_ALWAYS | FA_WRITE);
|
|
65
|
+#ifdef DEBUG_DISK_WRITE_SOURCES
|
|
66
|
+static void write_sources(void) {
|
|
67
|
+ FIL file;
|
|
68
|
+ FRESULT res = f_open(&file, "src.tar.xz", FA_CREATE_ALWAYS | FA_WRITE);
|
71
|
69
|
if (res != FR_OK) {
|
72
|
70
|
debug("error: f_open returned %d", res);
|
73
|
71
|
} else {
|
|
@@ -92,6 +90,23 @@ void debug_disk_init(void) {
|
92
|
90
|
debug("error: f_close returned %d", res);
|
93
|
91
|
}
|
94
|
92
|
}
|
|
93
|
+}
|
|
94
|
+#endif // DEBUG_DISK_WRITE_SOURCES
|
|
95
|
+
|
|
96
|
+void debug_disk_init(void) {
|
|
97
|
+ if (debug_disk_mount() != 0) {
|
|
98
|
+ debug("error mounting disk");
|
|
99
|
+ return;
|
|
100
|
+ }
|
|
101
|
+
|
|
102
|
+ // maximum length: 11 bytes
|
|
103
|
+ f_setlabel("DEBUG DISK");
|
|
104
|
+
|
|
105
|
+ write_readme();
|
|
106
|
+
|
|
107
|
+#ifdef DEBUG_DISK_WRITE_SOURCES
|
|
108
|
+ write_sources();
|
|
109
|
+#endif // DEBUG_DISK_WRITE_SOURCES
|
95
|
110
|
|
96
|
111
|
if (debug_disk_unmount() != 0) {
|
97
|
112
|
debug("error unmounting disk");
|