[PATCH] [SPARC] Disable muldf3_extend for LEON targets

2017-07-20 Thread Sebastian Huber
Since a prominent LEON2 chip, the AT697F, does not support the FSMULD
instruction, disable it for all LEON2 targets due to simplicity.  The
code generation for the fmaf() function of Newlib changes for example
from

 :
   0:   9c 03 bf b0 add  %sp, -80, %sp
   4:   d2 23 a0 4c st  %o1, [ %sp + 0x4c ]
   8:   d1 03 a0 4c ld  [ %sp + 0x4c ], %f8
   c:   d0 23 a0 4c st  %o0, [ %sp + 0x4c ]
  10:   d3 03 a0 4c ld  [ %sp + 0x4c ], %f9
  14:   d4 23 a0 4c st  %o2, [ %sp + 0x4c ]
  18:   81 a2 0d 29 fsmuld  %f8, %f9, %f0
  1c:   d1 03 a0 4c ld  [ %sp + 0x4c ], %f8
  20:   91 a0 19 28 fstod  %f8, %f8
  24:   9c 03 a0 50 add  %sp, 0x50, %sp
  28:   81 a0 08 48 faddd  %f0, %f8, %f0
  2c:   81 c3 e0 08 retl
  30:   81 a0 18 c0 fdtos  %f0, %f0

to

 :
   0:   9c 03 bf b0 add  %sp, -80, %sp
   4:   d0 23 a0 4c st  %o0, [ %sp + 0x4c ]
   8:   d1 03 a0 4c ld  [ %sp + 0x4c ], %f8
   c:   d2 23 a0 4c st  %o1, [ %sp + 0x4c ]
  10:   81 a0 19 28 fstod  %f8, %f0
  14:   d1 03 a0 4c ld  [ %sp + 0x4c ], %f8
  18:   95 a0 19 28 fstod  %f8, %f10
  1c:   d4 23 a0 4c st  %o2, [ %sp + 0x4c ]
  20:   d1 03 a0 4c ld  [ %sp + 0x4c ], %f8
  24:   81 a0 09 4a fmuld  %f0, %f10, %f0
  28:   91 a0 19 28 fstod  %f8, %f8
  2c:   9c 03 a0 50 add  %sp, 0x50, %sp
  30:   81 a0 08 48 faddd  %f0, %f8, %f0
  34:   81 c3 e0 08 retl
  38:   81 a0 18 c0 fdtos  %f0, %f0

gcc/
* config/sparc/sparc.md (muldf3_extend): Disable if -mcpu=leon.
---
 gcc/config/sparc/sparc.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/config/sparc/sparc.md b/gcc/config/sparc/sparc.md
