diff mbox series

[v3,1/3] arch: add support for Andes 32-bit(nds32)

Message ID 20190307021125.8530-2-nylon7@andestech.com
State Changes Requested
Headers show
Series Add prebuilt nds32 toolchain, ae3xx board and autobuild configs support | expand

Commit Message

Nylon Chen March 7, 2019, 2:11 a.m. UTC
This commit provides basic support for the Andes 32-bit(nds32) architecture.

Signed-off-by: Che-Wei Chuang <cnoize@andestech.com>
Signed-off-by: Greentime Hu <greentime@andestech.com>
Signed-off-by: Nylon Chen <nylon7@andestech.com>
---
 DEVELOPERS           |  3 +++
 arch/Config.in       | 12 ++++++++++++
 arch/Config.in.nds32 | 19 +++++++++++++++++++
 3 files changed, 34 insertions(+)
 create mode 100644 arch/Config.in.nds32

Comments

Yann E. MORIN March 14, 2019, 10:22 p.m. UTC | #1
Nylon, All,

On 2019-03-07 10:11 +0800, Nylon Chen spake thusly:
> This commit provides basic support for the Andes 32-bit(nds32) architecture.

Out of curiosity, and just for my information: do you have examples of
products shipping with an nds32 CPU?

I have a few comments (the last one very minor), see below...

> Signed-off-by: Che-Wei Chuang <cnoize@andestech.com>
> Signed-off-by: Greentime Hu <greentime@andestech.com>
> Signed-off-by: Nylon Chen <nylon7@andestech.com>
> ---
>  DEVELOPERS           |  3 +++
>  arch/Config.in       | 12 ++++++++++++
>  arch/Config.in.nds32 | 19 +++++++++++++++++++
>  3 files changed, 34 insertions(+)
>  create mode 100644 arch/Config.in.nds32
> 
> diff --git a/DEVELOPERS b/DEVELOPERS
> index c17ba6db99..06a20c68b6 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -1605,6 +1605,9 @@ F:	package/trousers/
>  N:	Norbert Lange <nolange79@gmail.com>
>  F:	package/tcf-agent/
>  
> +N:	Nylon Chen <nylon7@andestech.com>
> +F:	arch/Config.in.nds32
> +
>  N:	Olaf Rempel <razzor@kopf-tisch.de>
>  F:	package/ctorrent/
>  
> diff --git a/arch/Config.in b/arch/Config.in
> index f50760a0cf..d82803c828 100644
> --- a/arch/Config.in
> +++ b/arch/Config.in
> @@ -154,6 +154,14 @@ config BR2_mips64el
>  	  http://www.mips.com/
>  	  http://en.wikipedia.org/wiki/MIPS_Technologies
>  
> +config BR2_nds32
> +	bool "nds32"
> +	select BR2_ARCH_HAS_NO_TOOLCHAIN_BUILDROOT

It would be nice that you provide a package for a pre-built toolchain,
like we have for a few of them, see:

    toolchain/toolchain-external/

This is not mandatory, but would be a good addition.

It would even make the defconfig in your second patch a bit simpler.

> +	select BR2_ARCH_HAS_MMU_MANDATORY
> +	help
> +	  nds32 is a 32-bit architecture developed by Andes Technology.
> +	  https://en.wikipedia.org/wiki/Andes_Technology
> +
>  config BR2_nios2
>  	bool "Nios II"
>  	select BR2_ARCH_HAS_MMU_MANDATORY
> @@ -419,6 +427,10 @@ if BR2_mips || BR2_mips64 || BR2_mipsel || BR2_mips64el
>  source "arch/Config.in.mips"
>  endif
>  
> +if BR2_nds32
> +source "arch/Config.in.nds32"
> +endif
> +
>  if BR2_nios2
>  source "arch/Config.in.nios2"
>  endif
> diff --git a/arch/Config.in.nds32 b/arch/Config.in.nds32
> new file mode 100644
> index 0000000000..38b1c2d4eb
> --- /dev/null
> +++ b/arch/Config.in.nds32
> @@ -0,0 +1,19 @@
> +config BR2_ARCH
> +	default "nds32"
> +
> +config BR2_ANDES_NDS32_FPU
> +	bool "Enable FPU coprocessor"
> +	help
> +	  You can say y here if your Andes CPU have a Floating-Point Coprocessor
> +	  or if you need FPU support for your user-space programs.

So, the situation about FPU is always a bit icky for me.

