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

[newlib/libgloss] Add support for RF16 configurations #231

Closed
abrodkin opened this issue Dec 24, 2019 · 6 comments
Closed

[newlib/libgloss] Add support for RF16 configurations #231

abrodkin opened this issue Dec 24, 2019 · 6 comments

Comments

@abrodkin
Copy link
Member

Currently we have this:

$ arc-elf32-gcc -mcpu=em_mini -Os --specs=nsim.specs test.c
.../bin/../lib/gcc/arc-elf32/9.2.1/../../../../arc-elf32/bin/ld: error: a.out: cannot mix rf16 with full register set .../bin/../lib/gcc/arc-elf32/9.2.1/../../../../arc-elf32/lib/em_mini/libnsim.a(nsim-syscalls.o)
.../bin/../lib/gcc/arc-elf32/9.2.1/../../../../arc-elf32/bin/ld: failed to merge target specific data of file .../bin/../lib/gcc/arc-elf32/9.2.1/../../../../arc-elf32/lib/em_mini/libnsim.a(nsim-syscalls.o)

@claziss @shahab-vahedi who's interested in getting this done at some point? :)

We need this to have an ability to add RF16 (-mcpu=em_mini) configuration in automated testing, i.e. have an ability to run a simple "hello world" application in nSIM similarly to what we do for other configurations.

In particular we do it in automated flow as a part of release (as well as engineering build & RCs) publishing. So that will help us to be sure stuff builds and runs on RF16 configs, instead of getting unexpected reports like #216.

@abrodkin abrodkin added this to the 2020.03 milestone Dec 24, 2019
@claziss
Copy link
Contributor

claziss commented Dec 24, 2019

Not sure if we can use the nsim's gnu Host I/O for RF16. We need to investigate more.

@claziss
Copy link
Contributor

claziss commented Feb 13, 2020

Supporting RF16 with existing GNU host I/O for nsim is not possible as the syscalls are using unsupported registers. For example:

#define _naked_syscall2(__res, name, a, b)			\
	__asm__ __volatile__ ("mov	r1, %3\n\t"		\
			"mov	r0, %2\n\t"			\
			"mov	r8, %1\n\t"			\
			SYSCALL					\
			"mov	%0, r0"				\
			: "=r" (__res)				\
			: "i" (SYS_##name),			\
			  "r" ((long)a),			\
			  "r" ((long)b)				\
			: "cc", "r0", "r1", "r8");		\
	if ((unsigned long)(__res) >= (unsigned long)(-125)) {	\
		errno = -__res;					\
		__res = -1;					\
	}

As you can see r8 is illegal for RF16 configuration. A solution is to switch for MWDT host I/O interface. However, we lack information on its specs.

@claziss claziss removed this from the 2020.03 milestone Feb 13, 2020
@vineetgarc
Copy link
Contributor

AFAIKR, for reduced regfile configs, syscall number was in r4 - please check the ABI doc

@claziss
Copy link
Contributor

claziss commented Jan 22, 2021

Having the new mwdt hostlink libgloss may be a solution.

@abrodkin
Copy link
Member Author

Indeed, foss-for-synopsys-dwc-arc-processors/newlib#14 should fix this.

@VVIsaev
Copy link
Contributor

VVIsaev commented Feb 8, 2021

Should be fixed in https://github.com/foss-for-synopsys-dwc-arc-processors/newlib/tree/arc-2021.03.

$ cat hello.c
#include <stdio.h>

int main() {
        printf("hello \n");
}
$ arc-elf32-gcc -mcpu=em_mini --specs=hl.specs ./hello.c -o hello
$ nsimdrv -prop=nsim_isa_rgf_num_regs=16 -prop=nsim_isa_family=av2em -prop=nsim_isa_core=1 -prop=nsim_hlink_gnu_io_ext=1 ./hello
hello

@VVIsaev VVIsaev closed this as completed Feb 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants