Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
ns32ktoolchain [2020/06/20 00:46] – [GDB] adminns32ktoolchain [2020/07/10 00:19] – [GDB] admin
Line 63: Line 63:
 Not-so-old (i.e. > ''binutils-2.20'' (correct me)) may be successfully compiled under **GCC 4**. Not-so-old (i.e. > ''binutils-2.20'' (correct me)) may be successfully compiled under **GCC 4**.
  
-Source download: http://ftp.gnu.org/gnu/binutils/binutils-2.27.tar.bz2+Source download: http://ftp.gnu.org/gnu/binutils/binutils-2.27.tar.gz
  
 If you have to build early ''binutils-2.13'', you have to use **GCC 3**, but this version deprecated and disappeared from the most of modern systems. You have to find or build a local **GCC 3** for your system (not covered by this document) or use a "compatibility" compiler pre-built for some systems. As an example, Redhat RHEL 5 and CENTOS 5 provide a "compat-gcc-34" package, MinGW provides "mingw32-gcc-v3-core" (correct me). FreeBSD 6 uses GCC 3 as system compiler and FreeBSD 7 provides gcc-3.4 (lang/gcc34) in the port collection. The latest Cygwin with system GCC 3 compiler was a Gygwin-1.5.25 and it may be obtained from the [[http://www.crouchingtigerhiddenfruitbat.org/Cygwin/timemachine.html|Cygwin Time Machine]] (see a cygwin-legacy). If you have to build early ''binutils-2.13'', you have to use **GCC 3**, but this version deprecated and disappeared from the most of modern systems. You have to find or build a local **GCC 3** for your system (not covered by this document) or use a "compatibility" compiler pre-built for some systems. As an example, Redhat RHEL 5 and CENTOS 5 provide a "compat-gcc-34" package, MinGW provides "mingw32-gcc-v3-core" (correct me). FreeBSD 6 uses GCC 3 as system compiler and FreeBSD 7 provides gcc-3.4 (lang/gcc34) in the port collection. The latest Cygwin with system GCC 3 compiler was a Gygwin-1.5.25 and it may be obtained from the [[http://www.crouchingtigerhiddenfruitbat.org/Cygwin/timemachine.html|Cygwin Time Machine]] (see a cygwin-legacy).
Line 75: Line 75:
 (Example for Cygwin-1.5.25 with full build tools installed, running under Windows XP inside the VirtualBox) (Example for Cygwin-1.5.25 with full build tools installed, running under Windows XP inside the VirtualBox)
 <code> <code>
-tar jxf binutils-2.27.tar.bz2 +tar zxf binutils-2.27.tar.gz 
-cd binutils-2.24+cd binutils-2.27
 ./configure --prefix=/opt/cross --target=ns32k-pc532-netbsd --disable-nls ./configure --prefix=/opt/cross --target=ns32k-pc532-netbsd --disable-nls
 make make
Line 91: Line 91:
 ==== GNU as ==== ==== GNU as ====
  
-GNU ''as'' (gas) has a slightly different syntax than the so-called TDS (Tiny Development System) and [[http://wiki.sensi.org/download/ns32k/as_refman.pdf|GENIX assembler]]. Be careful when porting your ns32k assembler files to gas. As an example, all hex constants should be written as 0x123456 not x'123456. Immediate values should not be prepended with ''$''. To access a variable as PC-relative use ''movd var(pc),r0'' istruction. Many assembler directives are different too. Consult a documentation :+GNU ''as'' (gas) has a slightly different syntax than so-called TDS (Tiny Development System) assembler and [[http://wiki.sensi.org/download/ns32k/as_refman.pdf|GENIX assembler]]. Be careful when porting your ns32k assembler files to gas. As an example, all hex constants should be written as 0x123456 not x'123456. Immediate values should not be prepended with ''$''. To access a variable as PC-relative use ''movd var(pc),r0'' istruction template. Many assembler directives are different too. Consult a documentation :
  
 https://sourceware.org/binutils/docs/as/index.html https://sourceware.org/binutils/docs/as/index.html
  
-On the other hand, GNU ''as'' is just a "backend" for the GCC compiler and rarely used standalone.+On the other hand, GNU ''as'' is just a "backend" for the GCC compiler and rarely used standalone. An examples of the GNU ''as'' usage may be found in the NetBSD ns32k for the pc532 port: in the bootloader, kernel ans some libraries call optimized for speed.
  
 GCC compiler has an interesting option ''-S'' to produce an assembly ''.s'' file from the ''.c''. Resulting files are fully compatible with ''gas''. Also GCC may pass an options to ''as'' with ''-Wa'' option. To produce an assembler listing with source code lines: GCC compiler has an interesting option ''-S'' to produce an assembly ''.s'' file from the ''.c''. Resulting files are fully compatible with ''gas''. Also GCC may pass an options to ''as'' with ''-Wa'' option. To produce an assembler listing with source code lines:
Line 109: Line 109:
 You have to extract NetBSD "include" directory before GCC building. You have to extract NetBSD "include" directory before GCC building.
  
-Download:\\ +Download NetBSD 1.5.3 includes and libraries:\\ 
-ftp://ftp.netbsd.org/pub/NetBSD-archive/NetBSD-1.5.3/pc532/binary/sets/base.tgz\\ +https://archive.netbsd.org/pub/NetBSD-archive/NetBSD-1.5.3/pc532/binary/sets/base.tgz\\ 
-ftp://ftp.netbsd.org/pub/NetBSD-archive/NetBSD-1.5.3/pc532/binary/sets/comp.tgz\\+https://archive.netbsd.org/pub/NetBSD-archive/NetBSD-1.5.3/pc532/binary/sets/comp.tgz\\
 <code> <code>
 mkdir /tmp/NetBSD-1.5.3 mkdir /tmp/NetBSD-1.5.3
Line 136: Line 136:
 Further reading: http://wiki.osdev.org/GCC_Cross-Compiler Further reading: http://wiki.osdev.org/GCC_Cross-Compiler
  
 +Precompiled binaries: http://wiki.sensi.org/download/ns32k/ns32k-netbsd-cross-i686-linux.tgz \\
 +Includes binutils-2.27, gcc-3.4.6, NetBSD-1.5.3 headers. Prefix: ''/opt/cross'' \\
 +Binaris are compiled with GCC-3 for the i686 arhitecture and tested on the modern 64-bit Centos 7 (RHEL 7) \\
 +Since these are 32-bit -i686 binaries, install a ''glibc.i686'' package \\
 +Just copy this TAR file to the root ''/''  and extract it with ''tar zxf'' \\
 +Add an ''export PATH=/opt/cross/bin:$PATH''
  
 ==== Standalone binaries ==== ==== Standalone binaries ====
Line 171: Line 177:
 The option ''-ffreestanding'' disables "hosted" environment where ''main()'' is the first "user" function in the programm called by  **crt0.o**. The option ''-ffreestanding'' disables "hosted" environment where ''main()'' is the first "user" function in the programm called by  **crt0.o**.
  
-NOTE! GCC sometimes emits "built-in" functions like ''__udivdi3'' and requres "compiler runtime" library [[https://gcc.gnu.org/onlinedocs/gccint/Libgcc.html|libgcc]] for target processor.+NOTE! GCC sometimes emits "built-in" functions like ''__udivdi3'' and requres "compiler runtime" library [[https://gcc.gnu.org/onlinedocs/gccint/Libgcc.html|libgcc]] for target processor. Smplify arithmetic expressions.
  
 Another useful GCC option is ''-fomit-frame-pointer'' - it disables usage of the ''fp'' register (frame pointer) and use ''sp''-related (stack pointer) addressing for local variables like "old" compilers. GCC also supports ''-fpic'' option to compile PIC (Position-Independent Code) with ''sb''-related addressing ''0(_glblvar(sb))''. Another useful GCC option is ''-fomit-frame-pointer'' - it disables usage of the ''fp'' register (frame pointer) and use ''sp''-related (stack pointer) addressing for local variables like "old" compilers. GCC also supports ''-fpic'' option to compile PIC (Position-Independent Code) with ''sb''-related addressing ''0(_glblvar(sb))''.
Line 255: Line 261:
 ...Work in progress ...Work in progress
  
-ftp://sourceware.org/pub/gdb/old-releases/+Sources: ftp://sourceware.org/pub/gdb/old-releases/ 
  
 GDB 2.5.1: no ns32k support. parsing ns32k COFF coffread.c \\ GDB 2.5.1: no ns32k support. parsing ns32k COFF coffread.c \\
Line 263: Line 270:
 ... \\ ... \\
 GDB 4.0.1: uses [[wp>Binary_File_Descriptor_library|BFD]] \\ GDB 4.0.1: uses [[wp>Binary_File_Descriptor_library|BFD]] \\
 +...\\
 +NetBSD 1.5.3 uses GDB 4.17\\
 ... \\ ... \\
 GDB 6.4 dropped support for ns32k-*-* GDB 6.4 dropped support for ns32k-*-*
Navigation