On 01/07/2011 05:56 PM, Peter Maydell wrote:
Or you can just test "by hand":
Got it. For anyone wondering into this thread, if you use ubuntu/linaro toolchains to compile the example below, you need a -marm flag for the compiler or you'll get a weird error on swi...
Looks good, I'll add these the next batch of patches.
#include<stdio.h> struct datablock { char *string; int buflen; }; char buf[20]; int main(int argc, char **argv) { int r, i; struct datablock datablock; printf("semihosting-cmd test: argc %d\n", argc); for (i = 0; i< argc; i++) { printf("argv[%d]: %s\n", i, argv[i]); } datablock.string = buf; datablock.buflen = sizeof(buf); { register int r0 asm ("r0") = 0x15; register void * r1 asm ("r1") =&datablock; register int result asm ("r0"); __asm__ __volatile__ ( "svc 0x123456" : "=r" (result) : "r" (r0), "r" (r1) : "cc", "memory"); r = result; } printf("semihosting returned status %d\n", r); if (r == 0) { printf("and string '%s'\n", datablock.string); } return 0; } -- PMM