If you say 'n' above, does that mean that you need to do a pure
soft-float build, or that the FP instrcution get trapped an emulated
by the kernel?

If the former, then you may want to check whether you need to select
BR2_SOFT_FLOAT (a few packages have conditions based on that).

> +config BR2_GCC_TARGET_ARCH
> +	default "v3"  if !BR2_ANDES_NDS32_FPU
> +	default "v3f" if BR2_ANDES_NDS32_FPU

I always find it nicer to have the positive logic come first. Also,
kconfig will stop on the first default stanza which condition is true,
so:

    config BR2_GCC_TARGET_ARCH
        default "v3f" if BR2_ANDES_NDS32_FPU
        default "v3"

> +config BR2_ENDIAN
> +	default "LITTLE"
> +
> +config BR2_READELF_ARCH_NAME
> +	default "Andes Technology compact code size embedded RISC processor family"
> +
> -- 
> 2.18.0
> 
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
Nylon Chen March 21, 2019, 2:36 a.m. UTC | #2
Hello Yann,

sorry,i thought that i didn't send the letter successfully, so I sent it twice(the first time, i only sent to you ).

Thank you for your comment

On Fri, Mar 15, 2019 at 06:22:11AM +0800, Yann E. MORIN wrote:
> Nylon, All,
> 
> On 2019-03-07 10:11 +0800, Nylon Chen spake thusly:
> > This commit provides basic support for the Andes 32-bit(nds32) architecture.
> 
> Out of curiosity, and just for my information: do you have examples of
> products shipping with an nds32 CPU?
> 
> I have a few comments (the last one very minor), see below...
> 
> > Signed-off-by: Che-Wei Chuang <cnoize@andestech.com>
> > Signed-off-by: Greentime Hu <greentime@andestech.com>
> > Signed-off-by: Nylon Chen <nylon7@andestech.com>
> > ---
> >  DEVELOPERS           |  3 +++
> >  arch/Config.in       | 12 ++++++++++++
> >  arch/Config.in.nds32 | 19 +++++++++++++++++++
> >  3 files changed, 34 insertions(+)
> >  create mode 100644 arch/Config.in.nds32
> > 
> > diff --git a/DEVELOPERS b/DEVELOPERS
> > index c17ba6db99..06a20c68b6 100644
> > --- a/DEVELOPERS
> > +++ b/DEVELOPERS
> > @@ -1605,6 +1605,9 @@ F:	package/trousers/
> >  N:	Norbert Lange <nolange79@gmail.com>
> >  F:	package/tcf-agent/
> >  
> > +N:	Nylon Chen <nylon7@andestech.com>
> > +F:	arch/Config.in.nds32
> > +
> >  N:	Olaf Rempel <razzor@kopf-tisch.de>
> >  F:	package/ctorrent/
> >  
> > diff --git a/arch/Config.in b/arch/Config.in
> > index f50760a0cf..d82803c828 100644
> > --- a/arch/Config.in
> > +++ b/arch/Config.in
> > @@ -154,6 +154,14 @@ config BR2_mips64el
> >  	  http://www.mips.com/
> >  	  http://en.wikipedia.org/wiki/MIPS_Technologies
> >  
> > +config BR2_nds32
> > +	bool "nds32"
> > +	select BR2_ARCH_HAS_NO_TOOLCHAIN_BUILDROOT
> 
> It would be nice that you provide a package for a pre-built toolchain,
> like we have for a few of them, see:
> 
>     toolchain/toolchain-external/
> 
> This is not mandatory, but would be a good addition.
> 
> It would even make the defconfig in your second patch a bit simpler.
> 
Ok,i will try this method
> > +	select BR2_ARCH_HAS_MMU_MANDATORY
> > +	help
> > +	  nds32 is a 32-bit architecture developed by Andes Technology.
> > +	  https://en.wikipedia.org/wiki/Andes_Technology
> > +
> >  config BR2_nios2
> >  	bool "Nios II"
> >  	select BR2_ARCH_HAS_MMU_MANDATORY
> > @@ -419,6 +427,10 @@ if BR2_mips || BR2_mips64 || BR2_mipsel || BR2_mips64el
> >  source "arch/Config.in.mips"
> >  endif
> >  
> > +if BR2_nds32
> > +source "arch/Config.in.nds32"
> > +endif
> > +
> >  if BR2_nios2
> >  source "arch/Config.in.nios2"
> >  endif
> > diff --git a/arch/Config.in.nds32 b/arch/Config.in.nds32
> > new file mode 100644
> > index 0000000000..38b1c2d4eb
> > --- /dev/null
> > +++ b/arch/Config.in.nds32
> > @@ -0,0 +1,19 @@
> > +config BR2_ARCH
> > +	default "nds32"
> > +
> > +config BR2_ANDES_NDS32_FPU
> > +	bool "Enable FPU coprocessor"
> > +	help
> > +	  You can say y here if your Andes CPU have a Floating-Point Coprocessor
> > +	  or if you need FPU support for your user-space programs.
> 
> So, the situation about FPU is always a bit icky for me.
> 
> If you say 'n' above, does that mean that you need to do a pure
> soft-float build, or that the FP instrcution get trapped an emulated
> by the kernel?
> 
> If the former, then you may want to check whether you need to select
> BR2_SOFT_FLOAT (a few packages have conditions based on that).
> 
> > +config BR2_GCC_TARGET_ARCH
> > +	default "v3"  if !BR2_ANDES_NDS32_FPU
> > +	default "v3f" if BR2_ANDES_NDS32_FPU
> 
> I always find it nicer to have the positive logic come first. Also,
> kconfig will stop on the first default stanza which condition is true,
> so:
> 
>     config BR2_GCC_TARGET_ARCH
>         default "v3f" if BR2_ANDES_NDS32_FPU
>         default "v3"
> 
Here is my negligence, thank you for your suggestion, i will adopt
> > +config BR2_ENDIAN
> > +	default "LITTLE"
> > +
> > +config BR2_READELF_ARCH_NAME
> > +	default "Andes Technology compact code size embedded RISC processor family"
> > +
> > -- 
> > 2.18.0
> > 
> > _______________________________________________
> > buildroot mailing list
> > buildroot@busybox.net
> > http://lists.busybox.net/mailman/listinfo/buildroot
> 
> -- 
> .-----------------.--------------------.------------------.--------------------.
> |  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
> | +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
> | +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
> | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
> '------------------------------^-------^------------------^--------------------'
Yann E. MORIN March 21, 2019, 11:18 a.m. UTC | #3
Nylon, All,

On 2019-03-21 10:36 +0800, Nylon Chen spake thusly:
> On Fri, Mar 15, 2019 at 06:22:11AM +0800, Yann E. MORIN wrote:
> > On 2019-03-07 10:11 +0800, Nylon Chen spake thusly:
> > > This commit provides basic support for the Andes 32-bit(nds32) architecture.
[--SNIP--]
> > > +config BR2_nds32
> > > +	bool "nds32"
> > > +	select BR2_ARCH_HAS_NO_TOOLCHAIN_BUILDROOT
> > It would be nice that you provide a package for a pre-built toolchain,
> > like we have for a few of them, see:
> > 
> >     toolchain/toolchain-external/
> > 
> > This is not mandatory, but would be a good addition.
> > 
> > It would even make the defconfig in your second patch a bit simpler.
> > 
> Ok,i will try this method

As I said: it is not mandatory; we can accept adding the nds32
architecture without an external-toolchain package.

It would be _nice_, though, but that can come later, in a followup
series.

> > > +config BR2_ANDES_NDS32_FPU
> > > +	bool "Enable FPU coprocessor"
> > > +	help
> > > +	  You can say y here if your Andes CPU have a Floating-Point Coprocessor
> > > +	  or if you need FPU support for your user-space programs.
> > 
> > So, the situation about FPU is always a bit icky for me.
> > 
> > If you say 'n' above, does that mean that you need to do a pure
> > soft-float build, or that the FP instrcution get trapped an emulated
> > by the kernel?
> > 
> > If the former, then you may want to check whether you need to select
> > BR2_SOFT_FLOAT (a few packages have conditions based on that).

This is an important question, but you did not reply to it.

> > > +config BR2_GCC_TARGET_ARCH
> > > +	default "v3"  if !BR2_ANDES_NDS32_FPU
> > > +	default "v3f" if BR2_ANDES_NDS32_FPU
> > 
> > I always find it nicer to have the positive logic come first. Also,
> > kconfig will stop on the first default stanza which condition is true,
> > so:
> > 
> >     config BR2_GCC_TARGET_ARCH
> >         default "v3f" if BR2_ANDES_NDS32_FPU
> >         default "v3"
> > 
> Here is my negligence, thank you for your suggestion, i will adopt

This was not about neglicence on your side, don't worry! ;-)

It is just about some (mostly-unwritten) conventional rules, with a bit
of personal preferences, so nothing you could have known.

