Skip to content

Instantly share code, notes, and snippets.

@pamaury
Created June 19, 2017 21:20
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save pamaury/d18d7b017eee5febf0330fa7f300a75d to your computer and use it in GitHub Desktop.
diff --git a/apps/plugins/SUBDIRS b/apps/plugins/SUBDIRS
index c22977f..ed75631a 100644
--- a/apps/plugins/SUBDIRS
+++ b/apps/plugins/SUBDIRS
@@ -31,7 +31,7 @@ fft
#endif
chessbox
-fractals
+//fractals
imageviewer
sudoku
reversi
diff --git a/apps/plugins/lib/SOURCES b/apps/plugins/lib/SOURCES
index d49605f..ce586bd 100644
--- a/apps/plugins/lib/SOURCES
+++ b/apps/plugins/lib/SOURCES
@@ -1,3 +1,4 @@
+../../../firmware/clang_fix_eabi.c
gcc-support.c
pluginlib_actions.c
helper.c
diff --git a/firmware/SOURCES b/firmware/SOURCES
index 2510419..2d6203b 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -1,6 +1,6 @@
#undef unix /* causes problems with some files */
#undef linux
-
+clang_fix_eabi.c
ata_idle_notify.c
events.c
backlight.c
diff --git a/firmware/clang_fix_eabi.c b/firmware/clang_fix_eabi.c
new file mode 100644
index 0000000..b453804
--- /dev/null
+++ b/firmware/clang_fix_eabi.c
@@ -0,0 +1,57 @@
+#include <stddef.h>
+
+void __aeabi_memcpy8(void *dest, const void *src, size_t n) {
+ memcpy(dest, src, n);
+}
+
+void __aeabi_memcpy4(void *dest, const void *src, size_t n) {
+ memcpy(dest, src, n);
+}
+
+void __aeabi_memcpy(void *dest, const void *src, size_t n) {
+ memcpy(dest, src, n);
+}
+
+
+void __aeabi_memmove8(void *dest, const void *src, size_t n) {
+ memmove(dest, src, n);
+}
+
+void __aeabi_memmove4(void *dest, const void *src, size_t n) {
+ memmove(dest, src, n);
+}
+
+void __aeabi_memmove(void *dest, const void *src, size_t n) {
+ memmove(dest, src, n);
+}
+
+/*
+ * __aeabi_memset has the order of its second and third arguments reversed.
+ * This allows __aeabi_memclr to tail-call __aeabi_memset
+ */
+
+void __aeabi_memset8(void *dest, size_t n, int c) {
+ memset(dest, c, n);
+}
+
+void __aeabi_memset4(void *dest, size_t n, int c) {
+ memset(dest, c, n);
+}
+
+void __aeabi_memset(void *dest, size_t n, int c) {
+ memset(dest, c, n);
+}
+
+
+void __aeabi_memclr8(void *dest, size_t n) {
+ __aeabi_memset8(dest, n, 0);
+}
+
+void __aeabi_memclr4(void *dest, size_t n) {
+ __aeabi_memset4(dest, n, 0);
+}
+
+void __aeabi_memclr(void *dest, size_t n) {
+ __aeabi_memset(dest, n, 0);
+}
+
diff --git a/lib/libsetjmp/arm/setjmp.S b/lib/libsetjmp/arm/setjmp.S
index ee5ebd9..eb7c895 100644
--- a/lib/libsetjmp/arm/setjmp.S
+++ b/lib/libsetjmp/arm/setjmp.S
@@ -6,19 +6,20 @@
#define CONCAT(a, b) CONCAT2(a, b)
#define CONCAT2(a, b) a##b
+#define __USER_LABEL_PREFIX__
#ifndef __USER_LABEL_PREFIX__
#error __USER_LABEL_PREFIX__ not defined
#endif
#define SYM(x) CONCAT (__USER_LABEL_PREFIX__, x)
-#ifdef __ELF__
+//#ifdef __ELF__
#define TYPE(x) .type SYM(x),function
#define SIZE(x) .size SYM(x), . - SYM(x)
-#else
-#define TYPE(x)
-#define SIZE(x)
-#endif
+//#else
+//#define TYPE(x)
+//#define SIZE(x)
+//#endif
/* Arm/Thumb interworking support:
diff --git a/lib/rbcodec/codecs/lib/SOURCES b/lib/rbcodec/codecs/lib/SOURCES
index 257dcb5..f533034 100644
--- a/lib/rbcodec/codecs/lib/SOURCES
+++ b/lib/rbcodec/codecs/lib/SOURCES
@@ -7,6 +7,8 @@ mdct_lookup.c
fft-ffmpeg.c
mdct.c
+../../../../firmware/clang_fix_eabi.c
+
#elif (CONFIG_PLATFORM & PLATFORM_HOSTED) && defined(__APPLE__)
osx.dummy.c
#endif
diff --git a/lib/rbcodec/codecs/libspc/spc_codec.h b/lib/rbcodec/codecs/libspc/spc_codec.h
index 7f6b6e2..2e6edff 100644
--- a/lib/rbcodec/codecs/libspc/spc_codec.h
+++ b/lib/rbcodec/codecs/libspc/spc_codec.h
@@ -304,7 +304,8 @@ struct voice_t
extern int16_t BRRcache [BRR_CACHE_SIZE];
#endif
-enum { FIR_BUF_HALF = 8 };
+//enum { FIR_BUF_HALF = 8 };
+#define FIR_BUF_HALF 8
#if defined(CPU_COLDFIRE)
/* global because of the large aligment requirement for hardware masking -
@@ -327,6 +328,12 @@ enum
FIR_BUF_MASK = ~((FIR_BUF_ALIGN / 2) | (sizeof ( int32_t ) - 1))
};
#else
+#define FIR_BUF_CNT (FIR_BUF_HALF * 2 * 2)
+#define FIR_BUF_SIZE (FIR_BUF_CNT * sizeof ( int32_t ))
+#define FIR_BUF_ALIGN (FIR_BUF_SIZE)
+#define FIR_BUF_MASK (~((FIR_BUF_ALIGN / 2) | (sizeof ( int32_t ) * 2 - 1)))
+
+#if 0
enum
{
FIR_BUF_CNT = FIR_BUF_HALF * 2 * 2,
@@ -334,6 +341,7 @@ enum
FIR_BUF_ALIGN = FIR_BUF_SIZE,
FIR_BUF_MASK = ~((FIR_BUF_ALIGN / 2) | (sizeof ( int32_t ) * 2 - 1))
};
+#endif
#endif /* ARM_ARCH */
#endif /* CPU_* */
diff --git a/lib/rbcodec/codecs/libspc/spc_dsp.c b/lib/rbcodec/codecs/libspc/spc_dsp.c
index 6350c4c..f1253dc 100644
--- a/lib/rbcodec/codecs/libspc/spc_dsp.c
+++ b/lib/rbcodec/codecs/libspc/spc_dsp.c
@@ -29,7 +29,7 @@
#if defined(CPU_COLDFIRE) || defined (CPU_ARM)
int32_t fir_buf[FIR_BUF_CNT] IBSS_ATTR_SPC
- __attribute__((aligned(FIR_BUF_ALIGN*1)));
+ __attribute__((aligned(FIR_BUF_ALIGN)));
#endif
#if SPC_BRRCACHE
/* a little extra for samples that go past end */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment