Skip to content

Instantly share code, notes, and snippets.

@jenschr
Last active September 14, 2020 11:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jenschr/db00a9d1e97e78abe9b4095371fbe5df to your computer and use it in GitHub Desktop.
Save jenschr/db00a9d1e97e78abe9b4095371fbe5df to your computer and use it in GitHub Desktop.
To get Flatbuffers to work with Teensy, we need to remove the Arduino specific code for STL (Teensy supports STL directly) in base.h (look for EDIT below, in two places)
#ifndef FLATBUFFERS_BASE_H_
#define FLATBUFFERS_BASE_H_
// clang-format off
// If activate should be declared and included first.
#if defined(FLATBUFFERS_MEMORY_LEAK_TRACKING) && \
defined(_MSC_VER) && defined(_DEBUG)
// The _CRTDBG_MAP_ALLOC inside <crtdbg.h> will replace
// calloc/free (etc) to its debug version using #define directives.
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
// Replace operator new by trace-enabled version.
#define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
#define new DEBUG_NEW
#endif
#if !defined(FLATBUFFERS_ASSERT)
#include <assert.h>
#define FLATBUFFERS_ASSERT assert
#elif defined(FLATBUFFERS_ASSERT_INCLUDE)
// Include file with forward declaration
#include FLATBUFFERS_ASSERT_INCLUDE
#endif
#ifndef ARDUINO
#include <cstdint>
#endif
#include <cstddef>
#include <cstdlib>
#include <cstring>
// EDIT: Remove the if defined(ARDUINO) part
#include <utility>
#include <string>
#include <type_traits>
#include <vector>
#include <set>
#include <algorithm>
#include <iterator>
#include <memory>
#ifdef _STLPORT_VERSION
#define FLATBUFFERS_CPP98_STL
#endif
#ifndef FLATBUFFERS_CPP98_STL
#include <functional>
#endif
// EDIT: remove the "flatbuffers/" path
#include "stl_emulation.h"
#if defined(__ICCARM__)
#include <intrinsics.h>
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment