mirror of
https://github.com/brain-hackers/boot4u
synced 2025-01-03 18:10:06 +09:00
Show image.jpg when switching fb address
This commit is contained in:
parent
4cb07e77bb
commit
4b5601c738
9
Makefile
9
Makefile
@ -8,10 +8,13 @@ all: AppMain.bin m4_loader.bin
|
|||||||
|
|
||||||
.PHONY:
|
.PHONY:
|
||||||
clean:
|
clean:
|
||||||
@rm -f *.bin *.elf
|
@rm -f *.bin *.elf pixels.c
|
||||||
|
|
||||||
AppMain.bin:
|
pixels.c:
|
||||||
@$(AS) main.S -o main.elf
|
@python3 img2c.py image.jpg pixels.c
|
||||||
|
|
||||||
|
AppMain.bin: pixels.c
|
||||||
|
@$(CC) -nostdlib -static -fPIC -mcpu=cortex-a7 main.S pixels.c -o main.elf
|
||||||
@./extract.py -p main.elf AppMain.bin
|
@./extract.py -p main.elf AppMain.bin
|
||||||
|
|
||||||
m4_loader.bin:
|
m4_loader.bin:
|
||||||
|
34
img2c.py
Normal file
34
img2c.py
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
import sys
|
||||||
|
from PIL import Image
|
||||||
|
|
||||||
|
|
||||||
|
template = '''void load_pixels() {{
|
||||||
|
{lines}
|
||||||
|
}};
|
||||||
|
'''
|
||||||
|
|
||||||
|
im = Image.open(sys.argv[-2]).convert('RGB')
|
||||||
|
|
||||||
|
with open(sys.argv[-1], 'w') as f:
|
||||||
|
pixels = []
|
||||||
|
lines = []
|
||||||
|
count = 0
|
||||||
|
|
||||||
|
for y in range(im.size[1]):
|
||||||
|
for x in range(0, im.size[0], 2):
|
||||||
|
r, g, b = im.getpixel((x, y))
|
||||||
|
rgb565 = ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3)
|
||||||
|
pixels.append(rgb565 >> 8)
|
||||||
|
pixels.append(rgb565 & 0xff)
|
||||||
|
|
||||||
|
r, g, b = im.getpixel((x+1, y))
|
||||||
|
rgb565 = ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3)
|
||||||
|
pixels.append(rgb565 >> 8)
|
||||||
|
pixels.append(rgb565 & 0xff)
|
||||||
|
|
||||||
|
u32 = (pixels[0] << 24) + (pixels[1] << 16) + (pixels[2] << 8) + pixels[3]
|
||||||
|
lines.append(f'\t*(unsigned int *)(0x62000000 + {count:7d}) = {u32:#08x};')
|
||||||
|
pixels = []
|
||||||
|
count += 4;
|
||||||
|
f.write(template.format(lines='\n'.join(lines)))
|
||||||
|
|
1
main.S
1
main.S
@ -3,6 +3,7 @@
|
|||||||
.global _start
|
.global _start
|
||||||
|
|
||||||
_start:
|
_start:
|
||||||
|
bl load_pixels
|
||||||
//M4 RTOS loader snipet prep
|
//M4 RTOS loader snipet prep
|
||||||
ldr r4, =0x60006400 //fopen addr
|
ldr r4, =0x60006400 //fopen addr
|
||||||
adr r0, [.LC2] //file name
|
adr r0, [.LC2] //file name
|
||||||
|
1
requirements.txt
Normal file
1
requirements.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
pillow
|
Loading…
Reference in New Issue
Block a user