index 337ccadfbe0..100178f67e4 100644
--- a/gcc/config/sparc/sparc.md
+++ b/gcc/config/sparc/sparc.md
@@ -6016,7 +6016,7 @@
   [(set (match_operand:DF 0 "register_operand" "=e")
(mult:DF (float_extend:DF (match_operand:SF 1 "register_operand" "f"))
 (float_extend:DF (match_operand:SF 2 "register_operand" 
"f"]
-  "(TARGET_V8 || TARGET_V9) && TARGET_FPU && !sparc_fix_ut699"
+  "(TARGET_V8 || TARGET_V9) && TARGET_FPU && !sparc_fix_ut699 && !TARGET_LEON"
   "fsmuld\t%1, %2, %0"
   [(set_attr "type" "fpmul")
(set_attr "fptype" "double")])
-- 
2.12.3

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: HiFive1 BSP current state

2017-07-20 Thread Denis Obrezkov
2017-07-18 14:10 GMT+02:00 Joel Sherrill :

> I am not near a computer to check but is there a section in the
> Configuring a System chapter with a low memory example? I know the
> individual options are documented but an example configuration with the
> safer ones to use might help users.
>
Could you point me to the documentation with the Configuration a System
chapter?


-- 
Regards, Denis Obrezkov
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: HiFive1 BSP current state

2017-07-20 Thread Joel Sherrill
https://docs.rtems.org/branches/master/c-user/configuring_a_system.html

The source is here in case you need to submit a patch:

https://git.rtems.org/rtems-docs/tree/c-user/configuring_a_system.rst

--joel

On Thu, Jul 20, 2017 at 4:34 AM, Denis Obrezkov 
wrote:

> 2017-07-18 14:10 GMT+02:00 Joel Sherrill :
>
>> I am not near a computer to check but is there a section in the
>> Configuring a System chapter with a low memory example? I know the
>> individual options are documented but an example configuration with the
>> safer ones to use might help users.
>>
> Could you point me to the documentation with the Configuration a System
> chapter?
>
>
> --
> Regards, Denis Obrezkov
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: HiFive1 BSP current state

2017-07-20 Thread Sebastian Huber

On 20/07/17 11:34, Denis Obrezkov wrote:

2017-07-18 14:10 GMT+02:00 Joel Sherrill >:


I am not near a computer to check but is there a section in the
Configuring a System chapter with a low memory example? I know the
individual options are documented but an example configuration
with the safer ones to use might help users.

Could you point me to the documentation with the Configuration a 
System chapter?


For real low memory systems we need self-contained objects and a static 
initialization.


https://lists.rtems.org/pipermail/devel/2017-February/016874.html

For threads we can use something like this:

struct my_thread {
  Thread_Control thread;
  char space_for_thread_control_addons_and_tls_and_stack[N];
} a;

SYSINIT_THREAD(&a, sizeof(a));

If sizeof(a) is too small, then issue a fatal error.

--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: HiFive1 BSP current state

2017-07-20 Thread Denis Obrezkov
2017-07-20 11:48 GMT+02:00 Sebastian Huber <
sebastian.hu...@embedded-brains.de>:

> On 20/07/17 11:34, Denis Obrezkov wrote:
>
> 2017-07-18 14:10 GMT+02:00 Joel Sherrill > joel.sherr...@gmail.com>>:
>>
>> I am not near a computer to check but is there a section in the
>> Configuring a System chapter with a low memory example? I know the
>> individual options are documented but an example configuration
>> with the safer ones to use might help users.
>>
>> Could you point me to the documentation with the Configuration a System
>> chapter?
>>
>
> For real low memory systems we need self-contained objects and a static
> initialization.
>
> https://lists.rtems.org/pipermail/devel/2017-February/016874.html
>
> For threads we can use something like this:
>
> struct my_thread {
>   Thread_Control thread;
>   char space_for_thread_control_addons_and_tls_and_stack[N];
> } a;
>
> SYSINIT_THREAD(&a, sizeof(a));
>
> If sizeof(a) is too small, then issue a fatal error.
>
> --
> Sebastian Huber, embedded brains GmbH
>
> Address : Dornierstr. 4, D-82178 Puchheim, Germany
> Phone   : +49 89 189 47 41-16
> Fax : +49 89 189 47 41-09
> E-Mail  : sebastian.hu...@embedded-brains.de
> PGP : Public key available on request.
>
> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
>
> I also have a mistake, it happens I think due to memory corruption:

#0  rtems_heap_allocate_aligned_with_boundary (size=541091836,
alignment=2147499792, boundary=0)
at
/home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/../../cpukit/libcsupport/src/malloc_deferred.c:59
#1  0x20417656 in malloc (size=32) at
/home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/../../cpukit/libcsupport/src/malloc.c:39
#2  0x20417052 in calloc (nelem=1, elsize=32) at
/home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/../../cpukit/libcsupport/src/calloc.c:34
#3  0x20401296 in rtems_termios_device_install (device_file=0x2041fe20
"/dev/console", handler=0x2041fe30 , flow=0x0,
context=0x8060 )
at
/home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/../../cpukit/libcsupport/src/termios.c:139
#4  0x2040091e in console_initialize (major=0, minor=0, arg=0x0)
at
/home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/lib/libbsp/riscv32/hifive1/console/fe310-uart.c:49
#5  0x20419632 in rtems_io_initialize (major=0, minor=0, argument=0x0)
at
/home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/../../cpukit/sapi/src/ioinitialize.c:36
#6  0x2040893e in _IO_Initialize_all_drivers () at
/home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/../../cpukit/sapi/src/io.c:33
#7  0x204088e2 in rtems_initialize_executive () at
/home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/../../cpukit/sapi/src/exinit.c:95
#8  0x2040045a in boot_card (cmdline=0x0) at
/home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/lib/libbsp/riscv32/hifive1/../../shared/bootcard.c:76
#9  0xd270 in ?? ()


-- 
Regards, Denis Obrezkov
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel