2021-06-08 13:20:23 +00:00
|
|
|
// XFLASH memory layout
|
|
|
|
#pragma once
|
|
|
|
#include <stdint.h>
|
2021-06-08 17:50:43 +00:00
|
|
|
#include "bootapp.h" // for RAMSIZE
|
2021-06-08 13:20:23 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#define XFLASH_SIZE 0x40000ul // size of XFLASH
|
|
|
|
#define LANG_OFFSET 0x0 // offset for language data
|
2021-06-08 13:28:02 +00:00
|
|
|
|
|
|
|
#ifndef XFLASH_DUMP
|
2021-06-08 13:20:23 +00:00
|
|
|
#define LANG_SIZE XFLASH_SIZE
|
2021-06-08 13:28:02 +00:00
|
|
|
#else
|
|
|
|
|
2021-06-21 22:04:39 +00:00
|
|
|
#define DUMP_MAGIC 0x55525547ul
|
2021-06-08 13:28:02 +00:00
|
|
|
|
|
|
|
struct dump_header_t
|
|
|
|
{
|
|
|
|
// start with a magic value to indicate the presence of a dump, so that clearing
|
|
|
|
// a single page is sufficient for resetting the state
|
|
|
|
uint32_t magic;
|
|
|
|
|
|
|
|
uint8_t regs_present; // true when the lower segment containing registers is present
|
2021-06-10 15:35:49 +00:00
|
|
|
uint8_t crash_reason; // uses values from dump_crash_source
|
2021-06-16 21:58:00 +00:00
|
|
|
|
|
|
|
uint32_t pc; // PC nearby the crash location
|
|
|
|
uint16_t sp; // SP nearby the crash location
|
2021-06-08 13:28:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct dump_data_t
|
|
|
|
{
|
|
|
|
// contiguous region containing all addressable ranges
|
2021-06-08 15:53:06 +00:00
|
|
|
uint8_t regs[RAMSTART];
|
|
|
|
uint8_t sram[RAMSIZE];
|
2021-06-08 13:28:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct dump_t
|
|
|
|
{
|
|
|
|
struct dump_header_t header;
|
|
|
|
|
|
|
|
// data is page aligned (no real space waste, due to the larger
|
|
|
|
// alignment required for the whole dump)
|
|
|
|
struct dump_data_t __attribute__((aligned(256))) data;
|
|
|
|
};
|
|
|
|
|
|
|
|
// dump offset must be aligned to lower 4kb sector boundary
|
|
|
|
#define DUMP_OFFSET ((XFLASH_SIZE - sizeof(dump_t)) & ~0xFFFul)
|
|
|
|
|
|
|
|
#define DUMP_SIZE (XFLASH_SIZE - DUMP_OFFSET) // effective dump size area
|
|
|
|
#define LANG_SIZE DUMP_OFFSET // available language space
|
|
|
|
|
|
|
|
#endif
|