|
| 1 | +.. _external_module_zscilib: |
| 2 | + |
| 3 | +Zephyr Scientific Library (zscilib) |
| 4 | +################################### |
| 5 | + |
| 6 | +Introduction |
| 7 | +************ |
| 8 | + |
| 9 | +The Zephyr Scientific Library (`zscilib`_) is an attempt to provide a set of |
| 10 | +functions useful for scientific computing, data analysis, and data manipulation |
| 11 | +in the context of resource-constrained embedded hardware devices. |
| 12 | + |
| 13 | +It is written entirely in C. While the main development target for the library |
| 14 | +is the Zephyr Project, it aims to be as portable as possible. A standalone |
| 15 | +reference project is included to use this library in non-Zephyr-based projects. |
| 16 | + |
| 17 | +Usage with Zephyr |
| 18 | +***************** |
| 19 | + |
| 20 | +To pull in zscilib as a Zephyr module, either add it as a West project in the ``west.yaml`` |
| 21 | +file or pull it in by adding a submanifest (e.g. ``zephyr/submanifests/zscilib.yaml``) file |
| 22 | +with the following content and run ``west update``: |
| 23 | + |
| 24 | +.. code-block:: yaml |
| 25 | +
|
| 26 | + manifest: |
| 27 | + projects: |
| 28 | + - name: zscilib- |
| 29 | + url: https://github.com/zephyrproject-rtos/zscilib |
| 30 | + revision: main |
| 31 | + path: modules/lib/zscilib # adjust the path as needed |
| 32 | +
|
| 33 | +For more detailed instructions and API documentation, refer to the `zscilib documentation`_ as |
| 34 | +well as the provided `zscilib examples`_. |
| 35 | + |
| 36 | + |
| 37 | +Running a sample application |
| 38 | +============================ |
| 39 | + |
| 40 | +To run one of the sample applications using qemu, run the following commands: |
| 41 | + |
| 42 | +Be sure to run source zephyr/zephyr-env.sh (OS X or Linux) or |
| 43 | +.\zephyr\zephyr-env.cmd (Windows) before the commands below! |
| 44 | +This also assumes qemu-system-arm is available on your local system. |
| 45 | + |
| 46 | +.. code-block:: console |
| 47 | +
|
| 48 | + $ west build -p -b qemu_cortex_a53 \ |
| 49 | + samples/matrix/mult -t run |
| 50 | + ... |
| 51 | + *** Booting Zephyr OS build zephyr-v2.6.0-536-g89212a7fbf5f *** |
| 52 | + zscilib matrix mult demo |
| 53 | +
|
| 54 | +
|
| 55 | + mtx multiply output (4x3 * 3x4 = 4x4): |
| 56 | +
|
| 57 | + 14.000000 17.000000 20.000000 23.000000 |
| 58 | + 35.000000 44.000000 53.000000 62.000000 |
| 59 | + 56.000000 71.000000 86.000000 101.000000 |
| 60 | + 7.000000 9.000000 11.000000 13.000000 |
| 61 | +
|
| 62 | +Press CTRL+A then x to quit qemu. |
| 63 | + |
| 64 | +Running Unit Tests |
| 65 | +==================== |
| 66 | + |
| 67 | +To run the unit tests for this library, run the following command: |
| 68 | + |
| 69 | +.. code-block:: console |
| 70 | +
|
| 71 | + $ twister --inline-logs -p mps2/an521/cpu0 -T tests |
| 72 | + See the tests folder for further details. |
| 73 | +
|
| 74 | +
|
| 75 | +
|
| 76 | +Reference |
| 77 | +********* |
| 78 | + |
| 79 | +.. _zscilib: |
| 80 | + https://github.com/zephyrproject-rtos/zscilib |
| 81 | + |
| 82 | +.. _zscilib documentation: |
| 83 | + https://zephyrproject-rtos.github.io/zscilib/ |
| 84 | + |
| 85 | +.. _zscilib examples: |
| 86 | + https://github.com/zephyrproject-rtos/zscilib/tree/master/samples |
0 commit comments