]> cloudbase.mooo.com Git - z180-stamp.git/commitdiff
Merge branch 'test-fboot-support'
authorLeo C <erbl259-lmu@yahoo.de>
Mon, 18 May 2015 08:06:49 +0000 (10:06 +0200)
committerLeo C <erbl259-lmu@yahoo.de>
Mon, 18 May 2015 08:06:49 +0000 (10:06 +0200)
1  2 
avr/command_tbl.c
avr/main.c
include/config.h

diff --combined avr/command_tbl.c
index f030b54c816eec3ef9cfa62e4fdc48e01970953a,cbd23821bfbfb33ca63f88d74a970b7655f95088..32730930dbb73f88b7b7f0634c48706a1383b872
@@@ -16,8 -16,6 +16,8 @@@ extern command_ret_t do_env_default(cmd
  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 []);
@@@ -62,6 -60,11 +62,11 @@@ CMD_TBL_ITEM
        "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",
@@@ -76,10 -79,9 +81,10 @@@ CMD_TBL_ITEM
  ),
  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,
@@@ -128,20 -130,6 +133,20 @@@ CMD_TBL_ITEM
        "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'",
@@@ -161,7 -149,7 +166,7 @@@ CMD_TBL_ITEM
        ""
  ),
  CMD_TBL_ITEM(
 -      connect, 1, 1,  do_console,
 +      connect, 1, 0,  do_console,
        "Connect to CPU console i/o",
        ""
  ),
@@@ -223,21 -211,23 +228,21 @@@ CMD_TBL_ITEM
        "    - 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 */
  
@@@ -248,7 -238,7 +253,7 @@@ CMD_TBL_ITEM
        "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)"
  ),
diff --combined avr/main.c
index 5a0d7928ea4b45aa9c7822d04dc84c1cd7ed1fe4,f4d4c6ff0b6b2d484b03b23f4e47cc7517f8139a..3852e754a5ba59477cf813421ebfcc36fea0f3c2
@@@ -7,11 -7,12 +7,12 @@@
  
  #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"),
@@@ -78,13 -91,6 +92,6 @@@ ISR(INT6_vect
  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. */
@@@ -139,17 -145,6 +146,17 @@@ void setup_system_time(void
        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() */
@@@ -266,9 -261,14 +273,9 @@@ int main(void
        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"));
  
diff --combined include/config.h
index 7c46b31bf4ba618157b83376ba652d18344e94fd,e40d016b017f5adf5bfc6f6b629fbb8c0e3cdc18..99e4e78632bc40253dad558ca692f69d982f9377
  #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
@@@ -27,9 -23,9 +27,9 @@@
  #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
  
@@@ -44,6 -40,8 +44,8 @@@
  #define CONFIG_SYS_PROMPT     "=> "
  #define CONFIG_ESC_CHAR               ('^'-0x40)
  
+ #define CONFIG_SYS_FBOOTSIG "Peda"
  
  /* TODO: */
  //#define CONFIG_CMDLINE_EDITING      1