Change boards/z16/z16f2811 to boards/z16/z16f

to fix the follow error:
Refresh z16f2800100zcog/nsh
LN: include/arch to arch/z16/include
LN: include/arch/board to /workspace/mirtos/nuttx/boards/z16/z16/z16f2800100zcog/include
No directory at /workspace/mirtos/nuttx/boards/z16/z16/z16f2800100zcog/include
This commit is contained in:
Xiang Xiao
2020-01-23 07:26:27 +08:00
committed by Gregory Nutt
parent 12cc24abb2
commit 7d33af1360
25 changed files with 26 additions and 28 deletions
+4
View File
@@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
+278
View File
@@ -0,0 +1,278 @@
README.txt
==========
This is the README file for the NuttX port to the ZiLog ZNEO MCU.
- Console output is on UART0.
- NOTE: My board has a 20MHz crystal, but I have heard of other boards with
18.432MHz crystals. If you board has a diff crystal installed, then
modify the system frequency in include/board.h.
Contents
========
- ZDS-II Compiler Versions
- Patches
- Serial Console
- Selecting Configurations
- Configuration Sub-directories
ZDS-II Compiler Versions
========================
Version 4.10.2
The ZDS-II version 4.10.2 will not compile NuttX. It reports "internal
errors" on some of the files. Upgrades to ZDS-II are available for
download from the Zilog website: http://www.zilog.com/software/zds2.asp
Version 4.11.0
NuttX compiles correctly with the newer 4.11.0 version of the ZDS-II
toolchain. However, I have found a few issues:
- The code will not run without the -reduceopt option. There is,
apparently, some optimization related issue. This issue has not
been analyzed as of this writing.
- Not all NuttX logic will not run with the -regvars option. There is
at least one failure that has been reported to ZiLOG as incident 81400.
Version 4.11.1
As of this writing (30 September 2010), the latest release of ZDS-II for the
ZNEO is 4.11.1. It is unknown if this release includes fixes for incidents
81400 and 81459 or not. It is unknown if the code will run without -reduceopt
either. (Basically, it compiles with 4.11.1, but is untested with that version).
Version 4.12.0
Never tested
Version 5.0.0
Never tested
Version 5.0.1
On November 29, 2012, all of the z16f configurations were converted to use 5.0.1,
but have not been verified on a running target.
Paths were also updated that are specific to a 32-bit toolchain running on
a 64 bit windows platform. Change to a different toolchain, you will need
to modify the versioning in the Make.defs file; if you want to build
on a different platform, you will need to change the path in the ZDS binaries
in those that file and your PATH environment variable.
Version 5.2.1
On June 2, 2019, support for the 5.2.1 ZDS-II toolchain was added.
I started verification using 5.30 on June 2, 2019. To use this toolchain,
I had to suppress the gmtime() and gmtimer() because these were causing an
internal compiler error:
time\lib_gmtimer.c
P2: Internal Error(0xB47E59):
Please contact Technical Support
This is the change to suppress building these files:
diff --git a/libs/libc/time/Make.defs b/libs/libc/time/Make.defs
index 5c9b746778..8327e287f4 100644
--- a/libs/libc/time/Make.defs
+++ b/libs/libc/time/Make.defs
@@ -44,7 +44,7 @@ ifdef CONFIG_LIBC_LOCALTIME
CSRCS += lib_localtime.c lib_asctime.c lib_asctimer.c lib_ctime.c
CSRCS += lib_ctimer.c
else
-CSRCS += lib_mktime.c lib_gmtime.c lib_gmtimer.c
+CSRCS += lib_mktime.c # lib_gmtime.c lib_gmtimer.c
ifdef CONFIG_TIME_EXTENDED
CSRCS += lib_dayofweek.c lib_asctime.c lib_asctimer.c lib_ctime.c
CSRCS += lib_ctimer.c
The consequence is, of course, that these interfaces will not be available
to applications.
Another issue is that the ZDS-II version of stdarg.h does not provide
va_copy(). This affects libs/libc/lib_sysloc.c.
There are a few outstanding build issues, but it seems close enough for
the time being.
Other Versions
If you use any version of ZDS-II or if you install ZDS-II at any location
other than the default location, you will have to modify
arch/z16/src/z16f/Kconfig and
boards/z16/z16f/z16f2800100zcog/scripts/Make.defs.
Simply edit that file, changing 5.0.1 to whatever.
Patches
=======
A bug has been found in the ZDS-II toolchain version 5.0.1. a patch is
available to work around the bug. A summary of the nature the bug and
instructions for applying the patch follow.
Parameters are passed different to variadic functions (i.e., functions
that accept a varying number of parameters) than to regular functions. For
most functions, parameters are passed in registers, beginning with R1. But
for variadic functions, all parameters must be passed on the stack.
The logic works correctly for global functions, local functions, and most
function pointers. It does not work correctly for the case where a variadic
function point is included within a structure. In that case, the caller
inappropriately passes the parameters in registers; the receiver will
attempt to recover the parameters from the stack and a failure then follows.
This bug prevents the use of NSH with the ZNEO. However, a patch has been
developed that works around the problem. That patch can be found at
boards/z16/z16f/z16f2800100zcog/tools/zneo-zdsii-5_0_1-variadic-func-fix.patch.
In that directory is also a bash script that will apply that patch for you.
The patch would be applied when NuttX is configured as follows:
tools/configure.sh z16f2800100zcog:nsh
dopatch.sh
make
The patch can also be removed with:
dopatch.sh -R
See the section "Selecting Configurations" below.
Serial Console
==============
By default, console output is on UART1 which corresponds to the DB9
connector labelled CONSOLE.
UART1 is also available on JP2:
MCU PIN GPIO JP2
Pin 86 TXD1 PD5 JP2 Pin 26
Pin 87 RXD1 PD4 JP2 Pin 27
Vcc JP2 Pin 59
GND JP2 Pins 19, 39, 46, 48, 56
Selecting Configurations
========================
Variations on the basic z8f162800100zcog configuration are maintained
in subdirectories. To configure any specific configuration, do the
following steps:
tools/configure.sh z16f2800100zcog:<sub-directory>
make
Where <sub-directory> is the specific board configuration that you
wish to build. The following board-specific configurations are
available. You may also need to apply a path to NuttX before making.
Please refer the section "Patches" above"
Configuration Sub-directories
=============================
source/ and include/
--------------------
These directories contain common logic for all z16f2800100zcog
configurations.
nsh
---
nsh:
This configuration directory will built the NuttShell (NSH). See
the NSH user manual in the documents directory (or online at nuttx.org).
See also the README.txt file in the nsh sub-directory for information
about using ZDS-II.
NOTES:
1. This configuration uses the mconf-based configuration tool. To
change this configuration using that tool, you should:
a. Build and install the kconfig-mconf tool. See nuttx/README.txt
see additional README.txt files in the NuttX tools repository.
b. Execute 'make menuconfig' in nuttx/ in order to start the
reconfiguration process.
2. By default, this configuration assumes that you are using the
Cygwin environment on Windows. An option is to use the native
CMD.exe window build as described in the top-level README.txt
file. To set up that configuration:
-CONFIG_WINDOWS_CYGWIN=y
+CONFIG_WINDOWS_NATIVE=y
And after configuring, make sure that CONFIG_APPS_DIR uses
the back slash character. For example:
CONFIG_APPS_DIR="..\apps"
NOTES:
a. If you need to change the toolchain path used in Make.defs, you
will need to use the short 8.3 filenames to avoid spaces. On my
PC, C:\PROGRA~1\ is is C:\Program Files\ and C:\PROGRA~2\ is
C:\Program Files (x86)\
b. I have not tried to use this configuration with the native
Windows build, but I would expect the same issues as is listed
for the ostest configuration..
STATUS:
1. Note that you must apply the ZNEO patch if you are using ZDS-II 5.0.1.
See the README.txt file in the parent directory for more information.
The configuration will run correctly with the patch applied.
ostest
------
This builds the examples/ostest application for execution from FLASH.
See the README.txt file in the ostest sub-directory for information
about using ZDS-II. See also apps/examples/README.txt for information
about ostest.
NOTES:
1. This configuration uses the mconf-based configuration tool. To
change this configuration using that tool, you should:
a. Build and install the kconfig-mconf tool. See nuttx/README.txt
see additional README.txt files in the NuttX tools repository.
b. Execute 'make menuconfig' in nuttx/ in order to start the
reconfiguration process.
2. By default, this configuration assumes that you are using the
Cygwin environment on Windows. An option is to use the native
CMD.exe window build as described in the top-level README.txt
file. To set up that configuration:
-CONFIG_WINDOWS_CYGWIN=y
+CONFIG_WINDOWS_NATIVE=y
And after configuring, make sure that CONFIG_APPS_DIR uses
the back slash character. For example:
CONFIG_APPS_DIR="..\apps"
NOTES:
a. If you need to change the toolchain path used in Make.defs, you
will need to use the short 8.3 filenames to avoid spaces. On my
PC, C:\PROGRA~1\ is is C:\Program Files\ and C:\PROGRA~2\ is
C:\Program Files (x86)\
b. At present, the native Windows build fails at the final link stages.
The failure is due to problems in arch/z16/src/nuttx.linkcmd that
is autogenerated by arch/z16/src/Makefile. The basic problem
is the spurious spaces and and carriage returns are generated at
the end of the lines after a line continuation (\ ^M). If these
trailing bad characters are manually eliminated, then the build
will succeed on the next try.
Check out any README.txt files in these <sub-directory>s.
@@ -0,0 +1,5 @@
nsh.hex
nsh.map
nsh.lod
nsh.wsp
@@ -0,0 +1,48 @@
README.txt
==========
Contents
--------
o NSH Project
o Loading and Executing Code
o Console Output
o STATUS
NSH Project
-----------
nsh.zfpproj is a simple ZDS II - ZNEO 5.0.1 project that will allow you
to use the ZDS-II debugger. Before using, copy the following files from
the toplevel directory:
nuttx.hex, nuttx.map, nuttx.lod
to this directory as:
nsh.hex, nsh.map, nsh.lod
Loading and Executing Code
--------------------------
1. Copy the files to this directory as described above
2. Connect the ZiLOG XTools USB debugger.
3. Install the USB driver from the ZDS-II device_drivers directory
4. Start ZDS-II and load the nsh.zfpproj project
5. In the debug tab, connect to the debugger
6. In the debug tab, load code, reset, and go
Console Output
--------------
Interaction with NSH is via the serial console at 57600 8N1 baud.
STATUS
------
1. Note that you must apply the ZNEO patch if you are using ZDS-II 5.0.1.
See the README.txt file in the parent directory for more information.
This configuration does run correctly with the path applied.
2. I bet that this code, like ostest, will not run if started by a hardware
reset. It may only run when started via the debugger.
@@ -0,0 +1,46 @@
#
# 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_NSH_ARGCAT is not set
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
# CONFIG_NSH_CMDPARMS is not set
# CONFIG_NSH_DISABLE_IFCONFIG is not set
# CONFIG_NSH_DISABLE_PS is not set
CONFIG_ARCH="z16"
CONFIG_ARCH_BOARD="z16f2800100zcog"
CONFIG_ARCH_BOARD_Z16F2800100ZCOG=y
CONFIG_ARCH_CHIP="z16f"
CONFIG_ARCH_CHIP_Z16F2811=y
CONFIG_ARCH_CHIP_Z16F=y
CONFIG_ARCH_Z16=y
CONFIG_BOARD_LOOPSPERMSEC=1250
CONFIG_BUILTIN=y
CONFIG_ENDIAN_BIG=y
CONFIG_MAX_TASKS=16
CONFIG_MAX_WDOGPARMS=2
CONFIG_NFILE_DESCRIPTORS=8
CONFIG_NFILE_STREAMS=8
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_READLINE=y
CONFIG_PREALLOC_MQ_MSGS=4
CONFIG_PREALLOC_TIMERS=4
CONFIG_PREALLOC_WDOGS=16
CONFIG_PTHREAD_STACK_DEFAULT=1536
CONFIG_RAM_SIZE=65536
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_WAITPID=y
CONFIG_SDCLONE_DISABLE=y
CONFIG_START_YEAR=2014
CONFIG_SYSTEM_NSH=y
CONFIG_TASK_NAME_SIZE=0
CONFIG_TASK_SPAWN_DEFAULT_STACKSIZE=1536
CONFIG_UART0_BAUD=57600
CONFIG_UART0_SERIAL_CONSOLE=y
CONFIG_UART1_BAUD=57600
CONFIG_USER_ENTRYPOINT="nsh_main"
CONFIG_WDOG_INTRESERVE=2
@@ -0,0 +1,238 @@
<project type="Standard" project-type="Standard" configuration="Debug" created-by="{{build_number}}" modified-by="d:5.0.0:11071102" ZDSII="ZDS - ZNEO 5.0.1 (Build 11071201)">
<cpu>Z16F2811AL</cpu>
<!-- file information -->
<files>
<file filter-key="flash">..\..\..\nuttx.hex</file>
</files>
<!-- configuration information -->
<configurations>
<configuration name="Debug" >
<tools>
<tool name="Assembler">
<options>
<option name="define" type="string" change-action="assemble">_Z16F2811AL=1,_Z16F_SERIES=1</option>
<option name="include" type="string" change-action="assemble"></option>
<option name="list" type="boolean" change-action="none">true</option>
<option name="listmac" type="boolean" change-action="none">false</option>
<option name="name" type="boolean" change-action="none">true</option>
<option name="pagelen" type="integer" change-action="none">56</option>
<option name="pagewidth" type="integer" change-action="none">80</option>
<option name="quiet" type="boolean" change-action="none">true</option>
</options>
</tool>
<tool name="Compiler">
<options>
<option name="chartype" type="string" change-action="compile">U</option>
<option name="define" type="string" change-action="compile">_Z16F2811AL,_Z16F_SERIES</option>
<option name="genprintf" type="boolean" change-action="compile">true</option>
<option name="keepasm" type="boolean" change-action="none">false</option>
<option name="keeplst" type="boolean" change-action="none">false</option>
<option name="list" type="boolean" change-action="none">false</option>
<option name="listinc" type="boolean" change-action="none">false</option>
<option name="model" type="string" change-action="compile">S</option>
<option name="modsect" type="boolean" change-action="compile">false</option>
<option name="stdinc" type="string" change-action="compile"></option>
<option name="usrinc" type="string" change-action="compile"></option>
<option name="regvar" type="boolean" change-action="compile">true</option>
<option name="regvarcache" type="boolean" change-action="none">false</option>
<option name="reduceopt" type="boolean" change-action="compile">false</option>
<option name="watch" type="boolean" change-action="none">false</option>
</options>
</tool>
<tool name="Debugger">
<options>
<option name="target" type="string" change-action="rebuild">Z16F2800100ZCOG</option>
<option name="debugtool" type="string" change-action="none">USBSmartCable</option>
<option name="usepageerase" type="boolean" change-action="none">true</option>
</options>
</tool>
<tool name="FlashProgrammer">
<options>
<option name="erasebeforeburn" type="boolean" change-action="none">false</option>
<option name="eraseinfopage" type="boolean" change-action="none">false</option>
<option name="enableinfopage" type="boolean" change-action="none">false</option>
<option name="includeserial" type="boolean" change-action="none">false</option>
<option name="offset" type="integer" change-action="none">0</option>
<option name="snenable" type="boolean" change-action="none">true</option>
<option name="sn" type="string" change-action="none">000000000000000000000000</option>
<option name="snsize" type="integer" change-action="none">1</option>
<option name="snstep" type="integer" change-action="none">000000000000000000000001</option>
<option name="snstepformat" type="integer" change-action="none">0</option>
<option name="snaddress" type="string" change-action="none">0</option>
<option name="snformat" type="integer" change-action="none">0</option>
<option name="snbigendian" type="boolean" change-action="none">true</option>
<option name="singleval" type="string" change-action="none">0</option>
<option name="singlevalformat" type="integer" change-action="none">0</option>
<option name="usepageerase" type="boolean" change-action="none">false</option>
<option name="autoselect" type="boolean" change-action="none">true</option>
</options>
</tool>
<tool name="General">
<options>
<option name="warn" type="boolean" change-action="none">true</option>
<option name="debug" type="boolean" change-action="assemble">true</option>
<option name="debugcache" type="boolean" change-action="none">true</option>
<option name="igcase" type="boolean" change-action="assemble">false</option>
<option name="outputdir" type="string" change-action="compile">.</option>
</options>
</tool>
<tool name="Librarian">
<options>
<option name="outfile" type="string" change-action="build"></option>
<option name="warn" type="boolean" change-action="none">false</option>
</options>
</tool>
<tool name="Linker">
<options>
<option name="directives" type="string" change-action="build"></option>
<option name="createnew" type="boolean" change-action="build">false</option>
<option name="eram" type="string" change-action="build">0-0</option>
<option name="erom" type="string" change-action="build">0-0</option>
<option name="exeform" type="string" change-action="build">OMF695,INTEL32</option>
<option name="fplib" type="string" change-action="build">Dummy</option>
<option name="iodata" type="string" change-action="build">0-0</option>
<option name="linkctlfile" type="string" change-action="build"></option>
<option name="map" type="boolean" change-action="none">true</option>
<option name="maxhexlen" type="integer" change-action="build">64</option>
<option name="objlibmods" type="string" change-action="build"></option>
<option name="of" type="string" change-action="build">.\nsh</option>
<option name="padhex" type="boolean" change-action="build">false</option>
<option name="quiet" type="boolean" change-action="none">false</option>
<option name="ram" type="string" change-action="build">FFB000-FFBFFF</option>
<option name="relist" type="boolean" change-action="build">false</option>
<option name="rom" type="string" change-action="build">000000-007FFF</option>
<option name="sort" type="string" change-action="none">name</option>
<option name="startuplnkcmds" type="boolean" change-action="build">true</option>
<option name="startuptype" type="string" change-action="build">1</option>
<option name="undefisfatal" type="boolean" change-action="none">true</option>
<option name="useadddirectives" type="boolean" change-action="build">false</option>
<option name="usecrun" type="boolean" change-action="build">true</option>
<option name="warnoverlap" type="boolean" change-action="none">false</option>
<option name="warnisfatal" type="boolean" change-action="none">false</option>
<option name="xref" type="boolean" change-action="none">false</option>
</options>
</tool>
</tools>
</configuration>
<configuration name="Release" >
<tools>
<tool name="Assembler">
<options>
<option name="define" type="string" change-action="assemble">_Z16F2811AL=1,_Z16F_SERIES=1</option>
<option name="include" type="string" change-action="assemble"></option>
<option name="list" type="boolean" change-action="none">true</option>
<option name="listmac" type="boolean" change-action="none">false</option>
<option name="name" type="boolean" change-action="none">true</option>
<option name="pagelen" type="integer" change-action="none">56</option>
<option name="pagewidth" type="integer" change-action="none">80</option>
<option name="quiet" type="boolean" change-action="none">true</option>
</options>
</tool>
<tool name="Compiler">
<options>
<option name="chartype" type="string" change-action="compile">U</option>
<option name="define" type="string" change-action="compile">_Z16F2811AL,_Z16F_SERIES</option>
<option name="genprintf" type="boolean" change-action="compile">true</option>
<option name="keepasm" type="boolean" change-action="none">false</option>
<option name="keeplst" type="boolean" change-action="none">false</option>
<option name="list" type="boolean" change-action="none">false</option>
<option name="listinc" type="boolean" change-action="none">false</option>
<option name="model" type="string" change-action="compile">S</option>
<option name="modsect" type="boolean" change-action="compile">false</option>
<option name="stdinc" type="string" change-action="compile"></option>
<option name="usrinc" type="string" change-action="compile"></option>
<option name="regvar" type="boolean" change-action="compile">true</option>
<option name="regvarcache" type="boolean" change-action="none">false</option>
<option name="reduceopt" type="boolean" change-action="compile">false</option>
<option name="watch" type="boolean" change-action="none">false</option>
</options>
</tool>
<tool name="Debugger">
<options>
<option name="target" type="string" change-action="rebuild"></option>
<option name="debugtool" type="string" change-action="none">ZPAKII</option>
<option name="usepageerase" type="boolean" change-action="none">true</option>
</options>
</tool>
<tool name="FlashProgrammer">
<options>
<option name="erasebeforeburn" type="boolean" change-action="none">false</option>
<option name="eraseinfopage" type="boolean" change-action="none">false</option>
<option name="enableinfopage" type="boolean" change-action="none">false</option>
<option name="includeserial" type="boolean" change-action="none">false</option>
<option name="offset" type="integer" change-action="none">0</option>
<option name="snenable" type="boolean" change-action="none">false</option>
<option name="sn" type="string" change-action="none">0</option>
<option name="snsize" type="integer" change-action="none">0</option>
<option name="snstep" type="integer" change-action="none">1</option>
<option name="snstepformat" type="integer" change-action="none">0</option>
<option name="snaddress" type="string" change-action="none">0</option>
<option name="snformat" type="integer" change-action="none">0</option>
<option name="snbigendian" type="boolean" change-action="none">true</option>
<option name="singleval" type="string" change-action="none">0</option>
<option name="singlevalformat" type="integer" change-action="none">0</option>
<option name="usepageerase" type="boolean" change-action="none">false</option>
<option name="autoselect" type="boolean" change-action="none">true</option>
</options>
</tool>
<tool name="General">
<options>
<option name="warn" type="boolean" change-action="none">true</option>
<option name="debug" type="boolean" change-action="assemble">false</option>
<option name="debugcache" type="boolean" change-action="none">true</option>
<option name="igcase" type="boolean" change-action="assemble">false</option>
<option name="outputdir" type="string" change-action="compile">.</option>
</options>
</tool>
<tool name="Librarian">
<options>
<option name="outfile" type="string" change-action="build"></option>
<option name="warn" type="boolean" change-action="none">false</option>
</options>
</tool>
<tool name="Linker">
<options>
<option name="directives" type="string" change-action="build"></option>
<option name="createnew" type="boolean" change-action="build">false</option>
<option name="eram" type="string" change-action="build">0-0</option>
<option name="erom" type="string" change-action="build">0-0</option>
<option name="exeform" type="string" change-action="build">OMF695,INTEL32</option>
<option name="fplib" type="string" change-action="build">Dummy</option>
<option name="iodata" type="string" change-action="build">0-0</option>
<option name="linkctlfile" type="string" change-action="build"></option>
<option name="map" type="boolean" change-action="none">true</option>
<option name="maxhexlen" type="integer" change-action="build">64</option>
<option name="objlibmods" type="string" change-action="build"></option>
<option name="of" type="string" change-action="build">.\nsh</option>
<option name="padhex" type="boolean" change-action="build">false</option>
<option name="quiet" type="boolean" change-action="none">false</option>
<option name="ram" type="string" change-action="build">FFB000-FFBFFF</option>
<option name="relist" type="boolean" change-action="build">false</option>
<option name="rom" type="string" change-action="build">000000-007FFF</option>
<option name="sort" type="string" change-action="none">name</option>
<option name="startuplnkcmds" type="boolean" change-action="build">true</option>
<option name="startuptype" type="string" change-action="build">1</option>
<option name="undefisfatal" type="boolean" change-action="none">true</option>
<option name="useadddirectives" type="boolean" change-action="build">false</option>
<option name="usecrun" type="boolean" change-action="build">true</option>
<option name="warnoverlap" type="boolean" change-action="none">false</option>
<option name="warnisfatal" type="boolean" change-action="none">false</option>
<option name="xref" type="boolean" change-action="none">false</option>
</options>
</tool>
</tools>
</configuration>
</configurations>
<!-- watch information -->
<watch-elements>
<watch-element expression="0x801d1a" />
</watch-elements>
<!-- breakpoint information -->
<breakpoints>
</breakpoints>
</project>
@@ -0,0 +1,5 @@
ostest.hex
ostest.map
ostest.lod
ostest.wsp
@@ -0,0 +1,39 @@
README.txt
^^^^^^^^^^
OSTEST Project
--------------
ostest.zfpproj is a simple ZDS II - ZNEO 5.0.1 project that will allow you
to use the ZDS-II debugger. Before using, copy the following files from
the toplevel directory:
nuttx.hex, nuttx.map, nuttx.lod
to this directory as:
ostest.hex, ostest.map, ostest.lod
Loading and Executing Code
--------------------------
1. Copy the files to this directory as described above
2. Connect the ZiLOG XTools USB debugger.
3. Install the USB driver from the ZDS-II device_drivers directory
4. Start ZDS-II and load the ostest.zfpproj project
5. In the debug tab, connect to the debugger
6. In the debug tab, load code, reset, and go
Hmmm... it appears that the code does not run if started by a hardware reset.
It runs only when started via the debugger. What is up with that?
Console Output
--------------
OS test results will be provided on the serial console at 57600 8N1 baud.
STATUS
------
This exemple works fine when started from ZDS-II. But I have seen problems
when starting from a hardware reset.
@@ -0,0 +1,41 @@
#
# 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_BOARD_Z16F2800100ZCOG=y
CONFIG_ARCH_BOARD="z16f2800100zcog"
CONFIG_ARCH_CHIP="z16f"
CONFIG_ARCH_CHIP_Z16F=y
CONFIG_ARCH_CHIP_Z16F2811=y
CONFIG_ARCH_Z16=y
CONFIG_ARCH="z16"
CONFIG_BOARD_LOOPSPERMSEC=1250
CONFIG_DEV_LOWCONSOLE=y
CONFIG_ENDIAN_BIG=y
CONFIG_HOST_WINDOWS=y
CONFIG_IDLETHREAD_STACKSIZE=4096
CONFIG_MAX_TASKS=16
CONFIG_MAX_WDOGPARMS=2
CONFIG_NFILE_DESCRIPTORS=8
CONFIG_NFILE_STREAMS=8
CONFIG_PREALLOC_MQ_MSGS=4
CONFIG_PREALLOC_TIMERS=4
CONFIG_PREALLOC_WDOGS=4
CONFIG_PTHREAD_STACK_DEFAULT=4096
CONFIG_RAM_SIZE=65536
CONFIG_RR_INTERVAL=200
CONFIG_SDCLONE_DISABLE=y
CONFIG_START_DAY=29
CONFIG_START_MONTH=11
CONFIG_START_YEAR=2012
CONFIG_TASK_NAME_SIZE=0
CONFIG_TESTING_OSTEST=y
CONFIG_UART0_BAUD=57600
CONFIG_UART0_SERIAL_CONSOLE=y
CONFIG_UART1_BAUD=57600
CONFIG_USER_ENTRYPOINT="ostest_main"
CONFIG_USERMAIN_STACKSIZE=4096
CONFIG_WDOG_INTRESERVE=0
@@ -0,0 +1,238 @@
<project type="Standard" project-type="Standard" configuration="Debug" created-by="{{build_number}}" modified-by="d:5.0.0:11071102" ZDSII="ZDS - ZNEO 5.0.1 (Build 11071201)">
<cpu>Z16F2811AL</cpu>
<!-- file information -->
<files>
<file filter-key="flash">..\..\..\nuttx.hex</file>
</files>
<!-- configuration information -->
<configurations>
<configuration name="Debug" >
<tools>
<tool name="Assembler">
<options>
<option name="define" type="string" change-action="assemble">_Z16F2811AL=1,_Z16F_SERIES=1</option>
<option name="include" type="string" change-action="assemble"></option>
<option name="list" type="boolean" change-action="none">true</option>
<option name="listmac" type="boolean" change-action="none">false</option>
<option name="name" type="boolean" change-action="none">true</option>
<option name="pagelen" type="integer" change-action="none">56</option>
<option name="pagewidth" type="integer" change-action="none">80</option>
<option name="quiet" type="boolean" change-action="none">true</option>
</options>
</tool>
<tool name="Compiler">
<options>
<option name="chartype" type="string" change-action="compile">U</option>
<option name="define" type="string" change-action="compile">_Z16F2811AL,_Z16F_SERIES</option>
<option name="genprintf" type="boolean" change-action="compile">true</option>
<option name="keepasm" type="boolean" change-action="none">false</option>
<option name="keeplst" type="boolean" change-action="none">false</option>
<option name="list" type="boolean" change-action="none">false</option>
<option name="listinc" type="boolean" change-action="none">false</option>
<option name="model" type="string" change-action="compile">S</option>
<option name="modsect" type="boolean" change-action="compile">false</option>
<option name="stdinc" type="string" change-action="compile"></option>
<option name="usrinc" type="string" change-action="compile"></option>
<option name="regvar" type="boolean" change-action="compile">true</option>
<option name="regvarcache" type="boolean" change-action="none">false</option>
<option name="reduceopt" type="boolean" change-action="compile">false</option>
<option name="watch" type="boolean" change-action="none">false</option>
</options>
</tool>
<tool name="Debugger">
<options>
<option name="target" type="string" change-action="rebuild">Z16F2800100ZCOG</option>
<option name="debugtool" type="string" change-action="none">USBSmartCable</option>
<option name="usepageerase" type="boolean" change-action="none">true</option>
</options>
</tool>
<tool name="FlashProgrammer">
<options>
<option name="erasebeforeburn" type="boolean" change-action="none">false</option>
<option name="eraseinfopage" type="boolean" change-action="none">false</option>
<option name="enableinfopage" type="boolean" change-action="none">false</option>
<option name="includeserial" type="boolean" change-action="none">false</option>
<option name="offset" type="integer" change-action="none">0</option>
<option name="snenable" type="boolean" change-action="none">true</option>
<option name="sn" type="string" change-action="none">000000000000000000000000</option>
<option name="snsize" type="integer" change-action="none">1</option>
<option name="snstep" type="integer" change-action="none">000000000000000000000001</option>
<option name="snstepformat" type="integer" change-action="none">0</option>
<option name="snaddress" type="string" change-action="none">0</option>
<option name="snformat" type="integer" change-action="none">0</option>
<option name="snbigendian" type="boolean" change-action="none">true</option>
<option name="singleval" type="string" change-action="none">0</option>
<option name="singlevalformat" type="integer" change-action="none">0</option>
<option name="usepageerase" type="boolean" change-action="none">false</option>
<option name="autoselect" type="boolean" change-action="none">true</option>
</options>
</tool>
<tool name="General">
<options>
<option name="warn" type="boolean" change-action="none">true</option>
<option name="debug" type="boolean" change-action="assemble">true</option>
<option name="debugcache" type="boolean" change-action="none">true</option>
<option name="igcase" type="boolean" change-action="assemble">false</option>
<option name="outputdir" type="string" change-action="compile">.</option>
</options>
</tool>
<tool name="Librarian">
<options>
<option name="outfile" type="string" change-action="build"></option>
<option name="warn" type="boolean" change-action="none">false</option>
</options>
</tool>
<tool name="Linker">
<options>
<option name="directives" type="string" change-action="build"></option>
<option name="createnew" type="boolean" change-action="build">false</option>
<option name="eram" type="string" change-action="build">0-0</option>
<option name="erom" type="string" change-action="build">0-0</option>
<option name="exeform" type="string" change-action="build">OMF695,INTEL32</option>
<option name="fplib" type="string" change-action="build">Dummy</option>
<option name="iodata" type="string" change-action="build">0-0</option>
<option name="linkctlfile" type="string" change-action="build"></option>
<option name="map" type="boolean" change-action="none">true</option>
<option name="maxhexlen" type="integer" change-action="build">64</option>
<option name="objlibmods" type="string" change-action="build"></option>
<option name="of" type="string" change-action="build">.\ostest</option>
<option name="padhex" type="boolean" change-action="build">false</option>
<option name="quiet" type="boolean" change-action="none">false</option>
<option name="ram" type="string" change-action="build">FFB000-FFBFFF</option>
<option name="relist" type="boolean" change-action="build">false</option>
<option name="rom" type="string" change-action="build">000000-007FFF</option>
<option name="sort" type="string" change-action="none">name</option>
<option name="startuplnkcmds" type="boolean" change-action="build">true</option>
<option name="startuptype" type="string" change-action="build">1</option>
<option name="undefisfatal" type="boolean" change-action="none">true</option>
<option name="useadddirectives" type="boolean" change-action="build">false</option>
<option name="usecrun" type="boolean" change-action="build">true</option>
<option name="warnoverlap" type="boolean" change-action="none">false</option>
<option name="warnisfatal" type="boolean" change-action="none">false</option>
<option name="xref" type="boolean" change-action="none">false</option>
</options>
</tool>
</tools>
</configuration>
<configuration name="Release" >
<tools>
<tool name="Assembler">
<options>
<option name="define" type="string" change-action="assemble">_Z16F2811AL=1,_Z16F_SERIES=1</option>
<option name="include" type="string" change-action="assemble"></option>
<option name="list" type="boolean" change-action="none">true</option>
<option name="listmac" type="boolean" change-action="none">false</option>
<option name="name" type="boolean" change-action="none">true</option>
<option name="pagelen" type="integer" change-action="none">56</option>
<option name="pagewidth" type="integer" change-action="none">80</option>
<option name="quiet" type="boolean" change-action="none">true</option>
</options>
</tool>
<tool name="Compiler">
<options>
<option name="chartype" type="string" change-action="compile">U</option>
<option name="define" type="string" change-action="compile">_Z16F2811AL,_Z16F_SERIES</option>
<option name="genprintf" type="boolean" change-action="compile">true</option>
<option name="keepasm" type="boolean" change-action="none">false</option>
<option name="keeplst" type="boolean" change-action="none">false</option>
<option name="list" type="boolean" change-action="none">false</option>
<option name="listinc" type="boolean" change-action="none">false</option>
<option name="model" type="string" change-action="compile">S</option>
<option name="modsect" type="boolean" change-action="compile">false</option>
<option name="stdinc" type="string" change-action="compile"></option>
<option name="usrinc" type="string" change-action="compile"></option>
<option name="regvar" type="boolean" change-action="compile">true</option>
<option name="regvarcache" type="boolean" change-action="none">false</option>
<option name="reduceopt" type="boolean" change-action="compile">false</option>
<option name="watch" type="boolean" change-action="none">false</option>
</options>
</tool>
<tool name="Debugger">
<options>
<option name="target" type="string" change-action="rebuild"></option>
<option name="debugtool" type="string" change-action="none">ZPAKII</option>
<option name="usepageerase" type="boolean" change-action="none">true</option>
</options>
</tool>
<tool name="FlashProgrammer">
<options>
<option name="erasebeforeburn" type="boolean" change-action="none">false</option>
<option name="eraseinfopage" type="boolean" change-action="none">false</option>
<option name="enableinfopage" type="boolean" change-action="none">false</option>
<option name="includeserial" type="boolean" change-action="none">false</option>
<option name="offset" type="integer" change-action="none">0</option>
<option name="snenable" type="boolean" change-action="none">false</option>
<option name="sn" type="string" change-action="none">0</option>
<option name="snsize" type="integer" change-action="none">0</option>
<option name="snstep" type="integer" change-action="none">1</option>
<option name="snstepformat" type="integer" change-action="none">0</option>
<option name="snaddress" type="string" change-action="none">0</option>
<option name="snformat" type="integer" change-action="none">0</option>
<option name="snbigendian" type="boolean" change-action="none">true</option>
<option name="singleval" type="string" change-action="none">0</option>
<option name="singlevalformat" type="integer" change-action="none">0</option>
<option name="usepageerase" type="boolean" change-action="none">false</option>
<option name="autoselect" type="boolean" change-action="none">true</option>
</options>
</tool>
<tool name="General">
<options>
<option name="warn" type="boolean" change-action="none">true</option>
<option name="debug" type="boolean" change-action="assemble">false</option>
<option name="debugcache" type="boolean" change-action="none">true</option>
<option name="igcase" type="boolean" change-action="assemble">false</option>
<option name="outputdir" type="string" change-action="compile">.</option>
</options>
</tool>
<tool name="Librarian">
<options>
<option name="outfile" type="string" change-action="build"></option>
<option name="warn" type="boolean" change-action="none">false</option>
</options>
</tool>
<tool name="Linker">
<options>
<option name="directives" type="string" change-action="build"></option>
<option name="createnew" type="boolean" change-action="build">false</option>
<option name="eram" type="string" change-action="build">0-0</option>
<option name="erom" type="string" change-action="build">0-0</option>
<option name="exeform" type="string" change-action="build">OMF695,INTEL32</option>
<option name="fplib" type="string" change-action="build">Dummy</option>
<option name="iodata" type="string" change-action="build">0-0</option>
<option name="linkctlfile" type="string" change-action="build"></option>
<option name="map" type="boolean" change-action="none">true</option>
<option name="maxhexlen" type="integer" change-action="build">64</option>
<option name="objlibmods" type="string" change-action="build"></option>
<option name="of" type="string" change-action="build">.\ostest</option>
<option name="padhex" type="boolean" change-action="build">false</option>
<option name="quiet" type="boolean" change-action="none">false</option>
<option name="ram" type="string" change-action="build">FFB000-FFBFFF</option>
<option name="relist" type="boolean" change-action="build">false</option>
<option name="rom" type="string" change-action="build">000000-007FFF</option>
<option name="sort" type="string" change-action="none">name</option>
<option name="startuplnkcmds" type="boolean" change-action="build">true</option>
<option name="startuptype" type="string" change-action="build">1</option>
<option name="undefisfatal" type="boolean" change-action="none">true</option>
<option name="useadddirectives" type="boolean" change-action="build">false</option>
<option name="usecrun" type="boolean" change-action="build">true</option>
<option name="warnoverlap" type="boolean" change-action="none">false</option>
<option name="warnisfatal" type="boolean" change-action="none">false</option>
<option name="xref" type="boolean" change-action="none">false</option>
</options>
</tool>
</tools>
</configuration>
</configurations>
<!-- watch information -->
<watch-elements>
<watch-element expression="0x801d1a" />
</watch-elements>
<!-- breakpoint information -->
<breakpoints>
</breakpoints>
</project>
@@ -0,0 +1,126 @@
/****************************************************************************
* boards/z16/z16f/z16f2800100zcog/board.h
*
* Copyright (C) 2008, 2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#ifndef __BOARDS_Z16_Z16F2811_Z16F2800100ZCOG_INCLUDE_BOARD_H
#define __BOARDS_Z16_Z16F2811_Z16F2800100ZCOG_INCLUDE_BOARD_H
/****************************************************************************
* Included Files
****************************************************************************/
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* The Z16F2800100ZCOG board has a 20MHz crystal. The ZNEO clocking will be
* configured to use this crystal frequency directly as the clock source
*/
#define BOARD_XTAL_FREQUENCY 20000000 /* 20MHz */
#define BOARD_CLKSRC 1 /* Clock source = external crystal */
#define BOARD_SYSTEM_FREQUENCY BOARD_XTAL_FREQUENCY
/* Flash option bits
*
* "Each time the option bits are programmed or erased, the device must be
* Reset for the change to take place. During any reset operation .., the
* option bits are automatically read from the Program memory and written
* to Option Configuration registers. ... Option Bit Control Register are
* loaded before the device exits Reset and the ZNEO CPU begins code
* execution. The Option Configuration registers are not part of the
* Register file and are not accessible for read or write access."
*/
#ifndef __ASSEMBLY__
# define BOARD_FLOPTION0 (Z16F_FLOPTION0_MAXPWR | Z16F_FLOPTION0_WDTRES | \
Z16F_FLOPTION0_WDTA0 | Z16F_FLOPTION0_VBOA0 | \
Z16F_FLOPTION0_DBGUART | Z16F_FLOPTION0_FWP | \
Z16F_FLOPTION0_RP)
# define BOARD_FLOPTION1 (Z16F_FLOPTION1_RESVD | Z16F_FLOPTION1_MCEN | \
Z16F_FLOPTION1_OFFH | Z16F_FLOPTION1_OFFL)
# define BOARD_FLOPTION2 Z16F_FLOPTION2_RESVD
# define BOARD_FLOPTION3 (Z16F_FLOPTION3_RESVD | Z16F_FLOPTION3_NORMAL | \
Z16F_FLOPTION3_ROMLESS)
/* The same settings, pre-digested for assembly language */
#else
# define BOARD_FLOPTION0 %ff
# define BOARD_FLOPTION1 %ff
# define BOARD_FLOPTION2 %ff
# define BOARD_FLOPTION3 %ff
#endif
/* LED pattern definitions
*
* The z16f2800100zcog board has four LEDs:
*
* - Green LED D1 which illuminates in the presence of Vcc
* - Red LED D2 connected to chip port PA0_T0IN
* - Yellow LED D3 connected to chip port PA1_T0OUT
* - Green LED D4 connected to chip port PA2_DE0
*/
#define LED_STARTED 0
#define LED_HEAPALLOCATE 1
#define LED_IRQSENABLED 2
#define LED_STACKCREATED 3
#define LED_IDLE 4
#define LED_INIRQ 5
#define LED_SIGNAL 6
#define LED_ASSERTION 7
#define LED_PANIC 8
/****************************************************************************
* Public Functions
****************************************************************************/
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __BOARDS_Z16_Z16F2811_Z16F2800100ZCOG_INCLUDE_BOARD_H */
@@ -0,0 +1,272 @@
############################################################################
# boards/z16/z16f/z16f2800100zcog/scripts/Make.defs
#
# Copyright (C) 2014, 2017 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################
include $(TOPDIR)/.config
include $(TOPDIR)/tools/Config.mk
# These are the default directories where the ZDS-II toolchain is installed.
# NOTE that short 8.3 path names are used in order to avoid spaces. On my
# machine I have:
#
# Versions 5.0.1
# C:\PROGRA~1\ = C:\Program Files\
# C:\PROGRA~2\ = C:\Program Files (x86)\
#
# Your PC may be configured differently.
#
# Version 5.2.1, the default install location is C:\ZiLOG
ifeq ($(CONFIG_Z16F_ZDSII_V511),y)
INSTALLROOT = C:/PROGRA~2/ZiLOG
ZDSVERSION := 5.0.1
else ifeq ($(CONFIG_Z16F_ZDSII_V521),y)
INSTALLROOT = C:/ZiLOG
ZDSVERSION := 5.2.1
endif
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
ZDSINSTALLDIR = $(INSTALLROOT)/ZDSII_ZNEO_$(ZDSVERSION)
INSTALLDIR = ${shell echo $(ZDSINSTALLDIR)| sed -e "s/\//\\/g"}
ZDSBINDIR = $(INSTALLDIR)\bin
ZDSSTDINCDIR = $(INSTALLDIR)\include\std
ZDSZILOGINCDIR = $(INSTALLDIR)\include\zilog
ZDSSTDLIBDIR = $(INSTALLDIR)\lib\std
ZDSZILOGLIBDIR = $(INSTALLDIR)\lib\zilog
# CFLAGs
ARCHASMINCLUDES = -include:$(TOPDIR)\include;$(ZDSSTDINCDIR);$(ZDSZILOGINCDIR)
EARCHASMINCLUDES = -include:$(TOPDIR)\include;$(ZDSSTDINCDIR);$(ZDSZILOGINCDIR)
ARCHSTDINCLUDES = -stdinc:$(TOPDIR)\include;$(ZDSSTDINCDIR);$(ZDSZILOGINCDIR)
ARCHUSRINCLUDES = -usrinc:.
else
WINTOOL = y
ZDSINSTALLDIR = $(INSTALLROOT)/ZDSII_ZNEO_$(ZDSVERSION)
INSTALLDIR = ${shell cygpath -u "$(ZDSINSTALLDIR)"}
ZDSBINDIR = $(INSTALLDIR)/bin
ZDSSTDINCDIR = $(INSTALLDIR)/include/std
ZDSZILOGINCDIR = $(INSTALLDIR)/include/zilog
ZDSSTDLIBDIR = $(INSTALLDIR)/lib/std
ZDSZILOGLIBDIR = $(INSTALLDIR)/lib/zilog
# These are the same directories but with the directory separator
# character swapped as needed by the ZDS-II compiler
WTOPDIR = ${shell cygpath -w "$(TOPDIR)"}
WZDSSTDINCDIR = ${shell cygpath -w "$(ZDSSTDINCDIR)"}
WZDSZILOGINCDIR = ${shell cygpath -w "$(ZDSZILOGINCDIR)"}
WZDSSTDLIBDIR = ${shell cygpath -w "$(ZDSSTDLIBDIR)"}
WZDSZILOGLIBDIR = ${shell cygpath -w "$(ZDSZILOGLIBDIR)"}
# Escaped versions
ETOPDIR = ${shell echo "$(WTOPDIR)" | sed -e "s/ /%20/g"}
EZDSSTDINCDIR = ${shell echo "$(WZDSSTDINCDIR)" | sed -e "s/ /%20/g"}
EZDSZILOGINCDIR = ${shell echo "$(WZDSZILOGINCDIR)" | sed -e "s/ /%20/g"}
# CFLAGs
ARCHASMINCLUDES = -include:'$(WTOPDIR)\include;$(WZDSSTDINCDIR);$(WZDSZILOGINCDIR)'
EARCHASMINCLUDES = -include:'$(ETOPDIR)\include;$(EZDSSTDINCDIR);$(EZDSZILOGINCDIR)'
ARCHSTDINCLUDES = -stdinc:'$(WTOPDIR)\include;$(WZDSSTDINCDIR);$(WZDSZILOGINCDIR)'
ARCHUSRINCLUDES = -usrinc:'.'
endif
# Assembler definitions
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
ARCHASMOPTIMIZATION = -debug
else
ARCHASMOPTIMIZATION = -nodebug
endif
ARCHASMCPUFLAGS = -cpu:Z16F2811AL -NOigcase
ARCHASMLIST = -NOlistmac -name -pagelen:56 -pagewidth:80 -quiet
ARCHASMWARNINGS = -warn
ARCHASMDEFINES = -define:_Z16F2811AL=1 -define:_Z16K_SERIES=1 -define:_Z16F_SERIES=1 -define:__ASSEMBLY__
AFLAGS = $(ARCHASMCPUFLAGS) $(ARCHASMINCLUDES) $(ARCHASMLIST) $(ARCHASMWARNINGS) $(ARCHASMOPTIMIZATION)
# Compiler definitions
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
ARCHOPTIMIZATION = -debug
else
ARCHOPTIMIZATION = -nodebug
endif
ifeq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += -NOregvar -reduceopt
else
ARCHOPTIMIZATION += -regvar
endif
ARCHCPUFLAGS = -chartype:S -model:L -NOmodsect -cpu:Z16F2811AL -NOgenprint \
-asmsw:" $(ARCHASMCPUFLAGS) $(ARCHASMINCLUDES) $(ARCHASMWARNINGS) $(ARCHASMOPTIMIZATION)"
ARCHLIST = -keeplst -NOlist -NOlistinc -NOkeepasm
ARCHPICFLAGS =
ARCHWARNINGS = -warn
ARCHDEFINES = -define:_Z16F2811AL -define:_Z16K_SERIES -define:_Z16F_SERIES
ARCHINCLUDES = $(ARCHSTDINCLUDES) $(ARCHUSRINCLUDES)
CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHLIST) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
CPPDEFINES = -D_Z16F2811AL -D_Z16K_SERIES -D_Z16F_SERIES -D__ASSEMBLY__
CPPINCLUDES = -I$(TOPDIR)$(DELIM)include
CPPFLAGS = $(CPPDEFINES) $(CPPINCLUDES)
# Librarian definitions
ARFLAGS = -quiet -warn
# Linker definitions
LINKCMDTEMPLATE = $(TOPDIR)$(DELIM)boards$(DELIM)$(CONFIG_ARCH_CHIP)$(DELIM)z16f2800100zcog$(DELIM)scripts$(DELIM)z16f2800100zcog.linkcmd
# Tool names/pathes
CROSSDEV =
CC = $(ZDSBINDIR)$(DELIM)zneocc.exe
CPP = gcc -E
LD = $(ZDSBINDIR)$(DELIM)zneolink.exe
AS = $(ZDSBINDIR)$(DELIM)zneoasm.exe
AR = $(ZDSBINDIR)$(DELIM)zneolib.exe
# File extensions
ASMEXT = .asm
OBJEXT = .obj
LIBEXT = .lib
EXEEXT = .hex
# These are the macros that will be used in the NuttX make system
# to compile and assembly source files and to insert the resulting
# object files into an archive
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
define PREPROCESS
@echo CPP: $1->$2
$(Q) "$(CPP)" $(CPPFLAGS) $($(strip $1)_CPPFLAGS) $1 -o $2
endef
define COMPILE
$(Q) "$(CC)" $(CFLAGS) $($(strip $1)_CFLAGS) ${shell echo $1 | sed -e "s/\//\\/g"}
endef
define ASSEMBLE
$(Q) "$(AS)" $(AFLAGS) $($(strip $1)_AFLAGS) ${shell echo $1 | sed -e "s/\//\\/g"}
endef
define MOVEOBJ
$(call MOVEFILE, "$1.obj", "$2$(DELIM)$1.obj")
$(call MOVEFILE, "$1.lst", "$2$(DELIM)$1.lst")
endef
define ARCHIVE
@echo AR: $2
$(Q) for %%G in ($(2)) do ( "$(AR)" $(ARFLAGS) $1=-+%%G )
endef
define CLEAN
$(Q) if exist *.obj (del /f /q *.obj)
$(Q) if exist *.src (del /f /q *.src)
$(Q) if exist *.lib (del /f /q *.lib)
$(Q) if exist *.hex (del /f /q *.hex)
$(Q) if exist *.lod (del /f /q *.lod)
$(Q) if exist *.lst (del /f /q *.lst)
endef
else
define PREPROCESS
@echo "CPP: $1->$2"
$(Q) "$(CPP)" $(CPPFLAGS) $($(strip $1)_CPPFLAGS) $1 -o $2
endef
define COMPILE
$(Q) "$(CC)" $(CFLAGS) $($(strip $1)_CFLAGS) `cygpath -w "$1"`
endef
define ASSEMBLE
$(Q) "$(AS)" $(AFLAGS) $($(strip $1)_AFLAGS) `cygpath -w "$1"`
endef
define MOVEOBJ
$(call MOVEFILE, "$1.obj", "$2$(DELIM)$1.obj")
$(call MOVEFILE, "$1.lst", "$2$(DELIM)$1.lst")
endef
define ARCHIVE
$(Q) for __obj in $(2) ; do \
echo "AR: $$__obj"; \
"$(AR)" $(ARFLAGS) $1=-+$$__obj || { echo "$(AR) $1=-+$$__obj FAILED!" ; exit 1 ; } \
done
endef
define CLEAN
$(Q) rm -f *.obj *.src *.lib *.hex *.lod *.lst
endef
endif
# Windows native host tool definitions
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
HOSTCC = mingw32-gcc.exe
HOSTINCLUDES = -I.
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -g -pipe
HOSTLDFLAGS =
HOSTEXEEXT = .exe
# Windows-native host tools
#MKDEP = $(TOPDIR)\tools\mkdeps.exe --winnative
MKDEP = $(TOPDIR)$(DELIM)tools$(DELIM)mknulldeps.sh
else
# Linux/Cygwin host tool definitions
HOSTCC = gcc
HOSTINCLUDES = -I.
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -g -pipe
HOSTLDFLAGS =
# This is the tool to use for dependencies (i.e., none)
MKDEP = $(TOPDIR)$(DELIM)tools$(DELIM)mknulldeps.sh
# ZDS-II cannot follow Cygwin soft links, so we will have to use directory copies
DIRLINK = $(TOPDIR)$(DELIM)tools$(DELIM)copydir.sh
DIRUNLINK = $(TOPDIR)$(DELIM)tools$(DELIM)unlink.sh
endif
@@ -0,0 +1,92 @@
/****************************************************************************/
/* boards/z16/z16f/z16f2800100zcog/scripts/z16f2800100zcog.linkcmd */
/* */
/* Copyright (C) 2008, 2014, 2017 Gregory Nutt. All rights reserved. */
/* Author: Gregory Nutt <gnutt@nuttx.org> */
/* */
/* Redistribution and use in source and binary forms, with or without */
/* modification, are permitted provided that the following conditions */
/* are met: */
/* */
/* 1. Redistributions of source code must retain the above copyright */
/* notice, this list of conditions and the following disclaimer. */
/* 2. Redistributions in binary form must reproduce the above copyright */
/* notice, this list of conditions and the following disclaimer in */
/* the documentation and/or other materials provided with the */
/* distribution. */
/* 3. Neither the name NuttX nor the names of its contributors may be */
/* used to endorse or promote products derived from this software */
/* without specific prior written permission. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
/* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
/* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
/* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS */
/* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED */
/* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
/* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
/* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/****************************************************************************/
-FORMAT=OMF695,INTEL32
-map -maxhexlen=64 -quiet -sort NAME=ascending -unresolved=fatal
-warnoverlap -NOxref -warn -debug -NOigcase
RANGE ROM $000000 : $007FFF
RANGE RAM $FFB000 : $FFBFFF
RANGE IODATA $FFC000 : $FFFFFF
RANGE EROM $008000 : $01FFFF
RANGE ERAM $800000 : $87FFFF
CHANGE NEAR_TEXT=NEAR_DATA
CHANGE FAR_TEXT=FAR_DATA
ORDER FAR_BSS, FAR_DATA
ORDER NEAR_BSS, NEAR_DATA
COPY NEAR_DATA EROM
COPY FAR_DATA EROM
define _0_exit = 0
define _low_near_romdata = copy base of NEAR_DATA
define _low_neardata = base of NEAR_DATA
define _len_neardata = length of NEAR_DATA
define _low_far_romdata = copy base of FAR_DATA
define _low_fardata = base of FAR_DATA
define _len_fardata = length of FAR_DATA
define _low_nearbss = base of NEAR_BSS
define _len_nearbss = length of NEAR_BSS
define _low_farbss = base of FAR_BSS
define _len_farbss = length of FAR_BSS
define _near_heaptop = highaddr of RAM
define _far_heaptop = highaddr of ERAM
define _far_stack = highaddr of ERAM
define _near_stack = highaddr of RAM
define _near_heapbot = top of RAM
define _far_heapbot = top of ERAM
define _SYS_CLK_SRC = 1
define _SYS_CLK_FREQ = 20000000
define __EXTCT_INIT_PARAM = $80
define __EXTCS0_INIT_PARAM = $8012
define __EXTCS1_INIT_PARAM = $8001
define __EXTCS2_INIT_PARAM = $0000
define __EXTCS3_INIT_PARAM = $0000
define __EXTCS4_INIT_PARAM = $0000
define __EXTCS5_INIT_PARAM = $0000
define __PFAF_INIT_PARAM = $ff
define __PGAF_INIT_PARAM = $ff
define __PDAF_INIT_PARAM = $ff00
define __PAAF_INIT_PARAM = $0000
define __PCAF_INIT_PARAM = $0000
define __PHAF_INIT_PARAM = $0300
define __PKAF_INIT_PARAM = $0f
/* arch/z16/src/Makefile will append target, object and library paths below */
@@ -0,0 +1,4 @@
/Make.dep
/.depend
/*.obj
@@ -0,0 +1,41 @@
############################################################################
# boards/z16/z16f/z16f2800100zcog/Makefile
#
# Copyright (C) 2008, 2012 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################
-include $(TOPDIR)/Make.defs
ASRCS =
CSRCS = z16f_boot.c z16f_leds.c
include $(TOPDIR)/boards/Board.mk
@@ -0,0 +1,94 @@
/****************************************************************************
* boards/z16/z16f/z16f2800100zcog/src/z16f_boot.c
*
* Copyright (C) 2008, 2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Based upon sample code included with the Zilog ZDS-II toolchain.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include "chip.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: z16f_gpioinit
*
* Description:
* Configure board-specific GPIO usage here. Driver pin configurations
* are set in the associated device drivers (such as UART, SPI, I2C,
* etc.) and must be preserved.
*
****************************************************************************/
static void z16f_gpioinit(void)
{
/* Configure LEDs and Run/Stop switch port */
putreg8(getreg8(Z16F_GPIOA_DD) | 0x87, Z16F_GPIOA_DD);
putreg8(getreg8(Z16F_GPIOA_OUT) | 0x07, Z16F_GPIOA_OUT);
putreg8(getreg8(Z16F_GPIOA_DD) & 0xf8, Z16F_GPIOA_DD);
/* Configure rate switch port */
putreg8(getreg8(Z16F_GPIOB_DD) | 0x20, Z16F_GPIOB_DD);
putreg8(getreg8(Z16F_GPIOB_AFL) | 0x20, Z16F_GPIOB_AFL);
#if 0 /* Not yet */
putreg8(0x05, Z16F_ADC0_MAX);
putreg8(0xf5, Z16F_ADC0_CTL);
#endif
/* Configure Direction switch port */
putreg8(getreg8(Z16F_GPIOC_DD) | 0x01, Z16F_GPIOC_DD);
}
/****************************************************************************
* Public Functions
****************************************************************************/
void z16f_board_initialize(void)
{
z16f_gpioinit();
}
@@ -0,0 +1,107 @@
/****************************************************************************
* boards/z16/z16f/z16f2800100zcog/z16f_leds.c
*
* Copyright (C) 2008, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/* The z16f2800100zcog board has four LEDs:
*
* - Green LED D1 which illuminates in the presence of Vcc
* - Red LED D2 connected to chip port PA0_T0IN
* - Yellow LED D3 connected to chip port PA1_T0OUT
* - Green LED D4 connected to chip port PA2_DE0
*/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/board.h>
#include <arch/board/board.h>
#include "up_internal.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_autoled_initialize
****************************************************************************/
#ifdef CONFIG_ARCH_LEDS
void board_autoled_initialize(void)
{
/* The following is performed up_board_initialize() as well */
putreg8(getreg8(Z16F_GPIOA_OUT) | 0x07, Z16F_GPIOA_OUT);
putreg8(getreg8(Z16F_GPIOA_DD) & 0xf8, Z16F_GPIOA_DD);
}
/****************************************************************************
* Name: board_autoled_on
****************************************************************************/
void board_autoled_on(int led)
{
if ((unsigned)led <= 7)
{
putreg8(((getreg8(Z16F_GPIOA_OUT) & 0xf8) | led), Z16F_GPIOA_OUT);
}
}
/****************************************************************************
* Name: board_autoled_off
****************************************************************************/
void board_autoled_off(int led)
{
if (led >= 1)
{
board_autoled_on(led-1);
}
}
#endif /* CONFIG_ARCH_LEDS */
+60
View File
@@ -0,0 +1,60 @@
#!/usr/bin/env bash
############################################################################
# boards/z16/z16f/z16f2800100zcog/tools/dopatch.sh
#
# Copyright (C) 2014 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################
USAGE="${0} [-R] \$PWD"
WD=`pwd`
TOOLDIR=${WD}/boards/z16f2800100zcog/tools
ME=${TOOLDIR}/dopatch.sh
PATCH=${TOOLDIR}/zneo-zdsii-5_0_1-variadic-func-fix.patch
ARGS=${1}
if [ ! -x ${ME} ]; then
echo "ERROR: This script must be executed from the top-level NuttX directory"
echo ${USAGE}
exit 1
fi
if [ ! -r ${PATCH} ]; then
echo "ERROR: Readable patch not found at ${PATCH}"
echo ${USAGE}
exit 1
fi
cd .. || \
{ echo "ERROR: failed to CD to the parent directory"; exit 1; }
cat ${PATCH} | patch ${ARGS} -p1 || \
{ echo "ERROR: patch failed" ; exit 1; }
@@ -0,0 +1,163 @@
diff --git a/apps/nshlib/nsh_console.c b/apps/nshlib/nsh_console.c
index ba7dbe7..45e4ab1 100644
--- a/apps/nshlib/nsh_console.c
+++ b/apps/nshlib/nsh_console.c
@@ -46,6 +46,7 @@
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
+#include <stdarg.h>
#include <assert.h>
#include <errno.h>
#include <debug.h>
@@ -79,7 +80,12 @@ static FAR struct nsh_vtbl_s *nsh_consoleclone(FAR struct nsh_vtbl_s *vtbl);
static void nsh_consolerelease(FAR struct nsh_vtbl_s *vtbl);
static ssize_t nsh_consolewrite(FAR struct nsh_vtbl_s *vtbl,
FAR const void *buffer, size_t nbytes);
+#if 0
static int nsh_consoleoutput(FAR struct nsh_vtbl_s *vtbl,
FAR const char *fmt, ...);
+#else
+static int nsh_consolevoutput(FAR struct nsh_vtbl_s *vtbl,
+ FAR const char *fmt, va_list ap);
+#endif
static FAR char *nsh_consolelinebuffer(FAR struct nsh_vtbl_s *vtbl);
@@ -213,6 +219,7 @@ static ssize_t nsh_consolewrite(FAR struct nsh_vtbl_s *vtbl, FAR const void *buf
*
****************************************************************************/
+#if 0
static int nsh_consoleoutput(FAR struct nsh_vtbl_s *vtbl,
FAR const char *fmt, ...)
{
@@ -263,6 +270,29 @@ static int nsh_consoleoutput(FAR struct nsh_vtbl_s *vtbl,
#endif
}
+#else
+static int nsh_consolevoutput(FAR struct nsh_vtbl_s *vtbl, FAR const char *fmt, va_list ap)
+{
+ FAR struct console_stdio_s *pstate = (FAR struct console_stdio_s *)vtbl;
+ int ret;
+
+ /* The stream is open in a lazy fashion. This is done because the file
+ * descriptor may be opened on a different task than the stream. The
+ * actual open will then occur with the first output from the new task.
+ */
+
+ if (nsh_openifnotopen(pstate) != 0)
+ {
+ return ERROR;
+ }
+
+ ret = vfprintf(pstate->cn_outstream, fmt, ap);
+
+ return ret;
+#endif
+}
+#endif
+
/****************************************************************************
* Name: nsh_consolelinebuffer
*
@@ -452,7 +504,11 @@ FAR struct console_stdio_s *nsh_newconsole(void)
pstate->cn_vtbl.release = nsh_consolerelease;
#endif
pstate->cn_vtbl.write = nsh_consolewrite;
+#if 0
pstate->cn_vtbl.output = nsh_consoleoutput;
+#else
+ pstate->cn_vtbl.voutput = nsh_consolevoutput;
+#endif
pstate->cn_vtbl.linebuffer = nsh_consolelinebuffer;
pstate->cn_vtbl.exit = nsh_consoleexit;
@@ -489,3 +545,15 @@ FAR struct console_stdio_s *nsh_newconsole(void)
}
return pstate;
}
+
+int nsh_output(FAR struct nsh_vtbl_s *vtbl, FAR const char *fmt, ...)
+{
+ va_list ap;
+ int ret;
+
+ va_start(ap, fmt);
+ ret = vtbl->voutput(vtbl, fmt, ap);
+ va_end(ap);
+
+ return ret;
+}
diff --git a/apps/nshlib/nsh_console.h b/apps/nshlib/nsh_console.h
index c78362f..207f9b9 100644
--- a/apps/nshlib/nsh_console.h
+++ b/apps/nshlib/nsh_console.h
@@ -47,6 +47,7 @@
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
+#include <stdarg.h>
#include <errno.h>
/****************************************************************************
@@ -62,11 +63,13 @@
#define nsh_undirect(v,s) (v)->undirect(v,s)
#define nsh_exit(v,s) (v)->exit(v,s)
+#if 0
#ifdef CONFIG_CPP_HAVE_VARARGS
# define nsh_output(v, ...) (v)->output(v, ##__VA_ARGS__)
#else
# define nsh_output vtbl->output
#endif
+#endif
/* Size of info to be saved in call to nsh_redirect */
@@ -107,6 +110,10 @@ struct nsh_vtbl_s
void (*release)(FAR struct nsh_vtbl_s *vtbl);
#endif
ssize_t (*write)(FAR struct nsh_vtbl_s *vtbl, FAR const void *buffer, size_t nbytes);
+#if 0
int (*output)(FAR struct nsh_vtbl_s *vtbl, FAR const char *fmt, ...);
+#else
+ int (*voutput)(FAR struct nsh_vtbl_s *vtbl, FAR const char *fmt, va_list ap);
+#endif
FAR char *(*linebuffer)(FAR struct nsh_vtbl_s *vtbl);
void (*redirect)(FAR struct nsh_vtbl_s *vtbl, int fd, FAR uint8_t *save);
@@ -159,5 +166,6 @@ struct console_stdio_s
/* Defined in nsh_console.c *************************************************/
FAR struct console_stdio_s *nsh_newconsole(void);
+int nsh_output(FAR struct nsh_vtbl_s *vtbl, FAR const char *fmt, ...);
#endif /* __APPS_NSHLIB_NSH_CONSOLE_H */
diff --git a/nuttx/include/wdog.h b/nuttx/include/nuttx/wdog.h
index 0aa3584..ac4a36a 100644
--- a/nuttx/include/nuttx/wdog.h
+++ b/nuttx/include/nuttx/wdog.h
@@ -74,7 +74,23 @@ typedef union wdparm_u wdparm_t;
* watchdog function expires. Up to four parameters may be passed.
*/
+#if 0
typedef CODE void (*wdentry_t)(int argc, uint32_t arg1, ...);
+#elif CONFIG_MAX_WDOGPARMS < 1
+typedef CODE void (*wdentry_t)(int argc);
+#elif CONFIG_MAX_WDOGPARMS < 2
+typedef CODE void (*wdentry_t)(int argc, uint32_t arg1);
+#elif CONFIG_MAX_WDOGPARMS < 3
+typedef CODE void (*wdentry_t)(int argc, uint32_t arg1, uint32_t arg2);
+#elif CONFIG_MAX_WDOGPARMS < 4
+typedef CODE void (*wdentry_t)(int argc, uint32_t arg1, uint32_t arg2,
+ uint32_t arg3);
+#elif CONFIG_MAX_WDOGPARMS < 5
+typedef CODE void (*wdentry_t)(int argc, uint32_t arg1, uint32_t arg2,
+ uint32_t arg3, uint32_t arg4);
+#else
+# error Ooops. CONFIG_MAX_WDOGPARMS > 4
+#endif
/* Watchdog 'handle' */