summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-03-07 02:53:37 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-03-07 02:53:37 +0000
commitddd126cb2969bec42a4430b7d8fcdd45de4a42c1 (patch)
tree283523ab8c113f44f7cee4d75b7e8c4deac85b71
parentdc9631bf8e809702235b43dbc2414eb4a09622f9 (diff)
downloadnuttx-ddd126cb2969bec42a4430b7d8fcdd45de4a42c1.tar.gz
nuttx-ddd126cb2969bec42a4430b7d8fcdd45de4a42c1.tar.bz2
nuttx-ddd126cb2969bec42a4430b7d8fcdd45de4a42c1.zip
Add i486 toolchain support
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3349 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r--misc/buildroot/ChangeLog9
-rw-r--r--misc/buildroot/ReleaseNotes22
-rw-r--r--misc/buildroot/configs/README.txt9
-rw-r--r--misc/buildroot/configs/i486-defconfig-4.3.3103
-rw-r--r--nuttx/Documentation/NuttX.html10
-rw-r--r--nuttx/arch/x86/src/qemu/qemu_fullcontextrestore.S26
-rw-r--r--nuttx/arch/x86/src/qemu/qemu_saveusercontext.S20
-rw-r--r--nuttx/configs/qemu-i486/README.txt52
-rwxr-xr-xnuttx/configs/qemu-i486/ostest/ld.script1
9 files changed, 222 insertions, 30 deletions
diff --git a/misc/buildroot/ChangeLog b/misc/buildroot/ChangeLog
index 927bc96a1..3ea2b60f3 100644
--- a/misc/buildroot/ChangeLog
+++ b/misc/buildroot/ChangeLog
@@ -81,3 +81,12 @@ buildroot-1.10 2011-xx-xx <spudmonkey@racsa.co.cr>
* Add patch submitted by Dimiter Georgiev to work around problems in building
GDB 6.8 with versions of Cygwin > 1.7.
+ * configs/i486-defconfig-4.3.3 - Builds an i486 cross development toolchain
+ using gcc 4.3.3. Why wouldyou want such a thing? On Linux, of course,
+ such a thing is not needed because you can use the installed GCC to build
+ i486 ELF binaries. But that will not work under Cygwin! The Cygwin
+ toolchain (and probably MinGW), build DOS MZ format executables (i.e.,
+ .exe files). That is probably not usable for most NuttX targets.
+ Instead, you should use this i486-elf-gcc to generate true ELF binaries
+ under Cygwin.
+
diff --git a/misc/buildroot/ReleaseNotes b/misc/buildroot/ReleaseNotes
index 8206a15f4..d0077d613 100644
--- a/misc/buildroot/ReleaseNotes
+++ b/misc/buildroot/ReleaseNotes
@@ -21,6 +21,20 @@ can be used to build the following NuttX-compatible toolchains:
o avr-elf toolchain needed for use with the ATmega128 ports
provided with the NuttX releases.
+ o H8/300 toolchain (not currently used in any NuttX
+ configuration).
+
+ o i486-elf toochain. Why would you want such a thing? On Linux, of
+ course, such a thing is not needed because you can use the installed GCC
+ to build i486 ELF binaries. But that will not work under Cygwin! The
+ Cygwin toolchain (and probably MinGW), build DOS MZ format executables
+ (i.e., .exe files). That is probably not usable for most NuttX targets.
+ Instead, you should use this i486-elf-gcc to generate true ELF binaries
+ under Cygwin.
+
+ o bfin-elf toolchain not currently used in any NuttX
+ configuration).
+
o m68k-elf toolchain (not currently used in any NuttX
configuration).
@@ -34,15 +48,9 @@ can be used to build the following NuttX-compatible toolchains:
binutils 2.18 and gcc 3.3.6 and patches available from
http://www.msextra.com/tools courtesy of James Cortina.
- o sh-elf toolchain needed for the SH-1 NuttX port.
-
o m32c-elf toolchain needed for the Renesas M16C NuttX port.
- o H8/300 toolchain (not currently used in any NuttX
- configuration).
-
- o bfin-elf toolchain not currently used in any NuttX
- configuration).
+ o sh-elf toolchain needed for the SH-1 NuttX port.
Supported tool versions include:
diff --git a/misc/buildroot/configs/README.txt b/misc/buildroot/configs/README.txt
index 6421afaa6..91c2fcc42 100644
--- a/misc/buildroot/configs/README.txt
+++ b/misc/buildroot/configs/README.txt
@@ -61,6 +61,15 @@ bfin-defconfig-4.2.4
h8300_config
Builds an H8/300 toolchain using gcc 3.4.6
+i486-defconfig-4.3.3
+ Builds an i486 cross development toolchain using gcc 4.3.3. Why would
+ you want such a thing? On Linux, of course, such a thing is not needed
+ because you can use the installed GCC to build i486 ELF binaries. But
+ that will not work under Cygwin! The Cygwin toolchain (and probably
+ MinGW), build DOS MZ format executables (i.e., .exe files). That is
+ probably not usable for most NuttX targets. Instead, you should use this
+ i486-elf-gcc to generate true ELF binaries under Cygwin.
+
m32c_defconfig_4.2.4
m32c_defconfig_4.3.3
Build a toolchain for use with the M16C port using eith gcc 4.2.4 or 4.3.3
diff --git a/misc/buildroot/configs/i486-defconfig-4.3.3 b/misc/buildroot/configs/i486-defconfig-4.3.3
new file mode 100644
index 000000000..c99130521
--- /dev/null
+++ b/misc/buildroot/configs/i486-defconfig-4.3.3
@@ -0,0 +1,103 @@
+#
+# Automatically generated make config: don't edit
+#
+BR2_HAVE_DOT_CONFIG=y
+# BR2_alpha is not set
+# BR2_arm is not set
+# BR2_armeb is not set
+# BR2_avr is not set
+# BR2_avr32 is not set
+# BR2_bfin is not set
+# BR2_cris is not set
+BR2_i386=y
+# BR2_m32c is not set
+# BR2_m68k is not set
+# BR2_m68hc11 is not set
+# BR2_m68hc12 is not set
+# BR2_m9s12x is not set
+# BR2_mips is not set
+# BR2_mipsel is not set
+# BR2_nios2 is not set
+# BR2_powerpc is not set
+# BR2_sh is not set
+# BR2_sh64 is not set
+# BR2_h8300 is not set
+# BR2_sparc is not set
+# BR2_x86_64 is not set
+# BR2_x86_i386 is not set
+BR2_x86_i486=y
+# BR2_x86_i586 is not set
+# BR2_x86_i686 is not set
+BR2_ARCH="i486"
+BR2_GCC_TARGET_TUNE="i486"
+BR2_GCC_TARGET_ARCH="i486"
+BR2_ENDIAN="LITTLE"
+
+#
+# Build options
+#
+BR2_WGET="wget --passive-ftp"
+BR2_SVN="svn co"
+BR2_ZCAT="zcat"
+BR2_BZCAT="bzcat"
+BR2_TAR_OPTIONS=""
+BR2_DL_DIR="$(BASE_DIR)/../archives"
+BR2_STAGING_DIR="$(BUILD_DIR)/staging_dir"
+BR2_NUTTX_DIR="$(TOPDIR)/../../nuttx"
+BR2_TOPDIR_PREFIX=""
+BR2_TOPDIR_SUFFIX=""
+BR2_GNU_BUILD_SUFFIX="pc-elf"
+BR2_GNU_TARGET_SUFFIX="elf"
+# BR2_PREFER_IMA is not set
+
+#
+# Toolchain Options
+#
+
+#
+# Binutils Options
+#
+# BR2_BINUTILS_VERSION_2_17 is not set
+# BR2_BINUTILS_VERSION_2_18 is not set
+# BR2_BINUTILS_VERSION_2_19 is not set
+BR2_BINUTILS_VERSION_2_19_1=y
+BR2_BINUTILS_VERSION="2.19.1"
+BR2_EXTRA_BINUTILS_CONFIG_OPTIONS=""
+
+#
+# GCC Options
+#
+BR2_PACKAGE_GCC=y
+# BR2_GCC_VERSION_3_3_6 is not set
+# BR2_GCC_VERSION_3_4_6 is not set
+# BR2_GCC_VERSION_4_2_4 is not set
+BR2_GCC_VERSION_4_3_3=y
+BR2_GCC_SUPPORTS_SYSROOT=y
+BR2_GCC_VERSION="4.3.3"
+# BR2_GCC_USE_SJLJ_EXCEPTIONS is not set
+BR2_EXTRA_GCC_CONFIG_OPTIONS=""
+BR2_INSTALL_LIBSTDCPP=y
+# BR2_INSTALL_LIBGCJ is not set
+# BR2_INSTALL_OBJC is not set
+# BR2_INSTALL_FORTRAN is not set
+
+#
+# Gdb Options
+#
+# BR2_PACKAGE_GDB is not set
+# BR2_PACKAGE_GDB_SERVER is not set
+# BR2_PACKAGE_GDB_HOST is not set
+
+#
+# NuttX Binary Support
+#
+BR2_PACKAGE_GENROMFS=y
+
+#
+# Common Toolchain Options
+#
+# BR2_PACKAGE_SSTRIP_TARGET is not set
+# BR2_PACKAGE_SSTRIP_HOST is not set
+# BR2_ENABLE_MULTILIB is not set
+BR2_LARGEFILE=y
+BR2_TARGET_OPTIMIZATION="-Os -pipe"
diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html
index 117afd5f8..bf638b5ec 100644
--- a/nuttx/Documentation/NuttX.html
+++ b/nuttx/Documentation/NuttX.html
@@ -2159,6 +2159,16 @@ pascal-2.1 2011-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
buildroot-1.10 2011-xx-xx <spudmonkey@racsa.co.cr>
+ * Add patch submitted by Dimiter Georgiev to work around problems in building
+ GDB 6.8 with versions of Cygwin > 1.7.
+ * configs/i486-defconfig-4.3.3 - Builds an i486 cross development toolchain
+ using gcc 4.3.3. Why wouldyou want such a thing? On Linux, of course,
+ such a thing is not needed because you can use the installed GCC to build
+ i486 ELF binaries. But that will not work under Cygwin! The Cygwin
+ toolchain (and probably MinGW), build DOS MZ format executables (i.e.,
+ .exe files). That is probably not usable for most NuttX targets.
+ Instead, you should use this i486-elf-gcc to generate true ELF binaries
+ under Cygwin.
</pre></ul>
<table width ="100%">
diff --git a/nuttx/arch/x86/src/qemu/qemu_fullcontextrestore.S b/nuttx/arch/x86/src/qemu/qemu_fullcontextrestore.S
index b4704f23a..b9c553fdf 100644
--- a/nuttx/arch/x86/src/qemu/qemu_fullcontextrestore.S
+++ b/nuttx/arch/x86/src/qemu/qemu_fullcontextrestore.S
@@ -111,34 +111,34 @@ SYMBOL(up_fullcontextrestore):
* stack pointer.
*/
- movl (REG_SP)(%eax), %esp
+ movl (4*REG_SP)(%eax), %esp
/* Save the return address, EFLAGS, and the values as well the
* values of EBX and EAC on the new stack.
*/
- movl (REG_EIP)(%eax), %ebx
+ movl (4*REG_EIP)(%eax), %ebx
push %ebx
- movl (REG_EFLAGS)(%eax), %ebx
+ movl (4*REG_EFLAGS)(%eax), %ebx
push %ebx
- movl (REG_EAX)(%eax), %ebx
+ movl (4*REG_EAX)(%eax), %ebx
push %ebx
- movl (REG_EBX)(%eax), %ebx
+ movl (4*REG_EBX)(%eax), %ebx
push %ebx
/* Now restore the remaining registers */
- movl (REG_EDI)(%ebx), %edi
- movl (REG_ESI)(%ebx), %esi
- movl (REG_EBP)(%ebx), %ebp
- movl (REG_EDX)(%ebx), %edx
- movl (REG_ECX)(%ebx), %ecx
+ movl (4*REG_EDI)(%ebx), %edi
+ movl (4*REG_ESI)(%ebx), %esi
+ movl (4*REG_EBP)(%ebx), %ebp
+ movl (4*REG_EDX)(%ebx), %edx
+ movl (4*REG_ECX)(%ebx), %ecx
/* Restore the segment registers */
- mov (REG_DS)(%ebx), %ds
- mov (REG_CS)(%ebx), %cs
- mov (REG_SS)(%ebx), %ss
+ mov (4*REG_DS)(%ebx), %ds
+ mov (4*REG_CS)(%ebx), %cs
+ mov (4*REG_SS)(%ebx), %ss
/* Restore the correct value of EAX, EBX, and the EFLAGS then return */
diff --git a/nuttx/arch/x86/src/qemu/qemu_saveusercontext.S b/nuttx/arch/x86/src/qemu/qemu_saveusercontext.S
index 841023b40..3da2d1491 100644
--- a/nuttx/arch/x86/src/qemu/qemu_saveusercontext.S
+++ b/nuttx/arch/x86/src/qemu/qemu_saveusercontext.S
@@ -121,37 +121,37 @@ SYMBOL(up_saveusercontext):
* because it will be the return value from this function.
*/
- movl %ebx, (REG_EBX)(%eax)
- movl %esi, (REG_ESI)(%eax)
- movl %edi, (REG_EDI)(%eax)
+ movl %ebx, (4*REG_EBX)(%eax)
+ movl %esi, (4*REG_ESI)(%eax)
+ movl %edi, (4*REG_EDI)(%eax)
/* Save the segment registers */
- mov %ss, (REG_SS)(%eax)
- mov %cs, (REG_CS)(%eax)
- mov %ds, (REG_DS)(%eax)
+ mov %ss, (4*REG_SS)(%eax)
+ mov %cs, (4*REG_CS)(%eax)
+ mov %ds, (4*REG_DS)(%eax)
/* Save the value of SP as will be after we return (don't bother to save
* REG_ESP).
*/
leal 4(%esp), %ecx
- movl %ecx, (REG_SP)(%eax)
+ movl %ecx, (4*REG_SP)(%eax)
/* Fetch the PC from the stack and save it in the save block */
movl 0(%esp), %ecx
- movl %ecx, (REG_EIP)(%eax)
+ movl %ecx, (4*REG_EIP)(%eax)
/* Save the framepointer */
- movl %ebp, (REG_EBP)(%eax)
+ movl %ebp, (4*REG_EBP)(%eax)
/* Get and save the interrupt state */
pushf
pop %ecx
- movl %ecx, (REG_EFLAGS)(%eax)
+ movl %ecx, (4*REG_EFLAGS)(%eax)
/* And return 0. 'ret' will remove the EIP from the top of the stack. */
diff --git a/nuttx/configs/qemu-i486/README.txt b/nuttx/configs/qemu-i486/README.txt
index 32cbfa76f..9d5a49c14 100644
--- a/nuttx/configs/qemu-i486/README.txt
+++ b/nuttx/configs/qemu-i486/README.txt
@@ -8,6 +8,7 @@ Contents
^^^^^^^^
* QEMU
+ * Toolchains
* Configurations
QEMU
@@ -51,6 +52,57 @@ Cygwin build problems:
binaries. I found 0.14.0 here: http://dietpc.org/windows/qemu/, or
2. Try building QEMU with MingGW
+Toolchains
+^^^^^^^^^^
+
+ Two target environments are supported: (1) Linux and (2) Cygwin under Windows.
+ Any GCC toolchain that can produce i486 ELF binaries should work. On Linux,
+ you can probably use the installed system gcc. But that will not work with
+ Cygwin. Why? Because the Cygwin gcc (and probably the MinGW gcc as well) do
+ not produce ELF final binaries but, rather, DOS MZ executables (i.e., .exe
+ files). Those cannot be used with QEMU.
+
+ The file */setenv.sh should be modified to point to the correct path to the
+ GCC toolchain (if different from the default in your PATH variable).
+
+ Cygwin Buildroot Toolchain
+
+ With Cygwin the solution is to build an i486 cross-development toolchain to
+ generate the i486 ELF files needed by QEMU. The NuttX buildroot package will
+ create such a toolchain.
+
+ NOTE: As of this writing, none of the released buildroot packages support the
+ i486 build. This is only available in SVN or in any any 1.10 or later buildroot
+ release.
+
+ Buildroot Instructions
+
+ 1. You must have already configured Nuttx in <some-dir>/nuttx.
+
+ cd tools
+ ./configure.sh qemu-i486/<sub-dir>
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack the buildroot tarball. The resulting directory may
+ have versioning information on it like buildroot-x.y.z. If so,
+ rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/i486-defconfig-4.3.3 .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ 8. Edit setenv.h, if necessary, so that the PATH variable includes
+ the path to the newly built binaries.
+
+ See the file configs/README.txt in the buildroot source tree. That has more
+ detailed PLUS some special instructions that you will need to follow if you
+ run into problems building the toolchain for Cygwin under Windows.
+
Configurations
^^^^^^^^^^^^^^
diff --git a/nuttx/configs/qemu-i486/ostest/ld.script b/nuttx/configs/qemu-i486/ostest/ld.script
index cf4e40cb0..612160e41 100755
--- a/nuttx/configs/qemu-i486/ostest/ld.script
+++ b/nuttx/configs/qemu-i486/ostest/ld.script
@@ -33,6 +33,7 @@
*
****************************************************************************/
+OUTPUT_ARCH(elf_i386)
ENTRY(__start)
SECTIONS
{