volumit / tricore_gcc940_linux_bins Goto Github PK
View Code? Open in Web Editor NEWGCC 9.4.0. Tricore / AURIX Prebuild Binaries for Ubuntu
License: GNU General Public License v3.0
GCC 9.4.0. Tricore / AURIX Prebuild Binaries for Ubuntu
License: GNU General Public License v3.0
potential issue with ftell and fseek
avoid issues of #1
even if the difference between the tricore implemtations are mininmal, an additional robustness check is needed to ensure compatiblity and no pitfalls like in #1 wil happen.
#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
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.
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:
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
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
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
$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;
}
$TRICORE_QEMU_PATH/qemu-system-tricore -display none -M tricore_tsim161 -semihosting -S -s -kernel build/c_demo.elf
$TRICORE_GDB_PATH/gdb -data-directory $TRICORE_GDB_PATH/data-directory ./build/c_demo.elf
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)
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-gnu18.04)
Thread model: posix
gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1
follow up required.
#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
/home/dummy/tricore_940_linux/bin/tricore-elf-gcc -Xlinker -Map=output.map -o test_read_file.elf test_read_file.c
see output.map
In addition qemu needs an extension that it fails for illegal mem access and startup addr has to unified.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.