diff --git a/boards/z80/ez80/z20x/README.txt b/boards/z80/ez80/z20x/README.txt
index d65f0cb3065..9aa65789948 100644
--- a/boards/z80/ez80/z20x/README.txt
+++ b/boards/z80/ez80/z20x/README.txt
@@ -204,7 +204,25 @@ Common Configuration Notes
Configuration Subdirectories
----------------------------
- nsh_ram:
+ hello:
+
+ This is a minimal "Hello, World!" program that runs out of RAM. It is
+ a small program that is really useful only for testing the bootloader.
+
+ NOTES:
+
+ 1. Debugging from RAM
+
+ You can debug from RAM version using ZDS-II as follows:
+
+ a. Connect to the debugger,
+ b. Reset, Go, and Break. This will initialize the external RAM
+ c. Break and Load the nuttx.lod file
+ c. Set the PC to 0x050000
+ d. Single step a few times to make sure things look good, then
+ e. Go
+
+ nsh:
This configuration builds the NuttShell (NSH). That code can be
found in apps/system/nsh and apps/system/nshlib.. For more
@@ -290,14 +308,14 @@ Configuration Subdirectories
NOTE: The is no card detect signal so the microSD card must be
placed in the card slot before the system is started.
- 3. Debugging the RAM version
+ 3. Debugging from RAM
- You can debug the all RAM version using ZDS-II as follows:
+ You can debug from RAM version using ZDS-II as follows:
a. Connect to the debugger,
b. Reset, Go, and Break. This will initialize the external RAM
c. Break and Load the nuttx.lod file
- c. Set the PC to 0x040000
+ c. Set the PC to 0x050000
d. Single step a few times to make sure things look good, then
e. Go
@@ -375,4 +393,4 @@ Configuration Subdirectories
2. Booting large programs from the serial FLASH is unbearably slow;
you will think that the system is simply not booting at all. There
is probably some bug contributing to this probably (maybe the timer
- interrupt rate?)
\ No newline at end of file
+ interrupt rate?)
diff --git a/boards/z80/ez80/z20x/configs/nsh_ram/.gitignore b/boards/z80/ez80/z20x/configs/hello/.gitignore
similarity index 100%
rename from boards/z80/ez80/z20x/configs/nsh_ram/.gitignore
rename to boards/z80/ez80/z20x/configs/hello/.gitignore
diff --git a/boards/z80/ez80/z20x/configs/hello/README.txt b/boards/z80/ez80/z20x/configs/hello/README.txt
new file mode 100644
index 00000000000..706dbdb58bc
--- /dev/null
+++ b/boards/z80/ez80/z20x/configs/hello/README.txt
@@ -0,0 +1,13 @@
+README.txt
+^^^^^^^^^^
+
+hello.zdsproj is a simple ZDS-II project that will allow you
+ to use the ZDS-II debugger.
+hello.zfpproj is a simple project that will allow you to use the Smart Flash
+ Programming. NOTE: As of this writing this project does not work, probably
+ due to RAM configuration in the project. Use ZDS-II instead as is described
+ in the upper README.txt file
+hello_ram.ztgt is the target file that accompanies the project files. This
+ one is identical to boards/scripts/z20x_ram.ztgt.
+hello_flash.ztgt is the target file that accompanies the project files. This
+ one is identical to boards/scripts/z20x_flash.ztgt.
diff --git a/boards/z80/ez80/z20x/configs/hello/defconfig b/boards/z80/ez80/z20x/configs/hello/defconfig
new file mode 100644
index 00000000000..61ee1437da5
--- /dev/null
+++ b/boards/z80/ez80/z20x/configs/hello/defconfig
@@ -0,0 +1,42 @@
+#
+# This file is autogenerated: PLEASE DO NOT EDIT IT.
+#
+# You can use "make menuconfig" to make any modifications to the installed .config file.
+# You can then do "make savedefconfig" to generate a new defconfig file that includes your
+# modifications.
+#
+CONFIG_ARCH="z80"
+CONFIG_ARCH_BOARD="z20x"
+CONFIG_ARCH_BOARD_Z20X=y
+CONFIG_ARCH_CHIP="ez80"
+CONFIG_ARCH_CHIP_EZ80=y
+CONFIG_ARCH_CHIP_EZ80F92=y
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_Z80=y
+CONFIG_BOARD_LOOPSPERMSEC=1250
+CONFIG_BOOT_RUNFROMEXTSRAM=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_EXAMPLES_HELLO=y
+CONFIG_EZ80_UART1=y
+CONFIG_HOST_WINDOWS=y
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_PREALLOC_TIMERS=4
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PTHREAD_STACK_DEFAULT=1024
+CONFIG_RAM_SIZE=65536
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_START_DAY=12
+CONFIG_START_MONTH=3
+CONFIG_START_YEAR=2020
+CONFIG_UART1_BAUD=2400
+CONFIG_UART1_BITS=0
+CONFIG_UART1_RXBUFSIZE=64
+CONFIG_UART1_SERIAL_CONSOLE=y
+CONFIG_UART1_TXBUFSIZE=64
+CONFIG_USER_ENTRYPOINT="hello_main"
+CONFIG_WDOG_INTRESERVE=1
diff --git a/boards/z80/ez80/z20x/configs/hello/hello.zdsproj b/boards/z80/ez80/z20x/configs/hello/hello.zdsproj
new file mode 100644
index 00000000000..d0d7c3ce460
--- /dev/null
+++ b/boards/z80/ez80/z20x/configs/hello/hello.zdsproj
@@ -0,0 +1,260 @@
+
+eZ80F91
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/boards/z80/ez80/z20x/configs/hello/hello.zfpproj b/boards/z80/ez80/z20x/configs/hello/hello.zfpproj
new file mode 100644
index 00000000000..8049fd9332b
--- /dev/null
+++ b/boards/z80/ez80/z20x/configs/hello/hello.zfpproj
@@ -0,0 +1,315 @@
+
+eZ80F92
+
+
+
+..\..\..\nuttx.hex
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/boards/z80/ez80/z20x/configs/nsh_ram/nsh_flash.ztgt b/boards/z80/ez80/z20x/configs/hello/hello_flash.ztgt
similarity index 100%
rename from boards/z80/ez80/z20x/configs/nsh_ram/nsh_flash.ztgt
rename to boards/z80/ez80/z20x/configs/hello/hello_flash.ztgt
diff --git a/boards/z80/ez80/z20x/configs/nsh_ram/nsh_ram.ztgt b/boards/z80/ez80/z20x/configs/hello/hello_ram.ztgt
similarity index 100%
rename from boards/z80/ez80/z20x/configs/nsh_ram/nsh_ram.ztgt
rename to boards/z80/ez80/z20x/configs/hello/hello_ram.ztgt
diff --git a/boards/z80/ez80/z20x/configs/nsh/.gitignore b/boards/z80/ez80/z20x/configs/nsh/.gitignore
new file mode 100644
index 00000000000..739fb85e2e6
--- /dev/null
+++ b/boards/z80/ez80/z20x/configs/nsh/.gitignore
@@ -0,0 +1,6 @@
+nsh.hex
+nsh.map
+nsh.lod
+nsh.wsp
+*.asm
+Debug
diff --git a/boards/z80/ez80/z20x/configs/nsh_ram/README.txt b/boards/z80/ez80/z20x/configs/nsh/README.txt
similarity index 87%
rename from boards/z80/ez80/z20x/configs/nsh_ram/README.txt
rename to boards/z80/ez80/z20x/configs/nsh/README.txt
index db71007fede..06419ddb9cd 100644
--- a/boards/z80/ez80/z20x/configs/nsh_ram/README.txt
+++ b/boards/z80/ez80/z20x/configs/nsh/README.txt
@@ -9,5 +9,5 @@ nsh.zfpproj is a simple project that will allow you to use the Smart Flash
in the upper README.txt file
nsh_ram.ztgt is the target file that accompanies the project files. This
one is identical to boards/scripts/z20x_ram.ztgt.
-nsh_ram.ztgt is the target file that accompanies the project files. This
+nsh_flash.ztgt is the target file that accompanies the project files. This
one is identical to boards/scripts/z20x_flash.ztgt.
diff --git a/boards/z80/ez80/z20x/configs/nsh_ram/defconfig b/boards/z80/ez80/z20x/configs/nsh/defconfig
similarity index 100%
rename from boards/z80/ez80/z20x/configs/nsh_ram/defconfig
rename to boards/z80/ez80/z20x/configs/nsh/defconfig
diff --git a/boards/z80/ez80/z20x/configs/nsh_ram/nsh.zdsproj b/boards/z80/ez80/z20x/configs/nsh/nsh.zdsproj
similarity index 100%
rename from boards/z80/ez80/z20x/configs/nsh_ram/nsh.zdsproj
rename to boards/z80/ez80/z20x/configs/nsh/nsh.zdsproj
diff --git a/boards/z80/ez80/z20x/configs/nsh_ram/nsh.zfpproj b/boards/z80/ez80/z20x/configs/nsh/nsh.zfpproj
similarity index 100%
rename from boards/z80/ez80/z20x/configs/nsh_ram/nsh.zfpproj
rename to boards/z80/ez80/z20x/configs/nsh/nsh.zfpproj
diff --git a/boards/z80/ez80/z20x/configs/nsh/nsh_flash.ztgt b/boards/z80/ez80/z20x/configs/nsh/nsh_flash.ztgt
new file mode 100644
index 00000000000..b691cd51021
--- /dev/null
+++ b/boards/z80/ez80/z20x/configs/nsh/nsh_flash.ztgt
@@ -0,0 +1,69 @@
+
+
+
+
+ true
+ 1f4
+ 8
+ 20000000
+
+ PLL
+ 20000000
+
+
+ 0
+ 140000
+ FFFF
+ true
+
+
+
+ 200000
+ false
+ 040000
+ 0BFFFF
+
+ 1
+ false
+ true
+
+
+
+
+ 0
+ 8
+ 4
+ B
+
+
+ 0
+ 0
+ 0
+ 0
+
+
+ 0
+ 0
+ 0
+ 0
+
+
+ 0
+ 0
+ 0
+ 0
+
+
+
+ 0
+ AF
+ true
+ true
+ false
+
+ 4
+
+ EZ80F92
+ 1.0.1
+ 1.00
+
diff --git a/boards/z80/ez80/z20x/configs/nsh/nsh_ram.ztgt b/boards/z80/ez80/z20x/configs/nsh/nsh_ram.ztgt
new file mode 100644
index 00000000000..8f78f6b941d
--- /dev/null
+++ b/boards/z80/ez80/z20x/configs/nsh/nsh_ram.ztgt
@@ -0,0 +1,69 @@
+
+
+
+
+ true
+ 1f4
+ 8
+ 20000000
+
+ PLL
+ 20000000
+
+
+ 0
+ 100000
+ ffff
+ true
+
+
+
+ 200000
+ false
+ 000000
+ FFFFF
+
+ 1
+ false
+ true
+
+
+
+
+ 0
+ 8
+ 0
+ 7
+
+
+ 0
+ 0
+ 0
+ 0
+
+
+ 0
+ 0
+ 0
+ 0
+
+
+ 0
+ 0
+ 0
+ 0
+
+
+
+ 0
+ AF
+ false
+ true
+ false
+
+ 4
+
+ EZ80F92
+ 1.0.1
+ 1.00
+
diff --git a/boards/z80/ez80/z20x/configs/w25boot/defconfig b/boards/z80/ez80/z20x/configs/w25boot/defconfig
index 3059947eb89..c8fa1c40bb7 100644
--- a/boards/z80/ez80/z20x/configs/w25boot/defconfig
+++ b/boards/z80/ez80/z20x/configs/w25boot/defconfig
@@ -14,7 +14,9 @@ CONFIG_ARCH_CHIP_EZ80F92=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_ARCH_Z80=y
CONFIG_BOARD_LOOPSPERMSEC=1250
+CONFIG_DISABLE_ENVIRON=y
CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_PTHREAD=y
CONFIG_EZ80_SPI=y
CONFIG_EZ80_UART1=y
CONFIG_FS_WRITABLE=y
diff --git a/boards/z80/ez80/z20x/configs/w25boot/w25boot.zdsproj b/boards/z80/ez80/z20x/configs/w25boot/w25boot.zdsproj
index 2ee448c7351..b649632e450 100644
--- a/boards/z80/ez80/z20x/configs/w25boot/w25boot.zdsproj
+++ b/boards/z80/ez80/z20x/configs/w25boot/w25boot.zdsproj
@@ -177,9 +177,9 @@
-
-
-
+
+
+
@@ -258,4 +258,4 @@
-
+
\ No newline at end of file
diff --git a/boards/z80/ez80/z20x/scripts/z20x_copytoram.linkcmd b/boards/z80/ez80/z20x/scripts/z20x_copytoram.linkcmd
index 630b22c0d58..56651e5899a 100644
--- a/boards/z80/ez80/z20x/scripts/z20x_copytoram.linkcmd
+++ b/boards/z80/ez80/z20x/scripts/z20x_copytoram.linkcmd
@@ -68,7 +68,7 @@ DEFINE __CS3_CTL_INIT_PARAM = $00
DEFINE __CS3_BMC_INIT_PARAM = $00
DEFINE __RAM_CTL_INIT_PARAM = $80
DEFINE __RAM_ADDR_U_INIT_PARAM = $AF
-DEFINE __FLASH_CTL_INIT_PARAM = $88
+DEFINE __FLASH_CTL_INIT_PARAM = $28
DEFINE __FLASH_ADDR_U_INIT_PARAM = $00
define _SYS_CLK_FREQ = 20000000
diff --git a/boards/z80/ez80/z20x/scripts/z20x_flash.linkcmd b/boards/z80/ez80/z20x/scripts/z20x_flash.linkcmd
index dcb051959c6..76b3e47e267 100644
--- a/boards/z80/ez80/z20x/scripts/z20x_flash.linkcmd
+++ b/boards/z80/ez80/z20x/scripts/z20x_flash.linkcmd
@@ -65,7 +65,7 @@ DEFINE __CS3_CTL_INIT_PARAM = $00
DEFINE __CS3_BMC_INIT_PARAM = $00
DEFINE __RAM_CTL_INIT_PARAM = $80
DEFINE __RAM_ADDR_U_INIT_PARAM = $AF
-DEFINE __FLASH_CTL_INIT_PARAM = $88
+DEFINE __FLASH_CTL_INIT_PARAM = $28
DEFINE __FLASH_ADDR_U_INIT_PARAM = $00
define _SYS_CLK_FREQ = 20000000
diff --git a/boards/z80/ez80/z20x/scripts/z20x_loader.linkcmd b/boards/z80/ez80/z20x/scripts/z20x_loader.linkcmd
index a1d22325e42..48f348a140d 100644
--- a/boards/z80/ez80/z20x/scripts/z20x_loader.linkcmd
+++ b/boards/z80/ez80/z20x/scripts/z20x_loader.linkcmd
@@ -72,7 +72,7 @@ DEFINE __CS3_CTL_INIT_PARAM = $00
DEFINE __CS3_BMC_INIT_PARAM = $00
DEFINE __RAM_CTL_INIT_PARAM = $80
DEFINE __RAM_ADDR_U_INIT_PARAM = $AF
-DEFINE __FLASH_CTL_INIT_PARAM = $88
+DEFINE __FLASH_CTL_INIT_PARAM = $28
DEFINE __FLASH_ADDR_U_INIT_PARAM = $00
define _SYS_CLK_FREQ = 20000000
diff --git a/boards/z80/ez80/z20x/scripts/z20x_program.linkcmd b/boards/z80/ez80/z20x/scripts/z20x_program.linkcmd
index 509cdc58a36..1c3983ea2cd 100644
--- a/boards/z80/ez80/z20x/scripts/z20x_program.linkcmd
+++ b/boards/z80/ez80/z20x/scripts/z20x_program.linkcmd
@@ -75,7 +75,7 @@ DEFINE __CS3_CTL_INIT_PARAM = $00
DEFINE __CS3_BMC_INIT_PARAM = $00
DEFINE __RAM_CTL_INIT_PARAM = $80
DEFINE __RAM_ADDR_U_INIT_PARAM = $AF
-DEFINE __FLASH_CTL_INIT_PARAM = $88
+DEFINE __FLASH_CTL_INIT_PARAM = $28
DEFINE __FLASH_ADDR_U_INIT_PARAM = $00
define _SYS_CLK_FREQ = 20000000
diff --git a/boards/z80/ez80/z20x/src/w25_main.c b/boards/z80/ez80/z20x/src/w25_main.c
index 7a7767830aa..46cfc8ce915 100644
--- a/boards/z80/ez80/z20x/src/w25_main.c
+++ b/boards/z80/ez80/z20x/src/w25_main.c
@@ -143,7 +143,9 @@ static int w25_read_hex(FAR uint24_t *len)
return ret;
}
- printf("Successfully loaded the Intel HEX file into memory...\n");
+ printf("Intel HEX file into memory loaded into RAM...\n");
+ fflush(stdout);
+
*len = memoutstream.public.nput;
return OK;
}
@@ -220,6 +222,7 @@ static int w25_write_binary(FAR const struct prog_header_s *hdr)
printf("Writing %lu bytes to the W25 Serial FLASH\n",
(unsigned long)hdr->len);
+ fflush(stdout);
ret = w25_write(fd, (FAR const void *)PROGSTART, hdr->len);
if (ret < 0)
@@ -323,6 +326,10 @@ static int w25_read_binary(FAR struct prog_header_s *hdr)
* CRC after loaded to memory.
*/
+ printf("Reading %lu bytes from the W25 Serial FLASH\n",
+ (unsigned long)hdr->len);
+ fflush(stdout);
+
ret = w25_read(fd, (FAR void *)PROGSTART, hdr->len);
if (ret < 0)
{
@@ -343,11 +350,12 @@ errout:
*
****************************************************************************/
-static uint24_t w25_crc24(uint32_t len)
+static uint24_t w25_crc24(uint24_t len)
{
+#if 0 /* Very slow */
FAR const uint8_t *src = (FAR const uint8_t *)PROGSTART;
uint32_t crc = 0;
- int i;
+ uint24_t i;
int j;
/* Loop for each byte in the binary image */
@@ -370,6 +378,52 @@ static uint24_t w25_crc24(uint32_t len)
}
return (uint24_t)crc;
+#else
+ FAR const uint24_t *src = (FAR const uint24_t *)PROGSTART;
+ uint24_t chksum = 0;
+ uint24_t remaining;
+
+ /* Loop for each uint24_t in the binary image */
+
+ for (remaining = len;
+ remaining >= sizeof(uint24_t);
+ remaining -= sizeof(uint24_t))
+ {
+ uint24_t val = *src++;
+
+ /* Simple checksum */
+
+ chksum += val;
+ }
+
+ /* Handle trailing partial uint24_t's (assumes little endian) */
+
+ if (remaining > 0)
+ {
+ uint24_t val = *src;
+
+ switch (remaining)
+ {
+ case 1:
+ val &= 0x0000ff;
+ break;
+
+ case 2:
+ val &= 0x00ffff;
+ break;
+
+ default: /* Shouldn't happen */
+ val = 0;
+ break;
+ }
+
+ /* Simple checksum */
+
+ chksum += val;
+ }
+
+ return chksum;
+#endif
}
/****************************************************************************
@@ -396,16 +450,15 @@ static int w25_read_verify(void)
return ret;
}
- printf("Verifying %lu bytes in the W25 Serial FLASH\n",
- (unsigned long)hdr.len);
+ printf("Verifying %lu bytes in RAM\n", (unsigned long)hdr.len);
+ fflush(stdout);
/* Compare CRCs */
crc = w25_crc24(hdr.len);
if (crc == hdr.crc)
{
- printf("Successfully verified %lu bytes in the W25 Serial FLASH\n",
- (unsigned long)hdr.len);
+ printf("Successfully verified %lu bytes\n", (unsigned long)hdr.len);
}
else
{