]> vcs.slashdirt.org Git - sw/tic2json.git/commitdiff

vcs.slashdirt.org Git - sw/tic2json.git/commitdiff

git git / sw / tic2json.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ba1cbaf)
embedded: add ARM Mbed stub
2021年9月14日 19:59:02 +0000 (21:59 +0200)
2021年9月15日 19:44:59 +0000 (21:44 +0200)

diff --git a/embedded/ARM-Mbed/mbed-os-tic2json/.gitignore b/embedded/ARM-Mbed/mbed-os-tic2json/.gitignore
new file mode 100644 (file)
index 0000000..82e5343
--- /dev/null
+++ b/embedded/ARM-Mbed/mbed-os-tic2json/.gitignore
@@ -0,0 +1,7 @@
+.build
+.mbed
+projectfiles
+*.py*
+mbed-os
+BUILD
+
diff --git a/embedded/ARM-Mbed/mbed-os-tic2json/README.md b/embedded/ARM-Mbed/mbed-os-tic2json/README.md
new file mode 100644 (file)
index 0000000..3a93f96
--- /dev/null
+++ b/embedded/ARM-Mbed/mbed-os-tic2json/README.md
@@ -0,0 +1,21 @@
+# _mbed-os-tic2json_
+
+Non-functional implementation of tic2json for ARM Mbed.
+Gets TIC data on RX pin, outputs formatted JSON on UART TX.
+
+**Note:** it seems using stdio on this platform does not produce the expected
+results so this implementation will probably need more work. TBC.
+
+### Configure the project
+
+* Edit `tic2json/mbed_lib.json`: in `macros` adjust for `TICV01` or `TICV02`
+* Edit `main.cpp`, adjust defines at the top
+* Copy or link `mbed-os`
+
+### Build and Flash
+
+Before build, run `make -C tic2json/src csources`
+
+Build the project and flash it to the board, using Mbed Studio or `mbed`.
+
+Note: ARMC6 does not seem to correctly build this, use GCC_ARM instead.
diff --git a/embedded/ARM-Mbed/mbed-os-tic2json/main.cpp b/embedded/ARM-Mbed/mbed-os-tic2json/main.cpp
new file mode 100644 (file)
index 0000000..2971306
--- /dev/null
+++ b/embedded/ARM-Mbed/mbed-os-tic2json/main.cpp
@@ -0,0 +1,43 @@
+//
+// main.cpp
+// app stub for ARM Mbed OS
+//
+// (C) 2021 Thibaut VARENE
+// License: GPLv2 - http://www.gnu.org/licenses/gpl-2.0.html
+//
+
+/**
+ * @file
+ * Receives TIC on RX, outputs JSON on TX.
+ */
+
+#include "mbed.h"
+
+#define TIC_TX CONSOLE_TX
+#define TIC_RX CONSOLE_RX
+#define TICBAUDRATE 9600 // 1200 for V01, 9600 for V02s
+
+//https://forums.mbed.com/t/hitchhikers-guide-to-printf-in-mbed-6/12492
+namespace mbed
+{
+ FileHandle *mbed_override_console(int fd)
+ {
+ static BufferedSerial console(TIC_TX, TIC_RX, TICBAUDRATE);
+ console.set_format(7, BufferedSerial::Even, 1);
+ return &console;
+ }
+}
+
+extern "C" {
+ void tic2json_main(void);
+}
+
+
+// main() runs in its own thread in the OS
+int main()
+{
+ while (true)
+ tic2json_main();
+
+ return 0;
+}
diff --git a/embedded/ARM-Mbed/mbed-os-tic2json/mbed-os.lib b/embedded/ARM-Mbed/mbed-os-tic2json/mbed-os.lib
new file mode 100644 (file)
index 0000000..8f47248
--- /dev/null
+++ b/embedded/ARM-Mbed/mbed-os-tic2json/mbed-os.lib
@@ -0,0 +1 @@
+https://github.com/ARMmbed/mbed-os.git#26606218ad9d1ee1c8781aa73774fd7ea3a7658e
\ No newline at end of file
diff --git a/embedded/ARM-Mbed/mbed-os-tic2json/mbed_app.json b/embedded/ARM-Mbed/mbed-os-tic2json/mbed_app.json
new file mode 100644 (file)
index 0000000..425c790
--- /dev/null
+++ b/embedded/ARM-Mbed/mbed-os-tic2json/mbed_app.json
@@ -0,0 +1,7 @@
+{
+ "target_overrides": {
+ "*": {
+ "rtos.main-thread-stack-size": 8192
+ }
+ }
+}
\ No newline at end of file
diff --git a/embedded/ARM-Mbed/mbed-os-tic2json/tic2json/.mbedignore b/embedded/ARM-Mbed/mbed-os-tic2json/tic2json/.mbedignore
new file mode 100644 (file)
index 0000000..eaa1c66
--- /dev/null
+++ b/embedded/ARM-Mbed/mbed-os-tic2json/tic2json/.mbedignore
@@ -0,0 +1 @@
+src/embedded/*
diff --git a/embedded/ARM-Mbed/mbed-os-tic2json/tic2json/mbed_lib.json b/embedded/ARM-Mbed/mbed-os-tic2json/tic2json/mbed_lib.json
new file mode 100644 (file)
index 0000000..440397f
--- /dev/null
+++ b/embedded/ARM-Mbed/mbed-os-tic2json/tic2json/mbed_lib.json
@@ -0,0 +1,4 @@
+{
+ "name": "tic2json",
+ "macros": ["BAREBUILD", "TICV02"]
+}
diff --git a/embedded/ARM-Mbed/mbed-os-tic2json/tic2json/src b/embedded/ARM-Mbed/mbed-os-tic2json/tic2json/src
new file mode 120000 (symlink)
index 0000000..210be6a
--- /dev/null
+++ b/embedded/ARM-Mbed/mbed-os-tic2json/tic2json/src
@@ -0,0 +1 @@
+/Users/varenet/NOBACKUP/tic2json
\ No newline at end of file
tic2json TIC parser/converter
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /