19 lines
No EOL
999 B
Text
19 lines
No EOL
999 B
Text
This is just for me to understand how all this works, and to learn something new.
|
|
|
|
For example, I learned that endianness is not per bit but per byte. My whole life I've been in misinformation.
|
|
So little endian is not that first bit is the LSB, but it's MSB... and after 8 bits it becomes larger, which makes no point
|
|
|
|
And I learned about sign extension, which is pretty cool
|
|
|
|
And I learned that Java is bad because it doesn't have unsigned numbers
|
|
|
|
To compile stuff:
|
|
0. Get the toolchain obviously
|
|
1. riscv32-unknown-elf-gcc -c -Oz program.c
|
|
2. riscv32-unknown-elf-objcopy -O binary program.o program.bin
|
|
program.bin is the binary file with the program
|
|
3. Encode to Base64: cat program.bin | base64
|
|
|
|
rv32i, ilp32 compatible toolchain for 64bit Linux: https://lfs.m724.eu/toolchain.tar.zst
|
|
Or just the stuff necessary to make a binary file: https://lfs.m724.eu/toolchainlite.tar.zst
|
|
Those were compiled with `./configure --prefix=$(pwd)/../toolchain --with-arch=rv32i --with-abi=ilp32` and `make` |