Re: [PATCH v2] user: Add docu for use of Rust with RTEMS

2024-03-19 Thread Frank Kühndel

Hi Chris,

On 3/19/24 03:24, Chris Johns wrote:

On 16/3/2024 1:14 am, Frank Kühndel wrote:

Ping!

The last discussion of this patch was
https://lists.rtems.org/pipermail/devel/2024-February/077289.html

Does the fact that I recive no further comments to this patch mean it can be
pushed to the RTEMS User Manual as it is?

Sorry Frank, I have been busy with other changes. It is on my list but I have
will need to reread the thread when I have time.


No problem. This can wait.

Greetings,
Frank

--
embedded brains GmbH & Co. KG
Herr Frank KÜHNDEL
Dornierstr. 4
82178 Puchheim
Germany
email: frank.kuehn...@embedded-brains.de
phone:  +49-89-18 94 741 - 23
mobile: +49-176-15 22 06 - 11

Registergericht: Amtsgericht München
Registernummer: HRA 117265
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH v2] user: Add docu for use of Rust with RTEMS

2024-03-18 Thread Chris Johns
On 16/3/2024 1:14 am, Frank Kühndel wrote:
> Ping!
> 
> The last discussion of this patch was
>    https://lists.rtems.org/pipermail/devel/2024-February/077289.html
> 
> Does the fact that I recive no further comments to this patch mean it can be
> pushed to the RTEMS User Manual as it is?

Sorry Frank, I have been busy with other changes. It is on my list but I have
will need to reread the thread when I have time.

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

Re: [PATCH v2] user: Add docu for use of Rust with RTEMS

2024-03-15 Thread Frank Kühndel

Ping!

The last discussion of this patch was
   https://lists.rtems.org/pipermail/devel/2024-February/077289.html

Does the fact that I recive no further comments to this patch mean it 
can be pushed to the RTEMS User Manual as it is?


Greetings
Frank

On 2/23/24 17:29, Frank Kuehndel wrote:

From: Frank Kühndel

---
  user/index.rst   |   3 +-
  user/overview/index.rst  |   2 +
  user/rust/bare-metal.rst | 548 +++
  user/rust/index.rst  |  64 +
  4 files changed, 616 insertions(+), 1 deletion(-)
  create mode 100644 user/rust/bare-metal.rst
  create mode 100644 user/rust/index.rst

diff --git a/user/index.rst b/user/index.rst
index 5b7f3ce..0cc6b2c 100644
--- a/user/index.rst
+++ b/user/index.rst
@@ -18,7 +18,7 @@ RTEMS User Manual (|version|).
  ||copy|  2018 Shashvat Jain
  ||copy|  2018 Vidushi Vashishth
  ||copy|  2017 Tanu Hari Dixit
-||copy|  2016, 2019 embedded brains GmbH & Co. KG
+||copy|  2016, 2024 embedded brains GmbH & Co. KG
  ||copy|  2016, 2019 Sebastian Huber
  ||copy|  2012, 2022 Chris Johns
  ||copy|  2012, 2020 Gedare Bloom
@@ -51,5 +51,6 @@ RTEMS User Manual (|version|).
  
  tools/index

  rsb/index
+rust/index
  
  glossary/index

diff --git a/user/overview/index.rst b/user/overview/index.rst
index 16389d9..cc292e1 100644
--- a/user/overview/index.rst
+++ b/user/overview/index.rst
@@ -66,6 +66,8 @@ RTEMS provides the following basic feature set:
  
  - Python and MicroPython
  
+- :ref:`Rust `

+
  - Parallel languages
  
  - :ref:term:`EMB²`

diff --git a/user/rust/bare-metal.rst b/user/rust/bare-metal.rst
new file mode 100644
index 000..b1c3980
--- /dev/null
+++ b/user/rust/bare-metal.rst
@@ -0,0 +1,548 @@
+.. SPDX-License-Identifier: CC-BY-SA-4.0
+
+.. Copyright (C) 2024 embedded brains GmbH & Co. KG
+
+.. _RustBareMetal:
+
+Bare Metal Rust with RTEMS
+==
+
+To develop with Rust and RTEMS together, you must find a Rust bare metal
+target which matches an RTEMS BSP. The instructions in this section
+are for a SPARC and a Risc-V*hello world*  program. These examples use
+the combinations shown in the table below:
+
+++--++--+
+| RTEMS Architecture | RTEMS BSP| Rust Target| Rust 
CPU |
+++==++==+
+| rtems-sparc| sparc/leon3  | sparc-unknown-none-elf | leon3   
 |
+++--++--+
+| rtems-riscv| riscv/rv64imafdc | riscv64gc-unknown-none-elf | 
generic-rv64 |
+++--++--+
+
+The following sources may be helpful to find a matching BSP and target:
+
+- ``./waf bsplist`` -- executed in an RTEMS git clone
+- ``source-builder/sb-set-builder --list-bsets`` -- executed in an
+  RTEMS source builder git clone
+- `RTEMS Supported 
Architectures`_
+- `RTEMS Board Support 
Packages`_
+- ``rustc --print target-list``
+- ``rustc --target=riscv64gc-unknown-none-elf --print target-features``
+- ``rustc --target=riscv64gc-unknown-none-elf  --print target-cpus``
+- `Rust Platform 
Support`_
+
+The sample instructions which follow build two executables using the
+same source code for the RTEMS configuration ``init.c`` and the Rust
+hello-world application ``lib.rs``. Only the configuration as well as
+the compile and link commands differ for SPARC Leon3 and RISC-V
+64 bit. The Rust application uses ``printk()`` from RTEMS to print
+text to the console.
+
+After building the RTEMS BSP and installing Rust, the basic steps are:
+
+1. Compile the RTEMS configuration in ``init.c`` into an object
+   file using the GNU C compiler from the RTEMS tool chain.
+2. Compile the Rust code containing ``main()`` into a
+   static library using the Rust compiler.
+3. Link the static library with the Rust code,
+   the RTEMS configuration and the RTEMS OS libraries
+   together into one single executable.
+4. Finally run the executable on a simulator.
+
+You can build the examples in a container. This is optional. If you
+prefer to follow these instructions directly on your machine simply
+skip the section*Build a Container*. Just make sure that you machine
+meets all prerequisites to build the RTEMS tools and install the Rust
+tools.
+
+.. _RustBareMetal_Container:
+
+Build a Container
+-
+
+The container must be able to execute the RTEMS source builder and to
+install and run the Rust tools. In an empty directory of your choice
+create the following ``Dockerfile``.
+
+.. code-block:: shell
+
+cat >Dockerfile <<"EOF"
+# Docke