added base_device
This commit is contained in:
parent
35849425b4
commit
7282d7aa89
16
devices/base_device/Makefile
Normal file
16
devices/base_device/Makefile
Normal file
@ -0,0 +1,16 @@
|
||||
ifeq ($(ANDROID_NDK_ROOT),)
|
||||
$(error Error : Set the env variable 'ANDROID_NDK_ROOT' with the path of the Android NDK (version 20))
|
||||
endif
|
||||
|
||||
CC := $(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android27-clang
|
||||
AR := $(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-ar
|
||||
OBJCOPY := $(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-objcopy
|
||||
LD := $(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-ld.bfd
|
||||
|
||||
CFLAGS_BASE_DEVICE := -Werror -Wno-unused-variable -Os -Idevices/base_device/
|
||||
base_device:
|
||||
[ -d bin/base_device ] || mkdir -p bin/base_device/
|
||||
$(CC) arm64_stub.S -c -o bin/base_device/entry.o $(CFLAGS_BASE_DEVICE)
|
||||
$(CC) debugger.c -c -o bin/base_device/debugger.o $(CFLAGS_BASE_DEVICE)
|
||||
$(LD) -T devices/base_device/linkscript.ld bin/base_device/entry.o bin/base_device/debugger.o -o bin/base_device/debugger.elf --just-symbols=devices/base_device/symbols.txt
|
||||
$(OBJCOPY) -O binary bin/base_device/debugger.elf bin/base_device/debugger.bin
|
38
devices/base_device/device.h
Normal file
38
devices/base_device/device.h
Normal file
@ -0,0 +1,38 @@
|
||||
|
||||
void send(void *buffer, uint32_t size, uint32_t *num_xfer){
|
||||
// TODO implement
|
||||
}
|
||||
|
||||
int recv(void *buffer, uint32_t size, uint32_t *num_xfer){
|
||||
// TODO implement
|
||||
return 0;
|
||||
}
|
||||
|
||||
void recv_data(void *data, uint32_t len) {
|
||||
uint32_t rx_err_code;
|
||||
uint32_t xfer = 0;
|
||||
while(1) {
|
||||
recv(data, len, &xfer);
|
||||
if(xfer >= len) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int mystrlen(char *data) {
|
||||
int i=0;
|
||||
while(1) {
|
||||
if(data[i++] == '\0'){
|
||||
break;
|
||||
}
|
||||
}
|
||||
return i-1;
|
||||
}
|
||||
|
||||
void usb_log(char * msg, uint32_t * error){
|
||||
send(msg, mystrlen(msg), error);
|
||||
}
|
||||
|
||||
void concrete_main(uint32_t debugger){
|
||||
// TODO device specific code
|
||||
}
|
0
devices/base_device/linkscript.ld
Normal file
0
devices/base_device/linkscript.ld
Normal file
6
devices/base_device/symbols.txt
Normal file
6
devices/base_device/symbols.txt
Normal file
@ -0,0 +1,6 @@
|
||||
send = 0x001065C0;
|
||||
recv = 0x00106612;
|
||||
|
||||
|
||||
debugger_storage = 0x40013000;
|
||||
debugger_stack = 0x40014000;
|
Loading…
x
Reference in New Issue
Block a user