-
Notifications
You must be signed in to change notification settings - Fork 4
/
README.patmos
68 lines (42 loc) · 2.04 KB
/
README.patmos
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
PATMOS NEWLIB README
This is a port of the newlib C library for the Patmos processor. We rely on LLVM
as a compiler, such that all system libraries are compiled to LLVM byte-code
(LLVM BC).
--------------------------------------------------------------------------------
1. Requirements
- LLVM and Clang for Patmos
https://github.com/t-crest/patmos-llvm
https://github.com/t-crest/patmos-clang
- really not much else
--------------------------------------------------------------------------------
2. Configure
In order to configure the build correctly use the following command, assuming
LLVM/Clang are installed unter ${LLVM_DIR}:
configure --target=patmos-unknown-unknown-elf AR_FOR_TARGET=${LLVM_DIR}/bin/patmos-llvm-ar \
RANLIB_FOR_TARGET=${LLVM_DIR}/bin/patmos-llvm-ranlib \
LD_FOR_TARGET=${LLVM_DIR}/bin/patmos-llvm-ld \
CC_FOR_TARGET=${LLVM_DIR}/bin/patmos-clang \
CFLAGS_FOR_TARGET="-target patmos-unknown-unknown-elf -O3" \
--prefix=${LLVM_DIR}
This overrides some variables in order to use the LLVM tools and the Clang C
compiler to generate LLVM-BC-based library and start-up files for Patmos. The
library is configured to be installed under the LLVM install directory, since
the LLVM/Clang tool chain refers to that location to search for includes and
libraries.
optional options:
--enable-newlib-multithread=no
--disable-newlib-io-float
--------------------------------------------------------------------------------
3. Build and install
That is simple:
make && make install
--------------------------------------------------------------------------------
4. Using Patmos' newlib
The LLVM/Clang tool chain is configured to use Patmos' newlib port by default.
All that needs to be done is to make sure that the Clang compiler generates
Patmos code:
clang -target patmos-unknown-unknown-elf -o test test.c
This compiles test.c into an LLVM BC file, links that BC file with the
LLVM-BC-based newlib library and start-up files and generates native Patmos code
from there.
Have fun!