From 2b3aff48bde947894e51da5f95c3ffe0e60cabac Mon Sep 17 00:00:00 2001 From: Leo C Date: Wed, 1 Jun 2016 21:19:47 +0200 Subject: [PATCH] loadcpm3(): set environment variable 'cpm3_scb' with base of scb (physical address) --- avr/cmd_loadcpm3.c | 3 +++ avr/main.c | 2 +- include/config.h | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/avr/cmd_loadcpm3.c b/avr/cmd_loadcpm3.c index f24ee19..6b2f62f 100644 --- a/avr/cmd_loadcpm3.c +++ b/avr/cmd_loadcpm3.c @@ -143,6 +143,9 @@ command_ret_t do_loadcpm3(cmd_tbl_t *cmdtp, int flag, int argc, char * const arg common_base = (uint16_t) buffer[0] + (buffer[1] << 8); setenv_hex(PSTR(ENV_CPM3_COMMON_BASE), common_base); } + + setenv_hex(PSTR(ENV_CPM3_SCB), mem_top - ((res_len - (6 - 1)) << 8) + common_base); + /* Main System Load */ /* Load Common Portion of System */ diff --git a/avr/main.c b/avr/main.c index 7796a36..423b48a 100644 --- a/avr/main.c +++ b/avr/main.c @@ -31,7 +31,7 @@ uint8_t mcusr __attribute__ ((section (".noinit"))); __attribute__ ((naked)) __attribute__ ((section (".init3"))) void preset_ram (void) { - for (uint8_t *p = RAMSTART; p <= (uint8_t *) RAMEND; p++) + for (uint8_t *p = (uint8_t *) RAMSTART; p <= (uint8_t *) RAMEND; p++) *p = 0xdd; } diff --git a/include/config.h b/include/config.h index e20e094..d0a1b31 100644 --- a/include/config.h +++ b/include/config.h @@ -19,6 +19,7 @@ #define ENV_CPM3_SYSFILE "cpm3_file" #define ENV_CPM3_COMMON_BASE "cpm3_commonbase" #define ENV_CPM3_BANKED_BASE "cpm3_bankedbase" +#define ENV_CPM3_SCB "cpm3_scb" #define ENV_PINALIAS "pin_alias" #define ENV_STARTADDRESS "startaddress" -- 2.39.2