-
Notifications
You must be signed in to change notification settings - Fork 2
/
Rack.armv7l.patch
147 lines (130 loc) · 4.69 KB
/
Rack.armv7l.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
diff --git a/compile.mk b/compile.mk
index 81c55f3..a1e26fb 100644
--- a/compile.mk
+++ b/compile.mk
@@ -12,7 +12,9 @@ FLAGS += -MMD -MP
# Debugger symbols. These are removed with `strip`.
FLAGS += -g
# Optimization
-FLAGS += -O3 -march=nocona -funsafe-math-optimizations
+#FLAGS += -O3 -march=armv7 -mfpu=neon -mno-unaligned-access -funsafe-math-optimizations
+# use the below options to optimize for the odroid u3
+FLAGS += -O3 -march=armv7 -mtune=cortex-a9 -mfpu=neon -mno-unaligned-access -funsafe-math-optimizations
# Warnings
FLAGS += -Wall -Wextra -Wno-unused-parameter
# C++ standard
@@ -72,7 +72,7 @@ build/%.m.o: %.m
build/%.bin.o: %
@mkdir -p $(@D)
ifdef ARCH_LIN
- $(OBJCOPY) -I binary -O elf64-x86-64 -B i386:x86-64 --rename-section .data=.rodata,alloc,load,readonly,data,contents $< $@
+ $(OBJCOPY) -I binary -O elf32-littlearm -B arm7 --rename-section .data=.rodata,alloc,load,readonly,data,contents $< $@
endif
ifdef ARCH_WIN
$(OBJCOPY) -I binary -O pe-x86-64 -B i386:x86-64 --rename-section .data=.rodata,alloc,load,readonly,data,contents $< $@
diff --git a/dep.mk b/dep.mk
index bad90ec..c1412e4 100644
--- a/dep.mk
+++ b/dep.mk
@@ -5,7 +5,9 @@ DEP_LOCAL ?= dep
$(shell mkdir -p $(DEP_LOCAL))
DEP_PATH := $(abspath $(DEP_LOCAL))
-DEP_FLAGS += -g -O3 -march=nocona
+#DEP_FLAGS += -g -O3 -march=armv7 -mfpu=neon -mno-unaligned-access
+# use the below options to optimize for the odroid u3
+DEP_FLAGS += -g -O3 -march=armv7 -mtune=cortex-a9 -mfpu=neon -mno-unaligned-access
ifeq ($(ARCH), mac)
DEP_MAC_SDK_FLAGS := -mmacosx-version-min=10.7
diff --git a/include/engine/Port.hpp b/include/engine/Port.hpp
index 012a3ec..3d9dfb9 100644
--- a/include/engine/Port.hpp
+++ b/include/engine/Port.hpp
@@ -11,7 +11,7 @@ namespace engine {
static const int PORT_MAX_CHANNELS = 16;
-struct alignas(32) Port {
+struct Port {
/** Voltage of the port. */
union {
/** Unstable API. Use getVoltage() and setVoltage() instead. */
diff --git a/plugin.mk b/plugin.mk
index ca2cd8e..88f56d1 100644
--- a/plugin.mk
+++ b/plugin.mk
@@ -48,6 +48,8 @@ all: $(TARGET)
include $(RACK_DIR)/compile.mk
+FLAGS += -mfpu=neon -mno-unaligned-access
+
clean:
rm -rfv build $(TARGET) dist
diff --git a/dep/Makefile b/dep/Makefile
index 4ce54ad..0878501 100755
--- a/dep/Makefile
+++ b/dep/Makefile
@@ -113,8 +113,8 @@ openssl-1.1.1d:
rm openssl-1.1.1d.tar.gz
$(openssl): openssl-1.1.1d
- @# ./config ignores CFLAGS, so hack it in with CC
- cd openssl-1.1.1d && CC="$(CC) $(CFLAGS)" ./config --prefix="$(DEP_PATH)"
+ @# we have to unset CFLAGS, as otherwise it will try to compile armv8 asm
+ cd openssl-1.1.1d && CFLAGS="" ./config --prefix="$(DEP_PATH)"
$(MAKE) -C openssl-1.1.1d
$(MAKE) -C openssl-1.1.1d install_sw
@@ -185,10 +185,15 @@ $(libsamplerate): libsamplerate-0.1.9
$(MAKE) -C libsamplerate-0.1.9 install
rtmidi-4.0.0:
- $(WGET) "http://www.music.mcgill.ca/~gary/rtmidi/release/rtmidi-4.0.0.tar.gz"
- $(SHA256) rtmidi-4.0.0.tar.gz 370cfe710f43fbeba8d2b8c8bc310f314338c519c2cf2865e2d2737b251526cd
- $(UNTAR) rtmidi-4.0.0.tar.gz
- rm rtmidi-4.0.0.tar.gz
+# $(WGET) "http://www.music.mcgill.ca/~gary/rtmidi/release/rtmidi-4.0.0.tar.gz"
+# $(SHA256) rtmidi-4.0.0.tar.gz 370cfe710f43fbeba8d2b8c8bc310f314338c519c2cf2865e2d2737b251526cd
+# $(UNTAR) rtmidi-4.0.0.tar.gz
+# rm rtmidi-4.0.0.tar.gz
+ $(WGET) "https://github.com/thestk/rtmidi/archive/4.0.0.tar.gz"
+ $(SHA256) 4.0.0.tar.gz d32de9ceebf6d969537e9a9720925a1ac7f6a8bc4ac4ce7c58c01434f4e54f44
+ $(UNTAR) 4.0.0.tar.gz
+ rm 4.0.0.tar.gz
+ cd rtmidi-4.0.0 && ./autogen.sh --no-configure
RTMIDI_FLAGS += --enable-shared=no
ifdef ARCH_LIN
diff --git a/src/engine/Engine.cpp b/src/engine/Engine.cpp
index ee0e64b..3b6bc33 100644
--- a/src/engine/Engine.cpp
+++ b/src/engine/Engine.cpp
@@ -10,7 +10,8 @@
#include <mutex>
#include <atomic>
#include <tuple>
-#include <pmmintrin.h>
+/* #include <pmmintrin.h> */
+#include <unistd.h>
namespace rack {
@@ -20,10 +21,10 @@ namespace engine {
static void initMXCSR() {
// Set CPU to flush-to-zero (FTZ) and denormals-are-zero (DAZ) mode
// https://software.intel.com/en-us/node/682949
- _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);
- _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON);
+ // _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);
+ // _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON);
// Reset other flags
- _MM_SET_ROUNDING_MODE(_MM_ROUND_NEAREST);
+ // _MM_SET_ROUNDING_MODE(_MM_ROUND_NEAREST);
}
@@ -93,7 +94,7 @@ struct SpinBarrier {
}
else {
while (count != 0) {
- _mm_pause();
+ asm volatile("yield" ::: "memory");
}
}
}
@@ -131,7 +132,7 @@ struct HybridBarrier {
while (!yield) {
if (count == 0)
return;
- _mm_pause();
+ asm volatile("yield" ::: "memory");
}
// Wait on mutex