From f440728644ad3698ffd6af1abcfcc07aad5793c3 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Tue, 8 Aug 2023 23:10:02 -0400 Subject: initial commit * combine all source files into this monorepo * convert all third-party source packages into submodules * small fixes due to changes in latest third-part packages --- firmware/source/elfload.hpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 firmware/source/elfload.hpp (limited to 'firmware/source/elfload.hpp') diff --git a/firmware/source/elfload.hpp b/firmware/source/elfload.hpp new file mode 100644 index 0000000..10d95d7 --- /dev/null +++ b/firmware/source/elfload.hpp @@ -0,0 +1,39 @@ +/** + * @file elfload.hpp + * @brief Loads ELF binary data into memory for execution. + * + * Copyright (C) 2021 Clyne Sullivan + * + * Distributed under the GNU GPL v3 or later. You should have received a copy of + * the GNU General Public License along with this program. + * If not, see . + */ + +#ifndef ELF_LOAD_HPP_ +#define ELF_LOAD_HPP_ + +#include "samplebuffer.hpp" + +#include +#include + +constexpr unsigned int MAX_ELF_FILE_SIZE = 16 * 1024; + +class ELFManager +{ +public: + using EntryFunc = Sample *(*)(Sample *, size_t); + + static bool loadFromInternalBuffer(); + static EntryFunc loadedElf(); + static unsigned char *fileBuffer(); + static void unload(); + +private: + static EntryFunc m_entry; + + static std::array m_file_buffer; +}; + +#endif // ELF_LOAD_HPP_ + -- cgit v1.2.3