volumit / package_940

GCC 9.4.0/Binutils 2.20/Newlib Source code for Tricore Aurix
GNU General Public License v3.0
21 stars 13 forks source link

[Question] How to run a helloworld application in qemu after build by GCC #1

Closed Changqing-JING closed 2 years ago

Changqing-JING commented 2 years ago

I have created a helloworld application and build by gcc

`

include

int main(){

printf("hello\n");

return 0;

} `

./tricore_940_linux/bin/tricore-elf-gcc -o hello.bin hello.c The tricore qemu doesn't provide a user mode emulator, how to run the hello.bin with qemu-system-tricore? Where can I get a bootloader/kernel to load the hello.bin?

volumit commented 2 years ago

See below! It loads directly the corresponding *.elf file. Default compilation is for TC1.6.1, aka devices of the TC3xx family. -semihosting enable the output of printf etc. towards stdout.

tricore-elf-gcc -o main.elf main.c qemu-system-tricore -display none -M tricore_tsim161 -semihosting -kernel ./main.elf HELLO WORLD!

volumit commented 2 years ago

If you want to go for real silicon, linker files have to be adapted. QEMU and default linker scripts are adapted for hugh code and data memory to allow the proper execution of the gcc testsuite (some of the test are not fitting in a real device).