Message ID | 20180501142222.19154-3-kbastian@mail.uni-paderborn.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Bastian Koppelmann <kbastian@mail.uni-paderborn.de> writes: > this includes the Makefile and linker script to build all the tests. > > Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de> > --- > tests/tcg/tricore/Makefile | 30 +++++++++++++++++++++++ > tests/tcg/tricore/link.ld | 60 ++++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 90 insertions(+) > create mode 100644 tests/tcg/tricore/Makefile > create mode 100644 tests/tcg/tricore/link.ld > > diff --git a/tests/tcg/tricore/Makefile b/tests/tcg/tricore/Makefile > new file mode 100644 > index 0000000000..8c168d1062 > --- /dev/null > +++ b/tests/tcg/tricore/Makefile > @@ -0,0 +1,30 @@ > +AS := tricore-as > +LD := tricore-ld Where do these come from? Ideally we'd get these in a docker container like the rest. It would actually be easier to use tricore-gcc if it exists because at the moment my docker series only exposes a C compiler to the make system. > +HOST_CC = gcc > + > +LDFLAGS = -Tlink.ld > +ASFLAGS = > + > +SIM = ../../../tricore-softmmu/qemu-system-tricore > +SIMFLAGS = -M tricore_testboard -nographic -kernel > + > +all: build > + > +%.pS: %.S > + $(HOST_CC) -E -o $@ $< > + > +%.o: %.pS > + $(AS) $(ASFLAGS) -o $@ $< > + > +%.tst: %.o link.ld > + $(LD) $(LDFLAGS) $< -o $@ > + > +build: $(TESTCASES) > + > +check: $(addprefix run-, $(TESTCASES)) > + > +run-%.tst: %.tst > + $(SIM) $(SIMFLAGS) ./$< > + > +clean: > + $(RM) -fr $(TESTCASES) linker.ld > diff --git a/tests/tcg/tricore/link.ld b/tests/tcg/tricore/link.ld > new file mode 100644 > index 0000000000..364bcdc00a > --- /dev/null > +++ b/tests/tcg/tricore/link.ld > @@ -0,0 +1,60 @@ > +/* Default linker script, for normal executables */ > +OUTPUT_FORMAT("elf32-tricore") > +OUTPUT_ARCH(tricore) > +ENTRY(_start) > + > +/* the internal ram description */ > +MEMORY > +{ > + text_ram (rx!p): org = 0x80000000, len = 15K > + data_ram (w!xp): org = 0xd0000000, len = 130K > +} > +/* > + * Define the sizes of the user and system stacks. > + */ > +__USTACK_SIZE = DEFINED (__USTACK_SIZE) ? __USTACK_SIZE : 1K ; > +/* > + * Define the start address and the size of the context save area. > + */ > +__CSA_BEGIN = 0xd0000000 ; > +__CSA_SIZE = 8k ; > +__CSA_END = __CSA_BEGIN + __CSA_SIZE ; > + > +SECTIONS > +{ > + .text : > + { > + *(.text) > + . = ALIGN(8); > + } > text_ram > + > + .rodata : > + { > + *(.rodata) > + *(.rodata1) > + } > data_ram > + > + .data : > + { > + . = ALIGN(8) ; > + *(.data) > + *(.data.*) > + . = ALIGN(8) ; > + __USTACK = . + __USTACK_SIZE -768; > + > + } > data_ram > + /* > + * Allocate space for BSS sections. > + */ > + .bss : > + { > + BSS_BASE = . ; > + *(.bss) > + *(COMMON) > + . = ALIGN(8) ; > + } > data_ram > + /* Make sure CSA, stack and heap addresses are properly aligned. */ > + _. = ASSERT ((__CSA_BEGIN & 0x3f) == 0 , "illegal CSA start address") ; > + _. = ASSERT ((__CSA_SIZE & 0x3f) == 0 , "illegal CSA size") ; > + > +} -- Alex Bennée
Hi Bastian, On 05/01/2018 11:22 AM, Bastian Koppelmann wrote: > this includes the Makefile and linker script to build all the tests. > > Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de> > --- > tests/tcg/tricore/Makefile | 30 +++++++++++++++++++++++ > tests/tcg/tricore/link.ld | 60 ++++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 90 insertions(+) > create mode 100644 tests/tcg/tricore/Makefile > create mode 100644 tests/tcg/tricore/link.ld > > diff --git a/tests/tcg/tricore/Makefile b/tests/tcg/tricore/Makefile > new file mode 100644 > index 0000000000..8c168d1062 > --- /dev/null > +++ b/tests/tcg/tricore/Makefile > @@ -0,0 +1,30 @@ > +AS := tricore-as > +LD := tricore-ld > +HOST_CC = gcc > + > +LDFLAGS = -Tlink.ld > +ASFLAGS = > + > +SIM = ../../../tricore-softmmu/qemu-system-tricore > +SIMFLAGS = -M tricore_testboard -nographic -kernel I applied this on upstream QEMU (26bd8d98c4b32). I suppose you are doing in-tree build, since this doesn't work with out-of-tree builds (see the $SIM relative path). I then get: tricore-softmmu/qemu-system-tricore -M tricore_testboard -nographic -kests/tcg/tricore/test_muls.tst -d in_asm QEMU 2.12.50 monitor - type 'help' for more information (qemu) QEMU 2.12.50 monitor - type 'help' for more information (qemu) IN: 0x80000000: qemu-system-tricore: function cpu_get_phys_page_attrs_debug not implemented, aborting OBJD-T: 0000000000000000000000000000000000000000000000000000000000000000 OBJD-T: 000000000000000000000000 Having checked the testdevice is here: tricore-softmmu/qemu-system-tricore -M tricore_testboard -S -monitor stdio QEMU 2.12.50 monitor - type 'help' for more information (qemu) info mtree address-space: memory 0000000000000000-ffffffffffffffff (prio 0, i/o): system 0000000080000000-00000000801fffff (prio 0, ram): powerlink_ext_c.ram 00000000a1000000-00000000a13fffff (prio 0, ram): powerlink_ext_d.ram 00000000d0000000-00000000d000bfff (prio 0, ram): powerlink_int_d.ram 00000000d4000000-00000000d400bfff (prio 0, ram): powerlink_int_c.ram 00000000f0000000-00000000f0000003 (prio 0, i/o): tricore_testdevice 00000000f0050000-00000000f0053fff (prio 0, ram): powerlink_pcp_data.ram 00000000f0060000-00000000f0067fff (prio 0, ram): powerlink_pcp_text.ram Using the docker image provided here: http://lists.nongnu.org/archive/html/qemu-devel/2018-05/msg00151.html (which you can build with 'make docker-image-debian-tricore-cross', I didn't try to merge your series over Alex's tcg-testing one) This test seems correctly linked: $ docker run --rm -it -v $(pwd):$(pwd) -w $(pwd) -u $(id -u) \ qemu:debian-tricore-cross \ tricore-readelf -e tests/tcg/tricore/test_muls.tst ELF Header: Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 Class: ELF32 Data: 2's complement, little endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: EXEC (Executable file) Machine: Siemens Tricore Version: 0x1 Entry point address: 0x80000000 Start of program headers: 52 (bytes into file) Start of section headers: 32812 (bytes into file) Flags: 0x2 Size of this header: 52 (bytes) Size of program headers: 32 (bytes) Number of program headers: 2 Size of section headers: 40 (bytes) Number of section headers: 7 Section header string table index: 4 Section Headers: [Nr] Name Type Addr Off Size ES Flg Lk Inf Al [ 0] NULL 00000000 000000 000000 00 0 0 0 [ 1] .text PROGBITS 80000000 004000 0000a8 00 AX 0 0 2 [ 2] .data PROGBITS d0000000 008000 000000 00 WA 0 0 8 [ 3] .bss NOBITS d0000000 008000 000000 00 WA 0 0 8 [ 4] .shstrtab STRTAB 00000000 008000 00002c 00 0 0 1 [ 5] .symtab SYMTAB 00000000 008144 0001c0 10 6 14 4 [ 6] .strtab STRTAB 00000000 008304 0000b3 00 0 0 1 Key to Flags: W (write), A (alloc), X (execute), M (merge), S (strings) I (info), L (link order), G (group), x (unknown) O (extra OS processing required) o (OS specific), p (processor specific) Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align LOAD 0x004000 0x80000000 0x80000000 0x000a8 0x000a8 R E 0x4000 LOAD 0x008000 0xd0000000 0xd0000000 0x00000 0x00000 RW 0x4000 Section to Segment mapping: Segment Sections... 00 .text 01 > + > +all: build > + > +%.pS: %.S > + $(HOST_CC) -E -o $@ $< > + > +%.o: %.pS > + $(AS) $(ASFLAGS) -o $@ $< > + > +%.tst: %.o link.ld > + $(LD) $(LDFLAGS) $< -o $@ Those rules did not work for me: $ make test_dvstep.tst cc -c -o test_dvstep.o test_dvstep.S test_dvstep.S: Assembler messages: test_dvstep.S:6: Error: no such instruction: `mov.u %d6,lo:0xfffffe5c' test_dvstep.S:6: Error: no such instruction: `movh %d10,up:0xfffffe5c' However called in the same line it did: $ make test_muls.pS test_muls.o test_muls.tst gcc -E -o test_muls.pS test_muls.S tricore-as -o test_muls.o test_muls.pS tricore-ld -Tlink.ld test_muls.o -o test_muls.tst Regards, Phil. > + > +build: $(TESTCASES) > + > +check: $(addprefix run-, $(TESTCASES)) > + > +run-%.tst: %.tst > + $(SIM) $(SIMFLAGS) ./$< > + > +clean: > + $(RM) -fr $(TESTCASES) linker.ld > diff --git a/tests/tcg/tricore/link.ld b/tests/tcg/tricore/link.ld > new file mode 100644 > index 0000000000..364bcdc00a > --- /dev/null > +++ b/tests/tcg/tricore/link.ld > @@ -0,0 +1,60 @@ > +/* Default linker script, for normal executables */ > +OUTPUT_FORMAT("elf32-tricore") > +OUTPUT_ARCH(tricore) > +ENTRY(_start) > + > +/* the internal ram description */ > +MEMORY > +{ > + text_ram (rx!p): org = 0x80000000, len = 15K > + data_ram (w!xp): org = 0xd0000000, len = 130K > +} > +/* > + * Define the sizes of the user and system stacks. > + */ > +__USTACK_SIZE = DEFINED (__USTACK_SIZE) ? __USTACK_SIZE : 1K ; > +/* > + * Define the start address and the size of the context save area. > + */ > +__CSA_BEGIN = 0xd0000000 ; > +__CSA_SIZE = 8k ; > +__CSA_END = __CSA_BEGIN + __CSA_SIZE ; > + > +SECTIONS > +{ > + .text : > + { > + *(.text) > + . = ALIGN(8); > + } > text_ram > + > + .rodata : > + { > + *(.rodata) > + *(.rodata1) > + } > data_ram > + > + .data : > + { > + . = ALIGN(8) ; > + *(.data) > + *(.data.*) > + . = ALIGN(8) ; > + __USTACK = . + __USTACK_SIZE -768; > + > + } > data_ram > + /* > + * Allocate space for BSS sections. > + */ > + .bss : > + { > + BSS_BASE = . ; > + *(.bss) > + *(COMMON) > + . = ALIGN(8) ; > + } > data_ram > + /* Make sure CSA, stack and heap addresses are properly aligned. */ > + _. = ASSERT ((__CSA_BEGIN & 0x3f) == 0 , "illegal CSA start address") ; > + _. = ASSERT ((__CSA_SIZE & 0x3f) == 0 , "illegal CSA size") ; > + > +} >
Hi Phil, On 05/02/2018 02:41 AM, Philippe Mathieu-Daudé wrote: > Hi Bastian, > > On 05/01/2018 11:22 AM, Bastian Koppelmann wrote: >> this includes the Makefile and linker script to build all the tests. >> >> Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de> >> --- >> tests/tcg/tricore/Makefile | 30 +++++++++++++++++++++++ >> tests/tcg/tricore/link.ld | 60 ++++++++++++++++++++++++++++++++++++++++++++++ >> 2 files changed, 90 insertions(+) >> create mode 100644 tests/tcg/tricore/Makefile >> create mode 100644 tests/tcg/tricore/link.ld >> >> diff --git a/tests/tcg/tricore/Makefile b/tests/tcg/tricore/Makefile >> new file mode 100644 >> index 0000000000..8c168d1062 >> --- /dev/null >> +++ b/tests/tcg/tricore/Makefile >> @@ -0,0 +1,30 @@ >> +AS := tricore-as >> +LD := tricore-ld >> +HOST_CC = gcc >> + >> +LDFLAGS = -Tlink.ld >> +ASFLAGS = >> + >> +SIM = ../../../tricore-softmmu/qemu-system-tricore >> +SIMFLAGS = -M tricore_testboard -nographic -kernel > > I applied this on upstream QEMU (26bd8d98c4b32). > > I suppose you are doing in-tree build, since this doesn't work with> out-of-tree builds (see the $SIM relative path). Ooops, this is mostly copied from tests/tcg/xtensa :) > > I then get: > > tricore-softmmu/qemu-system-tricore -M tricore_testboard -nographic > -kests/tcg/tricore/test_muls.tst -d in_asm > QEMU 2.12.50 monitor - type 'help' for more information > (qemu) QEMU 2.12.50 monitor - type 'help' for more information > (qemu) IN: > 0x80000000: qemu-system-tricore: function cpu_get_phys_page_attrs_debug > not implemented, aborting This is odd. I'll try to reproduce it. [...] > http://lists.nongnu.org/archive/html/qemu-devel/2018-05/msg00151.html > (which you can build with 'make docker-image-debian-tricore-cross', I > didn't try to merge your series over Alex's tcg-testing one) Thanks for creating this docker image, you helped me a great deal :) [...] >> + >> +all: build >> + >> +%.pS: %.S >> + $(HOST_CC) -E -o $@ $< >> + >> +%.o: %.pS >> + $(AS) $(ASFLAGS) -o $@ $< >> + >> +%.tst: %.o link.ld >> + $(LD) $(LDFLAGS) $< -o $@ > > Those rules did not work for me: I assume make uses the built-in rules. Can you try $ make --no-builtin-rules? Cheers, Bastian
On 05/01/2018 06:48 PM, Bastian Koppelmann wrote: > Hi Alex, > > On 05/01/2018 05:40 PM, Alex Bennée wrote: >> Bastian Koppelmann <kbastian@mail.uni-paderborn.de> writes: >> >>> this includes the Makefile and linker script to build all the tests. >>> >>> Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de> >>> --- >>> tests/tcg/tricore/Makefile | 30 +++++++++++++++++++++++ >>> tests/tcg/tricore/link.ld | 60 ++++++++++++++++++++++++++++++++++++++++++++++ >>> 2 files changed, 90 insertions(+) >>> create mode 100644 tests/tcg/tricore/Makefile >>> create mode 100644 tests/tcg/tricore/link.ld >>> >>> diff --git a/tests/tcg/tricore/Makefile b/tests/tcg/tricore/Makefile >>> new file mode 100644 >>> index 0000000000..8c168d1062 >>> --- /dev/null >>> +++ b/tests/tcg/tricore/Makefile >>> @@ -0,0 +1,30 @@ >>> +AS := tricore-as >>> +LD := tricore-ld >> Where do these come from? Ideally we'd get these in a docker container >> like the rest. It would actually be easier to use tricore-gcc if it >> exists because at the moment my docker series only exposes a C compiler >> to the make system. > > I don't have access to gcc unfortunately. The only thing I can provide is the > patched binutils (https://github.com/bkoppelmann/tricore-binutils). > > Can you give me a pointer regarding your docker images? > > Cheers, > Bastian Sorry Alex for taking this off list. I was at a new machine... Cheers, Bastian
On 05/02/2018 11:26 AM, Bastian Koppelmann wrote: > Hi Phil, > [...] >> I then get: >> >> tricore-softmmu/qemu-system-tricore -M tricore_testboard -nographic >> -kests/tcg/tricore/test_muls.tst -d in_asm >> QEMU 2.12.50 monitor - type 'help' for more information >> (qemu) QEMU 2.12.50 monitor - type 'help' for more information >> (qemu) IN: >> 0x80000000: qemu-system-tricore: function cpu_get_phys_page_attrs_debug >> not implemented, aborting > > This is odd. I'll try to reproduce it. It looks like this is due to -d in_asm. I'll sent fix this in a different patchset. Cheers, Bastian
Bastian Koppelmann <kbastian@mail.uni-paderborn.de> writes: > On 05/01/2018 06:48 PM, Bastian Koppelmann wrote: >> Hi Alex, >> >> On 05/01/2018 05:40 PM, Alex Bennée wrote: >>> Bastian Koppelmann <kbastian@mail.uni-paderborn.de> writes: >>> >>>> this includes the Makefile and linker script to build all the tests. >>>> >>>> Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de> >>>> --- >>>> tests/tcg/tricore/Makefile | 30 +++++++++++++++++++++++ >>>> tests/tcg/tricore/link.ld | 60 ++++++++++++++++++++++++++++++++++++++++++++++ >>>> 2 files changed, 90 insertions(+) >>>> create mode 100644 tests/tcg/tricore/Makefile >>>> create mode 100644 tests/tcg/tricore/link.ld >>>> >>>> diff --git a/tests/tcg/tricore/Makefile b/tests/tcg/tricore/Makefile >>>> new file mode 100644 >>>> index 0000000000..8c168d1062 >>>> --- /dev/null >>>> +++ b/tests/tcg/tricore/Makefile >>>> @@ -0,0 +1,30 @@ >>>> +AS := tricore-as >>>> +LD := tricore-ld >>> Where do these come from? Ideally we'd get these in a docker container >>> like the rest. It would actually be easier to use tricore-gcc if it >>> exists because at the moment my docker series only exposes a C compiler >>> to the make system. >> >> I don't have access to gcc unfortunately. The only thing I can provide is the >> patched binutils (https://github.com/bkoppelmann/tricore-binutils). >> >> Can you give me a pointer regarding your docker images? >> >> Cheers, >> Bastian > > Sorry Alex for taking this off list. I was at a new machine... No worries, sorry for being late with the pointer: https://lists.gnu.org/archive/html/qemu-devel/2018-04/msg03906.html My current WIP tree is: https://github.com/stsquad/qemu/tree/testing/tcg-tests-revival-v4 although the usual caveats about re-basing apply to that ;-) -- Alex Bennée
diff --git a/tests/tcg/tricore/Makefile b/tests/tcg/tricore/Makefile new file mode 100644 index 0000000000..8c168d1062 --- /dev/null +++ b/tests/tcg/tricore/Makefile @@ -0,0 +1,30 @@ +AS := tricore-as +LD := tricore-ld +HOST_CC = gcc + +LDFLAGS = -Tlink.ld +ASFLAGS = + +SIM = ../../../tricore-softmmu/qemu-system-tricore +SIMFLAGS = -M tricore_testboard -nographic -kernel + +all: build + +%.pS: %.S + $(HOST_CC) -E -o $@ $< + +%.o: %.pS + $(AS) $(ASFLAGS) -o $@ $< + +%.tst: %.o link.ld + $(LD) $(LDFLAGS) $< -o $@ + +build: $(TESTCASES) + +check: $(addprefix run-, $(TESTCASES)) + +run-%.tst: %.tst + $(SIM) $(SIMFLAGS) ./$< + +clean: + $(RM) -fr $(TESTCASES) linker.ld diff --git a/tests/tcg/tricore/link.ld b/tests/tcg/tricore/link.ld new file mode 100644 index 0000000000..364bcdc00a --- /dev/null +++ b/tests/tcg/tricore/link.ld @@ -0,0 +1,60 @@ +/* Default linker script, for normal executables */ +OUTPUT_FORMAT("elf32-tricore") +OUTPUT_ARCH(tricore) +ENTRY(_start) + +/* the internal ram description */ +MEMORY +{ + text_ram (rx!p): org = 0x80000000, len = 15K + data_ram (w!xp): org = 0xd0000000, len = 130K +} +/* + * Define the sizes of the user and system stacks. + */ +__USTACK_SIZE = DEFINED (__USTACK_SIZE) ? __USTACK_SIZE : 1K ; +/* + * Define the start address and the size of the context save area. + */ +__CSA_BEGIN = 0xd0000000 ; +__CSA_SIZE = 8k ; +__CSA_END = __CSA_BEGIN + __CSA_SIZE ; + +SECTIONS +{ + .text : + { + *(.text) + . = ALIGN(8); + } > text_ram + + .rodata : + { + *(.rodata) + *(.rodata1) + } > data_ram + + .data : + { + . = ALIGN(8) ; + *(.data) + *(.data.*) + . = ALIGN(8) ; + __USTACK = . + __USTACK_SIZE -768; + + } > data_ram + /* + * Allocate space for BSS sections. + */ + .bss : + { + BSS_BASE = . ; + *(.bss) + *(COMMON) + . = ALIGN(8) ; + } > data_ram + /* Make sure CSA, stack and heap addresses are properly aligned. */ + _. = ASSERT ((__CSA_BEGIN & 0x3f) == 0 , "illegal CSA start address") ; + _. = ASSERT ((__CSA_SIZE & 0x3f) == 0 , "illegal CSA size") ; + +}
this includes the Makefile and linker script to build all the tests. Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de> --- tests/tcg/tricore/Makefile | 30 +++++++++++++++++++++++ tests/tcg/tricore/link.ld | 60 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 tests/tcg/tricore/Makefile create mode 100644 tests/tcg/tricore/link.ld