xfdump: reuse standard definitions for SRAM size/offset

This commit is contained in:
Yuri D'Elia 2021-06-08 17:53:06 +02:00
parent 520f7a2e26
commit c331c07b16
4 changed files with 8 additions and 10 deletions

View file

@ -278,7 +278,7 @@ void dcode_1()
*/ */
void dcode_2() void dcode_2()
{ {
dcode_core(SRAM_START, SRAM_START + SRAM_SIZE, dcode_mem_t::sram, 2, _N("SRAM")); dcode_core(RAMSTART, RAMEND, dcode_mem_t::sram, 2, _N("SRAM"));
} }
#endif #endif

View file

@ -3,10 +3,11 @@
#define BOOTAPP_H #define BOOTAPP_H
#include "config.h" #include "config.h"
#include <avr/io.h>
#include <inttypes.h> #include <inttypes.h>
#define RAMSIZE 0x2000 #define RAMSIZE (RAMEND-RAMSTART)
#define boot_src_addr (*((uint32_t*)(RAMSIZE - 16))) #define boot_src_addr (*((uint32_t*)(RAMSIZE - 16)))
#define boot_dst_addr (*((uint32_t*)(RAMSIZE - 12))) #define boot_dst_addr (*((uint32_t*)(RAMSIZE - 12)))
#define boot_copy_size (*((uint16_t*)(RAMSIZE - 8))) #define boot_copy_size (*((uint16_t*)(RAMSIZE - 8)))

View file

@ -83,7 +83,7 @@ void xfdump_dump()
// write sram only // write sram only
xfdump_dump_core(buf, DUMP_OFFSET + offsetof(dump_t, data.sram), xfdump_dump_core(buf, DUMP_OFFSET + offsetof(dump_t, data.sram),
(uint8_t*)SRAM_START, SRAM_SIZE); (uint8_t*)RAMSTART, RAMSIZE);
} }
@ -98,8 +98,7 @@ void xfdump_full_dump_and_reset(bool crash)
cli(); cli();
// write all addressable ranges (this will trash bidirectional registers) // write all addressable ranges (this will trash bidirectional registers)
xfdump_dump_core(buf, DUMP_OFFSET + offsetof(dump_t, data), xfdump_dump_core(buf, DUMP_OFFSET + offsetof(dump_t, data), 0, RAMEND);
0, SRAM_START + SRAM_SIZE);
// force a reset soon // force a reset soon
wdt_enable(0); wdt_enable(0);

View file

@ -1,12 +1,10 @@
// XFLASH memory layout // XFLASH memory layout
#pragma once #pragma once
#include <stdint.h> #include <stdint.h>
#include "bootapp.h"
#include "config.h" #include "config.h"
#define XFLASH_SIZE 0x40000ul // size of XFLASH #define XFLASH_SIZE 0x40000ul // size of XFLASH
#define SRAM_SIZE 0x2000u // size of SRAM
#define SRAM_START 0x200u // start of SRAM
#define LANG_OFFSET 0x0 // offset for language data #define LANG_OFFSET 0x0 // offset for language data
#ifndef XFLASH_DUMP #ifndef XFLASH_DUMP
@ -28,8 +26,8 @@ struct dump_header_t
struct dump_data_t struct dump_data_t
{ {
// contiguous region containing all addressable ranges // contiguous region containing all addressable ranges
uint8_t regs[SRAM_START]; uint8_t regs[RAMSTART];
uint8_t sram[SRAM_SIZE]; uint8_t sram[RAMSIZE];
}; };
struct dump_t struct dump_t