mirror of
https://github.com/Polprzewodnikowy/SummerCart64.git
synced 2024-11-22 05:59:15 +01:00
bootloader improvements
This commit is contained in:
parent
ad802282b7
commit
0f42c6e0d7
@ -40,7 +40,7 @@ SRC_FILES = \
|
|||||||
fatfs/ffunicode.c
|
fatfs/ffunicode.c
|
||||||
|
|
||||||
ASSET_FILES = \
|
ASSET_FILES = \
|
||||||
exception_background.png
|
sc64_logo_640_240_dimmed.png
|
||||||
|
|
||||||
SRCS = $(SRC_FILES) $(ASSET_FILES)
|
SRCS = $(SRC_FILES) $(ASSET_FILES)
|
||||||
SRC_OBJS = $(patsubst %,%.o,$(SRC_FILES))
|
SRC_OBJS = $(patsubst %,%.o,$(SRC_FILES))
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
MEMORY {
|
MEMORY {
|
||||||
rdram (rwx) : org = 0x80300000, len = 1M
|
framebuffer (rw) : org = 0x8026A000, len = 600k
|
||||||
flash (r) : org = 0xB0000000, len = 1028k
|
ram (rwx) : org = 0x80300000, len = 1M
|
||||||
|
rom (r) : org = 0xB0000000, len = 1028k
|
||||||
}
|
}
|
||||||
|
|
||||||
ENTRY(entry_handler)
|
ENTRY(entry_handler)
|
||||||
@ -9,23 +10,28 @@ __exception_stack_size = 8k;
|
|||||||
__stack_size = 16k;
|
__stack_size = 16k;
|
||||||
|
|
||||||
SECTIONS {
|
SECTIONS {
|
||||||
.flash : {
|
.boot : {
|
||||||
KEEP(*(.text.rom_header));
|
KEEP(*(.text.rom_header));
|
||||||
KEEP(*(.text.ipl3));
|
KEEP(*(.text.ipl3));
|
||||||
} > flash
|
} > rom
|
||||||
|
|
||||||
|
.framebuffer (NOLOAD) : SUBALIGN(64) {
|
||||||
|
*(.framebuffer .framebuffer.*)
|
||||||
|
} > framebuffer
|
||||||
|
|
||||||
.text : SUBALIGN(4) {
|
.text : SUBALIGN(4) {
|
||||||
*(.text.entry_handler)
|
*(.text.entry_handler)
|
||||||
*(.text .text.* .gnu.linkonce.t.*)
|
*(.text .text.* .gnu.linkonce.t.*)
|
||||||
|
*(.assets .assets.*)
|
||||||
*(.rodata .rodata.* .gnu.linkonce.r.*)
|
*(.rodata .rodata.* .gnu.linkonce.r.*)
|
||||||
*(.data .data.* .gnu.linkonce.d.*)
|
*(.data .data.* .gnu.linkonce.d.*)
|
||||||
_gp = . + 0x8000;
|
_gp = . + 0x8000;
|
||||||
*(.sdata .sdata.* .gnu.linkonce.s.*)
|
*(.sdata .sdata.* .gnu.linkonce.s.*)
|
||||||
*(.lit8 .lit4)
|
*(.lit8 .lit4)
|
||||||
. = ALIGN(8);
|
} > ram AT > rom
|
||||||
} > rdram AT > flash
|
|
||||||
|
|
||||||
.bss : {
|
.bss : {
|
||||||
|
. = ALIGN(8);
|
||||||
_sbss = .;
|
_sbss = .;
|
||||||
*(.sbss .sbss.* .gnu.linkonce.sb.*)
|
*(.sbss .sbss.* .gnu.linkonce.sb.*)
|
||||||
*(.scommon .scommon.*)
|
*(.scommon .scommon.*)
|
||||||
@ -33,10 +39,10 @@ SECTIONS {
|
|||||||
*(COMMON)
|
*(COMMON)
|
||||||
. = ALIGN(8);
|
. = ALIGN(8);
|
||||||
_ebss = .;
|
_ebss = .;
|
||||||
} > rdram
|
} > ram
|
||||||
|
|
||||||
_sheap = .;
|
_sheap = .;
|
||||||
. = ORIGIN(rdram) + LENGTH(rdram) - __exception_stack_size - __stack_size;
|
. = ORIGIN(ram) + LENGTH(ram) - __exception_stack_size - __stack_size;
|
||||||
_eheap = .;
|
_eheap = .;
|
||||||
|
|
||||||
. += __exception_stack_size;
|
. += __exception_stack_size;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
.section .assets.@sym@
|
||||||
.global assets_@sym@
|
.global assets_@sym@
|
||||||
assets_@sym@:
|
assets_@sym@:
|
||||||
.incbin "@file@"
|
.incbin "@file@"
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|
||||||
extern const uint32_t assets_exception_background;
|
extern const uint32_t assets_sc64_logo_640_240_dimmed;
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 6.6 KiB |
BIN
sw/bootloader/assets/sc64_logo_640_240_dimmed.png
Normal file
BIN
sw/bootloader/assets/sc64_logo_640_240_dimmed.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 42 KiB |
@ -66,14 +66,9 @@ bool boot_get_tv_type (boot_info_t *info) {
|
|||||||
bool boot_get_cic_seed_version (boot_info_t *info) {
|
bool boot_get_cic_seed_version (boot_info_t *info) {
|
||||||
io32_t *base = boot_get_device_base(info);
|
io32_t *base = boot_get_device_base(info);
|
||||||
|
|
||||||
uint32_t ipl3[1008];
|
uint32_t ipl3[1008] __attribute__((aligned(8)));
|
||||||
|
|
||||||
io32_t *ipl3_src = &base[16];
|
pi_dma_read(&base[16], ipl3, sizeof(ipl3));
|
||||||
uint32_t *ipl3_dst = ipl3;
|
|
||||||
|
|
||||||
for (int i = 0; i < sizeof(ipl3); i += sizeof(uint32_t)) {
|
|
||||||
*ipl3_dst++ = pi_io_read(ipl3_src++);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t crc32 = crc32_calculate(ipl3, sizeof(ipl3));
|
uint32_t crc32 = crc32_calculate(ipl3, sizeof(ipl3));
|
||||||
|
|
||||||
|
@ -6,15 +6,15 @@
|
|||||||
|
|
||||||
#define SCREEN_WIDTH (640)
|
#define SCREEN_WIDTH (640)
|
||||||
#define SCREEN_HEIGHT (240)
|
#define SCREEN_HEIGHT (240)
|
||||||
#define BORDER_WIDTH (32)
|
#define BORDER_WIDTH (64)
|
||||||
#define BORDER_HEIGHT (16)
|
#define BORDER_HEIGHT (24)
|
||||||
|
|
||||||
#define BACKGROUND_COLOR (0x00000000UL)
|
#define BACKGROUND_COLOR (0x00000000UL)
|
||||||
#define TEXT_COLOR (0xFFFFFFFFUL)
|
#define TEXT_COLOR (0xFFFFFFFFUL)
|
||||||
#define LINE_HEIGHT (10)
|
#define LINE_SPACING (2)
|
||||||
|
|
||||||
|
|
||||||
static io32_t display_framebuffer[SCREEN_WIDTH * SCREEN_HEIGHT] __attribute__((aligned(64)));
|
static io32_t display_framebuffer[SCREEN_WIDTH * SCREEN_HEIGHT] __attribute__((section(".framebuffer")));
|
||||||
static int char_x;
|
static int char_x;
|
||||||
static int char_y;
|
static int char_y;
|
||||||
static const vi_regs_t vi_config[] = {{
|
static const vi_regs_t vi_config[] = {{
|
||||||
@ -63,13 +63,13 @@ static const vi_regs_t vi_config[] = {{
|
|||||||
static void display_draw_character (char c) {
|
static void display_draw_character (char c) {
|
||||||
if (c == '\n') {
|
if (c == '\n') {
|
||||||
char_x = BORDER_WIDTH;
|
char_x = BORDER_WIDTH;
|
||||||
char_y += LINE_HEIGHT;
|
char_y += FONT_HEIGHT + LINE_SPACING;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((char_x + FONT_WIDTH) > (SCREEN_WIDTH - BORDER_WIDTH)) {
|
if ((char_x + FONT_WIDTH) > (SCREEN_WIDTH - BORDER_WIDTH)) {
|
||||||
char_x = BORDER_WIDTH;
|
char_x = BORDER_WIDTH;
|
||||||
char_y += LINE_HEIGHT;
|
char_y += FONT_HEIGHT + LINE_SPACING;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((c < ' ') || (c > '~')) {
|
if ((c < ' ') || (c > '~')) {
|
||||||
@ -107,14 +107,12 @@ void display_init (uint32_t *background) {
|
|||||||
char_y = BORDER_HEIGHT;
|
char_y = BORDER_HEIGHT;
|
||||||
|
|
||||||
if (background == NULL) {
|
if (background == NULL) {
|
||||||
for (int i = 0; i < (SCREEN_WIDTH * SCREEN_HEIGHT); i += 1) {
|
for (int i = 0; i < (SCREEN_WIDTH * SCREEN_HEIGHT); i++) {
|
||||||
io_write(&display_framebuffer[i], BACKGROUND_COLOR);
|
io_write(&display_framebuffer[i], BACKGROUND_COLOR);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < (SCREEN_WIDTH * SCREEN_HEIGHT); i += 2) {
|
for (int i = 0; i < (SCREEN_WIDTH * SCREEN_HEIGHT); i++) {
|
||||||
io_write(&display_framebuffer[i], *background);
|
io_write(&display_framebuffer[i], *background++);
|
||||||
io_write(&display_framebuffer[i + 1], *background);
|
|
||||||
background++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,23 +45,22 @@ void exception_fatal_handler (uint32_t exception_code, uint32_t interrupt_mask,
|
|||||||
version_t *version = version_get();
|
version_t *version = version_get();
|
||||||
uint32_t *instruction_address = (((uint32_t *) (e->epc.u32)) + ((e->cr & C0_CR_BD) ? 1 : 0));
|
uint32_t *instruction_address = (((uint32_t *) (e->epc.u32)) + ((e->cr & C0_CR_BD) ? 1 : 0));
|
||||||
|
|
||||||
display_init((uint32_t *) (&assets_exception_background));
|
display_init((uint32_t *) (&assets_sc64_logo_640_240_dimmed));
|
||||||
|
|
||||||
display_printf("branch: %s | tag: %s\n", version->git_branch, version->git_tag);
|
display_printf("branch: %s | tag: %s\n", version->git_branch, version->git_tag);
|
||||||
display_printf("sha: %s\n", version->git_sha);
|
display_printf("sha: %s\n", version->git_sha);
|
||||||
display_printf("%s\n\n", version->git_message);
|
display_printf("%s\n\n", version->git_message);
|
||||||
|
|
||||||
display_printf("%s\n\n", exception_get_description(exception_code));
|
display_printf("%s\n", exception_get_description(exception_code));
|
||||||
|
display_printf(" pc: 0x%08lX sr: 0x%08lX cr: 0x%08lX va: 0x%08lX\n", e->epc.u32, e->sr, e->cr, e->badvaddr.u32);
|
||||||
display_printf("pc: 0x%08lX sr: 0x%08lX cr: 0x%08lX va: 0x%08lX\n", e->epc.u32, e->sr, e->cr, e->badvaddr.u32);
|
display_printf(" zr: 0x%08lX at: 0x%08lX v0: 0x%08lX v1: 0x%08lX\n", e->zr.u32, e->at.u32, e->v0.u32, e->v1.u32);
|
||||||
display_printf("zr: 0x%08lX at: 0x%08lX v0: 0x%08lX v1: 0x%08lX\n", e->zr.u32, e->at.u32, e->v0.u32, e->v1.u32);
|
display_printf(" a0: 0x%08lX a1: 0x%08lX a2: 0x%08lX a3: 0x%08lX\n", e->a0.u32, e->a1.u32, e->a2.u32, e->a3.u32);
|
||||||
display_printf("a0: 0x%08lX a1: 0x%08lX a2: 0x%08lX a3: 0x%08lX\n", e->a0.u32, e->a1.u32, e->a2.u32, e->a3.u32);
|
display_printf(" t0: 0x%08lX t1: 0x%08lX t2: 0x%08lX t3: 0x%08lX\n", e->t0.u32, e->t1.u32, e->t2.u32, e->t3.u32);
|
||||||
display_printf("t0: 0x%08lX t1: 0x%08lX t2: 0x%08lX t3: 0x%08lX\n", e->t0.u32, e->t1.u32, e->t2.u32, e->t3.u32);
|
display_printf(" t4: 0x%08lX t5: 0x%08lX t6: 0x%08lX t7: 0x%08lX\n", e->t4.u32, e->t5.u32, e->t6.u32, e->t7.u32);
|
||||||
display_printf("t4: 0x%08lX t5: 0x%08lX t6: 0x%08lX t7: 0x%08lX\n", e->t4.u32, e->t5.u32, e->t6.u32, e->t7.u32);
|
display_printf(" s0: 0x%08lX s1: 0x%08lX s2: 0x%08lX s3: 0x%08lX\n", e->s0.u32, e->s1.u32, e->s2.u32, e->s3.u32);
|
||||||
display_printf("s0: 0x%08lX s1: 0x%08lX s2: 0x%08lX s3: 0x%08lX\n", e->s0.u32, e->s1.u32, e->s2.u32, e->s3.u32);
|
display_printf(" s4: 0x%08lX s5: 0x%08lX s6: 0x%08lX s7: 0x%08lX\n", e->s4.u32, e->s5.u32, e->s6.u32, e->s7.u32);
|
||||||
display_printf("s4: 0x%08lX s5: 0x%08lX s6: 0x%08lX s7: 0x%08lX\n", e->s4.u32, e->s5.u32, e->s6.u32, e->s7.u32);
|
display_printf(" t8: 0x%08lX t9: 0x%08lX k0: 0x%08lX k1: 0x%08lX\n", e->t8.u32, e->t9.u32, e->k0.u32, e->k1.u32);
|
||||||
display_printf("t8: 0x%08lX t9: 0x%08lX k0: 0x%08lX k1: 0x%08lX\n", e->t8.u32, e->t9.u32, e->k0.u32, e->k1.u32);
|
display_printf(" gp: 0x%08lX sp: 0x%08lX s8: 0x%08lX ra: 0x%08lX\n\n", e->gp.u32, e->sp.u32, e->s8.u32, e->ra.u32);
|
||||||
display_printf("gp: 0x%08lX sp: 0x%08lX s8: 0x%08lX ra: 0x%08lX\n\n", e->gp.u32, e->sp.u32, e->s8.u32, e->ra.u32);
|
|
||||||
|
|
||||||
if (exception_code == EXCEPTION_INTERRUPT) {
|
if (exception_code == EXCEPTION_INTERRUPT) {
|
||||||
if (interrupt_mask & INTERRUPT_MASK_TIMER) {
|
if (interrupt_mask & INTERRUPT_MASK_TIMER) {
|
||||||
|
@ -201,8 +201,8 @@ bool sc64_sd_read_sectors (uint32_t *address, uint32_t sector, uint32_t count) {
|
|||||||
return sc64_execute_cmd(SC64_CMD_SD_READ, read_args, NULL);
|
return sc64_execute_cmd(SC64_CMD_SD_READ, read_args, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool sc64_dd_set_sd_disk_info (uint32_t *address, uint32_t count) {
|
bool sc64_dd_set_sd_disk_info (uint32_t *address, uint32_t length) {
|
||||||
uint32_t args[2] = { (uint32_t) (address), count };
|
uint32_t args[2] = { (uint32_t) (address), length };
|
||||||
if (sc64_execute_cmd(SC64_CMD_DD_SD_DISK_INFO, args, NULL)) {
|
if (sc64_execute_cmd(SC64_CMD_DD_SD_DISK_INFO, args, NULL)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,7 @@ bool sc64_sd_card_get_status (void);
|
|||||||
bool sc64_sd_card_get_info (uint32_t *address);
|
bool sc64_sd_card_get_info (uint32_t *address);
|
||||||
bool sc64_sd_write_sectors (uint32_t *address, uint32_t sector, uint32_t count);
|
bool sc64_sd_write_sectors (uint32_t *address, uint32_t sector, uint32_t count);
|
||||||
bool sc64_sd_read_sectors (uint32_t *address, uint32_t sector, uint32_t count);
|
bool sc64_sd_read_sectors (uint32_t *address, uint32_t sector, uint32_t count);
|
||||||
bool sc64_dd_set_sd_disk_info (uint32_t *address, uint32_t count);
|
bool sc64_dd_set_sd_disk_info (uint32_t *address, uint32_t length);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user