Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge GDB patches from go2sh/tricore-binutils-gdb, enable gdb in build script #3

Merged
merged 11 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 4 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

- name: Install dependencies
run: |
sudo ./scripts/install-gcc-deps
sudo ./scripts/install-apt-dependencies

- name: Build Linux
run: |
Expand Down Expand Up @@ -51,8 +51,10 @@ jobs:
- name: Package
run: |
cd /opt/gcc/linux
rm -rf deps
zip -r9 ../gcc-linux.zip .
cd /opt/gcc/win32
rm -rf deps
zip -r9 ../gcc-win32.zip .

- name: Upload artifacts
Expand All @@ -74,7 +76,7 @@ jobs:

- name: Install dependencies
run: |
sudo ./scripts/install-qemu-deps
sudo ./scripts/install-apt-dependencies

- name: Build Linux
run: |
Expand Down
80 changes: 73 additions & 7 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ BINUTILS_SRCDIR := @with_binutils_src@
NEWLIB_SRCDIR := @with_newlib_src@
GCC_SRCDIR := @with_gcc_src@
QEMU_SRCDIR := $(srcdir)/qemu
GMP_SRCDIR := $(srcdir)/gmp-6.1.0
MPFR_SRCDIR := $(srcdir)/mpfr-3.1.6
MPC_SRCDIR := $(srcdir)/mpc-1.0.3

CONFIGURE_HOST = @configure_host@
QEMU_CONFIGURE_HOST = @qemu_configure_host@
Expand Down Expand Up @@ -42,8 +45,47 @@ clean-qemu:
clean:
rm -rf build-* stamps

stamps/install-deps: $(GCC_SRCDIR)
if test -f $</contrib/download_prerequisites; then cd $< && ./contrib/download_prerequisites; fi
stamps/build-gmp: $(GMP_SRCDIR)
rm -rf $@ $(notdir $@)
mkdir $(notdir $@)
cd $(notdir $@) && $</configure \
--prefix=$(INSTALL_DIR)/deps \
$(CONFIGURE_HOST) \
--disable-assembly \
--enable-static \
--disable-shared
$(MAKE) -C $(notdir $@)
$(MAKE) -C $(notdir $@) install
mkdir -p $(dir $@) && touch $@

stamps/build-mpfr: $(MPFR_SRCDIR) stamps/build-gmp
rm -rf $@ $(notdir $@)
mkdir $(notdir $@)
cd $(notdir $@) && $</configure \
--prefix=$(INSTALL_DIR)/deps \
$(CONFIGURE_HOST) \
--with-gmp-include=$(INSTALL_DIR)/deps/include \
--with-gmp-lib=$(INSTALL_DIR)/deps/lib \
--enable-static \
--disable-shared
$(MAKE) -C $(notdir $@)
$(MAKE) -C $(notdir $@) install
mkdir -p $(dir $@) && touch $@

stamps/build-mpc: $(MPC_SRCDIR) stamps/build-gmp stamps/build-mpfr
rm -rf $@ $(notdir $@)
mkdir $(notdir $@)
cd $(notdir $@) && $</configure \
--prefix=$(INSTALL_DIR)/deps \
$(CONFIGURE_HOST) \
--with-gmp-include=$(INSTALL_DIR)/deps/include \
--with-gmp-lib=$(INSTALL_DIR)/deps/lib \
--with-mpfr-include=$(INSTALL_DIR)/deps/include \
--with-mpfr-lib=$(INSTALL_DIR)/deps/lib \
--enable-static \
--disable-shared
$(MAKE) -C $(notdir $@)
$(MAKE) -C $(notdir $@) install
mkdir -p $(dir $@) && touch $@

stamps/build-binutils-mcs: $(BINUTILS_SRCDIR)
Expand Down Expand Up @@ -77,7 +119,7 @@ stamps/build-binutils-mcs: $(BINUTILS_SRCDIR)
$(MAKE) -C $(notdir $@) install
mkdir -p $(dir $@) && touch $@

