From bc228da3552108f199206f573e463165afede3b3 Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 8 Jan 2008 22:11:00 +0000 Subject: Add logic for environments that can't use soft links git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@530 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/ChangeLog | 1 + nuttx/Documentation/NuttX.html | 211 ++++++++++++++++++++++++++++++-- nuttx/Makefile | 75 ++++-------- nuttx/configs/z16f2800100zcog/Make.defs | 5 + nuttx/tools/link.sh | 84 +++++++++++++ nuttx/tools/unlink.sh | 70 +++++++++++ nuttx/tools/winlink.sh | 97 +++++++++++++++ 7 files changed, 479 insertions(+), 64 deletions(-) create mode 100755 nuttx/tools/link.sh create mode 100755 nuttx/tools/unlink.sh create mode 100755 nuttx/tools/winlink.sh diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 8ba9463ed..36de29e4d 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -303,4 +303,5 @@ * Add support toolchains that do not support making of dependencies * Fix Cygwin build with spaces in directory names * Name make system changes to deal with non-GNU toolchains (i.e., Zilog) + * Add support for Windows native toolchains that cannot follow Cygwin soft links diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html index 52ed3cfa9..69d7d4c25 100644 --- a/nuttx/Documentation/NuttX.html +++ b/nuttx/Documentation/NuttX.html @@ -8,7 +8,7 @@

NuttX RTOS

-

Last Updated: January 7, 2008

+

Last Updated: January 8, 2008

@@ -27,39 +27,76 @@ - + + + + + - + - + - + - + - + - + - + - +
Overview + Overview.
+ What is NuttX? +
+ Downloads.
+ Where can I get NuttX? What is the current development status? +
Downloads + Supported Platforms.
+ What target platforms has NuttX been ported to? +
Supported Platforms + Development Environments.
+ What kinds of host cross-development platforms can be used with NuttX? +
Memory Footprint + Memory Footprint.
+ Just how big is it? Do I have enough memory to use NuttX? +
Licensing + Licensing.
+ Are there any licensing restrictions for the use of NuttX? (Almost none) + Will there be problems if I link my proprietary code with NuttX? (No) +
Release History + Release History
+ What has changed in the last release of NuttX? + What unreleased changes are pending in CVS? +
Bugs, Issues, Things-To-Do + Bugs, Issues, Things-To-Do.
+ Software is never finished nor ever tested well enough. + (Do you want to help devlop NuttX? If so, send me an email). +
Other Documentation + Other Documentation.
+ What other NuttX documentation is available? +
Trademarks + Trademarks.
+ Some of the words used in this document belong to other people. +
@@ -643,6 +680,159 @@ is available that may be used to build a NuttX-compatible arm-elf toolchain under Linux or Cygwin. + + + + +
+

Development Environments

+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Linux + GNU make + GCC/binutils +

+

+ The is the most natural development environment for NuttX. + Any version of the GCC/binutils toolchain may be used. + There is a highly modified buildroot + available for download from the + NuttX SourceForge + page. + This download may be used to build a NuttX-compatible arm-elf toolchain under Linux or Cygwin. + Additional support for m68k, m68hc11, and m68hc12 is available in the + NuttX CVS. +

+
+ Linux + GNU make + SDCC +

+

+ Also very usable is the Linux environment using the + SDCC compiler. + The SDCC compiler provides support for the 8051/2, z80, hc08, and other microcontrollers. + The SDCC-based logic is less well exercised and you will likely find some compilation + issues if you use parts of NuttX with SDCC that have not been well-tested. +

+
+ Cygwin + GNU make + GCC/binutils +

+

+ This combination works well too. + It works just as well as the native Linux environment except + that compilation and build times are a little longer. + The custom NuttX buildroot referenced above may be build in + the Cygwin environment as well. +

+
+ Cygwin + GNU make + SDCC +

+

+ I have never tried this combination, but it would probably work just fine. +

+
+ Cygwin + GNU make + Windows Native Toolchain +

+

+ This is a tougher environment. + In this case, the Windows native toolchain is unaware of the the + Cygwin sandbox and, instead, operates in the native Windows environment. + The primary difficulties with this are: +

