You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/nuttx-rv64ilp32.md
+11-13Lines changed: 11 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -12,14 +12,14 @@ So how can NuttX benefit from this `rv64ilp32` thing?
12
12
13
13
## The toolchain
14
14
15
-
After downloading the [RuyiSDK rv64ilp32 toolchain](https://github.com/ruyisdk/riscv-gnu-toolchain-rv64ilp32/releases), playing the `hello` demo and raising questions to the friendly toolchain experts, concepts about how it works have been established.
15
+
After downloading the [RuyiSDK rv64ilp32 toolchain](https://github.com/ruyisdk/riscv-gnu-toolchain-rv64ilp32/releases), playing the `hello` demo and raising questions to the friendly RuiyiSDK toolchain developers, concepts about how it works have been established.
16
16
17
-
Here are the major points:
17
+
The following are the major points:
18
18
19
-
- The `rv64ilp32` program is of ELF-32 class, but with flag 0x25;
20
-
- The `-rsicv64ilp32`named QEMU tools in the toolchain not only support the `rv64ilp32`program format, but also support masking of the higher 32-bit addresses used by the program;
19
+
- The `rv64ilp32` program ABI is of ELF-32 class, but with flag 0x25;
20
+
- The `-rsicv64ilp32`suffixed QEMU tools within the toolchain not only support `rv64ilp32`ABI, but also support masking of the higher 32-bit addresses on the fly;
21
21
- The toolchain uses `-march=rv64`, `-mabi=ilp32` for rv64ilp32 binaries;
22
-
- The compiler has `__riscv_xlen_t==64` and `sizeof(void*)==32` defined for programs to adapt themselves;
22
+
- The compiler has `__riscv_xlen_t==64` and `sizeof(void*)==32` defined for programs to adapt themselves to this ABI;
23
23
- Access to addresses beyond 4G space shall be done via assembly as compiled address has been limited in 32-bit.
24
24
25
25
## Building NuttX
@@ -29,7 +29,7 @@ With toolchain knowledge and [some tweaks](https://github.com/apache/nuttx/pull/
29
29
- Add `rv64ilp32` toolchain in `arch/risc-v` Kconfig and Toolchain.cmake to support generation of nuttx-rv64ilp32 binary.
30
30
- Add a type for register width data in `arch/risc-v` layer, with some tweaking of the code base to support both existing 64-bit and 32-bit ABIs and the new rv64ilp32 ABI.
31
31
32
-
Thanks to NuttX's well designed structure, the `nuttx-ilp32` image can boot smoothly on the QEMU comes with the toolchain and `ostest` also passed, though there are still some cleanups left behind.
32
+
Thanks to well designed structure of NuttX, the `nuttx-rv64ilp32` image can boot smoothly on QEMU and `ostest` also passed, though there are still some cleanups left behind.
33
33
34
34
## QEMU results
35
35
@@ -42,7 +42,7 @@ Static footprints with `C` extension:
42
42
```
43
43
$ size nuttx-*
44
44
text data bss dec hex filename
45
-
176861 397 10256 187514 2dc7a nuttx-ilp32
45
+
176861 397 10256 187514 2dc7a nuttx-rv64ilp32
46
46
173171 681 12416 186268 2d79c nuttx-lp64
47
47
```
48
48
@@ -66,20 +66,18 @@ We can see that the code size if `rv64ilp32` is slightly(2.13%) bigger, and data
66
66
67
67
### The C extension
68
68
69
-
When sharing the initial comparison with RuyiSDK people, they suggested to turn off the compressed instruction extension `C` and recheck the text sizes.
69
+
When sharing above initial comparison with XuanTie developer, I was suggested to turn off the compressed instruction extension `C` and recheck the text sizes.
70
70
71
71
So here we have a another list, while the rv64ilp32 program's text size is smaller:
72
72
73
73
```
74
74
$ size nuttx-*
75
75
text data bss dec hex filename
76
-
231321 397 10256 241974 3b136 nuttx-ilp32
76
+
231321 397 10256 241974 3b136 nuttx-rv64ilp32
77
77
231441 681 12416 244538 3bb3a nuttx-lp64
78
78
```
79
79
80
-
Experts further said that current RISC-V ISA C extension doesn't have enough considerations for the `rv64ilp32` ABI, thus code size is slightly larger when the ISA C extension is turned on.
81
-
82
-
Let's hope the RISC-V ISA C extension can evolve to support `rv64ilp32` better in the future.
80
+
The XuanTie developer futher exaplained that current RISC-V ISA C extension doesn't have enough considerations for the `rv64ilp32` ABI, thus code size is slightly larger when the C extension is used. Here we hope that the RISC-V ISA C extension can evolve to support `rv64ilp32` ABI better in the future.
The data memory reducation is in line with that of QEMU. Performances of a few checked apps like [getprime](https://github.com/apache/nuttx-apps/tree/master/testing/getprime) and slightly tweaked [smallpt](https://www.kevinbeason.com/smallpt/) are no worse than that of the `rv64lp64` build, and one app [calib_udelay](https://github.com/apache/nuttx-apps/blob/master/examples/calib_udelay/calib_udelay_main.c) has 15% faster result.
117
+
The data memory reducation is in line with that of QEMU. Performances of a few checked apps like [getprime](https://github.com/apache/nuttx-apps/tree/master/testing/getprime) and slightly tweaked [smallpt](https://www.kevinbeason.com/smallpt/) are no worse than that of the `rv64lp64` build, and the [calib_udelay](https://github.com/apache/nuttx-apps/blob/master/examples/calib_udelay/calib_udelay_main.c) app even has 15% faster result.
120
118
121
119
Note that this isn't a formal test due to limited set of apps at hand, but the result is basically in line with [those published results](https://mp.weixin.qq.com/s/rsF7kriYYaiWQYmHGYGjlg).
0 commit comments