*********************************************** *********************************************** *********************************************** *********************************************** *********************************************** *********************************************** 7305 HEADER #ifndef __7305_H__ # define __7305_H__ typedef struct intc_s { union IPRA_u { unsigned short WORD; struct { unsigned TMU0 :4; unsigned TMU1 :4; unsigned TMU2 :4; unsigned RTC :4; }; } IPRA; unsigned : 0x10; union IPRB_u { unsigned short WORD; struct { unsigned WDT :4; unsigned REF :4; unsigned :4; unsigned :4; }; } IPRB; unsigned : 0x10; union IPRC_u { unsigned short WORD; struct { unsigned IRQ3 :4; unsigned IRQ2 :4; unsigned IRQ1 :4; unsigned IRQ0 :4; }; } IPRC; unsigned : 0x10; union IPRD_u { unsigned short WORD; struct { unsigned PINT7 :4; unsigned PINT15 :4; unsigned IRQ5 :4; unsigned IRQ4 :4; }; } IPRD; unsigned : 0x10; union IPRE_u { unsigned short WORD; struct { unsigned DMAC :4; unsigned SCIF0 :4; unsigned SCIF2 :4; unsigned ADC :4; }; } IPRE; unsigned : 0x10; union IPRF_u { unsigned short WORD; struct { unsigned :4; unsigned :4; unsigned USB :4; unsigned :4; }; } IPRF; unsigned : 0x10; union IPRG_u { unsigned short WORD; struct { unsigned TPU0 :4; unsigned TPU1 :4; unsigned :4; unsigned :4; }; } IPRG; unsigned : 0x10; union IPRH_u { unsigned short WORD; struct { unsigned TPU2 :4; unsigned TPU3 :4; unsigned :4; unsigned :4; }; } IPRH; } INTC_t; #define INTC (*(volatile INTC_t*)0xa4080000) #endif ******************************************************* ******************************************************* ******************************************************* ******************************************************* ******************************************************* ******************************************************* ******************************************************* INTERRUPT.C #include "glados/7305.h" #include "glados/stream.h" #include "glados/syscall.h" #include "glados/screen.h" #include "lib/my_stdio.h" #include "lib/my_unistd.h" extern void put_nbr(int x, int y, uint32_t data, int pos); volatile uint32_t interrupt_counter; extern uint32_t glados_vbr; extern glados_t *glados; __attribute__((section(".glados.exept"), interrupt_handler)) void exeption_handler(void) { while (1); } __attribute__((section(".glados.tlb"), interrupt_handler)) void tlb_handler(void) { while (1); } __attribute__((section(".glados.interupt"), interrupt_handler)) void interrupt_handler(void) { while (1); } #ifdef INTERRUPT_DEBUG static void stop_interrupt(void) { INTC.IPRA.WORD = 0x0000; INTC.IPRB.WORD = 0x0000; INTC.IPRC.WORD = 0x0000; INTC.IPRD.WORD = 0x0000; INTC.IPRE.WORD = 0x0000; INTC.IPRF.WORD = 0x0000; INTC.IPRG.WORD = 0x0000; INTC.IPRH.WORD = 0x0000; } static void dump_intc(void) { my_printf("IPRA: %#x\n", INTC.IPRA.WORD); my_printf("IPRB: %#x\n", INTC.IPRB.WORD); my_printf("IPRC: %#x\n", INTC.IPRC.WORD); my_printf("IPRD: %#x\n", INTC.IPRD.WORD); my_printf("IPRE: %#x\n", INTC.IPRE.WORD); my_printf("IPRF: %#x\n", INTC.IPRF.WORD); my_printf("IPRG: %#x\n", INTC.IPRG.WORD); my_printf("IPRH: %#x\n", INTC.IPRH.WORD); } void show_interrupt_counter(void) { puts("stop interrupt..."); __block_interrupt(); puts("DONE\nDump INTC:\n"); dump_intc(); puts("reset interrupt..."); stop_interrupt(); puts("DONE\n"); interrupt_counter = 0; puts("set new VBR..."); __set_vbr((void*)&glados_vbr); puts("DONE\nAllow interrupt..."); __unblock_interrupt(); puts("DONE\n"); //puts("FAIL\n"); puts("Re-dump INTC:\n"); dump_intc(); while (1); while (1){ __clear_vram(glados->vram); put_nbr(0, 0, interrupt_counter, 0); __display_vram(glados->vram); } } #endif ********************************************************* ********************************************************* ********************************************************* ********************************************************* ********************************************************* ********************************************************* ********************************************************* ********************************************************* MEMORY_MAP.TXT Archive member included to satisfy reference by file (symbol) lib//libmystdlib.a(lib_lmystdlib_my_malloc.o) build/bootstrap_ini_glados.o (_malloc) lib//libmystdlib.a(lib_lmystdlib_my_free.o) build/bootstrap_ini_glados.o (_free) lib//libmystdio.a(lib_lmystdio_my_printf.o) build/interrupt_handler.o (_my_printf) lib//libmystdio.a(lib_lmystdio_my_vfprintf.o) lib//libmystdio.a(lib_lmystdio_my_printf.o) (_my_vfprintf) lib//libmystdio.a(lib_lmystdio_vfprintf_get_option.o) lib//libmystdio.a(lib_lmystdio_my_vfprintf.o) (_vfprintf_get_flags) lib//libmystdio.a(lib_lmystdio_vfprintf_get_arg.o) lib//libmystdio.a(lib_lmystdio_my_vfprintf.o) (_vfprintf_get_arg) lib//libmystdio.a(lib_lmystdio_vfprintf_get_size.o) lib//libmystdio.a(lib_lmystdio_my_vfprintf.o) (_vfprintf_get_size) lib//libmystdio.a(lib_lmystdio_vfprintf_print_arg.o) lib//libmystdio.a(lib_lmystdio_my_vfprintf.o) (_vfprintf_print_arg) lib//libmyunistd.a(lib_lmyunistd_write.o) build/interrupt_handler.o (_write) /home/paquity/CASIO/sh3eb-elf/lib/gcc/sh3eb-elf/8.2.0/libgcc.a(_sdivsi3.o) lib//libmystdio.a(lib_lmystdio_vfprintf_get_size.o) (___sdivsi3) /home/paquity/CASIO/sh3eb-elf/lib/gcc/sh3eb-elf/8.2.0/libgcc.a(_udivsi3.o) lib//libmystdio.a(lib_lmystdio_vfprintf_get_size.o) (___udivsi3) Allocating common symbols Common symbol size file glados 0x4 build/bootstrap_ini_glados.o interrupt_counter 0x4 build/interrupt_handler.o Memory Configuration Name Origin Length Attributes rom 0x0000000000300200 0x0000000000080000 ram 0x0000000008100000 0x0000000000002000 my_ram 0x000000008800d000 0x0000000000003000 *default* 0x0000000000000000 0xffffffffffffffff Linker script and memory map LOAD build/interrupt_handler.o LOAD build/flash_save_stream.o LOAD build/flash_flash.o LOAD build/keyboard_driver.o LOAD build/screen_driver.o LOAD build/stream_display.o LOAD build/stream_update.o LOAD build/bootstrap_crt0.o LOAD build/bootstrap_ini_glados.o LOAD build/bootstrap_stuff.o LOAD build/shell_main.o LOAD build/syscall_syscall.o LOAD lib//libmystdlib.a LOAD lib//libmystdio.a LOAD lib//libmyunistd.a LOAD lib//libmystring.a LOAD /home/paquity/CASIO/sh3eb-elf/lib/gcc/sh3eb-elf/8.2.0/libgcc.a .text 0x0000000000300200 0x29e8 *(.pretext) .pretext 0x0000000000300200 0xbc build/bootstrap_crt0.o 0x0000000000300200 _bootstrap .pretext 0x00000000003002bc 0x46 build/bootstrap_stuff.o 0x00000000003002bc ___save_stuff 0x00000000003002e0 ___restore_stuff *(.pretext.*) .pretext.dump 0x0000000000300302 0x100 build/bootstrap_crt0.o 0x0000000000300302 _section_dump 0x0000000000300394 _section_reset *(.text) *fill* 0x0000000000300402 0x2 .text 0x0000000000300404 0x184 build/interrupt_handler.o 0x0000000000300540 _show_interrupt_counter .text 0x0000000000300588 0x180 build/flash_save_stream.o 0x0000000000300600 _save_global_output *fill* 0x0000000000300708 0x8 .text 0x0000000000300710 0x70 build/flash_flash.o 0x0000000000300710 ___Bfile_OpenFile 0x000000000030071c ___Bfile_WriteFile 0x0000000000300728 ___Bfile_ReadFile 0x0000000000300734 ___Bfile_CreateFile 0x0000000000300740 ___Bfile_DeleteFile 0x000000000030074c ___Bfile_CloseFile .text 0x0000000000300780 0xd4 build/keyboard_driver.o 0x0000000000300780 _key_down *fill* 0x0000000000300854 0xc .text 0x0000000000300860 0x90 build/screen_driver.o 0x0000000000300860 ___clear_vram 0x00000000003008a4 ___display_vram .text 0x00000000003008f0 0x410 build/stream_display.o 0x0000000000300b08 _put_nbr 0x0000000000300be0 _display_stream .text 0x0000000000300d00 0x19c build/stream_update.o 0x0000000000300dd4 _update_stream .text 0x0000000000300e9c 0x0 build/bootstrap_crt0.o .text 0x0000000000300e9c 0x170 build/bootstrap_ini_glados.o 0x0000000000300e9c _init_glados 0x0000000000300fe4 _quit_glados .text 0x000000000030100c 0x0 build/bootstrap_stuff.o .text 0x000000000030100c 0x1cc build/shell_main.o 0x000000000030100c _main *fill* 0x00000000003011d8 0x8 .text 0x00000000003011e0 0x80 build/syscall_syscall.o 0x00000000003011e0 ___free 0x00000000003011ec ___malloc 0x00000000003011f8 ___get_vram 0x0000000000301204 ___get_osinfo 0x0000000000301210 ___get_vbr 0x0000000000301214 ___set_vbr 0x0000000000301218 ___block_interrupt 0x0000000000301224 ___unblock_interrupt .text 0x0000000000301260 0x30 lib//libmystdlib.a(lib_lmystdlib_my_malloc.o) 0x0000000000301260 _malloc .text 0x0000000000301290 0x2c lib//libmystdlib.a(lib_lmystdlib_my_free.o) 0x0000000000301290 _free .text 0x00000000003012bc 0x38 lib//libmystdio.a(lib_lmystdio_my_printf.o) 0x00000000003012bc _my_printf .text 0x00000000003012f4 0x2e0 lib//libmystdio.a(lib_lmystdio_my_vfprintf.o) 0x0000000000301520 _my_vfprintf .text 0x00000000003015d4 0x698 lib//libmystdio.a(lib_lmystdio_vfprintf_get_option.o) 0x00000000003015d4 _vfprintf_get_flags 0x0000000000301726 _vfprintf_get_type 0x0000000000301966 _vfprintf_get_precision 0x0000000000301a22 _vfprintf_get_base 0x0000000000301ad8 _vfprintf_get_ouput_type .text 0x0000000000301c6c 0x31c lib//libmystdio.a(lib_lmystdio_vfprintf_get_arg.o) 0x0000000000301ebe _vfprintf_get_arg .text 0x0000000000301f88 0x390 lib//libmystdio.a(lib_lmystdio_vfprintf_get_size.o) 0x000000000030223c _vfprintf_get_size .text 0x0000000000302318 0x64c lib//libmystdio.a(lib_lmystdio_vfprintf_print_arg.o) 0x0000000000302792 _vfprintf_print_arg .text 0x0000000000302964 0x178 lib//libmyunistd.a(lib_lmyunistd_write.o) 0x00000000003029d4 _write .text 0x0000000000302adc 0xa0 /home/paquity/CASIO/sh3eb-elf/lib/gcc/sh3eb-elf/8.2.0/libgcc.a(_sdivsi3.o) 0x0000000000302adc ___sdivsi3 .text 0x0000000000302b7c 0x6c /home/paquity/CASIO/sh3eb-elf/lib/gcc/sh3eb-elf/8.2.0/libgcc.a(_udivsi3.o) 0x0000000000302b9e ___udivsi3 *(.text.*) .rodata 0x0000000000302be8 0xe36 *(.rodata) .rodata 0x0000000000302be8 0x285 build/interrupt_handler.o *fill* 0x0000000000302e6d 0x3 .rodata 0x0000000000302e70 0x23f build/flash_save_stream.o *fill* 0x00000000003030af 0x1 .rodata 0x00000000003030b0 0x200 build/stream_display.o .rodata 0x00000000003032b0 0x200 build/stream_update.o .rodata 0x00000000003034b0 0x349 build/shell_main.o *fill* 0x00000000003037f9 0x3 .rodata 0x00000000003037fc 0x2 lib//libmystdio.a(lib_lmystdio_vfprintf_get_option.o) .rodata 0x00000000003037fe 0x20 lib//libmystdio.a(lib_lmystdio_vfprintf_print_arg.o) .rodata 0x000000000030381e 0x200 lib//libmyunistd.a(lib_lmyunistd_write.o) *(.rodata.*) 0x0000000000303a1e _erodata = . .bss 0x0000000008100000 0x8 *(.bss) .bss 0x0000000008100000 0x0 build/interrupt_handler.o .bss 0x0000000008100000 0x0 build/flash_save_stream.o .bss 0x0000000008100000 0x0 build/flash_flash.o .bss 0x0000000008100000 0x0 build/keyboard_driver.o .bss 0x0000000008100000 0x0 build/screen_driver.o .bss 0x0000000008100000 0x0 build/stream_display.o .bss 0x0000000008100000 0x0 build/stream_update.o .bss 0x0000000008100000 0x0 build/bootstrap_crt0.o .bss 0x0000000008100000 0x0 build/bootstrap_ini_glados.o .bss 0x0000000008100000 0x0 build/bootstrap_stuff.o .bss 0x0000000008100000 0x0 build/shell_main.o .bss 0x0000000008100000 0x0 build/syscall_syscall.o .bss 0x0000000008100000 0x0 lib//libmystdlib.a(lib_lmystdlib_my_malloc.o) .bss 0x0000000008100000 0x0 lib//libmystdlib.a(lib_lmystdlib_my_free.o) .bss 0x0000000008100000 0x0 lib//libmystdio.a(lib_lmystdio_my_printf.o) .bss 0x0000000008100000 0x0 lib//libmystdio.a(lib_lmystdio_my_vfprintf.o) .bss 0x0000000008100000 0x0 lib//libmystdio.a(lib_lmystdio_vfprintf_get_option.o) .bss 0x0000000008100000 0x0 lib//libmystdio.a(lib_lmystdio_vfprintf_get_arg.o) .bss 0x0000000008100000 0x0 lib//libmystdio.a(lib_lmystdio_vfprintf_get_size.o) .bss 0x0000000008100000 0x0 lib//libmystdio.a(lib_lmystdio_vfprintf_print_arg.o) .bss 0x0000000008100000 0x0 lib//libmyunistd.a(lib_lmyunistd_write.o) .bss 0x0000000008100000 0x0 /home/paquity/CASIO/sh3eb-elf/lib/gcc/sh3eb-elf/8.2.0/libgcc.a(_sdivsi3.o) .bss 0x0000000008100000 0x0 /home/paquity/CASIO/sh3eb-elf/lib/gcc/sh3eb-elf/8.2.0/libgcc.a(_udivsi3.o) *(.bss.*) *(COMMON) COMMON 0x0000000008100000 0x4 build/interrupt_handler.o 0x0000000008100000 _interrupt_counter COMMON 0x0000000008100004 0x4 build/bootstrap_ini_glados.o 0x0000000008100004 _glados 0x0000000000000008 _bss_size = SIZEOF (.bss) 0x0000000008100000 _bbss_rom = LOADADDR (.bss) .data 0x0000000008100008 0x0 load address 0x0000000000303a26 0x0000000008100008 _bdata_ram = . *(.data) .data 0x0000000008100008 0x0 build/interrupt_handler.o .data 0x0000000008100008 0x0 build/flash_save_stream.o .data 0x0000000008100008 0x0 build/flash_flash.o .data 0x0000000008100008 0x0 build/keyboard_driver.o .data 0x0000000008100008 0x0 build/screen_driver.o .data 0x0000000008100008 0x0 build/stream_display.o .data 0x0000000008100008 0x0 build/stream_update.o .data 0x0000000008100008 0x0 build/bootstrap_crt0.o .data 0x0000000008100008 0x0 build/bootstrap_ini_glados.o .data 0x0000000008100008 0x0 build/bootstrap_stuff.o .data 0x0000000008100008 0x0 build/shell_main.o .data 0x0000000008100008 0x0 build/syscall_syscall.o .data 0x0000000008100008 0x0 lib//libmystdlib.a(lib_lmystdlib_my_malloc.o) .data 0x0000000008100008 0x0 lib//libmystdlib.a(lib_lmystdlib_my_free.o) .data 0x0000000008100008 0x0 lib//libmystdio.a(lib_lmystdio_my_printf.o) .data 0x0000000008100008 0x0 lib//libmystdio.a(lib_lmystdio_my_vfprintf.o) .data 0x0000000008100008 0x0 lib//libmystdio.a(lib_lmystdio_vfprintf_get_option.o) .data 0x0000000008100008 0x0 lib//libmystdio.a(lib_lmystdio_vfprintf_get_arg.o) .data 0x0000000008100008 0x0 lib//libmystdio.a(lib_lmystdio_vfprintf_get_size.o) .data 0x0000000008100008 0x0 lib//libmystdio.a(lib_lmystdio_vfprintf_print_arg.o) .data 0x0000000008100008 0x0 lib//libmyunistd.a(lib_lmyunistd_write.o) .data 0x0000000008100008 0x0 /home/paquity/CASIO/sh3eb-elf/lib/gcc/sh3eb-elf/8.2.0/libgcc.a(_sdivsi3.o) .data 0x0000000008100008 0x0 /home/paquity/CASIO/sh3eb-elf/lib/gcc/sh3eb-elf/8.2.0/libgcc.a(_udivsi3.o) *(.data.*) 0x0000000008100008 . = ALIGN (0x4) 0x0000000000303a26 _data_size = (LOADADDR (.data) + SIZEOF (.data)) 0x0000000000303a26 _bdata_rom = LOADADDR (.data) .glados 0x000000008800d000 0x608 load address 0x0000000000303a26 0x000000008800d000 . = ALIGN (0x100) 0x000000008800d000 _glados_vbr = . 0x000000008800d000 _bglados_ram = . 0x000000008800d100 . = (_glados_vbr + 0x100) *fill* 0x000000008800d000 0x100 *(.glados.exept) .glados.exept 0x000000008800d100 0x8 build/interrupt_handler.o 0x000000008800d100 _exeption_handler 0x000000008800d400 . = (_glados_vbr + 0x400) *fill* 0x000000008800d108 0x2f8 *(.glados.tlb) .glados.tlb 0x000000008800d400 0x8 build/interrupt_handler.o 0x000000008800d400 _tlb_handler 0x000000008800d600 . = (_glados_vbr + 0x600) *fill* 0x000000008800d408 0x1f8 *(.glados.interupt) .glados.interupt 0x000000008800d600 0x8 build/interrupt_handler.o 0x000000008800d600 _interrupt_handler 0x000000008800d608 . = ALIGN (0x4) 0x000000000030402e _glados_size = (LOADADDR (.glados) + SIZEOF (.glados)) 0x0000000000303a26 _bglados_rom = LOADADDR (.glados) .rela.dyn 0x000000008800d608 0x0 load address 0x0000000000304030 .rela.text 0x000000008800d608 0x0 build/flash_save_stream.o .rela.pretext 0x000000008800d608 0x0 build/flash_save_stream.o .eh_frame *(.eh_frame) *(.eh_frame.*) OUTPUT(glados.elf elf32-sh) .comment 0x0000000000000000 0x11 .comment 0x0000000000000000 0x11 build/interrupt_handler.o 0x12 (size before relaxing) .comment 0x0000000000000011 0x12 build/flash_save_stream.o .comment 0x0000000000000011 0x12 build/keyboard_driver.o .comment 0x0000000000000011 0x12 build/stream_display.o .comment 0x0000000000000011 0x12 build/stream_update.o .comment 0x0000000000000011 0x12 build/bootstrap_crt0.o .comment 0x0000000000000011 0x12 build/bootstrap_ini_glados.o .comment 0x0000000000000011 0x12 build/shell_main.o .comment 0x0000000000000011 0x12 lib//libmystdlib.a(lib_lmystdlib_my_malloc.o) .comment 0x0000000000000011 0x12 lib//libmystdlib.a(lib_lmystdlib_my_free.o) .comment 0x0000000000000011 0x12 lib//libmystdio.a(lib_lmystdio_my_printf.o) .comment 0x0000000000000011 0x12 lib//libmystdio.a(lib_lmystdio_my_vfprintf.o) .comment 0x0000000000000011 0x12 lib//libmystdio.a(lib_lmystdio_vfprintf_get_option.o) .comment 0x0000000000000011 0x12 lib//libmystdio.a(lib_lmystdio_vfprintf_get_arg.o) .comment 0x0000000000000011 0x12 lib//libmystdio.a(lib_lmystdio_vfprintf_get_size.o) .comment 0x0000000000000011 0x12 lib//libmystdio.a(lib_lmystdio_vfprintf_print_arg.o) .comment 0x0000000000000011 0x12 lib//libmyunistd.a(lib_lmyunistd_write.o)