diff --git a/ion/Makefile b/ion/Makefile index 61d317d19..ac20803fa 100644 --- a/ion/Makefile +++ b/ion/Makefile @@ -14,13 +14,13 @@ include ion/src/shared/tools/Makefile # char test[4]= "ab"; is valid and should initialize test to 'a','b',0,0). # Older versions of GCC are not conformant so we resort to an initializer list. initializer_list = $(shell echo $(1) | sed "s/\(.\)/'\1',/g")0 -ion/src/shared/software_version.o: SFLAGS += -DPATCH_LEVEL="$(call initializer_list,$(PATCH_LEVEL))" -DEPSILON_VERSION="$(call initializer_list,$(EPSILON_VERSION))" +ion/src/shared/platform_info.o: SFLAGS += -DPATCH_LEVEL="$(call initializer_list,$(PATCH_LEVEL))" -DEPSILON_VERSION="$(call initializer_list,$(EPSILON_VERSION))" objs += $(addprefix ion/src/shared/, \ events.o \ kallax.o \ record.o \ - software_version.o \ + platform_info.o \ ) tests += $(addprefix ion/test/,\ diff --git a/ion/src/device/Makefile b/ion/src/device/Makefile index 69b39c342..210b33e54 100644 --- a/ion/src/device/Makefile +++ b/ion/src/device/Makefile @@ -1,9 +1,7 @@ include ion/src/device/boot/Makefile include ion/src/device/bench/Makefile -ion/src/device/kallax_info.o: SFLAGS += -DHEADER_SECTION="__attribute__((section(\".header\")))" -DFORCE_LINK="__attribute__((used))" - -ion/src/shared/software_version.o: SFLAGS += -DHEADER_SECTION="__attribute__((section(\".header\")))" +ion/src/shared/platform_info.o: SFLAGS += -DHEADER_SECTION="__attribute__((section(\".header\")))" -DFORCE_LINK="__attribute__((used))" objs += $(addprefix ion/src/shared/, \ console_line.o \ @@ -21,7 +19,6 @@ objs += $(addprefix ion/src/device/, \ display.o\ events_keyboard.o\ fcc_id.o\ - kallax_info.o\ keyboard.o\ led.o\ power.o\ diff --git a/ion/src/device/kallax_info.cpp b/ion/src/device/kallax_info.cpp deleted file mode 100644 index e0d6d2b82..000000000 --- a/ion/src/device/kallax_info.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "kallax_info.h" - -#ifndef HEADER_SECTION -#define HEADER_SECTION -#endif - -#ifndef FORCE_LINK -#define FORCE_LINK -#endif - -namespace Ion { -namespace Device { - -extern Kallax f; -constexpr KallaxInfo HEADER_SECTION FORCE_LINK kallax_infos((uint32_t)(&f)); - -} -} diff --git a/ion/src/device/kallax_info.h b/ion/src/device/kallax_info.h deleted file mode 100644 index 4c3ca2f5c..000000000 --- a/ion/src/device/kallax_info.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef ION_DEVICE_KALLAX_INFO_H -#define ION_DEVICE_KALLAX_INFO_H - -#include - -namespace Ion { -namespace Device { - -class KallaxInfo { -public: - constexpr KallaxInfo(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/ion/src/shared/kallax.cpp b/ion/src/shared/kallax.cpp index 79adae710..82ae852bf 100644 --- a/ion/src/shared/kallax.cpp +++ b/ion/src/shared/kallax.cpp @@ -2,18 +2,10 @@ #include #include -#ifndef HEADER_SECTION -#define HEADER_SECTION -#endif - -#ifndef FORCE_LINK -#define FORCE_LINK -#endif +Ion::Kallax kallax; namespace Ion { -Kallax f; - Kallax::Kallax() : m_dataHeader(Magic), m_data(), @@ -24,7 +16,7 @@ Kallax::Kallax() : } Kallax * Kallax::sharedKallax() { - return &f; + return &kallax; } int Kallax::numberOfRecordOfType(Record::Type type) { diff --git a/ion/src/shared/software_version.cpp b/ion/src/shared/platform_info.cpp similarity index 74% rename from ion/src/shared/software_version.cpp rename to ion/src/shared/platform_info.cpp index 59a2a8baf..870e27965 100644 --- a/ion/src/shared/software_version.cpp +++ b/ion/src/shared/platform_info.cpp @@ -16,12 +16,19 @@ #define HEADER_SECTION #endif -class VersionInfo { +#ifndef FORCE_LINK +#define FORCE_LINK +#endif + +extern Ion::Kallax kallax; + +class PlatformInfo { public: - constexpr VersionInfo() : + constexpr PlatformInfo() : m_header(Magic), m_version{EPSILON_VERSION}, m_patchLevel{PATCH_LEVEL}, + m_storageAddress(&kallax), m_footer(Magic) { } const char * version() const { assert(m_header == Magic); @@ -38,15 +45,16 @@ private: uint32_t m_header; const char m_version[8]; const char m_patchLevel[8]; + void * m_storageAddress; uint32_t m_footer; }; -constexpr VersionInfo HEADER_SECTION version_infos; +constexpr PlatformInfo HEADER_SECTION platform_infos; const char * Ion::softwareVersion() { - return version_infos.version(); + return platform_infos.version(); } const char * Ion::patchLevel() { - return version_infos.patchLevel(); + return platform_infos.patchLevel(); }