[escher] Indicate the address of the file system in the header section

of the flash
This commit is contained in:
Émilie Feral
2018-02-27 14:41:10 +01:00
committed by EmilieNumworks
parent 19ca0f0640
commit 338ee4e0b0
3 changed files with 27 additions and 2 deletions

View File

@@ -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

View File

@@ -3,6 +3,17 @@
#include <string.h>
#include <assert.h>
#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;
}

View File

@@ -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/, \