mirror of
https://github.com/brain-hackers/lab
synced 2025-10-15 20:58:39 +09:00
@@ -2,7 +2,6 @@
|
||||
|
||||
#define readl(a) (*(volatile unsigned int *)(a))
|
||||
#define writel(v, a) (*(volatile unsigned int *)(a) = (v))
|
||||
#define writeb(v, a) (*(volatile unsigned char *)(a) = (v))
|
||||
|
||||
typedef unsigned int u32;
|
||||
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}
|
||||
}};
|
Reference in New Issue
Block a user