Browse Source

Add README.md

sh3port
Memallox 1 year ago
parent
commit
f92ef41904
1 changed files with 64 additions and 0 deletions
  1. 64
    0
      README.md

+ 64
- 0
README.md View File

@@ -0,0 +1,64 @@


# Newlib - a C Standard Library for Casio Calulators

## Motivation
Until now there was no complete [C standard library]([https://en.wikipedia.org/wiki/C_standard_library]) (aka libc) available for the Casio calculators. Although some parts of this library have been provided by fxlib and [gint](https://git.planet-casio.com/lephe/gint), there was no libc implementation complying with the standard and compatible with the sh3eb architecture ready to use.

To change that, I decided to port [newlib](https://sourceware.org/newlib/) to the Casio CPU. Newlib is an alternative libc implementation intended for use on embedded systems.

## Alpha
Follow this link and click the download button in the top right corner:

[v1.1](https://git.planet-casio.com/Memallox/libc/tags/sh3eb_v1.01)


## Installation
*For a complete tutorial on how to setup a toolchain for Casio calculators, see [Compiler sous Linux avec GCC](https://www.planet-casio.com/Fr/programmation/tutoriels.php?id=61#E7).*

To build newlib, you first need binutils and gcc for the target `sh3eb-elf`. Make sure to configure gcc with the arguments `--with-newlib --without-headers`.

Now you can install newlib. Simply call configure and make:

```bash
../newlib-cygwin/configure --target=sh3eb-elf --prefix=...
make
make install
```

Afterwards, you have to build gcc again with the argument `--with-newlib`.

For a more detailes tutorial about how to setup newlib in general, see this [more detailed turorial](http://www.ifp.illinois.edu/~nakazato/tips/xgcc.html#newlib).


## Features for Casio fx9860g calculators:
* C standard library libc
* printf implementation to print text to the display
* Dynamic allocation of memory using malloc and free
* Memory manipulation using memcpy, memcmp, memset etc.
* String manipulation using strcpy, strcmp, strstr, strtok
* ...
* Math library libm
* Floating point arithmetics
* ...
* Automatic library and include path recognition after installation
* Basic Casio features:
* implementation of GetKey, Bdisp_AllClr_DDVRAM, Bdisp_PutDisp_DD, Print and locate without fxlib (but you can use it if you want)


# Further information
## Upstream Repository

Newlib provides releases in their [ftp directory](ftp://sourceware.org/pub/newlib/index.html) and their code on their [git repository](https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git). I try to rebase my fork regulary to their master branch to keep it up-to-date.

## The target `sh3eb-elf`

There is a [great explanation](https://wiki.gentoo.org/wiki/Embedded_Handbook/Tuples) on the naming convention of targets. To really understand what `sh3eb-elf` means, I'll boil it down for you:

To compile code for our Casio calulator, we need to tell newlib where we want to run the code. In our case, the *target*'s name is `sh3eb-elf`.

`sh` is here short for the [SuperH](https://www.renesas.com/us/en/products/microcontrollers-microprocessors/superh.html#) processor architecture. (Fortunately, newlib supports SuperH the by default.)

To be more specific, `sh3` is a 32-bit CPU architecture of the SuperH family. Furthermore, `eb` stands for the `big endian` format (that indicates the [byte order](https://en.wikipedia.org/wiki/Endianness) used for multi-byte variables). Usually a target also indicates a vendor which in this case is `unknown`. Lastly, the end of the target's name is `elf` (which is usually the kernel). Here, we have no kernel (and hence no operating system) at all.

For newlib, the target `sh3eb` had to be specifically added.

Loading…
Cancel
Save