This patchset is pretty good, now, and we're now looking at the minor
details.

Regards,
Yann E. MORIN.

> > > +config BR2_ENDIAN
> > > +	default "LITTLE"
> > > +
> > > +config BR2_READELF_ARCH_NAME
> > > +	default "Andes Technology compact code size embedded RISC processor family"
> > > +
> > > -- 
> > > 2.18.0
> > > 
> > > _______________________________________________
> > > buildroot mailing list
> > > buildroot@busybox.net
> > > http://lists.busybox.net/mailman/listinfo/buildroot
> > 
> > -- 
> > .-----------------.--------------------.------------------.--------------------.
> > |  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
> > | +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
> > | +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
> > | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
> > '------------------------------^-------^------------------^--------------------'
Nylon Chen March 22, 2019, 8:39 a.m. UTC | #4
Yann, All,

Again, thank you for your comment

On Thu, Mar 21, 2019 at 07:18:54PM +0800, Yann E. MORIN wrote:
> Nylon, All,
> 
> On 2019-03-21 10:36 +0800, Nylon Chen spake thusly:
> > On Fri, Mar 15, 2019 at 06:22:11AM +0800, Yann E. MORIN wrote:
> > > On 2019-03-07 10:11 +0800, Nylon Chen spake thusly:
> > > > This commit provides basic support for the Andes 32-bit(nds32) architecture.
> [--SNIP--]
> > > > +config BR2_nds32
> > > > +	bool "nds32"
> > > > +	select BR2_ARCH_HAS_NO_TOOLCHAIN_BUILDROOT
> > > It would be nice that you provide a package for a pre-built toolchain,
> > > like we have for a few of them, see:
> > > 
> > >     toolchain/toolchain-external/
> > > 
> > > This is not mandatory, but would be a good addition.
> > > 
> > > It would even make the defconfig in your second patch a bit simpler.
> > > 
> > Ok,i will try this method
> 
> As I said: it is not mandatory; we can accept adding the nds32
> architecture without an external-toolchain package.
> 
> It would be _nice_, though, but that can come later, in a followup
> series.
>
Ok, thanks
> > > > +config BR2_ANDES_NDS32_FPU
> > > > +	bool "Enable FPU coprocessor"
> > > > +	help
> > > > +	  You can say y here if your Andes CPU have a Floating-Point Coprocessor
> > > > +	  or if you need FPU support for your user-space programs.
> > > 
> > > So, the situation about FPU is always a bit icky for me.
> > > 
> > > If you say 'n' above, does that mean that you need to do a pure
> > > soft-float build, or that the FP instrcution get trapped an emulated
> > > by the kernel?
> > > 
> > > If the former, then you may want to check whether you need to select
> > > BR2_SOFT_FLOAT (a few packages have conditions based on that).
> 
> This is an important question, but you did not reply to it.
>
Sorry I'm missing this comment.

BR2_ANDES_NDS32_FPU are selector,we can depend on it switch v3 or v3f toolcahin

After we add new defconfig(for v3f),I will be adding BR2_SOFT_FLOAT(-msoft-float) to arch/Config.in.nds32
> > > > +config BR2_GCC_TARGET_ARCH
> > > > +	default "v3"  if !BR2_ANDES_NDS32_FPU
> > > > +	default "v3f" if BR2_ANDES_NDS32_FPU
> > > 
> > > I always find it nicer to have the positive logic come first. Also,
> > > kconfig will stop on the first default stanza which condition is true,
> > > so:
> > > 
> > >     config BR2_GCC_TARGET_ARCH
> > >         default "v3f" if BR2_ANDES_NDS32_FPU
> > >         default "v3"
> > > 
> > Here is my negligence, thank you for your suggestion, i will adopt
> 
> This was not about neglicence on your side, don't worry! ;-)
> 
> It is just about some (mostly-unwritten) conventional rules, with a bit
> of personal preferences, so nothing you could have known.
> 
> This patchset is pretty good, now, and we're now looking at the minor
> details.
> 
> Regards,
> Yann E. MORIN.
> 
> > > > +config BR2_ENDIAN
> > > > +	default "LITTLE"
> > > > +
> > > > +config BR2_READELF_ARCH_NAME
> > > > +	default "Andes Technology compact code size embedded RISC processor family"
> > > > +
> > > > -- 
> > > > 2.18.0
> > > > 
> > > > _______________________________________________
> > > > buildroot mailing list
> > > > buildroot@busybox.net
> > > > http://lists.busybox.net/mailman/listinfo/buildroot
> > > 
> > > -- 
> > > .-----------------.--------------------.------------------.--------------------.
> > > |  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
> > > | +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
> > > | +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
> > > | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
> > > '------------------------------^-------^------------------^--------------------'
> 
> -- 
> .-----------------.--------------------.------------------.--------------------.
> |  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
> | +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
> | +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
> | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
> '------------------------------^-------^------------------^--------------------'
Yann E. MORIN March 22, 2019, 11:40 a.m. UTC | #5
Nylon, All,

