Skip to content

Commit f3393e2

Browse files
committed
arcv: Add a section about building C++ applications with Picolibc
Signed-off-by: Yuriy Kolerov <ykolerov@synopsys.com>
1 parent 242d7d4 commit f3393e2

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

docs/arcv/building-picolibc.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,35 @@ Hello, World!
8484
Refer to [Running on nSIM](./nsim.md) and [Running on QEMU](./qemu.md) to learn how
8585
to run ARC-V examples on nSIM or QEMU simulator.
8686

87+
## Compiling C++ applications
88+
89+
Consider a simple code example:
90+
91+
```c
92+
#include <iostream>
93+
94+
int main()
95+
{
96+
std::cout << "Hello, World!" << std::endl;
97+
return 0;
98+
}
99+
```
100+
101+
For compiling C++ applications use `-specs=picolibcpp.specs`:
102+
103+
```
104+
$ riscv64-snps-elf-gcc \
105+
-march=rv32imafc \
106+
-mabi=ilp32f \
107+
-mtune=arc-v-rhx-100-series \
108+
-specs=picolibcpp.specs \
109+
--crt0=semihost \
110+
--oslib=semihost \
111+
-Wl,--defsym=__flash_size=2M \
112+
-Wl,--defsym=__ram_size=2M \
113+
example.c -o example.elf
114+
```
115+
87116
## Choosing a `crt0` variant
88117

89118
A variant of a startup file (`crt0.o`) is chosen through `--crt0=` option. See a list of all supported values for this option below.

0 commit comments

Comments
 (0)