aboutsummaryrefslogtreecommitdiffstats
path: root/filter
diff options
context:
space:
mode:
Diffstat (limited to 'filter')
-rw-r--r--filter/Makefile14
-rw-r--r--filter/test.cpp15
2 files changed, 29 insertions, 0 deletions
diff --git a/filter/Makefile b/filter/Makefile
new file mode 100644
index 0000000..a1ce186
--- /dev/null
+++ b/filter/Makefile
@@ -0,0 +1,14 @@
+all:
+ @arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -Os --specs=nosys.specs -nostartfiles -fPIE -c test.cpp
+ @arm-none-eabi-ld -shared -n -N -z max-page-size=512 -Ttext-segment=0 \
+ test.o -o test.so
+ @arm-none-eabi-strip -s -S --strip-unneeded test.so
+ @arm-none-eabi-objcopy --remove-section .dynsym \
+ --remove-section .dynstr \
+ --remove-section .dynamic \
+ --remove-section .hash \
+ --remove-section .ARM.exidx \
+ --remove-section .ARM.attributes \
+ --remove-section .comment \
+ test.so
+
diff --git a/filter/test.cpp b/filter/test.cpp
new file mode 100644
index 0000000..0953539
--- /dev/null
+++ b/filter/test.cpp
@@ -0,0 +1,15 @@
+#include <cstdint>
+
+using adcsample_t = uint16_t;
+__attribute__((section(".process_data")))
+void process_data(adcsample_t *samples, unsigned int size);
+
+////////////////////////////////////////////////////////////////////////////////
+
+void process_data(adcsample_t *samples, unsigned int size)
+{
+ size--;
+ for (unsigned int i = 0; i < size; i++)
+ samples[i] = samples[i] * 80 / 100 + samples[i + 1] * 20 / 100;
+}
+