On 2019-03-22 16:39 +0800, Nylon Chen spake thusly:
> On Thu, Mar 21, 2019 at 07:18:54PM +0800, Yann E. MORIN wrote:
> > On 2019-03-21 10:36 +0800, Nylon Chen spake thusly:
> > > On Fri, Mar 15, 2019 at 06:22:11AM +0800, Yann E. MORIN wrote:
> > > > On 2019-03-07 10:11 +0800, Nylon Chen spake thusly:
> > > > > +config BR2_ANDES_NDS32_FPU
> > > > > +	bool "Enable FPU coprocessor"
> > > > > +	help
> > > > > +	  You can say y here if your Andes CPU have a Floating-Point Coprocessor
> > > > > +	  or if you need FPU support for your user-space programs.
> > > > So, the situation about FPU is always a bit icky for me.
[--SNIP--]
> BR2_ANDES_NDS32_FPU are selector, we can depend on it switch v3 or v3f
> toolcahin
> 
> After we add new defconfig(for v3f),I will be adding BR2_SOFT_FLOAT
>(-msoft-float) to arch/Config.in.nds32

Then if the v3f is currently the only supported alternative, do not
offer the FPU choice in this initial integration.

Adding support for the v3 (not f) and the FPU selection can be done in a
later patch, then.

Regards,
Yann E. MORIN.
diff mbox series

Patch

diff --git a/DEVELOPERS b/DEVELOPERS
index c17ba6db99..06a20c68b6 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1605,6 +1605,9 @@  F:	package/trousers/
 N:	Norbert Lange <nolange79@gmail.com>
 F:	package/tcf-agent/
 
+N:	Nylon Chen <nylon7@andestech.com>
+F:	arch/Config.in.nds32
+
 N:	Olaf Rempel <razzor@kopf-tisch.de>
 F:	package/ctorrent/
 
diff --git a/arch/Config.in b/arch/Config.in
index f50760a0cf..d82803c828 100644
--- a/arch/Config.in
+++ b/arch/Config.in
@@ -154,6 +154,14 @@  config BR2_mips64el
 	  http://www.mips.com/
 	  http://en.wikipedia.org/wiki/MIPS_Technologies
 
+config BR2_nds32
+	bool "nds32"
+	select BR2_ARCH_HAS_NO_TOOLCHAIN_BUILDROOT
+	select BR2_ARCH_HAS_MMU_MANDATORY
+	help
+	  nds32 is a 32-bit architecture developed by Andes Technology.
+	  https://en.wikipedia.org/wiki/Andes_Technology
+
 config BR2_nios2
 	bool "Nios II"
 	select BR2_ARCH_HAS_MMU_MANDATORY
@@ -419,6 +427,10 @@  if BR2_mips || BR2_mips64 || BR2_mipsel || BR2_mips64el
 source "arch/Config.in.mips"
 endif
 
+if BR2_nds32
+source "arch/Config.in.nds32"
+endif
+
 if BR2_nios2
 source "arch/Config.in.nios2"
 endif
diff --git a/arch/Config.in.nds32 b/arch/Config.in.nds32
new file mode 100644
index 0000000000..38b1c2d4eb
--- /dev/null
+++ b/arch/Config.in.nds32
@@ -0,0 +1,19 @@ 
+config BR2_ARCH
+	default "nds32"
+
+config BR2_ANDES_NDS32_FPU
+	bool "Enable FPU coprocessor"
+	help
+	  You can say y here if your Andes CPU have a Floating-Point Coprocessor
+	  or if you need FPU support for your user-space programs.
+
+config BR2_GCC_TARGET_ARCH
+	default "v3"  if !BR2_ANDES_NDS32_FPU
+	default "v3f" if BR2_ANDES_NDS32_FPU
+
+config BR2_ENDIAN
+	default "LITTLE"
+
+config BR2_READELF_ARCH_NAME
+	default "Andes Technology compact code size embedded RISC processor family"
+