extern command_ret_t do_env_set(cmd_tbl_t *, int, int, char * const []);
extern command_ret_t do_env_save(cmd_tbl_t *, int, int, char * const []);
extern command_ret_t do_loadf(cmd_tbl_t *, int, int, char * const []);
+extern command_ret_t do_loadcpm3(cmd_tbl_t *, int, int, char * const []);
+extern command_ret_t do_loadihex(cmd_tbl_t *, int, int, char * const []);
extern command_ret_t do_go(cmd_tbl_t *, int, int, char * const []);
extern command_ret_t do_restart(cmd_tbl_t *, int, int, char * const []);
extern command_ret_t do_console(cmd_tbl_t *, int, int, char * const []);
"EEPROM dump",
"address [count]"
),
+ CMD_TBL_ITEM(
+ !mdf, 3, 1, do_dump_mem,
+ "FLASH dump",
+ "address [count]"
+ ),
CMD_TBL_ITEM(
!cpe, 4, 0, do_eep_cp,
"EEPROM copy",
),
CMD_TBL_ITEM(
echo, CONFIG_SYS_MAXARGS, 1, do_echo,
- "echo args to console",
- "[args..]\n"
- " - echo args to console; \\c suppresses newline"
+ "display a line of text",
+ "[-n] [argument ...]\n"
+ " - echo the argument(s) to console.\n"
+ " -n do not output the trailing newline"
),
CMD_TBL_ITEM(
sleep , 2, 1, do_sleep,
"load srec_cat prepared image from controller flash",
""
),
+CMD_TBL_ITEM(
+ loadcpm3, 3, 0, do_loadcpm3,
+ "load CPM3.SYS file",
+ "[offset] [filename]\n"
+ " - Load CP/M 3 system file from FAT filesystem. This command makes\n"
+ " CPMLDR superfluous. Default filename is '"CONFIG_PATH_CPM3SYS"', but\n"
+ " uses environment variable '"ENV_PATH_CPM3SYS"', if set."
+),
+CMD_TBL_ITEM(
+ loadi, 2, 0, do_loadihex,
+ "load intel hex file over serial line",
+ "[[-]offset]\n"
+ " - load Intel-Hex-Record file over serial line with offset 'offset'"
+),
CMD_TBL_ITEM(
go, 2, 0, do_go,
"start application at address 'addr'",
""
),
CMD_TBL_ITEM(
- connect, 1, 1, do_console,
+ connect, 1, 0, do_console,
"Connect to CPU console i/o",
""
),
" - set address offset for memory commands to 'offset'"
),
CMD_TBL_ITEM(
- loop, 3, 1, do_mem_loop,
+ mloop, 3, 1, do_mem_loop,
"infinite loop on address range",
"address number_of_bytes"
),
-#ifdef CONFIG_LOOPW
CMD_TBL_ITEM(
- loopw, 4, 1, do_mem_loopw,
+ mloopw, 4, 1, do_mem_loopw,
"infinite write loop on address range",
"address number_of_bytes data_to_write"
),
-#endif /* CONFIG_LOOPW */
#ifdef CONFIG_CMD_MEMTEST
CMD_TBL_ITEM(
- mtest, 5, 1, do_mem_mtest,
+ mtest, 4, 1, do_mem_mtest,
"simple RAM read/write test",
- "[start [end [pattern [iterations]]]]"
+ "[start [end [iterations]]]"
),
#endif /* CONFIG_CMD_MEMTEST */
"address count delay(ms)"
),
CMD_TBL_ITEM(
- mwc, 4, 1, do_mem_mwc,
+ mwc, 4, 1, do_mem_mdc,
"memory write cyclic",
"address value delay(ms)"
),
#include "common.h"
#include <avr/interrupt.h>
+ #include <avr/wdt.h>
#include <stdlib.h>
#include <stdio.h>
#include "config.h"
-#include "debug.h"
+#include "ff.h"
#include "z80-if.h"
#include "i2c.h"
#include "con-utils.h"
#include "gpio.h"
#include "time.h"
#include "rtc.h"
+#include "debug.h"
- static uint8_t mcusr;
+ uint8_t mcusr __attribute__ ((section (".noinit")));
- /*--------------------------------------------------------------------------*/
#if DEBUG
-
__attribute__ ((naked)) __attribute__ ((section (".init3")))
void preset_ram (void)
{
*p = 0xdd;
}
+ #endif
+
+ __attribute__ ((naked)) __attribute__ ((section (".init3")))
+ void get_mcusr (void)
+ {
+ /* save and clear reset reason(s) */
+ /* TODO: move to init section? */
+ mcusr = MCUSR;
+ MCUSR = 0;
+
+ wdt_disable();
+ }
+
+ /*--------------------------------------------------------------------------*/
+ #if DEBUG
static const FLASH char * const FLASH rreasons[] = {
FSTR("Power on"),
static
void setup_avr(void)
{
- /* save and clear reset reason(s) */
- /* TODO: move to init section? */
- mcusr = MCUSR;
- MCUSR = 0;
-
- /* WD */
-
/* CPU */
/* Disable JTAG Interface regardless of the JTAGEN fuse setting. */
set_system_time(mk_gmtime(&rtc_time) );
}
+
+
+static void setup_fatfs(void)
+{
+ static FATFS FatFs0;
+ static FATFS FatFs1;
+
+ f_mount(&FatFs0, "0:", 0);
+ f_mount(&FatFs1, "1:", 0);
+}
+
/*--------------------------------------------------------------------------*/
/* Stored value of bootdelay, used by autoboot_command() */
print_reset_reason();
#endif
-#if DEBUG
- unsigned long i_speed = getenv_ulong(PSTR("i2c_clock"), 10, CONFIG_SYS_I2C_CLOCK);
- debug("### Setting I2C clock Frequency to %lu Hz.\n", i_speed);
- i2c_init(i_speed);
-#else
i2c_init(CONFIG_SYS_I2C_CLOCK);
-#endif
setup_system_time();
+ setup_fatfs();
printf_P(PSTR("\nATMEGA1281+Z8S180 Stamp Monitor\n\n"));
#define ENV_BAUDRATE "baudrate"
#define ENV_BOOTDELAY "bootdelay"
#define ENV_BOOTCMD "bootcmd"
+#define ENV_PATH_CPM3SYS "cpm3_file"
#define ENV_PINALIAS "pin_alias"
+#define ENV_STARTADDRESS "startaddress"
+
+#define CONFIG_PATH_CPM3SYS "1:/cpm3.sys"
#define CONFIG_ENV_SIZE 1600
#define CONFIG_ENV_OFFSET 0
#define CONFIG_BOOTDELAY 4
//#define CONFIG_ZERO_BOOTDELAY_CHECK 1
-//#define CONFIG_LOOPW
-//#define CONFIG_CMD_MEMTEST
-//#define CONFIG_MX_CYCLIC
+#define CONFIG_CMD_MEMTEST
+#define CONFIG_MX_CYCLIC
+#define CONFIG_SYS_RAMSIZE_MAX (1l<<19) /* max. addressable memory */
#define CONFIG_CMD_DATE 1
#define CONFIG_SYS_PROMPT "=> "
#define CONFIG_ESC_CHAR ('^'-0x40)
+ #define CONFIG_SYS_FBOOTSIG "Peda"
+
/* TODO: */
//#define CONFIG_CMDLINE_EDITING 1