|
|
|
@ -5,8 +5,21 @@ My preferred compile commands to quickly look up
|
|
|
|
|
## Programming languages
|
|
|
|
|
* **C** - `gcc -std=gnu99 -Werror -Wfatal-errors -Wall -Wpedantic blub.c -o blub`
|
|
|
|
|
* if necessary, remove `-Wpedantic`, since it warns for features definitely included by using `gnu99` as compiler
|
|
|
|
|
* **C++** - `g++ -Wall -c blob.cpp blub.cpp` -> `g++ -Wall -o blub blob.o blub.o`
|
|
|
|
|
* `gcc -c -std=gnu99 -Werror -Wfatal-errors -Wall -Wpedantic blub.c -o blub` the `-c` to get object file only instead of binary
|
|
|
|
|
* **C++** -
|
|
|
|
|
* `g++ -pedantic -Wall -Wextra -Werror -c blob.cpp blub.cpp` -> object files
|
|
|
|
|
* `g++ -Wall -o blub blob.o blub.o` -> binaries
|
|
|
|
|
* `blob.cpp` gets linked (blub.cpp would likely start with something like `#include "blob.h"`)
|
|
|
|
|
* **Assembly** - (this is called *assembling* instead of *compiling*) `gcc -c blub.s`
|
|
|
|
|
* on systems that aren't ARM:
|
|
|
|
|
1. `aarch64-linux-gnu-gcc -c blub_asm.s`
|
|
|
|
|
2. `aarch64-linux-gnu-gcc -c blub_c.c`
|
|
|
|
|
3. `aarch64-linux-gnu-g++-10 -c blub.cpp`
|
|
|
|
|
4. linking: `aarch64-linux-gnu-g++-10 -o blub blob.o blub_asm.o blub_c.o`
|
|
|
|
|
5. running: `qemu-aarch64 ./blub`
|
|
|
|
|
* assembling and disassembling single commands:
|
|
|
|
|
- `echo "adds x0, x0, #5" | llvm-mc -triple=aarch64 --show-encoding`
|
|
|
|
|
- `echo "0x00 0x14 0x00 0xb1" | llvm-mc -triple=aarch64 -disassemble --show-encoding`
|
|
|
|
|
* **System Verilog** - `iverilog -Wall -g2012 1.sv 2.sv 3_tb.sv 3.sv -o 3_tb` <- tb for testbench simulation
|
|
|
|
|
|
|
|
|
|
## Other languages
|
|
|
|
|