slight cleanup & README update
This commit is contained in:
parent
c7d52b0e74
commit
778d095071
83
README.md
83
README.md
|
@ -6,35 +6,77 @@ not the first one, but hopefully one that properly documents some stuff
|
||||||
|
|
||||||
## Workflow
|
## Workflow
|
||||||
|
|
||||||
Currently targetting the Cypress FX3.
|
### Cypress FX3
|
||||||
|
|
||||||
### Compiling
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
$ # compile:
|
||||||
$ make
|
$ make
|
||||||
|
$ # launch OpenOCD background process (needs to be done once):
|
||||||
|
$ make openocd-launch
|
||||||
|
$ # run & debug code
|
||||||
|
$ make openocd-load && make gdb
|
||||||
```
|
```
|
||||||
|
|
||||||
Needs an `arm-none-eabi` toolchain.
|
Needs an `arm-none-eabi` toolchain, and OpenOCD.
|
||||||
|
|
||||||
### Running/debugging
|
### Raspberry Pi v1.x bare-metal
|
||||||
|
|
||||||
#### Setup
|
|
||||||
|
|
||||||
```
|
```
|
||||||
$ openocd -f ./arm926ejs_fx3.cfg -c "transport select jtag" -c "adapter speed 1000" -c "init"
|
$ # compile:
|
||||||
|
$ make -C rpi/
|
||||||
|
$ # now copy rpi/rpi.img to your microSD card and name it "kernel.img".
|
||||||
|
$ # alternatively, use OpenOCD again:
|
||||||
|
$ make launch-openocd
|
||||||
|
$ make openocd-load && make gdb
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Running code
|
Needs an `arm-none-eabi` toolchain, and optionally OpenOCD. Output is written
|
||||||
|
to the UART on pin 8 (TX).
|
||||||
|
|
||||||
|
Most likely won't work on a v2 or higher.
|
||||||
|
|
||||||
|
### Linux userspace
|
||||||
|
|
||||||
|
Currently only tested on a Raspberry Pi v1.2 B+. May also work on Linux running
|
||||||
|
on a Zynq.
|
||||||
|
|
||||||
```
|
```
|
||||||
$ printf 'reset halt\nload_image jazelle.elf\nexit\n' | nc localhost 4444
|
$ # native compilation:
|
||||||
$ arm-none-eabi-gdb -ex 'target extended-remote localhost:3333' -ex 'set $pc=_start' -ex 'b jazelle_exec' -ex c jazelle.elf
|
CFLAGS=-mtune=native make -C linux
|
||||||
|
$ # cross-compilation: (change the -march depending on your target)
|
||||||
|
CC=arm-linux-gnueabihf-gcc CFLAGS=-march=arm1176jzf-s make -C linux
|
||||||
|
$ # run it
|
||||||
|
$ linux/jazelle
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Requires an `arm-linux-gnueabihf` toolchain.
|
||||||
|
|
||||||
|
### Xilinx Zynq bare-metal
|
||||||
|
|
||||||
|
***NOTE: HIGHLY EXPERIMENTAL!***
|
||||||
|
|
||||||
|
```
|
||||||
|
$ make -C zynq jazelle.o
|
||||||
|
```
|
||||||
|
|
||||||
|
Then link `zynq/jazelle.o` into an XSDK/Vitis project. If things break, the
|
||||||
|
first thing you should try is replacing the cache routines with the ones from
|
||||||
|
the Xilinx libraries.
|
||||||
|
|
||||||
|
Requires an `arm-none-eabi` toolchain.
|
||||||
|
|
||||||
|
### Other ports
|
||||||
|
|
||||||
|
There are still several platforms out there which (most likely) can also run
|
||||||
|
Jazelle, but that don't have a port yet. See the [TODO](#TODO) header.
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
|
|
||||||
FX3 base code: gratuitously stolen from https://github.com/zeldin/fx3lafw/
|
FX3 base code: gratuitously stolen from https://github.com/zeldin/fx3lafw/
|
||||||
|
|
||||||
|
Cache manipulation code was inspired by code from libnds (ARM9), libn3ds
|
||||||
|
(ARM11), and Xilinx' embeddedsw (Cortex-A9).
|
||||||
|
|
||||||
Jazelle info this project is based on:
|
Jazelle info this project is based on:
|
||||||
* https://hackspire.org/index.php/Jazelle
|
* https://hackspire.org/index.php/Jazelle
|
||||||
* https://github.com/SonoSooS/libjz
|
* https://github.com/SonoSooS/libjz
|
||||||
|
@ -48,11 +90,22 @@ Jazelle info this project is based on:
|
||||||
* [ ] What control registers are there that influence the execution?
|
* [ ] What control registers are there that influence the execution?
|
||||||
* [ ] Is it possible to force execute a certain instruction using the handler
|
* [ ] Is it possible to force execute a certain instruction using the handler
|
||||||
instead of the default in-hardware execution?
|
instead of the default in-hardware execution?
|
||||||
|
* Apparently not?
|
||||||
* [ ] ...
|
* [ ] ...
|
||||||
* [ ] How does one call regular ARM/Thumb code from inside Jazelle?
|
* [x] How does one call regular ARM/Thumb code from inside Jazelle?
|
||||||
|
* invokeXYZ instruction implementation: check method reference string, do
|
||||||
|
things based on that
|
||||||
* [ ] ...
|
* [ ] ...
|
||||||
* [ ] Verify what Hackspire and libjz have, to check if it is correct
|
* [ ] Verify what Hackspire and libjz have, to check if it is correct
|
||||||
* [ ] Look at what Hackspire and libjz don't have and try to complete it
|
* [ ] Look at what Hackspire and libjz don't have and try to complete it
|
||||||
* [ ] Port this code to the ARM11 using either Raspberry Pi v1 baremetal, or
|
* Ports:
|
||||||
3DS homebrew with kernel privileges (and do tests on these to check for
|
* [ ] TI Nspire
|
||||||
different Jazelle versions)
|
* [x] Cypress FX3
|
||||||
|
* [x] Raspberry Pi v1 baremetal
|
||||||
|
* [x] Linux userspace
|
||||||
|
* [ ] Linux kernel module
|
||||||
|
* [ ] 3DS homebrew
|
||||||
|
* [ ] Xilinx Zynq
|
||||||
|
* [ ] BeagleBoard/BeagleBone/PocketBeagle? (any OMAP or TI Sitara AM335x,
|
||||||
|
most likely not the AM572x-based ones, and definitely not the BeagleV)
|
||||||
|
* ...
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
jazelle
|
|
@ -0,0 +1,17 @@
|
||||||
|
|
||||||
|
default: all
|
||||||
|
|
||||||
|
# NOTE: please explicitly pass an -mcpu flag specific to the target you're
|
||||||
|
# using. -mtune=native MIGHT work but it's not guaranteed!
|
||||||
|
CFLAGS += -Wall -Og -g #-mcpu=arm1176jzf-s
|
||||||
|
|
||||||
|
all: jazelle
|
||||||
|
|
||||||
|
jazelle: linux.c ../jazelle.c
|
||||||
|
$(CC) $(CFLAGS) -o "$@" $^
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(RM) -v jazelle
|
||||||
|
|
||||||
|
.PHONY: default all clean
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#ifndef __linux__
|
||||||
|
#error "This code should be compiled for Linux."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void jazelle_main(void);
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
const char* names[] = { NULL, "???", "???", "???", "ARM7", "ARM9", "ARM11",
|
||||||
|
"Cortex-Ax", "Cortex-Axx (AArch64)", "Cortex-X", "???", "???", "???" };
|
||||||
|
|
||||||
|
printf("Compiled for ARM v%d aka %s\n", __ARM_ARCH, names[__ARM_ARCH]);
|
||||||
|
jazelle_main();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
*.o
|
*.o
|
||||||
*.elf
|
*.elf
|
||||||
jazlinux
|
*.map
|
||||||
|
|
|
@ -11,9 +11,6 @@ GDB ?= $(PREFIX)gdb
|
||||||
PYTHON3 ?= python3
|
PYTHON3 ?= python3
|
||||||
NC ?= nc
|
NC ?= nc
|
||||||
|
|
||||||
LNXPREFIX ?= arm-linux-gnueabihf-
|
|
||||||
LNXCC = $(LNXPREFIX)gcc
|
|
||||||
|
|
||||||
default: all
|
default: all
|
||||||
|
|
||||||
all: rpi.elf rpi.img
|
all: rpi.elf rpi.img
|
||||||
|
@ -39,9 +36,6 @@ rpi.elf: rpi.o vectors.o nl-glue.o jazelle.o
|
||||||
rpi.img: rpi.elf
|
rpi.img: rpi.elf
|
||||||
$(PREFIX)objcopy -O binary "$<" "$@"
|
$(PREFIX)objcopy -O binary "$<" "$@"
|
||||||
|
|
||||||
jazlinux: linux.c ../jazelle.c
|
|
||||||
$(LNXCC) $(CLFAGS) -o "$@" $^
|
|
||||||
|
|
||||||
openocd-launch:
|
openocd-launch:
|
||||||
openocd -f interface/cmsis-dap.cfg -c "transport select jtag" \
|
openocd -f interface/cmsis-dap.cfg -c "transport select jtag" \
|
||||||
-c "adapter speed 50" -f target/bcm2835.cfg \
|
-c "adapter speed 50" -f target/bcm2835.cfg \
|
||||||
|
@ -58,6 +52,6 @@ gdb:
|
||||||
rpi.elf
|
rpi.elf
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@$(RM) -v rpi.o rpi.elf
|
@$(RM) -v rpi.o rpi.elf vectors.o jazelle.o nl-glue.o rpi.img
|
||||||
|
|
||||||
.PHONY: all clean openocd-launch openocd-load gdb
|
.PHONY: all clean openocd-launch openocd-load gdb
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
|
|
||||||
void jazelle_main(void);
|
|
||||||
|
|
||||||
int main() {
|
|
||||||
jazelle_main();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue