mirror of
https://github.com/brain-hackers/lab
synced 2024-12-22 20:20:04 +09:00
parent
795a46c767
commit
ae3be8aec0
1
x1/.gitignore
vendored
1
x1/.gitignore
vendored
@ -1 +0,0 @@
|
|||||||
c/uboot_bin.h
|
|
@ -21,15 +21,6 @@ c/main.elf:
|
|||||||
c/main.bin: c/main.elf
|
c/main.bin: c/main.elf
|
||||||
@./extract.py c/main.elf $@
|
@./extract.py c/main.elf $@
|
||||||
|
|
||||||
c/uboot_loader.bin:
|
|
||||||
@if [ "$(UBOOT)" = "" ]; then \
|
|
||||||
echo "Please specify UBOOT."; \
|
|
||||||
exit 1; \
|
|
||||||
fi
|
|
||||||
@c/generate.py $(UBOOT) c/uboot_bin.h.tpl c/uboot_bin.h
|
|
||||||
@$(CC) -nostdlib -static -fPIC -marm -O0 c/start.S c/main_uboot.c -o c/uboot_loader.elf
|
|
||||||
@./extract.py c/uboot_loader.elf $@
|
|
||||||
|
|
||||||
spray/main.bin:
|
spray/main.bin:
|
||||||
@$(AS) spray/top.S
|
@$(AS) spray/top.S
|
||||||
@./extract.py -p a.out spray/top.bin
|
@./extract.py -p a.out spray/top.bin
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
#define readl(a) (*(volatile unsigned int *)(a))
|
#define readl(a) (*(volatile unsigned int *)(a))
|
||||||
#define writel(v, a) (*(volatile unsigned int *)(a) = (v))
|
#define writel(v, a) (*(volatile unsigned int *)(a) = (v))
|
||||||
#define writeb(v, a) (*(volatile unsigned char *)(a) = (v))
|
|
||||||
|
|
||||||
typedef unsigned int u32;
|
typedef unsigned int u32;
|
||||||
typedef unsigned short u16;
|
typedef unsigned short u16;
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
import sys
|
|
||||||
import textwrap
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
if len(sys.argv) < 3:
|
|
||||||
print(f'Usage: {sys.argv[0]} u-boot.bin uboot_bin.h.tpl uboot_bin.h')
|
|
||||||
|
|
||||||
with open(sys.argv[2]) as f:
|
|
||||||
tpl = f.read()
|
|
||||||
|
|
||||||
with open(sys.argv[1], 'rb') as ui, open(sys.argv[3], 'w') as header:
|
|
||||||
uboot = ui.read()
|
|
||||||
|
|
||||||
out = ''
|
|
||||||
for i, b in enumerate(uboot):
|
|
||||||
out += f'{b:#04x}, '
|
|
||||||
if (i+1) % 16 == 0:
|
|
||||||
out = out.rstrip()
|
|
||||||
out += '\n'
|
|
||||||
|
|
||||||
formatted = tpl.format(uboot_size=len(uboot), uboot_bin=textwrap.indent(out, ' '))
|
|
||||||
header.write(formatted)
|
|
||||||
|
|
||||||
|
|
||||||
main()
|
|
@ -1,34 +0,0 @@
|
|||||||
#include "common.h"
|
|
||||||
#include "uboot_bin.h"
|
|
||||||
|
|
||||||
#define VIRT_START (unsigned char *)0x8c000000
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
int i;
|
|
||||||
u8* ptr = VIRT_START;
|
|
||||||
|
|
||||||
// Turn off interrupts
|
|
||||||
asm volatile (
|
|
||||||
"cpsid if \n"
|
|
||||||
);
|
|
||||||
|
|
||||||
for (i=0; i<UBOOT_SIZE; i++) {
|
|
||||||
writeb(uboot_bin[i], ptr);
|
|
||||||
ptr++;
|
|
||||||
}
|
|
||||||
|
|
||||||
asm volatile (
|
|
||||||
"mrc p15, 0, r8, c14, c2, 1 \n"
|
|
||||||
"bic r8, r8, #1 \n"
|
|
||||||
"mcr p15, 0, r8, c14, c2, 1 \n"
|
|
||||||
"mrc p15, 0, r8, c14, c3, 1 \n"
|
|
||||||
"bic r8, r8, #1 \n"
|
|
||||||
"mcr p15, 0, r8, c14, c3, 1 \n"
|
|
||||||
|
|
||||||
"mrc p15, 0, r10, c1, c0, 0 \n"
|
|
||||||
"bic r10, r10, #1 \n"
|
|
||||||
"mcr p15, 0, r10, c1, c0, 0 \n"
|
|
||||||
"ldr r0, =0x60200000 \n"
|
|
||||||
"mov pc, r0"
|
|
||||||
);
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
#define UBOOT_SIZE {uboot_size}
|
|
||||||
|
|
||||||
unsigned char uboot_bin[] = {{
|
|
||||||
{uboot_bin}
|
|
||||||
}};
|
|
Loading…
Reference in New Issue
Block a user