+
    +
  • + Pathes. + Full pathes for the native toolchain must follow Windows standards. + For example, the path /home/my\ name/nuttx/include my have to be + converted to something like 'C:\cygwin\home\my name\nuttx\include' + to be usable by the toolchain. +
  • +

    + Fortunately, this conversion is done simply using the cygpath utility. +

    +
  • + Symbolic Links + NuttX depends on symbolic links to install platform-specific directories in the build system. + On Linux, true symbolic links are used. + On Cygwin, emulated symbolic links are used. + Unfortunately, for native Windows applications that operate outside of the + Cygwin sandbox, these symbolic links cannot be used. +
  • +

    + The NuttX make system works around this limitation by copying the platform + specific directories in place. + These copied directories make work a little more complex, but otherwise work well. +

    +
+

+ At present, on the Zilog Z16F port uses a native Windows toolchain + (the Zilog ZDS-II toolchain). + +

+ Others? +

+

+ The primary environmental dependency of NuttX is GNU make. + If you have other platforms that support GNU make or make + utilities that are compatible with GNU make, then it is very + likely that NuttX would work in that environment as well. + If GNU make is not supported, then some significant modification + of the Make system would be required. +

+
+
@@ -790,6 +980,7 @@ Other memory: * Add support toolchains that do not support making of dependencies * Fix Cygwin build with spaces in directory names * Name make system changes to deal with non-GNU toolchains (i.e., Zilog) + * Add support for Windows native toolchains that cannot follow Cygwin soft links diff --git a/nuttx/Makefile b/nuttx/Makefile index 7ee658c64..4a7e17aba 100644 --- a/nuttx/Makefile +++ b/nuttx/Makefile @@ -37,6 +37,13 @@ TOPDIR := ${shell pwd | sed -e 's/ /\\ /g'} -include ${TOPDIR}/.config -include ${TOPDIR}/Make.defs +# Default tools + +ifeq ($(DIRLINK),) +DIRLINK = $(TOPDIR)/tools/link.sh +DIRUNLINK = $(TOPDIR)/tools/unlink.sh +endif + # Process architecture and board-specific directories ARCH_DIR = arch/$(CONFIG_ARCH) @@ -121,79 +128,39 @@ include/nuttx/config.h: $(TOPDIR)/.config tools/mkconfig # link the arch//include dir to include/arch include/arch: Make.defs - @if [ -h include/arch ]; then \ - rm -f include/arch ; \ - else \ - if [ -e include/arch ]; then \ - echo "include/arch exists but is not a symbolic link" ; \ - exit 1 ; \ - fi ; \ - fi - @ln -s $(TOPDIR)/$(ARCH_DIR)/include include/arch + @$(DIRLINK) $(TOPDIR)/$(ARCH_DIR)/include include/arch # Link the configs//include dir to include/arch/board -include/arch/board: Make.defs include/arch - @if [ -h include/arch/board ]; then \ - rm -f include/arch/board ; \ - else \ - if [ -e include/arch/board ]; then \ - echo "include/arch/board exists but is not a symbolic link" ; \ - exit 1 ; \ - fi ; \ - fi - @ln -s $(TOPDIR)/$(BOARD_DIR)/include include/arch/board +include/arch/board: include/arch Make.defs include/arch + @$(DIRLINK) $(TOPDIR)/$(BOARD_DIR)/include include/arch/board # Link the configs//src dir to arch//src/board $(ARCH_SRC)/board: Make.defs - @if [ -h $(ARCH_SRC)/board ]; then \ - rm -f $(ARCH_SRC)/board ; \ - else \ - if [ -e $(ARCH_SRC)/board ]; then \ - echo "$(ARCH_SRC)/board exists but is not a symbolic link" ; \ - exit 1 ; \ - fi ; \ - fi - @ln -s $(TOPDIR)/$(BOARD_DIR)/src $(ARCH_SRC)/board + @$(DIRLINK) $(TOPDIR)/$(BOARD_DIR)/src $(ARCH_SRC)/board # Link arch//include/ to arch//include/chip $(ARCH_SRC)/chip: Make.defs ifneq ($(CONFIG_ARCH_CHIP),) - @if [ -h $(ARCH_SRC)/chip ]; then \ - rm -f $(ARCH_SRC)/chip ; \ - else \ - if [ -e $(ARCH_SRC)/chip ]; then \ - echo "$(ARCH_SRC)/chip exists but is not a symbolic link" ; \ - exit 1 ; \ - fi ; \ - fi - @ln -s $(CONFIG_ARCH_CHIP) $(ARCH_SRC)/chip + @$(DIRLINK) $(CONFIG_ARCH_CHIP) $(ARCH_SRC)/chip endif # Link arch//src/ to arch//src/chip -$(ARCH_INC)/chip: Make.defs +include/arch/chip: include/arch Make.defs ifneq ($(CONFIG_ARCH_CHIP),) - @if [ -e $(ARCH_INC)/chip ]; then \ - if [ -h $(ARCH_INC)/chip ]; then \ - rm -f $(ARCH_INC)/chip ; \ - else \ - echo "$(ARCH_INC)/chip exists but is not a symbolic link" ; \ - exit 1 ; \ - fi ; \ - fi - @ln -s $(CONFIG_ARCH_CHIP) $(ARCH_INC)/chip + @$(DIRLINK) $(CONFIG_ARCH_CHIP) include/arch/chip endif -dirlinks: include/arch include/arch/board $(ARCH_SRC)/board $(ARCH_SRC)/chip $(ARCH_INC)/chip +dirlinks: include/arch include/arch/board include/arch/chip $(ARCH_SRC)/board $(ARCH_SRC)/chip context: check_context include/nuttx/config.h dirlinks clean_context: - @rm -f include/nuttx/config.h include/arch - @if [ -h include/arch ]; then rm -f include/arch ; fi - @if [ -h $(ARCH_INC)/board ]; then rm -f $(ARCH_INC)/board ; fi - @if [ -h $(ARCH_SRC)/board ]; then rm -f $(ARCH_SRC)/board ; fi - @if [ -h $(ARCH_INC)/chip ]; then rm -f $(ARCH_INC)/chip ; fi - @if [ -h $(ARCH_SRC)/chip ]; then rm -f $(ARCH_SRC)/chip ; fi + @rm -f include/nuttx/config.h + @$(DIRUNLINK) include/arch/board + @$(DIRUNLINK) include/arch/chip + @$(DIRUNLINK) include/arch + @$(DIRUNLINK) $(ARCH_SRC)/board + @$(DIRUNLINK) $(ARCH_SRC)/chip check_context: @if [ ! -e ${TOPDIR}/.config -o ! -e ${TOPDIR}/Make.defs ]; then \ diff --git a/nuttx/configs/z16f2800100zcog/Make.defs b/nuttx/configs/z16f2800100zcog/Make.defs index e9f7342b7..ee7a692ce 100644 --- a/nuttx/configs/z16f2800100zcog/Make.defs +++ b/nuttx/configs/z16f2800100zcog/Make.defs @@ -129,6 +129,11 @@ endef MKDEP = $(TOPDIR)/tools/mknulldeps.sh +# ZNeo-II cannot follow Cygwin soft links, so we will have to use directory copies + +DIRLINK = $(TOPDIR)/tools/winlink.sh +DIRUNLINK = $(TOPDIR)/tools/unlink.sh + # Linux/Cygwin host tool definitions HOSTCC = gcc diff --git a/nuttx/tools/link.sh b/nuttx/tools/link.sh new file mode 100755 index 000000000..5c9576294 --- /dev/null +++ b/nuttx/tools/link.sh @@ -0,0 +1,84 @@ +#!/bin/sh +############################################################################ +# tools/link.sh +# +# Copyright (C) 2008 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# 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. +# +############################################################################ + +src=$1 +dest=$2 + +# Verify that arguments were provided + +if [ -z "${src}" -o -z "${dest}" ]; then + echo "Missing src and/or dest arguments" + exit 1 +fi + +# Check if something already exists at the destination path + +if [ -e "${dest}" ]; then + + # Yes, is it a symbolic link? If so, then remove it so that we can + # replace it with the new link (which might be different) + + if [ -h "${dest}" ]; then + rm -f "${dest}" + else + + # If the path is a directory and contains the "fake link" mark, then + # treat it like a soft link (i.e., remove the directory) + + if [ -d "${dest}" -a -f "${dest}/.fakelnk" ]; then + rm -rf "${dest}" + else + + # It is something else (like a file) or directory that does + # not contain the "fake link" mark + + echo "${dest} already exists but is not a symbolic link" + exit 1 + fi + fi +fi + +# Verify that a directory exists at the source path + +if [ ! -d ${src} ]; then + echo "No directory at ${src}" + exit 1 +fi + +# Create the soft link + +ln -s "${src}" "${dest}" || \ + { echo "Failed to create link: $dest" ; exit 1 ; } \ No newline at end of file diff --git a/nuttx/tools/unlink.sh b/nuttx/tools/unlink.sh new file mode 100755 index 000000000..ebd21d512 --- /dev/null +++ b/nuttx/tools/unlink.sh @@ -0,0 +1,70 @@ +#!/bin/sh +############################################################################ +# tools/unlink.sh +# +# Copyright (C) 2008 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# 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. +# +############################################################################ + +link=$1 + +# Verify that arguments were provided + +if [ -z "${link}" ]; then + echo "Missing link argument" + exit 1 +fi + +# Check if something already exists at the link path + +if [ -e "${link}" ]; then + + # Yes, is it a symbolic link? If so, then remove it + + if [ -h "${link}" ]; then + rm -f "${link}" + else + + # If the path is a directory and contains the "fake link" mark, then + # treat it like a soft link (i.e., remove the directory) + + if [ -d "${link}" -a -f "${link}/.fakelnk" ]; then + rm -rf "${link}" + else + + # It is something else (like a file) or directory that does + # not contain the "fake link" mark + + echo "${link} already exists but is not a symbolic link" + exit 1 + fi + fi +fi \ No newline at end of file diff --git a/nuttx/tools/winlink.sh b/nuttx/tools/winlink.sh new file mode 100755 index 000000000..c98efa47d --- /dev/null +++ b/nuttx/tools/winlink.sh @@ -0,0 +1,97 @@ +#!/bin/sh +############################################################################ +# tools/winlink.sh +# +# Copyright (C) 2008 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# 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. +# +############################################################################ +# +# NuttX uses symbolic links to configure platform-specific directories into +# the build system. This works great except for when a Windows native +# toolchain is used in a Cygwin environment. In that case, symbolic +# links do not work correctly when accessed from the Windows native toolchain; +# rather, just look link files with the extension .lnk +# +# In this environment, the build system will work around this using this script +# as a replacement for the 'ln' command. This scrpt will simply copy the +# directory into the expected positiion. +# + +src=$1 +dest=$2 + +# Verify that arguments were provided + +if [ -z "${src}" -o -z "${dest}" ]; then + echo "Missing src and/or dest arguments" + exit 1 +fi + +# Check if something already exists at the destination path + +if [ -e "${dest}" ]; then + + # Yes, is it a symbolic link? If so, then remove it so that we can + # replace it with the new directory copy + + if [ -h "${dest}" ]; then + rm -f "${dest}" + else + + # If the path is a directory and contains the "fake link" mark, then + # remove the directory so that we can replace it with a new copy + + if [ -d "${dest}" -a -f "${dest}/.fakelnk" ]; then + rm -rf "${dest}" + else + + # It is something else (like a file) or directory that does + # not contain the "fake link" mark + + echo "${dest} already exists but is not a symbolic link" + exit 1 + fi + fi +fi + +# Verify that a directory exists at the source path + +if [ ! -d ${src} ]; then + echo "No directory at ${src}" + exit 1 +fi + +# Copy the directory + +cp -a "${src}" "${dest}" || \ + { echo "Failed to create link: $dest" ; rm -rf ${dest} ; exit 1 ; } +touch "${dest}/.fakelnk" || \ + { echo "Failed to touch ${dest}/.fakelnk" ; rm -rf ${dest} ; exit 1 ; } \ No newline at end of file -- cgit v1.2.3