Git Product home page Git Product logo

tricore_gcc940_linux_bins's People

Contributors

volumit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

tricore_gcc940_linux_bins's Issues

Qemu does not continue after debug in semihosting with trace files and single stepping

#1 (comment)
/home/dummy/qemu_tricore_6250/bin/qemu-system-tricore -display none -M tricore_tsim162 -semihosting -s -d in_asm,nochain -D ./qemutrace.txt -kernel ./test_read_file.elf

IN: _open_r
0x80001a32: 0f82 mov %d15,0
0x80001a34: 0820 sub.a %sp,8
0x80001a36: 4c40 mov.aa %a12,%a4
0x80001a38: fd000091 movh.a %a15,53248
0x80001a3c: a574 st.w [%sp],%d5
0x80001a3e: 5440 mov.aa %a4,%a5
0x80001a40: 5098ff59 st.w [%a15]2392 <0xd0000958>,%d15
0x80001a44: 2e01006d call 0x80007646


IN: open
0x80007646: 1c82 mov %d12,1
0x80007648: 0009001d j 0x8000765a


IN: ___virtio_hnd
0x8000765a: a000 debug

Feature enhancement requested for parameter passing

See also: #1 (comment)
``#include <stdio.h>

int main(int argc, char *argv[])
{
printf("tcargc %d\n",argc);
for (int i=0; i<argc; i+=1)
printf("tricore arg[%d]=%s\n",i,argv[i]);
return 0;
}
``
Delivers if called with the updates.
qemu-system-tricore -display none -M tricore_tsim162 -semihosting --semihosting-config enable=on,arg=123000,arg=123001,arg=123002,arg=123003,arg=123004,arg=123005 -kernel ./test_main_args.elf
tcargc 7
tricore arg[0]=./test_main_args.elf
tricore arg[1]=123000
tricore arg[2]=123001
tricore arg[3]=123002
tricore arg[4]=123003
tricore arg[5]=123004
tricore arg[6]=123005

There is a bug in qemu mainstream. What ever you do argv[0] should contain the file targeted for execution.
Fixed it in config.c.
The other stuff is in tricore and is not endangering the mainstream.
How does it work!
Find on which address main is, if main is reached, modify the stackpointer and pass the parameters in stack.
If main returns adapt sp.
main still should be reentrant capable
The parameter passing is only working if qemu is in semihosting, and no gdb is connected.

tricore gdb crash when fopen is used in source

Environment:

uname -a
Linux ubuntu 5.15.0-25-generic #25-Ubuntu SMP Wed Mar 30 15:54:22 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Reproduce steps:

  1. Install tricore gcc:
sudo apt install 7zip
git clone https://github.com/volumit/tricore_gcc940_linux_bins.git
cd tricore_gcc940_linux_bins
7z x tricore_940_linux.zip.001
chmod -R 777 tricore_940_linux
echo "export TRICORE_GCC_PATH=$(pwd)/tricore_940_linux/bin" >> ~/.profile
  1. Build tricore qemu from source:
git clone https://github.com/volumit/qemu.git
cd qemu
git submodule update --init --progress
mkdir build
cd build
CC=gcc-9 CFLAGS=-Wno-error ../configure
make -j $(nproc)
echo "export TRICORE_QEMU_PATH=$(pwd)/build" >> ~/.profile
  1. Build tricore gdb
git clone https://github.com/volumit/gdb-tricore.git
cd gdb-tricore
CC=gcc-9 CFLAGS=-Wno-error ./configure --target=tricore-unknown-elf x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu
make -j $(nproc)
echo "export TRICORE_GDB_PATH=$(pwd)/gdb" >> ~/.profile
  1. Build follow code with tricore gcc:
$TRICORE_GCC_PATH/tricore-elf-gcc -g -Wall -o build/c_demo.elf c_demo.c
#include <stdio.h>

int main(){

    FILE* f = fopen("", "rb");

    return f==NULL;
}
  1. Launch tricore qemu:
$TRICORE_QEMU_PATH/qemu-system-tricore -display none -M tricore_tsim161 -semihosting -S -s -kernel build/c_demo.elf
  1. Connect tricore gdb to qemu:
$TRICORE_GDB_PATH/gdb -data-directory $TRICORE_GDB_PATH/data-directory ./build/c_demo.elf
  1. Tricore gdb abort when continue debug:
Reading symbols from ./build/c_demo.elf...
(gdb) target remote :1234
Remote debugging using :1234
0x80000000 in _start ()
(gdb) run
The "remote" target does not support "run".  Try "help target" or "continue".
(gdb) continue
Continuing.
Aborted (core dumped)

C99 API related macros, such as _GLIBCXX_USE_C99_STDLIB and _GLIBCXX_USE_C99_STDIO are not defined by default. It lead to some C99 carry over API or some related C++ API can't work

#1 (comment)

confirmed, but actually it is unclear if it is a gcc fork issue at all or a tricore specific.
Was able to reproduce it with gcc tricore.
echo | g++ -dM -E -x c++ -
for g++ defines
echo | gcc -dM -E -
for gcc defines
not reproducable with older gcc
g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.5.0-3ubuntu118.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1
18.04)

follow up required.

Consistency issues in gdb for target xml

#1
including wrong ioread
(gdb) target remote:1234
Remote debugging using :1234
warning: while parsing target description (at line 1): Target description specified unknown architecture "TriCore:V1_6_2"
warning: Could not load XML target description; ignoring
0x80000020 in _start ()
(gdb) c
Continuing.
file content is:
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
[Inferior 1 (process 1) exited normally]
(gdb) quit

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.