stamps/build-binutils-tc: $(BINUTILS_SRCDIR) stamps/build-binutils-mcs
stamps/build-binutils-tc: $(BINUTILS_SRCDIR) stamps/build-binutils-mcs stamps/build-gmp stamps/build-mpfr stamps/build-mpc
rm -rf $@ $(notdir $@)
mkdir $(notdir $@)
cd $(notdir $@) && $</configure \
Expand All @@ -87,6 +129,12 @@ stamps/build-binutils-tc: $(BINUTILS_SRCDIR) stamps/build-binutils-mcs
--prefix=$(INSTALL_DIR) \
$(CONFIGURE_HOST) \
--disable-threads \
--with-gmp-include=$(INSTALL_DIR)/deps/include \
--with-gmp-lib=$(INSTALL_DIR)/deps/lib \
--with-mpc-include=$(INSTALL_DIR)/deps/include \
--with-mpc-lib=$(INSTALL_DIR)/deps/lib \
--with-mpfr-include=$(INSTALL_DIR)/deps/include \
--with-mpfr-lib=$(INSTALL_DIR)/deps/lib \
--enable-nls \
--disable-itcl \
--disable-tk \
Expand All @@ -97,7 +145,7 @@ stamps/build-binutils-tc: $(BINUTILS_SRCDIR) stamps/build-binutils-mcs
--disable-rda \
--disable-sid \
--disable-sim \
--disable-gdb \
--enable-gdb \
--disable-newlib \
--disable-libgloss \
--disable-test-suite \
Expand All @@ -109,7 +157,7 @@ stamps/build-binutils-tc: $(BINUTILS_SRCDIR) stamps/build-binutils-mcs
$(MAKE) -C $(notdir $@) install
mkdir -p $(dir $@) && touch $@

stamps/build-gcc-stage1: $(GCC_SRCDIR) stamps/install-deps stamps/build-binutils-tc
stamps/build-gcc-stage1: $(GCC_SRCDIR) stamps/build-binutils-tc stamps/build-gmp stamps/build-mpfr stamps/build-mpc
rm -rf $@ $(notdir $@)
mkdir $(notdir $@)
cd $(notdir $@) && $</configure \
Expand All @@ -130,6 +178,12 @@ stamps/build-gcc-stage1: $(GCC_SRCDIR) stamps/install-deps stamps/build-binutils
--disable-shared \
--with-headers=yes \
--with-newlib=yes \
--with-gmp-include=$(INSTALL_DIR)/deps/include \
--with-gmp-lib=$(INSTALL_DIR)/deps/lib \
--with-mpc-include=$(INSTALL_DIR)/deps/include \
--with-mpc-lib=$(INSTALL_DIR)/deps/lib \
--with-mpfr-include=$(INSTALL_DIR)/deps/include \
--with-mpfr-lib=$(INSTALL_DIR)/deps/lib \
--enable-mingw-wildcard \
--disable-libstdcxx-pch \
--enable-newlib-elix-level=3 \
Expand Down Expand Up @@ -166,7 +220,7 @@ stamps/build-newlib: $(NEWLIB_SRCDIR) stamps/build-gcc-stage1
$(MAKE) -C $(notdir $@) install
mkdir -p $(dir $@) && touch $@

stamps/build-gcc-stage2: $(GCC_SRCDIR) stamps/install-deps stamps/build-newlib
stamps/build-gcc-stage2: $(GCC_SRCDIR) stamps/build-newlib
rm -rf $@ $(notdir $@)
mkdir $(notdir $@)
cd $(notdir $@) && PATH=$(INSTALL_DIR)/bin:$$PATH $</configure \
Expand All @@ -177,6 +231,12 @@ stamps/build-gcc-stage2: $(GCC_SRCDIR) stamps/install-deps stamps/build-newlib
--disable-lib64 \
--prefix=$(INSTALL_DIR) \
$(CONFIGURE_HOST) \
--with-gmp-include=$(INSTALL_DIR)/deps/include \
--with-gmp-lib=$(INSTALL_DIR)/deps/lib \
--with-mpc-include=$(INSTALL_DIR)/deps/include \
--with-mpc-lib=$(INSTALL_DIR)/deps/lib \
--with-mpfr-include=$(INSTALL_DIR)/deps/include \
--with-mpfr-lib=$(INSTALL_DIR)/deps/lib \
--enable-languages=c,c++ \
--enable-libstdcxx-debug-flags='-gdwarf-3 -g -O0 -D_GLIBCXX_ASSERTIONS' \
--enable-c99 \
Expand All @@ -201,7 +261,7 @@ stamps/build-gcc-stage2: $(GCC_SRCDIR) stamps/install-deps stamps/build-newlib
$(MAKE) -C $(notdir $@) install
mkdir -p $(dir $@) && touch $@

