2020-10-24 14:03:04 +02:00
|
|
|
# Soft-FP sh3eb port of OpenLibm
|
|
|
|
|
|
|
|
This is a fork of [OpenLibm](https://github.com/JuliaMath/openlibm) with
|
|
|
|
support for the sh3eb architecture, intended for add-in programming on fx-9860G
|
|
|
|
and fx-CG 50.
|
|
|
|
|
2021-01-25 17:57:54 +01:00
|
|
|
## Installing with GiteaPC
|
|
|
|
|
|
|
|
This library can be installed automatically with [GiteaPC](https://gitea.planet-casio.com/Lephenixnoir/GiteaPC).
|
|
|
|
|
|
|
|
```
|
|
|
|
% giteapc install Lephenixnoir/OpenLibm
|
|
|
|
```
|
|
|
|
|
|
|
|
## Building manually
|
2020-10-24 14:03:04 +02:00
|
|
|
|
|
|
|
You will need a GCC toolchain built with `--target=sh3eb-elf`, such as the
|
|
|
|
`sh-elf-gcc` commonly used on Planète Casio.
|
|
|
|
|
|
|
|
First locate the compiler's install directory. This is normally the
|
|
|
|
`lib/gcc/sh3eb-elf/<version>/` folder inside the install path of the compiler.
|
|
|
|
|
|
|
|
```
|
|
|
|
% PREFIX=$(sh-elf-gcc --print-search-dirs | grep install | sed 's/install: //')
|
|
|
|
```
|
|
|
|
|
|
|
|
You can then build and install the static `libopenlibm.a` archive and the headers.
|
|
|
|
|
|
|
|
```
|
2021-05-20 23:29:39 +02:00
|
|
|
% make USEGCC=1 TOOLPREFIX=sh-elf- AR=sh-elf-ar CC=sh-elf-gcc libdir="$PREFIX" includedir="$PREFIX/include" install-static install-headers
|
2020-10-24 14:03:04 +02:00
|
|
|
```
|
|
|
|
|
2021-05-02 15:05:36 +02:00
|
|
|
## Using in a Makefile-based add-in
|
2020-10-24 14:03:04 +02:00
|
|
|
|
2021-05-02 15:05:36 +02:00
|
|
|
Link with `-lopenlibm` as you would do with `-lm`. Since OpenLibm headers
|
|
|
|
reference themselves by file name (`#include <openlibm_complex.h>`) even though
|
|
|
|
they are installed in a subfolder, you need a `-I` flag:
|
|
|
|
|
|
|
|
```
|
|
|
|
CFLAGS += -I $(shell sh-elf-gcc -print-file-name=include/openlibm)
|
|
|
|
LDFLAGS += -lopenlibm
|
|
|
|
```
|
|
|
|
|
|
|
|
## Using in a CMake-based add-in
|
|
|
|
|
|
|
|
When using CMake with the fxSDK, add the include folder and library like this.
|
|
|
|
|
|
|
|
```
|
|
|
|
target_include_directories(<TARGET> PRIVATE "${FXSDK_COMPILER_INSTALL}/include/openlibm")
|
|
|
|
target_link_libraries(<TARGET> -lopenlibm)
|
|
|
|
```
|
2020-10-24 14:03:04 +02:00
|
|
|
|
|
|
|
## README and Licensing
|
|
|
|
|
2021-05-02 15:05:36 +02:00
|
|
|
See the original README file in [README-OpenLibm.md](README-OpenLibm.md).
|
|
|
|
OpenLibm contains code covered by various licenses, see
|
|
|
|
[LICENSE.md](LICENSE.md).
|