[PATCH] Assembly suppport for context switch and bug fixes

2020-06-29 Thread utkarsh.ra...@gmail.com
From: Utkarsh Rai 

---
 cpukit/score/cpu/arm/cpu.c|  3 +-
 cpukit/score/cpu/arm/cpu_asm.S| 14 ++-
 .../score/cpu/arm/include/rtems/score/cpu.h   | 12 ++-
 cpukit/score/src/stackmanagement.c| 98 +++
 cpukit/score/src/threadloadenv.c  | 11 +++
 5 files changed, 92 insertions(+), 46 deletions(-)

diff --git a/cpukit/score/cpu/arm/cpu.c b/cpukit/score/cpu/arm/cpu.c
index 5ee1acede2..39b5a33c03 100644
--- a/cpukit/score/cpu/arm/cpu.c
+++ b/cpukit/score/cpu/arm/cpu.c
@@ -97,8 +97,9 @@ void _CPU_Context_Initialize(
 )
 {
   (void) new_level;
-
+  #if defined (USE_THREAD_STACK_PROTECTION)
   the_context->stack_attr = prot_stack_context_initialize();
+  #endif
   the_context->register_sp = (uint32_t) stack_area_begin + stack_area_size;
   the_context->register_lr = (uint32_t) entry_point;
   the_context->isr_dispatch_disable = 0;
diff --git a/cpukit/score/cpu/arm/cpu_asm.S b/cpukit/score/cpu/arm/cpu_asm.S
index e7cdd24c2f..2678589483 100644
--- a/cpukit/score/cpu/arm/cpu_asm.S
+++ b/cpukit/score/cpu/arm/cpu_asm.S
@@ -65,9 +65,13 @@ DEFINE_FUNCTION_ARM(_CPU_Context_switch)
 #endif
 
str r3, [r0, #ARM_CONTEXT_CONTROL_ISR_DISPATCH_DISABLE]
-   str r0, [r0, #44]
+#if defined ( USE_THREAD_STACK_PROTECTION )
+mov r2, r0
+   ldr r0, [r0, #ARM_STACK_PROT_ATTR_OFFSET]
bl  prot_stack_context_switch
-   
+   mov r0, r2
+#endif
+
 #ifdef RTEMS_SMP
/*
 * The executing thread no longer executes on this processor.  Switch
@@ -135,6 +139,12 @@ DEFINE_FUNCTION_ARM(_CPU_Context_switch)
  */
 DEFINE_FUNCTION_ARM(_CPU_Context_restore)
 mov r1, r0
+#if defined( USE_THREAD_STACK_PROTECTION )
+   ldr r2,  [lr]
+   ldr r0, [r0, #ARM_STACK_PROT_ATTR_OFFSET]
+   bl  prot_stack_context_restore
+   ldr lr, [r2]
+#endif
GET_SELF_CPU_CONTROLr2
 b   .L_restore
 
diff --git a/cpukit/score/cpu/arm/include/rtems/score/cpu.h 
b/cpukit/score/cpu/arm/include/rtems/score/cpu.h
index 481d50f427..f0af63e532 100644
--- a/cpukit/score/cpu/arm/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/arm/include/rtems/score/cpu.h
@@ -160,6 +160,16 @@
   #define ARM_CONTEXT_CONTROL_THREAD_ID_OFFSET 44
 #endif
 
+#ifdef USE_THREAD_STACK_PROTECTION
+  #if defined ARM_MULITLIB_VFP
+#define ARM_STACK_PROT_ATTR_OFFSET   112
+  #elif ARM_MULTILIB_HAS_THREAD_ID_REGISTER
+#define ARM_STACK_PROT_ATTR_OFFSET  48
+  #else 
+#define ARM_STACK_PROT_ATTR_OFFSET  44
+  #endif 
+#endif
+
 #ifdef ARM_MULTILIB_VFP
   #define ARM_CONTEXT_CONTROL_D8_OFFSET 48
 #endif
@@ -184,8 +194,6 @@
 
 #define ARM_EXCEPTION_FRAME_VFP_CONTEXT_OFFSET 72
 
-#define ARM_STACK_PROT_ATTR_OFFSET  44
-
 #define ARM_VFP_CONTEXT_SIZE 264
 
 
diff --git a/cpukit/score/src/stackmanagement.c 
b/cpukit/score/src/stackmanagement.c
index 5ed8242c50..eff1b59add 100644
--- a/cpukit/score/src/stackmanagement.c
+++ b/cpukit/score/src/stackmanagement.c
@@ -1,7 +1,8 @@
 #include 
 #include 
+#include 
 
-Chain_Control *node_control;
+Chain_Control prot_node_control = CHAIN_INITIALIZER_EMPTY(prot_node_control);
 
 Chain_Control *shared_node_control;
 
@@ -20,71 +21,82 @@ static void shared_stack_entry_remove(stack_attr_shared 
*shared_stack)
 memory_entries_unset(shared_stack->Base.stack_address, 
shared_stack->Base.size);
 node = node->next;
 }
-
 }
 }
 
-static void prot_stack_prev_entry_remove(stack_attr_prot *stack_attr)
+static void prot_stack_prev_entry_remove(void)
 {
- 
+
  Chain_Node *node;
-/*
-  if(node_control == NULL) {
-  _Chain_Initialize_empty(node_control);
+ stack_attr_prot *stack_attr;
+
+  if( _Chain_Is_empty(&prot_node_control) == true ) {
+  _Chain_Initialize_empty(&prot_node_control);
   }
-  */   
- while(!_Chain_Is_tail(node_control, node)) {
- stack_attr = (stack_attr_prot*) node;
+ node = _Chain_First( &prot_node_control );
+ 
+ while(_Chain_Is_tail(&prot_node_control, node) == false) {
 
-if( stack_attr->current_stack == false ) {
+stack_attr = RTEMS_CONTAINER_OF(node,stack_attr_prot, Base.node); 
+
+if( stack_attr->current_stack == false && 
_Chain_Is_head(&prot_node_control, node) == false ) {
 memory_entries_unset(stack_attr->Base.stack_address, 
stack_attr->Base.size);
-shared_stack_entry_remove(stack_attr->shared_stacks);
-node = node->next;
+ //   shared_stack_entry_remove(stack_attr->shared_stacks);
+
 }
+node =  _Chain_Immutable_next( node );
  }
- 
- 
+   
+   return ;
 }
 
-static void prot_stack_chain_append (Chain_Control *control, stack_attr_prot 
*stack_attr)  //maybe we don't need the chain control parameter to be passed 
+static void prot_stack_chain_append (Chain_Control *control, stack_attr_prot 
*stack_append_attr)  //maybe we don't need the chain con

[PATCH] This patch provides usage of RTEMS cross-compiler over GCC cross-compiler

2020-03-22 Thread utkarsh.ra...@gmail.com
---
 user/start/tools.rst | 25 +
 1 file changed, 25 insertions(+)

diff --git a/user/start/tools.rst b/user/start/tools.rst
index c3f039b..8a1f393 100644
--- a/user/start/tools.rst
+++ b/user/start/tools.rst
@@ -76,3 +76,28 @@ source code used.
 
 
 Add ``--verbose`` to the GCC command for the the verbose version details.
+
+RTEMS cross-compiler over GCC cross-compiler
+
+The new users are often confused as to why they can't use their 
distributions cross-compiler for their target on rtems, e.g., 
+the riscv64-linux-gnu or the arm-none-eabi-gcc.Below mentioned are some 
the reasons for using the RTEMS cross-compiler.
+
+ ``Correct configuration of newlib`` - 
+Newlib is a C standard library implementation intended 
+for use on embedded systems. Most of the POSIX and libc support for RTEMS 
is derived from newlib.
+The RTEMS cross-compiler configures newlib correctly for RTEMS.
+
+ ``Threading in GCC supported libraries`` -
+GCC supported threading libraries such as ``pthread.h`` 
+provide threading support to an application,these libraries are tailored 
according to RTEMS using
+the RTEMS cross-compiler.
+
+ ``Provide preprocessor define _rtems_`` -
+The ``_rtems_`` preprocessor define is genarally used to include rtems 
+specific libraries.This preprocessor define is provided by the RTEMS 
cross-compiler at the compile time.
+
+ ``Multilib variants to match the BSP``- 
+RTEMS configures GCC to create separate runtime libraries for
+each   supported instruction set, floating point unit, vector unit, word 
size (e.g. 32-bit and 64-bit), endianess,
+code model, ABI, processor errata workarounds, and so on in the 
architecture. This is termed multilib.
+Multilibs variants to match the BSP are set by selecting a specific set of 
machine options using the RTEMS cross-compiler.
-- 
2.17.1

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


[PATCH] This patch provides usage of RTEMS cross-compiler over GCC cross-compiler

2020-03-22 Thread utkarsh.ra...@gmail.com
Really sorry for a new patch, I somehow rm -rf'ed my machine's root
---
 user/start/tools.rst | 16 
 1 file changed, 16 insertions(+)

diff --git a/user/start/tools.rst b/user/start/tools.rst
index c3f039b..3bb939e 100644
--- a/user/start/tools.rst
+++ b/user/start/tools.rst
@@ -76,3 +76,19 @@ source code used.
 
 
 Add ``--verbose`` to the GCC command for the the verbose version details.
+
+Need for RTEMS-Specific Cross-Compiler
+
+  New users are often confused as to why they can't use their distribution's 
cross-compiler for their target on rtems, e.g.,the riscv64-linux-gnu or the 
arm-none-eabi-gcc. Below mentioned are some of the reasons for using the RTEMS 
cross-compiler.
+
+ ``Correct configuration of newlib`` -
+Newlib is a C standard library implementation intended for use on embedded 
systems. Most of the POSIX and libc support for RTEMS is derived from newlib. 
The RTEMS cross-compiler configures newlib correctly for RTEMS.
+
+ ``Threading in GCC support libraries`` -
+GCC support threading libraries such as ``pthread.h`` provide threading 
support to an application; these libraries are tailored according to RTEMS 
using the RTEMS cross-compiler.
+   
+ ``Provide preprocessor define __rtems__`` -
+The ``__rtems__`` preprocessor define is used to provide conditional code 
compilation in source files that are shared with other projects e.g. in newlib 
or imported code from freebsd.
+
+ ``Multilib variants to match the BSP``-
+RTEMS configures GCC to create separate runtime libraries for each 
supported instruction set, floating point unit, vector unit, word size (e.g. 
32-bit and 64-bit), endianness, ABI, processor errata workarounds,and so on in 
the architecture. These libraries are termed multilib variants. Multilibs 
variants to match the BSP are set by selecting a specific set of machine 
options using the RTEMS cross-compiler.
-- 
2.17.1

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


[PATCH 16/16] This patch provides usage of RTEMS cross-compiler over GCC cross-compiler

2020-03-24 Thread utkarsh.ra...@gmail.com
---
 user/start/tools.rst | 35 +--
 1 file changed, 25 insertions(+), 10 deletions(-)

diff --git a/user/start/tools.rst b/user/start/tools.rst
index 92e99c8..3a6da3a 100644
--- a/user/start/tools.rst
+++ b/user/start/tools.rst
@@ -79,17 +79,32 @@ Add ``--verbose`` to the GCC command for the the verbose 
version details.
 
 Need for RTEMS-Specific Cross-Compiler
 
-  New users are often confused as to why they can't use their distribution's 
cross-compiler for their target on rtems, e.g.,the riscv64-linux-gnu or the 
arm-none-eabi-gcc. Below mentioned are some of the reasons for using the RTEMS 
cross-compiler.
 
- ``Correct configuration of newlib`` -
-Newlib is a C standard library implementation intended for use on embedded 
systems. Most of the POSIX and libc support for RTEMS is derived from newlib. 
The RTEMS cross-compiler configures newlib correctly for RTEMS.
+New users are often confused as to why they can't use their distribution's
+cross-compiler for their target on rtems, e.g.,the riscv64-linux-gnu or the
+arm-none-eabi-gcc. Below mentioned are some of the reasons for using the RTEMS
+cross-compiler.
 
- ``Threading in GCC support libraries`` -
-GCC support threading libraries such as ``pthread.h`` provide threading 
support to an application; these libraries are tailored according to RTEMS 
using the RTEMS cross-compiler.
-   
- ``Provide preprocessor define __rtems__`` -
-The ``__rtems__`` preprocessor define is used to provide conditional code 
compilation in source files that are shared with other projects e.g. in newlib 
or imported code from freebsd.
+ ``Correct configuration of newlib`` - 
+ Newlib is a C standard library implementation intended for use on embedded
+ systems. Most of the POSIX and libc support for RTEMS is derived from newlib.
+ The RTEMS cross-compiler configures newlib correctly for RTEMS.
 
- ``Multilib variants to match the BSP``-
-RTEMS configures GCC to create separate runtime libraries for each 
supported instruction set, floating point unit, vector unit, word size (e.g. 
32-bit and 64-bit), endianness, ABI, processor errata workarounds,and so on in 
the architecture. These libraries are termed multilib variants. Multilibs 
variants to match the BSP are set by selecting a specific set of machine 
options using the RTEMS cross-compiler.
+ ``Threading in GCC support libraries`` - 
+ GCC support threading libraries such as ``pthread.h`` provide threading 
support
+ to an application; these libraries are tailored according to RTEMS using the
+ RTEMS cross-compiler.
+   
+ ``Provide preprocessor define __rtems__`` - 
+ The ``__rtems__`` preprocessor define is used to provide conditional code
+ compilation in source files that are shared with other projects e.g. in newlib
+ or imported code from freebsd.
+
+ ``Multilib variants to match the BSP``- 
+ RTEMS configures GCC to create separate runtime libraries for each supported
+ instruction set, floating point unit, vector unit, word size (e.g. 32-bit and
+ 64-bit), endianness, ABI, processor errata workarounds,and so on in the
+ architecture. These libraries are termed multilib variants. Multilibs variants
+ to match the BSP are set by selecting a specific set of machine options using
+ the RTEMS cross-compiler.
 
-- 
2.17.1

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


[PATCH] This patch provides usage of RTEMS cross-compiler over GCC cross-compiler

2020-03-25 Thread utkarsh.ra...@gmail.com
---
 user/start/tools.rst | 31 +++
 1 file changed, 31 insertions(+)

diff --git a/user/start/tools.rst b/user/start/tools.rst
index c3f039b..c3147e8 100644
--- a/user/start/tools.rst
+++ b/user/start/tools.rst
@@ -76,3 +76,34 @@ source code used.
 
 
 Add ``--verbose`` to the GCC command for the the verbose version details.
+
+Need for RTEMS-Specific Cross-Compiler
+
+ 
+New users are often confused as to why they can't use their distribution's
+cross-compiler for their target on rtems, e.g.,the riscv64-linux-gnu or the
+arm-none-eabi-gcc. Below mentioned are some of the reasons for using the RTEMS
+cross-compiler.
+
+ ``Correct configuration of newlib -`` 
+  Newlib is a C standard library implementation intended for use on embedded
+  systems. Most of the POSIX and libc support for RTEMS is derived from newlib.
+  The RTEMS cross-compiler configures newlib correctly for RTEMS.
+
+ ``Threading in GCC support libraries -`` 
+  GCC support threading libraries such as ``pthread.h`` provide threading
+  support to an application; these libraries are tailored according to RTEMS 
using
+  the RTEMS cross-compiler.
+   
+ ``Provide preprocessor define __rtems__ -``  
+  The ``__rtems__`` preprocessor define is used to provide conditional code
+  compilation in source files that are shared with other projects e.g. in 
newlib
+  or imported code from freebsd.
+
+ ``Multilib variants to match the BSP -`` 
+  RTEMS configures GCC to create separate runtime libraries for each supported
+  instruction set, floating point unit, vector unit, word size (e.g. 32-bit and
+  64-bit), endianness, ABI, processor errata workarounds,and so on in the
+  architecture. These libraries are termed multilib variants. Multilibs 
variants
+  to match the BSP are set by selecting a specific set of machine options using
+  the RTEMS cross-compiler.
-- 
2.17.1

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


[PATCH] Chapter on need for RTEMS-specific cross-compiler

2020-03-26 Thread utkarsh.ra...@gmail.com
---
 user/start/tools.rst | 31 +++
 1 file changed, 31 insertions(+)

diff --git a/user/start/tools.rst b/user/start/tools.rst
index c3f039b..63b6d17 100644
--- a/user/start/tools.rst
+++ b/user/start/tools.rst
@@ -76,3 +76,34 @@ source code used.
 
 
 Add ``--verbose`` to the GCC command for the the verbose version details.
+ 
+Need for RTEMS-Specific Cross-Compiler
+
+
+New users are often confused as to why they can't use their distribution's
+cross-compiler for their target on rtems, e.g., the riscv64-linux-gnu or the
+arm-none-eabi-gcc. Below mentioned are some of the reasons for using the RTEMS
+cross-compiler.
+
+ ``Correct configuration of newlib -`` 
+  Newlib is a C standard library implementation intended for use on embedded
+  systems. Most of the POSIX and libc support for RTEMS is derived from newlib.
+  The RTEMS cross-compiler configures newlib correctly for RTEMS.
+
+ ``Threading in GCC support libraries -`` 
+  Several threading packages in GCC such as Go threads (libgo), openmp
+  (libgomp), and openacc need to be customized according to RTEMS. This is done
+  by the RTEMS specific cross-compiler.
+  
+ ``Provide preprocessor define __rtems__ -`` 
+  The  ``__rtems__``  preprocessor define is used to provide conditional code
+  compilation in source files that are shared with other projects e.g. in 
newlib
+  or imported code from freebsd.
+
+ ``Multilib variants to match the BSP -`` 
+  RTEMS configures GCC to create separate runtime libraries for each supported
+  instruction set, floating point unit, vector unit, word size (e.g. 32-bit and
+  64-bit), endianness, ABI, processor errata workarounds, and so on in the
+  architecture. These libraries are termed multilib variants. Multilibs 
variants
+  to match the BSP are set by selecting a specific set of machine options using
+  the RTEMS cross-compiler.
-- 
2.17.1

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


[PATCH v2] Chapter-on-need-for-RTEMS-specific-cross-compiler

2020-03-27 Thread utkarsh.ra...@gmail.com
---
 user/start/tools.rst | 34 ++
 1 file changed, 34 insertions(+)

diff --git a/user/start/tools.rst b/user/start/tools.rst
index c3f039b..8ea1f64 100644
--- a/user/start/tools.rst
+++ b/user/start/tools.rst
@@ -3,6 +3,7 @@
 .. Copyright (C) 2019 embedded brains GmbH
 .. Copyright (C) 2019 Sebastian Huber
 .. Copyright (C) 2020 Chris Johns
+.. Copyright (C) 2020 Utkarsh Rai
 
 .. _QuickStartTools:
 
@@ -76,3 +77,36 @@ source code used.
 
 
 Add ``--verbose`` to the GCC command for the the verbose version details.
+
+ 
+Need for RTEMS-Specific Cross-Compiler
+
+
+New users are often confused as to why they cannot use their distribution's
+cross-compiler for their target on rtems, e.g., the riscv64-linux-gnu or the
+arm-none-eabi-gcc on RTEMS. Below mentioned are some of the reasons for using
+the RTEMS cross-compiler.
+
+ ``Correct configuration of Newlib -`` 
+ Newlib is a C standard library implementation intended for use on embedded
+ systems. Most of the POSIX and libc support for RTEMS is derived from
+ Newlib. The RTEMS cross-compiler configures Newlib correctly for RTEMS.
+
+ ``Threading in GCC support libraries -`` 
+ Several threading packages in GCC such as Go threads (libgo), OpenMP
+ (libgomp), and OpenACC need to be customized according to RTEMS. This is
+ done by the RTEMS specific cross-compiler.
+  
+ ``Provide preprocessor define __rtems__ -`` 
+ The  ``__rtems__``  preprocessor define is used to provide conditional 
code
+ compilation in source files that are shared with other projects e.g. in
+ Newlib or imported code from FreeBSD.
+
+ ``Multilib variants to match the BSP -`` 
+ RTEMS configures GCC to create separate runtime libraries for each
+ supported instruction set, floating point unit, vector unit, word size
+ (e.g. 32-bit and 64-bit), endianness, ABI, processor errata workarounds,
+ and so on in the architecture. These libraries are termed multilib 
variants
+ 
(https://docs.rtems.org/branches/master/user/hardware/architectures.html?highlight=multilib).
+ Multilibs variants to match the BSP are set by selecting a specific set of
+ machine options using the RTEMS cross-compiler.
-- 
2.17.1

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


[PATCH v3] Chapter-on-need-for-RTEMS-specific-cross-compiler

2020-04-03 Thread utkarsh.ra...@gmail.com
---
 user/start/tools.rst | 33 +
 1 file changed, 33 insertions(+)

diff --git a/user/start/tools.rst b/user/start/tools.rst
index c3f039b..494e95a 100644
--- a/user/start/tools.rst
+++ b/user/start/tools.rst
@@ -76,3 +76,36 @@ source code used.
 
 
 Add ``--verbose`` to the GCC command for the the verbose version details.
+
+
+Need for RTEMS-Specific Cross-Compiler
+-
+
+New users are often confused as to why they cannot use their distribution's
+cross-compiler for their target on rtems, e.g., the riscv64-linux-gnu or the
+arm-none-eabi-gcc on RTEMS. Below mentioned are some of the reasons for using
+the RTEMS cross-compiler.
+
+ ``Correct configuration of Newlib -`` 
+ Newlib is a C standard library implementation intended for use on embedded
+ systems. Most of the POSIX and libc support for RTEMS is derived from
+ Newlib. The RTEMS cross-compiler configures Newlib correctly for RTEMS.
+
+ ``Threading in GCC support libraries -`` 
+ Several threading packages in GCC such as Go threads (libgo), OpenMP
+ (libgomp), and OpenACC need to be customized according to RTEMS. This is
+ done by the RTEMS specific cross-compiler.
+  
+ ``Provide preprocessor define __rtems__ -`` 
+ The  ``__rtems__``  preprocessor define is used to provide conditional 
code
+ compilation in source files that are shared with other projects e.g. in
+ Newlib or imported code from FreeBSD.
+
+ ``Multilib variants to match the BSP -`` 
+ RTEMS configures GCC to create separate runtime libraries for each
+ supported instruction set, floating point unit, vector unit, word size
+ (e.g. 32-bit and 64-bit), endianness, ABI, processor errata workarounds,
+ and so on in the architecture. These libraries are termed as 
:ref:`Multilib
+ ` variants. Multilib variants to match the BSP are 
set
+ by selecting a specific set of machine options using the RTEMS
+ cross-compiler.
-- 
2.17.1

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


[PATCH v4] Chapter-on-need-for-RTEMS-specific-cross-compiler

2020-04-03 Thread utkarsh.ra...@gmail.com
---
 user/start/tools.rst | 33 +
 1 file changed, 33 insertions(+)

diff --git a/user/start/tools.rst b/user/start/tools.rst
index c3f039b..9a3a93a 100644
--- a/user/start/tools.rst
+++ b/user/start/tools.rst
@@ -3,6 +3,7 @@
 .. Copyright (C) 2019 embedded brains GmbH
 .. Copyright (C) 2019 Sebastian Huber
 .. Copyright (C) 2020 Chris Johns
+.. Copyright (C) 2020 Utkarsh Rai
 
 .. _QuickStartTools:
 
@@ -76,3 +77,35 @@ source code used.
 
 
 Add ``--verbose`` to the GCC command for the the verbose version details.
+
+Need for RTEMS-Specific Cross-Compiler
+-
+
+New users are often confused as to why they cannot use their distribution's
+cross-compiler for their target on rtems, e.g., the riscv64-linux-gnu or the
+arm-none-eabi-gcc on RTEMS. Below mentioned are some of the reasons for using
+the RTEMS cross-compiler.
+
+ ``Correct configuration of Newlib -``
+ Newlib is a C standard library implementation intended for use on embedded
+ systems. Most of the POSIX and libc support for RTEMS is derived from
+ Newlib. The RTEMS cross-compiler configures Newlib correctly for RTEMS.
+
+ ``Threading in GCC support libraries -``
+ Several threading packages in GCC such as Go threads (libgo), OpenMP
+ (libgomp), and OpenACC need to be customized according to RTEMS. This is
+ done by the RTEMS specific cross-compiler.
+
+ ``Provide preprocessor define __rtems__ -``
+ The  ``__rtems__``  preprocessor define is used to provide conditional 
code
+ compilation in source files that are shared with other projects e.g. in
+ Newlib or imported code from FreeBSD.
+
+ ``Multilib variants to match the BSP -``
+ RTEMS configures GCC to create separate runtime libraries for each
+ supported instruction set, floating point unit, vector unit, word size
+ (e.g. 32-bit and 64-bit), endianness, ABI, processor errata workarounds,
+ and so on in the architecture. These libraries are termed as 
:ref:`Multilib
+ ` variants. Multilib variants to match the BSP are 
set
+ by selecting a specific set of machine options using the RTEMS
+ cross-compiler.
-- 
2.17.1

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


[PATCH v5] Chapter-on-need-for-RTEMS-specific-cross-compiler

2020-04-03 Thread utkarsh.ra...@gmail.com
---
 user/start/tools.rst | 32 
 1 file changed, 32 insertions(+)

diff --git a/user/start/tools.rst b/user/start/tools.rst
index c3f039b..c1cd141 100644
--- a/user/start/tools.rst
+++ b/user/start/tools.rst
@@ -76,3 +76,35 @@ source code used.
 
 
 Add ``--verbose`` to the GCC command for the the verbose version details.
+
+Need for RTEMS-Specific Cross-Compiler
+-
+
+New users are often confused as to why they cannot use their distribution's
+cross-compiler for their target on rtems, e.g., the riscv64-linux-gnu or the
+arm-none-eabi-gcc on RTEMS. Below mentioned are some of the reasons for using
+the RTEMS cross-compiler.
+
+* ``Correct configuration of Newlib -``
+ Newlib is a C standard library implementation intended for use on embedded
+ systems. Most of the POSIX and libc support for RTEMS is derived from
+ Newlib. The RTEMS cross-compiler configures Newlib correctly for RTEMS.
+
+* ``Threading in GCC support libraries -``
+ Several threading packages in GCC such as Go threads (libgo), OpenMP
+ (libgomp), and OpenACC need to be customized according to RTEMS. This is
+ done by the RTEMS specific cross-compiler.
+
+* ``Provide preprocessor define __rtems__ -``
+ The  ``__rtems__``  preprocessor define is used to provide conditional 
code
+ compilation in source files that are shared with other projects e.g. in
+ Newlib or imported code from FreeBSD.
+
+* ``Multilib variants to match the BSP -``
+ RTEMS configures GCC to create separate runtime libraries for each
+ supported instruction set, floating point unit, vector unit, word size
+ (e.g. 32-bit and 64-bit), endianness, ABI, processor errata workarounds,
+ and so on in the architecture. These libraries are termed as 
:ref:`Multilib
+ ` variants. Multilib variants to match the BSP are 
set
+ by selecting a specific set of machine options using the RTEMS
+ cross-compiler.
-- 
2.17.1

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