diff --git a/escher/include/escher/file_system.h b/escher/include/escher/file_system.h index 312193177..fa52e81c2 100644 --- a/escher/include/escher/file_system.h +++ b/escher/include/escher/file_system.h @@ -29,11 +29,24 @@ private: char * nameOfFileStarting(char * start); char * bodyOfFileStarting(char * start); constexpr static size_t k_totalSize = 4096; - constexpr static uint32_t Magic = 0xDEC00DF0; + constexpr static uint32_t Magic = 0xDECA0DF0; uint32_t m_dataHeader; char m_data[k_totalSize]; uint32_t m_dataFooter; }; +class FileSystemInfo { +public: + constexpr FileSystemInfo(uint32_t address) : + m_header(Magic), + m_address(address), + m_footer(Magic) { } +private: + constexpr static uint32_t Magic = 0xDECB0DF0; + uint32_t m_header; + uint32_t m_address; + uint32_t m_footer; +}; + #endif diff --git a/escher/src/file_system.cpp b/escher/src/file_system.cpp index 58d5c5c1d..aae9645aa 100644 --- a/escher/src/file_system.cpp +++ b/escher/src/file_system.cpp @@ -3,6 +3,17 @@ #include #include +#ifndef HEADER_SECTION +#define HEADER_SECTION +#endif + +#ifndef FORCE_LINK +#define FORCE_LINK +#endif + +FileSystem f; +constexpr FileSystemInfo HEADER_SECTION FORCE_LINK file_system_infos((uint32_t)(&f)); + FileSystem::FileSystem() : m_dataHeader(Magic), m_data(), @@ -13,7 +24,6 @@ FileSystem::FileSystem() : } FileSystem * FileSystem::sharedFileSystem() { - static FileSystem f; return &f; } diff --git a/ion/src/device/Makefile b/ion/src/device/Makefile index 79d50998f..9dee045ec 100644 --- a/ion/src/device/Makefile +++ b/ion/src/device/Makefile @@ -1,6 +1,8 @@ include ion/src/device/boot/Makefile include ion/src/device/bench/Makefile +escher/src/file_system.o: SFLAGS += -DHEADER_SECTION="__attribute__((section(\".header\")))" -DFORCE_LINK="__attribute__((used))" + ion/src/shared/software_version.o: SFLAGS += -DHEADER_SECTION="__attribute__((section(\".header\")))" objs += $(addprefix ion/src/shared/, \