VxKernel 0.6.0-6 : Add exception/kernel panic screen + add assets

@add
<> assets
  | add default font assets (project)
  | add default font assets (image)
  | add default fotn assets (vxsdk conv information)
<> board/fxcg50/fxcg50
  | add kernel relocation start symbols for the kernel panic screen

@update
<> kernel/exch
  | reactivate the kernel panic screen
  | add relocation information
  | isolate the PC address properly

@fix
<> drivers/mpu/sh/sh7305/tmu
  | fix interrupt handler configuration crash
  | enable the TMU/ETMU driver
This commit is contained in:
Yann MAGNIN 2022-06-14 10:51:23 +02:00
parent cb4af4f7bb
commit 0c50357b7d
6 changed files with 26 additions and 17 deletions

BIN
assets/font8x9.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
assets/font8x9.xcf Normal file

Binary file not shown.

9
assets/vxconv.toml Normal file
View File

@ -0,0 +1,9 @@
[font8x9]
path = 'font8x9.png'
type = 'font'
charset = 'print'
grid.size = '8x12'
grid.padding = 1
grid.border = 1
proportional = 1
line_height = 9

View File

@ -20,6 +20,8 @@ SECTIONS
/* Code */
.text : {
PROVIDE(___kernel_reloc_start = .);
*(.text);
*(.text.*);

View File

@ -277,7 +277,7 @@ static void __tmu_configure(struct tmu_ctx *s)
}
/* install the TMUs interupt handler */
extern void *sh7305_inth_tmu;
extern uint32_t sh7305_inth_tmu;
sh7305_intc_install_inth(0x400, &sh7305_inth_tmu, 96);
/* install all ETMUx interrupt handler
@ -291,13 +291,13 @@ static void __tmu_configure(struct tmu_ctx *s)
We know that the ETMU4 (which have the interrupt vector 0xd00) is
followed by excatly 3 free gates (where not interrupt exist). We will
use this place to store all the ETMUx interrupt logic. */
extern void *sh7305_inth_etmu4;
extern void *sh7305_inth_etmux;
extern uint32_t sh7305_inth_etmu4;
extern uint32_t sh7305_inth_etmux;
void *h4;
void *h;
uint16_t etmu_event[6] = { 0x9e0, 0xc20, 0xc40, 0x900, 0xd00, 0xfa0 };
h4 = sh7305_intc_install_inth(etmu_event[4], sh7305_inth_etmu4, 96);
uint16_t etmu_evt[6] = { 0x9e0, 0xc20, 0xc40, 0x900, 0xd00, 0xfa0 };
h4 = sh7305_intc_install_inth(etmu_evt[4], &sh7305_inth_etmu4, 96);
for (int i = 0; i < 6; ++i) {
/* skip the core ETMUx core handler */
@ -305,7 +305,7 @@ static void __tmu_configure(struct tmu_ctx *s)
continue;
/* install the default interrupt handler */
h = sh7305_intc_install_inth(etmu_event[i], sh7305_inth_etmux, 32);
h = sh7305_intc_install_inth(etmu_evt[i], &sh7305_inth_etmux, 32);
/* Distance from VBR handler to ETMU4, used to jump */
*(uint32_t *)(h + 20) += (uintptr_t)h4 - (uintptr_t)cpu_get_vbr();
@ -376,7 +376,6 @@ static void __tmu_hrestore(struct tmu_ctx *s)
/* declare the TMU driver */
#if 0
struct vhex_driver drv_tmu = {
.name = "TMU",
.hsave = (void*)&__tmu_hsave,
@ -399,4 +398,3 @@ struct vhex_driver drv_tmu = {
}
};
VHEX_DECLARE_DRIVER(03, drv_tmu);
#endif

View File

@ -4,8 +4,7 @@
//TODO: add relocation information
void vhex_kernel_exch_panic(void)
{
#if 0
extern uint16_t vhex_vram[];
extern uint32_t __kernel_reloc_start;
uint32_t PC;
uint32_t TEA;
uint32_t TRA;
@ -21,8 +20,8 @@ void vhex_kernel_exch_panic(void)
dclear(C_WHITE);
dtext(6, 3, C_BLACK, "An exception occured! (System ERROR)");
uint32_t *long_vram = (void *)vhex_vram;
for(int i = 0; i < 198 * 16; i++) long_vram[i] = ~long_vram[i];
// uint32_t *long_vram = (void *)vhex_vram;
// for(int i = 0; i < 198 * 16; i++) long_vram[i] = ~long_vram[i];
char const *name = "";
if(code == 0x040) name = "TLB miss (nonexisting address) on read";
@ -36,7 +35,7 @@ void vhex_kernel_exch_panic(void)
dprint(6, 25, C_BLACK, "%03x %s", code, name);
dtext( 6, 45, C_BLACK, "PC");
dprint(38, 45, C_BLACK, "= %08x", PC);
dprint(38, 45, C_BLACK, "= %08x", PC - (uintptr_t)&__kernel_reloc_start);
dtext(261, 45, C_BLACK, "(Error location)");
dtext( 6, 60, C_BLACK, "TEA");
@ -47,10 +46,11 @@ void vhex_kernel_exch_panic(void)
dprint(38, 75, C_BLACK, "= %#x", TRA);
dtext(281, 75, C_BLACK, "(Trap number)");
dtext(6, 95, C_BLACK, "An unrecoverable error occurred in the add-in.");
dtext(6, 108, C_BLACK, "Please press the RESET button to restart the");
dtext(6, 121, C_BLACK, "calculator.");
dprint( 6, 90, C_BLACK, "reloc base = %p", &__kernel_reloc_start);
dtext(6, 120, C_BLACK, "An unrecoverable error occurred in the add-in.");
dtext(6, 135, C_BLACK, "Please press the RESET button to restart the");
dtext(6, 150, C_BLACK, "calculator.");
dupdate();
#endif
while (1) { __asm__ volatile ("sleep"); }
}