stamps/build-gcc-stage2-only: $(GCC_SRCDIR) stamps/install-deps
stamps/build-gcc-stage2-only: $(GCC_SRCDIR)
rm -rf $@ $(notdir $@)
mkdir $(notdir $@)
cd $(notdir $@) && $</configure \
Expand All @@ -212,6 +272,12 @@ stamps/build-gcc-stage2-only: $(GCC_SRCDIR) stamps/install-deps
--disable-lib64 \
--prefix=$(INSTALL_DIR) \
$(CONFIGURE_HOST) \
--with-gmp-include=$(INSTALL_DIR)/deps/include \
--with-gmp-lib=$(INSTALL_DIR)/deps/lib \
--with-mpc-include=$(INSTALL_DIR)/deps/include \
--with-mpc-lib=$(INSTALL_DIR)/deps/lib \
--with-mpfr-include=$(INSTALL_DIR)/deps/include \
--with-mpfr-lib=$(INSTALL_DIR)/deps/lib \
--enable-languages=c,c++ \
--enable-libstdcxx-debug-flags='-gdwarf-3 -g -O0 -D_GLIBCXX_ASSERTIONS' \
--enable-c99 \
Expand Down
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@ TriCore architectures 1.3, 1.3.1, 1.6, 1.6.1, 1.6.2 and 1.8.
Prebuilt packages are available in the
[release section](https://github.com/NoMore201/tricore-gcc-toolchain/releases).

> Note: Some feature in this fork are still waiting PR approval from upstream
> repository [EEESlab/tricore-gcc-toolchain-11.3.0](https://github.com/EEESlab/tricore-gcc-toolchain-11.3.0)
Documentation is published through Github Pages in [Docs](https://nomore201.github.io/tricore-gcc-toolchain/)

> This repository is a downstream of
> [EEESlab/tricore-gcc-toolchain-11.3.0](https://github.com/EEESlab/tricore-gcc-toolchain-11.3.0)
> that aims to be a playground for new features and improvements with a faster
> developement process and automated release management. All the meaningful
> changes will be contributed back to upstream repository

## Building (cross-compile)

Expand All @@ -25,7 +30,7 @@ work on other Linux distributions and also MSYS2 Windows environment.
Clone the repository:

```sh
git clone --recursive git@github.com:EEESlab/tricore-gcc-toolchain-11.3.0.git
git clone --recursive https://github.com/NoMore201/tricore-gcc-toolchain.git
```

Install build dependencies:
Expand Down
13 changes: 13 additions & 0 deletions docs/qemu-debug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Debugging with QEMU

> This page is work in progress

This toolchain provides `qemu-system-tricore` and `tricore-elf-gdb` executable
that can be used to run and debug your code in a simulated environment.

> [!IMPORTANT]
> QEMU support for Tricore architecture is incomplete. It provides only basic
> CPU instruction decode (no interrupts or multi-core) and no peripheral is
> available. Only core architecture from tc1.3 up to tc1.6.2 is supported

TODO..
43 changes: 43 additions & 0 deletions gmp-6.1.0/.gdbinit
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright 1999 Free Software Foundation, Inc.
#
# This file is part of the GNU MP Library.
#
# The GNU MP Library is free software; you can redistribute it and/or modify
# it under the terms of either:
#
# * the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 3 of the License, or (at your
# option) any later version.
#
# or
#
# * the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any
# later version.
#
# or both in parallel, as here.
#
# The GNU MP Library is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received copies of the GNU General Public License and the
# GNU Lesser General Public License along with the GNU MP Library. If not,
# see https://www.gnu.org/licenses/.


define pz
set __gmpz_dump ($)
end

define pq
set __gmpz_dump ($->_mp_num)
echo /
set __gmpz_dump ($->_mp_den)
end

define pf
set __gmpf_dump ($)
end

100 changes: 100 additions & 0 deletions gmp-6.1.0/AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
Authors of GNU MP (in chronological order of initial contribution)

Torbjörn Granlund Main author

John Amanatides Original version of mpz/pprime_p.c

Paul Zimmermann mpn/generic/mul_fft.c, now defunct dc_divrem_n.c,
rootrem.c, old mpz/powm.c, old toom3 code.

Ken Weber Now defunct mpn/generic/bdivmod.c, old mpn/generic/gcd.c

Bennet Yee Previous versions of mpz/jacobi.c mpz/legendre.c

Andreas Schwab mpn/m68k/lshift.asm, mpn/m68k/rshift.asm

Robert Harley Old mpn/generic/mul_n.c, previous versions of files in
mpn/arm

Linus Nordberg Random number framework, original autoconfery

Kent Boortz MacOS 9 port, now defunct.

Kevin Ryde Most x86 assembly, new autoconfery, and countless other
things (please see the GMP manual for complete list)

Gerardo Ballabio gmpxx.h and C++ istream input

Pedro Gimeno Mersenne Twister random generator, other random number
revisions

Jason Moxham Previous versions of mpz/fac_ui.c and gen-fac_ui.c

Niels Möller gen-jacobitab.c,
mpn/generic/hgcd2.c, hgcd.c, hgcd_step.c,
hgcd_appr.c, hgcd_matrix.c, hgcd_reduce.c,
gcd.c, gcdext.c, matrix22_mul.c,
gcdext_1.c, gcd_subdiv_step.c, gcd_lehmer.c,
gcdext_subdiv_step.c, gcdext_lehmer.c,
jacobi_2.c, jacbase.c, hgcd_jacobi.c, hgcd2_jacobi.c
matrix22_mul1_inverse_vector.c,
toom_interpolate_7pts, mulmod_bnm1.c, dcpi1_bdiv_qr.c,
dcpi1_bdiv_q.c, sbpi1_bdiv_qr.c, sbpi1_bdiv_q.c,
sec_invert.c,
toom_eval_dgr3_pm1.c, toom_eval_dgr3_pm2.c,
toom_eval_pm1.c, toom_eval_pm2.c, toom_eval_pm2exp.c,
divexact.c, mod_1_1.c, div_qr_2.c,
div_qr_2n_pi1.c, div_qr_2u_pi1.c, broot.c,
brootinv.c,
mpn/x86/k7/invert_limb.asm, mod_1_1.asm,
mpn/x86_64/invert_limb.asm,
invert_limb_table.asm, mod_1_1.asm,
div_qr_2n_pi1.asm, div_qr_2u_pi1.asm,
mpn/x86_64/core2/aorsmul_1.asm,
mpz/nextprime.c, divexact.c, gcd.c, gcdext.c,
jacobi.c, combit.c, mini-gmp/mini-gmp.c.

Marco Bodrato mpn/generic/toom44_mul.c, toom4_sqr.c, toom53_mul.c,
toom62_mul.c, toom43_mul.c, toom52_mul.c, toom54_mul.c,
toom_interpolate_6pts.c, toom_couple_handling.c,
toom63_mul.c, toom_interpolate_8pts.c,
toom6h_mul.c, toom6_sqr.c, toom_interpolate_12pts.c,
toom8h_mul.c, toom8_sqr.c, toom_interpolate_16pts.c,
mulmod_bnm1.c, sqrmod_bnm1.c, nussbaumer_mul.c,
toom_eval_pm2.c, toom_eval_pm2rexp.c,
mullo_n.c, sqrlo.c, invert.c, invertappr.c;
mpz/fac_ui.c, 2fac_ui.c, mfac_uiui.c, oddfac_1.c,
primorial_ui.c, prodlimbs.c, goetgheluck_bin_uiui.c.

David Harvey mpn/generic/add_err1_n.c, add_err2_n.c,
add_err3_n.c, sub_err1_n.c, sub_err2_n.c,
sub_err3_n.c, mulmid_basecase.c, mulmid_n.c,
toom42_mulmid.c,
mpn/x86_64/mul_basecase.asm, aors_err1_n.asm,
aors_err2_n.asm, aors_err3_n.asm,
mulmid_basecase.asm,
mpn/x86_64/core2/aors_err1_n.asm.

Martin Boij mpn/generic/perfpow.c

Marc Glisse gmpxx.h improvements

David Miller mpn/sparc32/ultrasparct1/{addmul_1,mul_1,submul_1}.asm
mpn/sparc64/ultrasparct3/{mul_1,addmul_1,submul_1}.asm
mpn/sparc64/ultrasparct3/{add_n,sub_n}.asm
mpn/sparc64/ultrasparct3/{popcount,hamdist}.asm
mpn/sparc64/ultrasparct3/cnd_aors_n.asm
mpn/sparc64/{rshift,lshift,lshiftc}.asm
mpn/sparc64/tabselect.asm

Mark Sofroniou mpn/generic/mul_fft.c type cleanup.

Ulrich Weigand Changes to support powerpc64le:
configure.ac, mpn/powerpc64/{elf,aix,darwin}.m4,
mpn/powerpc32/{darwin,elf}.m4,
mpn/powerpc64/mode64/{dive_1,divrem_1,divrem_2}.asm,
mpn/powerpc64/mode64/{gcd_1,invert_limb,mode1o}.asm,
mpn/powerpc64/mode64/{mod_1_1,mod_1_4}.asm,
mpn/powerpc64/mode64/p7/gcd_1.asm,
mpn/powerpc64/p6/{lshift,lshiftc,rshift}.asm,
mpn/powerpc64/vmx/popcount.asm.
Loading