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

Feature enhancement requested for parameter passing #10

Open
volumit opened this issue Jun 28, 2022 · 0 comments
Open

Feature enhancement requested for parameter passing #10

volumit opened this issue Jun 28, 2022 · 0 comments

Comments

@volumit
Copy link
Owner

volumit commented Jun 28, 2022

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.

volumit added a commit to volumit/qemu that referenced this issue Jun 28, 2022
changes to enable parameter passing via qemu commandline see volumit/tricore_gcc940_linux_bins#10 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant