Clean up plugin build workflow and docs
This commit is contained in:
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
r2plugin/*.so
|
||||||
|
examples/build/*.o
|
||||||
|
examples/build/*.elf
|
||||||
23
README.md
23
README.md
@@ -24,14 +24,23 @@ engineering ADSP-2191 firmware.
|
|||||||
|
|
||||||
## Plugin Status
|
## Plugin Status
|
||||||
|
|
||||||
Currently decodes: NOP, IDLE, Type 1 (multifunction), Type 3
|
The decoder now covers most ADSP-219x instruction types and has
|
||||||
(direct memory), Type 4 (compute + memory), Type 6/7 (immediate
|
assembler verification for 34 of 37 documented opcode families.
|
||||||
loads), Type 10/10a (jump/call), Type 17 (reg move), Type 20
|
|
||||||
(RTS/RTI).
|
|
||||||
|
|
||||||
Work in progress: Type 9/9a (standalone compute), Type 11
|
Assembler-verified coverage includes:
|
||||||
(DO UNTIL), Type 15 (shift), Type 18 (mode control), Type 25
|
|
||||||
(saturate).
|
- Types 1, 3, 4, 6, 7, 8, 9, 9a, 10, 10a, 11, 12, 14, 15, 16,
|
||||||
|
17, 18, 19, 20, 21, 21a, 23, 24, 25, 26, 29, 30, 32, 33, 34,
|
||||||
|
35, 36, 37
|
||||||
|
|
||||||
|
Structural-only coverage remains for:
|
||||||
|
|
||||||
|
- Type 22 / 22a (2-word immediate data write)
|
||||||
|
- Type 31 (IDLE)
|
||||||
|
- Type 32a (DAG register store with transfer)
|
||||||
|
|
||||||
|
For the current verification matrix and test inputs, see
|
||||||
|
`r2plugin/TESTING.md`.
|
||||||
|
|
||||||
## Assembler
|
## Assembler
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,24 @@
|
|||||||
NAME=asm_adsp219x
|
NAME ?= asm_adsp219x
|
||||||
R2_PLUGINS=$(shell r2 -H R2_USER_PLUGINS)
|
CC ?= gcc
|
||||||
R2_INCDIR=$(shell r2 -H R2_INCDIR)
|
CFLAGS ?= -Wall -Wextra -O2 -fPIC
|
||||||
R2_LIBDIR=$(shell r2 -H R2_LIBDIR)
|
LDFLAGS ?=
|
||||||
|
LDLIBS ?= -lr_arch -lr_util
|
||||||
|
|
||||||
|
R2_PLUGINS := $(shell r2 -H R2_USER_PLUGINS)
|
||||||
|
R2_INCDIR := $(shell r2 -H R2_INCDIR)
|
||||||
|
R2_LIBDIR := $(shell r2 -H R2_LIBDIR)
|
||||||
|
|
||||||
|
CPPFLAGS += -I$(R2_INCDIR) -I$(R2_INCDIR)/sdb
|
||||||
|
|
||||||
all: $(NAME).so
|
all: $(NAME).so
|
||||||
|
|
||||||
$(NAME).so: $(NAME).c
|
$(NAME).so: $(NAME).c
|
||||||
gcc -shared -Wall -O2 -fPIC \
|
$(CC) $(CPPFLAGS) $(CFLAGS) -shared $(LDFLAGS) \
|
||||||
-I$(R2_INCDIR) -I$(R2_INCDIR)/sdb \
|
|
||||||
-L$(R2_LIBDIR) \
|
-L$(R2_LIBDIR) \
|
||||||
$(NAME).c -o $@ -lr_arch -lr_util
|
$< -o $@ $(LDLIBS)
|
||||||
|
|
||||||
|
test: $(NAME).so
|
||||||
|
r2 -q -a adsp219x -L ./$(NAME).so -b 24 -c "pd 48" ../examples/isa_test.bin >/dev/null
|
||||||
|
|
||||||
install: $(NAME).so
|
install: $(NAME).so
|
||||||
mkdir -p $(R2_PLUGINS)
|
mkdir -p $(R2_PLUGINS)
|
||||||
@@ -21,4 +30,4 @@ uninstall:
|
|||||||
clean:
|
clean:
|
||||||
rm -f $(NAME).so
|
rm -f $(NAME).so
|
||||||
|
|
||||||
.PHONY: all install uninstall clean
|
.PHONY: all test install uninstall clean
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ ADSP-2191) 24-bit instructions in radare2 and iaito.
|
|||||||
|
|
||||||
Requires: GCC, radare2 >= 5.8.0 (RArchPlugin API).
|
Requires: GCC, radare2 >= 5.8.0 (RArchPlugin API).
|
||||||
|
|
||||||
|
The `Makefile` also provides `make test`, which builds the plugin and
|
||||||
|
runs a smoke test against `../examples/isa_test.bin`.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
r2 -a adsp219x -b 24 firmware.bin
|
r2 -a adsp219x -b 24 firmware.bin
|
||||||
@@ -20,9 +23,16 @@ Compare against the assembler-verified test ROM:
|
|||||||
|
|
||||||
r2 -a adsp219x -b 24 -q -c "pd 48" ../examples/isa_test.bin
|
r2 -a adsp219x -b 24 -q -c "pd 48" ../examples/isa_test.bin
|
||||||
|
|
||||||
|
Or run the local plugin without installing it:
|
||||||
|
|
||||||
|
make test
|
||||||
|
|
||||||
The test ROM (`isa_test.dsp`) was assembled with open21xx and
|
The test ROM (`isa_test.dsp`) was assembled with open21xx and
|
||||||
contains known opcodes for all major instruction types.
|
contains known opcodes for all major instruction types.
|
||||||
|
|
||||||
|
For the current verification matrix and remaining structural-only
|
||||||
|
types, see `TESTING.md`.
|
||||||
|
|
||||||
## Coding Standards
|
## Coding Standards
|
||||||
|
|
||||||
This plugin follows the GNU Coding Standards for C source code.
|
This plugin follows the GNU Coding Standards for C source code.
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ get_reg (int gp, int idx)
|
|||||||
static bool
|
static bool
|
||||||
decode (RArchSession *as, RAnalOp *op, RAnalOpMask mask)
|
decode (RArchSession *as, RAnalOp *op, RAnalOpMask mask)
|
||||||
{
|
{
|
||||||
|
(void) as;
|
||||||
ut32 ins, ins2 = 0;
|
ut32 ins, ins2 = 0;
|
||||||
const ut8 *b = op->bytes;
|
const ut8 *b = op->bytes;
|
||||||
int avail = op->size;
|
int avail = op->size;
|
||||||
@@ -814,6 +815,7 @@ decode (RArchSession *as, RAnalOp *op, RAnalOpMask mask)
|
|||||||
|
|
||||||
static int archinfo (RArchSession *s, ut32 q)
|
static int archinfo (RArchSession *s, ut32 q)
|
||||||
{
|
{
|
||||||
|
(void) s;
|
||||||
switch (q) {
|
switch (q) {
|
||||||
case R_ARCH_INFO_CODE_ALIGN: return 3;
|
case R_ARCH_INFO_CODE_ALIGN: return 3;
|
||||||
case R_ARCH_INFO_MINOP_SIZE: case R_ARCH_INFO_MAXOP_SIZE: return 3;
|
case R_ARCH_INFO_MINOP_SIZE: case R_ARCH_INFO_MAXOP_SIZE: return 3;
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user