mirror of
https://github.com/HendrikRauh/dmx-interface.git
synced 2025-07-12 00:15:44 +00:00
Other ETH lib
This commit is contained in:
parent
3ce1df2136
commit
c295017495
70 changed files with 21645 additions and 67 deletions
21
lib/ArtNet/Artnet/util/TeensyDirtySTLErrorSolution/LICENSE
Normal file
21
lib/ArtNet/Artnet/util/TeensyDirtySTLErrorSolution/LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2020 Hideaki Tai
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
57
lib/ArtNet/Artnet/util/TeensyDirtySTLErrorSolution/README.md
Normal file
57
lib/ArtNet/Artnet/util/TeensyDirtySTLErrorSolution/README.md
Normal file
|
@ -0,0 +1,57 @@
|
|||
# TeensyDirtySTLErrorSolution
|
||||
|
||||
dirty solution to use STL in teensy
|
||||
|
||||
## Introduction
|
||||
|
||||
Sometimes we want to use STL on Teensy, but Teensy 3.x in Arduino IDE does not support STL by default. Though STL is enabled on Teensy 4.x, but you have to enable it manually on Teensy 3.x. If you use PlatformIO, you can also use STL on Teensy 3.x.
|
||||
|
||||
| | Teensy 4.x | Teensy 3.x |
|
||||
| ----------- | ----------------- | ----------------- |
|
||||
| PlatformIO | Almost Compilable | Almost Compilable |
|
||||
| Arduino IDE | Almost Compilable | NOT Compilable |
|
||||
|
||||
|
||||
## Enable STL in Arduino IDE
|
||||
|
||||
To enable STL on Teensy 3.x using Arduino IDE, add `-lstdc++` to `build flags`, which is defined in `boards.txt`. Many STL can be used by adding this flag. You have to do this procedure every time you upgrade the version of Teensyduino.
|
||||
|
||||
| OS | default location |
|
||||
| ------- | --------------------------------------------------------------- |
|
||||
| macOS | `Arduino.app/Contents/Java/hardware/teensy/avr/boards.txt` |
|
||||
| Windows | `C:\Program Files (x86)\Arduino\hardware\teensy\avr\boards.txt` |
|
||||
|
||||
|
||||
#### Before
|
||||
|
||||
``` boards.txt
|
||||
teensy36.build.flags.libs=-larm_cortexM4lf_math -lm
|
||||
teensy35.build.flags.libs=-larm_cortexM4lf_math -lm
|
||||
teensy31.build.flags.libs=-larm_cortexM4l_math -lm
|
||||
```
|
||||
|
||||
#### After
|
||||
|
||||
``` boards.txt
|
||||
teensy36.build.flags.libs=-larm_cortexM4lf_math -lm -lstdc++
|
||||
teensy35.build.flags.libs=-larm_cortexM4lf_math -lm -lstdc++
|
||||
teensy31.build.flags.libs=-larm_cortexM4l_math -lm -lstdc++
|
||||
```
|
||||
|
||||
## Do you still have compile error?
|
||||
|
||||
Yes, maybe you still have compilation error in both 4.x and 3.x for some STLs... Then you should add this library (header file) to your project. Some dirty solution I found is included in this header file.
|
||||
|
||||
``` C++
|
||||
#include <TeensyDirtySTLErrorSolution.h>
|
||||
```
|
||||
|
||||
## Warning
|
||||
|
||||
This method is not recommended because STL is not enabled by default... (if you know the reason, please let me know). I am not responsible for any trouble that may occur as a result of the use of this library. Please use at your own risk.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#ifdef TEENSYDUINO
|
||||
#ifndef TEENSYDUINO_DIRTY_STL_ERROR_SOLUTION
|
||||
#define TEENSYDUINO_DIRTY_STL_ERROR_SOLUTION
|
||||
|
||||
|
||||
#if defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__) // TEENSY 3.1/3.2, 3.5, 3.6
|
||||
|
||||
extern "C"
|
||||
{
|
||||
int _write() { return -1; }
|
||||
}
|
||||
|
||||
#elif defined(__IMXRT1062__) // TEENSY4.0
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void *__exidx_start __attribute__((__visibility__ ("hidden")));
|
||||
void *__exidx_end __attribute__((__visibility__ ("hidden")));
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#error NOT SUPPORTED TEENSY VERSION
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
// ----- template -----
|
||||
//
|
||||
// #if defined(__MK20DX256__) // TEENSY3.1/3.2
|
||||
// #elif defined(__MK64FX512__) // TEENSY3.5
|
||||
// #elif defined(__MK66FX1M0__) // TEENSY3.6
|
||||
// #elif defined(__IMXRT1062__) // TEENSY4.0
|
||||
//
|
||||
// extern "C"
|
||||
// {
|
||||
// int _getpid() { return -1; }
|
||||
// int _kill(int pid, int sig) { return -1; }
|
||||
// int _write() { return -1; }
|
||||
// void *__exidx_start __attribute__((__visibility__ ("hidden")));
|
||||
// void *__exidx_end __attribute__((__visibility__ ("hidden")));
|
||||
// int _getpid();// { return -1; }
|
||||
// int _kill(int pid, int sig);// { return -1; }
|
||||
// int _write() { return -1; }
|
||||
// void *__exidx_start __attribute__((__visibility__ ("hidden")));
|
||||
// void *__exidx_end __attribute__((__visibility__ ("hidden")));
|
||||
// }
|
||||
//
|
||||
// // copied from https://github.com/gcc-mirror/
|
||||
// namespace std
|
||||
// {
|
||||
// void __throw_bad_alloc() { _GLIBCXX_THROW_OR_ABORT(bad_alloc()); }
|
||||
// void __throw_length_error(const char* __s __attribute__((unused))) { _GLIBCXX_THROW_OR_ABORT(length_error(_(__s))); }
|
||||
// void __throw_bad_function_call() { _GLIBCXX_THROW_OR_ABORT(bad_function_call()); }
|
||||
// void _Rb_tree_decrement(std::_Rb_tree_node_base* a) {}
|
||||
// void _Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&) {}
|
||||
// }
|
||||
|
||||
#endif // TEENSYDUINO_DIRTY_STL_ERROR_SOLUTION
|
||||
#endif // TEENSYDUINO
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue