Some random additions, mostly to firmware.

-SNES support for 32Byte page writes, but host lua scripts are a bit of
a mess and still need committed.  Firmware isn't very clean either but
it's working..
-SEGA stuff is early and non-working.  Got it working in a separate
branch which will commit shortly.
-SWIM updates for better erasing, flashing, and dumping routines
-FILES updates for jtag and some other niceties
-JTAG is working now for LC4032V & Mach-XO 256
This commit is contained in:
Paul XPS 2019-11-01 00:06:14 -05:00
parent d7658d0ab2
commit 9090177ce3
26 changed files with 4780 additions and 1348 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
Archive member included to satisfy reference by file (symbol)
c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v6-m\libgcc.a(unwind-arm.o)
C:\Users\PAUL_D~1\AppData\Local\Temp\ccYiu3Ln.o (__aeabi_unwind_cpp_pr0)
C:\Users\paul\AppData\Local\Temp\cc0qRkgb.o (__aeabi_unwind_cpp_pr0)
c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v6-m\libgcc.a(libunwind.o)
c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v6-m\libgcc.a(unwind-arm.o) (restore_core_regs)
c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v6-m\libgcc.a(pr-support.o)
@ -51,9 +51,9 @@ c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3
c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v6-m\libnosys.a(_exit.o)
c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v6-m\libg.a(lib_a-abort.o) (_exit)
c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v6-m\libgcc.a(_thumb1_case_uqi.o)
C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o (__gnu_thumb1_case_uqi)
C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o (__gnu_thumb1_case_uqi)
c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v6-m\libgcc.a(_thumb1_case_uhi.o)
C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o (__gnu_thumb1_case_uhi)
C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o (__gnu_thumb1_case_uhi)
Allocating common symbols
Common symbol size file
@ -133,39 +133,41 @@ Discarded input sections
.ARM.exidx 0x00000000 0x8 c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v6-m/crt0.o
.ARM.attributes
0x00000000 0x1b c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v6-m/crt0.o
.text 0x00000000 0x0 C:\Users\PAUL_D~1\AppData\Local\Temp\ccOm59Pi.o
.data 0x00000000 0x0 C:\Users\PAUL_D~1\AppData\Local\Temp\ccOm59Pi.o
.bss 0x00000000 0x0 C:\Users\PAUL_D~1\AppData\Local\Temp\ccOm59Pi.o
.stack 0x00000000 0xc00 C:\Users\PAUL_D~1\AppData\Local\Temp\ccOm59Pi.o
.heap 0x00000000 0x0 C:\Users\PAUL_D~1\AppData\Local\Temp\ccOm59Pi.o
.debug_line 0x00000000 0x7c C:\Users\PAUL_D~1\AppData\Local\Temp\ccOm59Pi.o
.debug_info 0x00000000 0x22 C:\Users\PAUL_D~1\AppData\Local\Temp\ccOm59Pi.o
.debug_abbrev 0x00000000 0x12 C:\Users\PAUL_D~1\AppData\Local\Temp\ccOm59Pi.o
.text 0x00000000 0x0 C:\Users\paul\AppData\Local\Temp\ccOqsUkN.o
.data 0x00000000 0x0 C:\Users\paul\AppData\Local\Temp\ccOqsUkN.o
.bss 0x00000000 0x0 C:\Users\paul\AppData\Local\Temp\ccOqsUkN.o
.stack 0x00000000 0xc00 C:\Users\paul\AppData\Local\Temp\ccOqsUkN.o
.heap 0x00000000 0x0 C:\Users\paul\AppData\Local\Temp\ccOqsUkN.o
.debug_line 0x00000000 0x7c C:\Users\paul\AppData\Local\Temp\ccOqsUkN.o
.debug_info 0x00000000 0x22 C:\Users\paul\AppData\Local\Temp\ccOqsUkN.o
.debug_abbrev 0x00000000 0x12 C:\Users\paul\AppData\Local\Temp\ccOqsUkN.o
.debug_aranges
0x00000000 0x28 C:\Users\PAUL_D~1\AppData\Local\Temp\ccOm59Pi.o
.debug_str 0x00000000 0x70 C:\Users\PAUL_D~1\AppData\Local\Temp\ccOm59Pi.o
.debug_ranges 0x00000000 0x20 C:\Users\PAUL_D~1\AppData\Local\Temp\ccOm59Pi.o
0x00000000 0x28 C:\Users\paul\AppData\Local\Temp\ccOqsUkN.o
.debug_str 0x00000000 0x68 C:\Users\paul\AppData\Local\Temp\ccOqsUkN.o
.debug_ranges 0x00000000 0x20 C:\Users\paul\AppData\Local\Temp\ccOqsUkN.o
.ARM.attributes
0x00000000 0x1b C:\Users\PAUL_D~1\AppData\Local\Temp\ccOm59Pi.o
.text 0x00000000 0x0 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.data 0x00000000 0x0 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.bss 0x00000000 0x0 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.text 0x00000000 0x4 C:\Users\PAUL_D~1\AppData\Local\Temp\ccYiu3Ln.o
.data 0x00000000 0x0 C:\Users\PAUL_D~1\AppData\Local\Temp\ccYiu3Ln.o
.bss 0x00000000 0x0 C:\Users\PAUL_D~1\AppData\Local\Temp\ccYiu3Ln.o
.ARM.extab 0x00000000 0x0 C:\Users\PAUL_D~1\AppData\Local\Temp\ccYiu3Ln.o
.ARM.exidx 0x00000000 0x8 C:\Users\PAUL_D~1\AppData\Local\Temp\ccYiu3Ln.o
.debug_line 0x00000000 0x49 C:\Users\PAUL_D~1\AppData\Local\Temp\ccYiu3Ln.o
.debug_info 0x00000000 0x26 C:\Users\PAUL_D~1\AppData\Local\Temp\ccYiu3Ln.o
.debug_abbrev 0x00000000 0x14 C:\Users\PAUL_D~1\AppData\Local\Temp\ccYiu3Ln.o
0x00000000 0x1b C:\Users\paul\AppData\Local\Temp\ccOqsUkN.o
.text 0x00000000 0x0 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.data 0x00000000 0x0 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.bss 0x00000000 0x0 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.snes_3v_buffer_wr
0x00000000 0x2 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text 0x00000000 0x4 C:\Users\paul\AppData\Local\Temp\cc0qRkgb.o
.data 0x00000000 0x0 C:\Users\paul\AppData\Local\Temp\cc0qRkgb.o
.bss 0x00000000 0x0 C:\Users\paul\AppData\Local\Temp\cc0qRkgb.o
.ARM.extab 0x00000000 0x0 C:\Users\paul\AppData\Local\Temp\cc0qRkgb.o
.ARM.exidx 0x00000000 0x8 C:\Users\paul\AppData\Local\Temp\cc0qRkgb.o
.debug_line 0x00000000 0x49 C:\Users\paul\AppData\Local\Temp\cc0qRkgb.o
.debug_info 0x00000000 0x26 C:\Users\paul\AppData\Local\Temp\cc0qRkgb.o
.debug_abbrev 0x00000000 0x14 C:\Users\paul\AppData\Local\Temp\cc0qRkgb.o
.debug_aranges
0x00000000 0x20 C:\Users\PAUL_D~1\AppData\Local\Temp\ccYiu3Ln.o
.debug_str 0x00000000 0x6d C:\Users\PAUL_D~1\AppData\Local\Temp\ccYiu3Ln.o
0x00000000 0x20 C:\Users\paul\AppData\Local\Temp\cc0qRkgb.o
.debug_str 0x00000000 0x65 C:\Users\paul\AppData\Local\Temp\cc0qRkgb.o
.ARM.attributes
0x00000000 0x21 C:\Users\PAUL_D~1\AppData\Local\Temp\ccYiu3Ln.o
.data 0x00000000 0x0 C:\Users\PAUL_D~1\AppData\Local\Temp\cc21n1gw.o
.bss 0x00000000 0x0 C:\Users\PAUL_D~1\AppData\Local\Temp\cc21n1gw.o
.ARM.extab 0x00000000 0x0 C:\Users\PAUL_D~1\AppData\Local\Temp\cc21n1gw.o
0x00000000 0x21 C:\Users\paul\AppData\Local\Temp\cc0qRkgb.o
.data 0x00000000 0x0 C:\Users\paul\AppData\Local\Temp\ccCWXcVB.o
.bss 0x00000000 0x0 C:\Users\paul\AppData\Local\Temp\ccCWXcVB.o
.ARM.extab 0x00000000 0x0 C:\Users\paul\AppData\Local\Temp\ccCWXcVB.o
.data 0x00000000 0x0 c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v6-m\libgcc.a(unwind-arm.o)
.bss 0x00000000 0x0 c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v6-m\libgcc.a(unwind-arm.o)
.debug_frame 0x00000000 0x2b4 c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v6-m\libgcc.a(unwind-arm.o)
@ -428,10 +430,10 @@ Linker script and memory map
LOAD c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v6-m/crti.o
LOAD c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v6-m/crtbegin.o
LOAD c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v6-m/crt0.o
LOAD C:\Users\PAUL_D~1\AppData\Local\Temp\ccOm59Pi.o
LOAD C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
LOAD C:\Users\PAUL_D~1\AppData\Local\Temp\ccYiu3Ln.o
LOAD C:\Users\PAUL_D~1\AppData\Local\Temp\cc21n1gw.o
LOAD C:\Users\paul\AppData\Local\Temp\ccOqsUkN.o
LOAD C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
LOAD C:\Users\paul\AppData\Local\Temp\cc0qRkgb.o
LOAD C:\Users\paul\AppData\Local\Temp\ccCWXcVB.o
START GROUP
LOAD c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v6-m\libgcc.a
LOAD c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v6-m\libg.a
@ -445,17 +447,17 @@ END GROUP
LOAD c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v6-m/crtend.o
LOAD c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v6-m/crtn.o
.text 0x08000000 0x5740
.text 0x08000000 0x5860
*(.isr_vector)
.isr_vector 0x08000000 0xc0 C:\Users\PAUL_D~1\AppData\Local\Temp\ccOm59Pi.o
.isr_vector 0x08000000 0xc0 C:\Users\paul\AppData\Local\Temp\ccOqsUkN.o
0x08000000 __isr_vector
*(.usb_driver)
.usb_driver 0x080000c0 0x3bc C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.usb_driver 0x080000c0 0x3bc C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
0x08000198 USB_IRQHandler
*(.usb_desc)
.usb_desc 0x0800047c 0xb8 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.usb_desc 0x0800047c 0xb8 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
*(.hardfault)
.hardfault 0x08000534 0x2 C:\Users\PAUL_D~1\AppData\Local\Temp\ccOm59Pi.o
.hardfault 0x08000534 0x2 C:\Users\paul\AppData\Local\Temp\ccOqsUkN.o
0x08000534 TIM1_CC_IRQHandler
0x08000534 TSC_IRQHandler
0x08000534 ADC1_COMP_IRQHandler
@ -494,7 +496,7 @@ LOAD c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eab
0x08000534 USART1_IRQHandler
0x08000534 TIM1_BRK_UP_TRG_COM_IRQHandler
*fill* 0x08000536 0x2 ff
.hardfault 0x08000538 0xc C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.hardfault 0x08000538 0xc C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
0x08000538 HardFault_Handler
*_thumb1_case_uqi.o()
.text 0x08000544 0x14 c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v6-m\libgcc.a(_thumb1_case_uqi.o)
@ -510,11 +512,11 @@ LOAD c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eab
0x0800058c 0x1e c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v6-m\libgcc.a(_thumb1_case_uhi.o)
*(.fw_update)
*fill* 0x080005aa 0x2 ff
.fw_update 0x080005ac 0x150 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.fw_update 0x080005ac 0x150 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
0x00000770 . = 0x770
*fill* 0x080006fc 0x74 ff
*(.fw_up_main)
.fw_up_main 0x08000770 0x70 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.fw_up_main 0x08000770 0x70 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
0x00000800 . = 0x800
*fill* 0x080007e0 0x20 ff
*(.appver)
@ -522,187 +524,191 @@ LOAD c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eab
*fill* 0x08000800 0x4 ff
*(.reset_handler)
.reset_handler
0x08000804 0x3c C:\Users\PAUL_D~1\AppData\Local\Temp\ccOm59Pi.o
0x08000804 0x3c C:\Users\paul\AppData\Local\Temp\ccOqsUkN.o
0x08000804 Reset_Handler
*(.usbFuncWrite)
.usbFuncWrite 0x08000840 0x44 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.usbFuncWrite 0x08000840 0x44 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
*(.usbFuncSetup)
.usbFuncSetup 0x08000884 0x1d04 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.usbFuncSetup 0x08000884 0x1d04 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
*(.text*)
.text.snes_page_rd_poll.constprop.29
0x08002588 0x7c C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x08002588 0x70 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.nes_cpu_page_rd_poll.constprop.28
0x08002604 0x6c C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x080025f8 0x6c C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.nes_ppu_page_rd_poll.constprop.25
0x08002670 0x68 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x08002664 0x68 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.append_pairity
0x080026d8 0x1e C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x080026cc 0x1e C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.delay_us
0x080026f6 0x14 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
*fill* 0x0800270a 0x2 ff
.text.lfsr_32 0x0800270c 0x30 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.text.snes_wr 0x0800273c 0x60 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.text.snes_rd 0x0800279c 0x48 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.text.write_page_snes.constprop.34
0x080027e4 0x194 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x080026ea 0x14 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
*fill* 0x080026fe 0x2 ff
.text.lfsr_32 0x08002700 0x30 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.snes_wr 0x08002730 0x60 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.snes_rd 0x08002790 0x48 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.write_page_snes.constprop.35
0x080027d8 0x194 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.write_page_buffer.constprop.34
0x0800296c 0x94 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.snes_3v_verify_wr
0x08002a00 0x50 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.snes_3v_flash_wr
0x08002978 0x50 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x08002a50 0x50 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.snes_5v_flash_wr
0x080029c8 0x50 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x08002aa0 0x50 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.genesis_page_rd
0x08002a18 0xa4 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x08002af0 0xa4 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.mmc3s_prgrom_flash_wr
0x08002abc 0x4 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x08002b94 0x4 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.nes_dualport_wr
0x08002ac0 0x50 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x08002b98 0x50 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.nes_dualport_rd
0x08002b10 0x38 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x08002be8 0x38 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.nes_ppu_wr
0x08002b48 0x50 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x08002c20 0x50 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.nes_ppu_rd
0x08002b98 0x38 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x08002c70 0x38 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.mmc3_chrrom_flash_wr
0x08002bd0 0x44 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x08002ca8 0x44 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.nrom_chrrom_flash_wr
0x08002c14 0x44 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x08002cec 0x44 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.nes_m2_high_wr
0x08002c58 0x60 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x08002d30 0x60 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.nes_cpu_wr
0x08002cb8 0x7c C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x08002d90 0x7c C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.cdream_chrrom_flash_wr
0x08002d34 0x8c C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x08002e0c 0x8c C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.mmc4_chrrom_flash_wr
0x08002dc0 0x74 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x08002e98 0x74 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.cnrom_chrrom_flash_wr
0x08002e34 0x7c C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x08002f0c 0x7c C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.nes_cpu_rd
0x08002eb0 0x38 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x08002f88 0x38 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.tssop_prgrom_flash_wr
0x08002ee8 0x2a C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x08002fc0 0x2a C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.a53_tssop_prgrom_flash_wr
0x08002f12 0x36 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x08002fea 0x36 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.gtrom_prgrom_flash_wr
0x08002f48 0x4c C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x08003020 0x4c C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.map30_prgrom_flash_wr
0x08002f94 0x74 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x0800306c 0x74 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.mmc4_prgrom_flash_wr
0x08003008 0x54 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x080030e0 0x54 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.mmc3_prgrom_flash_wr
0x0800305c 0x50 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x08003134 0x50 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.disc_push_exp0_prgrom_wr
0x080030ac 0x48 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x08003184 0x48 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.discrete_exp0_prgrom_wr
0x080030f4 0x58 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x080031cc 0x58 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.unrom_prgrom_flash_wr
0x0800314c 0x64 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x08003224 0x64 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.nrom_prgrom_flash_wr
0x080031b0 0x44 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x08003288 0x44 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.n64_latch_addr
0x080031f4 0x60 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x080032cc 0x60 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.pbje_scan
0x08003254 0x10c C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x0800332c 0x10c C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.pbje_state_change
0x08003360 0x88 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x08003438 0x88 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.jtag_init_pbje
0x080033e8 0xe0 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x080034c0 0xe0 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.jtag_run_pbje.part.0
0x080034c8 0xb8 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x080035a0 0xb8 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.io_reset
0x08003580 0x174 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.text.gba_rd 0x080036f4 0x4c C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x08003658 0x174 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.gba_rd 0x080037cc 0x4c C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.write_page_verify
0x08003740 0x5c C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x08003818 0x5c C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.write_page
0x0800379c 0x34 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x08003874 0x34 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.get_next_buff
0x080037d0 0x54 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x080038a8 0x54 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.mmc1_wr.constprop.12
0x08003824 0x22 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
*fill* 0x08003846 0x2 ff
0x080038fc 0x22 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
*fill* 0x0800391e 0x2 ff
.text.mmc1_chrrom_flash_wr
0x08003848 0x60 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x08003920 0x60 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.mmc1_prgrom_flash_wr
0x080038a8 0x50 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x08003980 0x50 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.swim_wotf
0x080038f8 0xb4 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x080039d0 0xb4 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.swim_rotf
0x080039ac 0xac C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x08003a84 0xac C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.text.startup.main
0x08003a58 0xb48 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x08003a58 main
.text 0x080045a0 0x154 C:\Users\PAUL_D~1\AppData\Local\Temp\cc21n1gw.o
0x080045a0 swim_xfr
.text 0x080046f4 0xa08 c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v6-m\libgcc.a(unwind-arm.o)
0x080049b0 _Unwind_GetCFA
0x080049b4 __gnu_Unwind_RaiseException
0x08004a08 __gnu_Unwind_ForcedUnwind
0x08004a1c __gnu_Unwind_Resume
0x08004a64 __gnu_Unwind_Resume_or_Rethrow
0x08004a80 _Unwind_Complete
0x08004a84 _Unwind_DeleteException
0x08004a94 _Unwind_VRS_Get
0x08004adc _Unwind_VRS_Set
0x08004b24 __gnu_Unwind_Backtrace
0x08004e74 __aeabi_unwind_cpp_pr0
0x08004e80 __aeabi_unwind_cpp_pr1
0x08004e8c __aeabi_unwind_cpp_pr2
0x08004e98 _Unwind_VRS_Pop
.text 0x080050fc 0x144 c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v6-m\libgcc.a(libunwind.o)
0x080050fc __restore_core_regs
0x080050fc restore_core_regs
0x08005128 __gnu_Unwind_Restore_VFP
0x0800512c __gnu_Unwind_Save_VFP
0x08005130 __gnu_Unwind_Restore_VFP_D
0x08005134 __gnu_Unwind_Save_VFP_D
0x08005138 __gnu_Unwind_Restore_VFP_D_16_to_31
0x0800513c __gnu_Unwind_Save_VFP_D_16_to_31
0x08005140 __gnu_Unwind_Restore_WMMXD
0x08005144 __gnu_Unwind_Save_WMMXD
0x08005148 __gnu_Unwind_Restore_WMMXC
0x0800514c __gnu_Unwind_Save_WMMXC
0x08005150 ___Unwind_RaiseException
0x08005150 _Unwind_RaiseException
0x08005180 _Unwind_Resume
0x08005180 ___Unwind_Resume
0x080051b0 _Unwind_Resume_or_Rethrow
0x080051b0 ___Unwind_Resume_or_Rethrow
0x080051e0 _Unwind_ForcedUnwind
0x080051e0 ___Unwind_ForcedUnwind
0x08005210 ___Unwind_Backtrace
0x08005210 _Unwind_Backtrace
.text 0x08005240 0x39c c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v6-m\libgcc.a(pr-support.o)
0x08005294 __gnu_unwind_execute
0x08005584 __gnu_unwind_frame
0x080055ac _Unwind_GetRegionStart
0x080055b8 _Unwind_GetLanguageSpecificData
0x080055cc _Unwind_GetDataRelBase
0x080055d4 _Unwind_GetTextRelBase
.text.abort 0x080055dc 0x10 c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v6-m\libg.a(lib_a-abort.o)
0x080055dc abort
.text.memcpy 0x080055ec 0x88 c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v6-m\libg.a(lib_a-memcpy-stub.o)
0x080055ec memcpy
0x08003b30 0xb90 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
0x08003b30 main
.text 0x080046c0 0x154 C:\Users\paul\AppData\Local\Temp\ccCWXcVB.o
0x080046c0 swim_xfr
.text 0x08004814 0xa08 c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v6-m\libgcc.a(unwind-arm.o)
0x08004ad0 _Unwind_GetCFA
0x08004ad4 __gnu_Unwind_RaiseException
0x08004b28 __gnu_Unwind_ForcedUnwind
0x08004b3c __gnu_Unwind_Resume
0x08004b84 __gnu_Unwind_Resume_or_Rethrow
0x08004ba0 _Unwind_Complete
0x08004ba4 _Unwind_DeleteException
0x08004bb4 _Unwind_VRS_Get
0x08004bfc _Unwind_VRS_Set
0x08004c44 __gnu_Unwind_Backtrace
0x08004f94 __aeabi_unwind_cpp_pr0
0x08004fa0 __aeabi_unwind_cpp_pr1
0x08004fac __aeabi_unwind_cpp_pr2
0x08004fb8 _Unwind_VRS_Pop
.text 0x0800521c 0x144 c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v6-m\libgcc.a(libunwind.o)
0x0800521c __restore_core_regs
0x0800521c restore_core_regs
0x08005248 __gnu_Unwind_Restore_VFP
0x0800524c __gnu_Unwind_Save_VFP
0x08005250 __gnu_Unwind_Restore_VFP_D
0x08005254 __gnu_Unwind_Save_VFP_D
0x08005258 __gnu_Unwind_Restore_VFP_D_16_to_31
0x0800525c __gnu_Unwind_Save_VFP_D_16_to_31
0x08005260 __gnu_Unwind_Restore_WMMXD
0x08005264 __gnu_Unwind_Save_WMMXD
0x08005268 __gnu_Unwind_Restore_WMMXC
0x0800526c __gnu_Unwind_Save_WMMXC
0x08005270 ___Unwind_RaiseException
0x08005270 _Unwind_RaiseException
0x080052a0 _Unwind_Resume
0x080052a0 ___Unwind_Resume
0x080052d0 _Unwind_Resume_or_Rethrow
0x080052d0 ___Unwind_Resume_or_Rethrow
0x08005300 _Unwind_ForcedUnwind
0x08005300 ___Unwind_ForcedUnwind
0x08005330 ___Unwind_Backtrace
0x08005330 _Unwind_Backtrace
.text 0x08005360 0x39c c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v6-m\libgcc.a(pr-support.o)
0x080053b4 __gnu_unwind_execute
0x080056a4 __gnu_unwind_frame
0x080056cc _Unwind_GetRegionStart
0x080056d8 _Unwind_GetLanguageSpecificData
0x080056ec _Unwind_GetDataRelBase
0x080056f4 _Unwind_GetTextRelBase
.text.abort 0x080056fc 0x10 c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v6-m\libg.a(lib_a-abort.o)
0x080056fc abort
.text.memcpy 0x0800570c 0x88 c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v6-m\libg.a(lib_a-memcpy-stub.o)
0x0800570c memcpy
.text._raise_r
0x08005674 0x5c c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v6-m\libg.a(lib_a-signal.o)
0x08005674 _raise_r
.text.raise 0x080056d0 0x14 c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v6-m\libg.a(lib_a-signal.o)
0x080056d0 raise
.text._kill_r 0x080056e4 0x28 c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v6-m\libg.a(lib_a-signalr.o)
0x080056e4 _kill_r
0x08005794 0x5c c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v6-m\libg.a(lib_a-signal.o)
0x08005794 _raise_r
.text.raise 0x080057f0 0x14 c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v6-m\libg.a(lib_a-signal.o)
0x080057f0 raise
.text._kill_r 0x08005804 0x28 c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v6-m\libg.a(lib_a-signalr.o)
0x08005804 _kill_r
.text._getpid_r
0x0800570c 0x8 c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v6-m\libg.a(lib_a-signalr.o)
0x0800570c _getpid_r
.text._getpid 0x08005714 0x10 c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v6-m\libnosys.a(getpid.o)
0x08005714 _getpid
.text._kill 0x08005724 0x10 c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v6-m\libnosys.a(kill.o)
0x08005724 _kill
.text._exit 0x08005734 0x4 c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v6-m\libnosys.a(_exit.o)
0x08005734 _exit
0x0800582c 0x8 c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v6-m\libg.a(lib_a-signalr.o)
0x0800582c _getpid_r
.text._getpid 0x08005834 0x10 c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v6-m\libnosys.a(getpid.o)
0x08005834 _getpid
.text._kill 0x08005844 0x10 c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v6-m\libnosys.a(kill.o)
0x08005844 _kill
.text._exit 0x08005854 0x4 c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v6-m\libnosys.a(_exit.o)
0x08005854 _exit
*(.init)
.init 0x08005738 0x4 c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v6-m/crti.o
0x08005738 _init
.init 0x08005858 0x4 c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v6-m/crti.o
0x08005858 _init
*(.fini)
.fini 0x0800573c 0x4 c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v6-m/crti.o
0x0800573c _fini
.fini 0x0800585c 0x4 c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v6-m/crti.o
0x0800585c _fini
*crtbegin.o(.ctors)
*crtbegin?.o(.ctors)
*(EXCLUDE_FILE(*crtend.o *crtend?.o) .ctors)
@ -716,42 +722,42 @@ LOAD c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eab
*(.rodata*)
*(.eh_frame*)
.glue_7 0x08005740 0x0
.glue_7 0x08005740 0x0 linker stubs
.glue_7 0x08005860 0x0
.glue_7 0x08005860 0x0 linker stubs
.glue_7t 0x08005740 0x0
.glue_7t 0x08005740 0x0 linker stubs
.glue_7t 0x08005860 0x0
.glue_7t 0x08005860 0x0 linker stubs
.vfp11_veneer 0x08005740 0x0
.vfp11_veneer 0x08005740 0x0 linker stubs
.vfp11_veneer 0x08005860 0x0
.vfp11_veneer 0x08005860 0x0 linker stubs
.v4_bx 0x08005740 0x0
.v4_bx 0x08005740 0x0 linker stubs
.v4_bx 0x08005860 0x0
.v4_bx 0x08005860 0x0 linker stubs
.iplt 0x08005740 0x0
.iplt 0x08005740 0x0 C:\Users\PAUL_D~1\AppData\Local\Temp\ccOm59Pi.o
.iplt 0x08005860 0x0
.iplt 0x08005860 0x0 C:\Users\paul\AppData\Local\Temp\ccOqsUkN.o
.ARM.extab 0x08005740 0x30
.ARM.extab 0x08005860 0x30
*(.ARM.extab* .gnu.linkonce.armextab.*)
.ARM.extab 0x08005740 0x24 c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v6-m\libgcc.a(unwind-arm.o)
.ARM.extab 0x08005764 0xc c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v6-m\libgcc.a(pr-support.o)
0x08005770 __exidx_start = .
.ARM.extab 0x08005860 0x24 c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v6-m\libgcc.a(unwind-arm.o)
.ARM.extab 0x08005884 0xc c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v6-m\libgcc.a(pr-support.o)
0x08005890 __exidx_start = .
.ARM.exidx 0x08005770 0xd0
.ARM.exidx 0x08005890 0xd0
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
.ARM.exidx 0x08005770 0x8 C:\Users\PAUL_D~1\AppData\Local\Temp\cc21n1gw.o
.ARM.exidx 0x08005890 0x8 C:\Users\paul\AppData\Local\Temp\ccCWXcVB.o
0x10 (size before relaxing)
.ARM.exidx 0x08005778 0x98 c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v6-m\libgcc.a(unwind-arm.o)
.ARM.exidx 0x08005898 0x98 c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v6-m\libgcc.a(unwind-arm.o)
0xd8 (size before relaxing)
.ARM.exidx 0x08005810 0x30 c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v6-m\libgcc.a(pr-support.o)
.ARM.exidx 0x08005930 0x30 c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v6-m\libgcc.a(pr-support.o)
0x48 (size before relaxing)
0x08005840 __exidx_end = .
0x08005840 __etext = ALIGN (0x4)
0x08005960 __exidx_end = .
0x08005960 __etext = ALIGN (0x4)
.rel.dyn 0x08005840 0x0
.rel.iplt 0x08005840 0x0 C:\Users\PAUL_D~1\AppData\Local\Temp\ccOm59Pi.o
.rel.dyn 0x08005960 0x0
.rel.iplt 0x08005960 0x0 C:\Users\paul\AppData\Local\Temp\ccOqsUkN.o
.data 0x20000000 0x430 load address 0x08005840
.data 0x20000000 0x430 load address 0x08005960
0x20000000 __data_start__ = .
*(vtable)
*(.data*)
@ -779,77 +785,77 @@ LOAD c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eab
*(.fastrun)
0x20000430 __data_end__ = .
.igot.plt 0x20000430 0x0 load address 0x08005c70
.igot.plt 0x20000430 0x0 C:\Users\PAUL_D~1\AppData\Local\Temp\ccOm59Pi.o
.igot.plt 0x20000430 0x0 load address 0x08005d90
.igot.plt 0x20000430 0x0 C:\Users\paul\AppData\Local\Temp\ccOqsUkN.o
.bss 0x20000430 0x308 load address 0x08005c70
.bss 0x20000430 0x308 load address 0x08005d90
0x20000430 . = ALIGN (0x4)
0x20000430 __bss_start__ = .
*(.bss*)
.bss.addr_ptr 0x20000430 0x4 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.bss.addrh 0x20000434 0x2 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.bss.addr_ptr 0x20000430 0x4 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.bss.addrh 0x20000434 0x2 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.bss.bank_table
0x20000436 0x2 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.bss.buff0 0x20000438 0x14 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.bss.buff1 0x2000044c 0x14 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.bss.buff2 0x20000460 0x14 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.bss.buff3 0x20000474 0x14 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x20000436 0x2 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.bss.buff0 0x20000438 0x14 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.bss.buff1 0x2000044c 0x14 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.bss.buff2 0x20000460 0x14 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.bss.buff3 0x20000474 0x14 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.bss.cur_addr_hi
0x20000488 0x1 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x20000488 0x1 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
*fill* 0x20000489 0x1
.bss.cur_addr_lo
0x2000048a 0x2 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.bss.cur_bank 0x2000048c 0x1 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x2000048a 0x2 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.bss.cur_bank 0x2000048c 0x1 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
*fill* 0x2000048d 0x3
.bss.cur_buff 0x20000490 0x4 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.bss.cur_buff 0x20000490 0x4 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.bss.cur_usb_load_buff
0x20000494 0x4 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x20000494 0x4 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.bss.incoming_bytes_remain
0x20000498 0x1 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x20000498 0x1 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
*fill* 0x20000499 0x3
.bss.lfsr 0x2000049c 0x4 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.bss.n64_bank 0x200004a0 0x2 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.bss.num_buff.5134
0x200004a2 0x1 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.bss.lfsr 0x2000049c 0x4 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.bss.n64_bank 0x200004a0 0x2 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.bss.num_buff.5143
0x200004a2 0x1 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.bss.num_prg_banks
0x200004a3 0x1 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x200004a3 0x1 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.bss.oper_info_struct
0x200004a4 0x20 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x200004a4 0x20 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.bss.pbje_command
0x200004c4 0x1 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x200004c4 0x1 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.bss.pbje_data
0x200004c5 0x20 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x200004c5 0x20 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.bss.pbje_numclk
0x200004e5 0x1 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x200004e5 0x1 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.bss.pbje_status
0x200004e6 0x1 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x200004e6 0x1 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.bss.raw_bank_status
0x200004e7 0x10 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x200004e7 0x10 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
*fill* 0x200004f7 0x1
.bss.raw_buffer16
0x200004f8 0x200 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.bss.rv16.4756
0x200006f8 0x8 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.bss.rv16.5054
0x20000700 0x8 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x200004f8 0x200 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.bss.rv16.4759
0x200006f8 0x8 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.bss.rv16.5063
0x20000700 0x8 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.bss.stm_debug_disable
0x20000708 0x1 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x20000708 0x1 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
*fill* 0x20000709 0x3
.bss.swim_base
0x2000070c 0x4 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.bss.swim_pin 0x20000710 0x1 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x2000070c 0x4 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.bss.swim_pin 0x20000710 0x1 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
*fill* 0x20000711 0x3
.bss.tck_base 0x20000714 0x4 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.bss.tck_pin 0x20000718 0x1 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.bss.tck_base 0x20000714 0x4 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.bss.tck_pin 0x20000718 0x1 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
*fill* 0x20000719 0x3
.bss.tdi_base 0x2000071c 0x4 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.bss.tdi_pin 0x20000720 0x1 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.bss.tdi_base 0x2000071c 0x4 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.bss.tdi_pin 0x20000720 0x1 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
*fill* 0x20000721 0x3
.bss.tdo_base 0x20000724 0x4 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.bss.tdo_pin 0x20000728 0x1 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.bss.tdo_base 0x20000724 0x4 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.bss.tdo_pin 0x20000728 0x1 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
*fill* 0x20000729 0x3
.bss.tms_base 0x2000072c 0x4 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.bss.tms_pin 0x20000730 0x1 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.bss.tms_base 0x2000072c 0x4 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.bss.tms_pin 0x20000730 0x1 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
*(COMMON)
*fill* 0x20000731 0x3
COMMON 0x20000734 0x4 c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v6-m\libg.a(lib_a-reent.o)
@ -876,45 +882,45 @@ OUTPUT(build_stm/inlretro_stm.elf elf32-littlearm)
.ARM.attributes
0x00000000 0x1e c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v6-m/crti.o
.ARM.attributes
0x0000001e 0x2f C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x0000001e 0x2f C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.ARM.attributes
0x0000004d 0x21 C:\Users\PAUL_D~1\AppData\Local\Temp\cc21n1gw.o
0x0000004d 0x21 C:\Users\paul\AppData\Local\Temp\ccCWXcVB.o
.comment 0x00000000 0x7f
.comment 0x00000000 0x7f C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.comment 0x00000000 0x7f C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
0x80 (size before relaxing)
.debug_info 0x00000000 0x57e5
.debug_info 0x00000000 0x57bf C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.debug_info 0x000057bf 0x26 C:\Users\PAUL_D~1\AppData\Local\Temp\cc21n1gw.o
.debug_info 0x00000000 0x5b65
.debug_info 0x00000000 0x5b3f C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.debug_info 0x00005b3f 0x26 C:\Users\paul\AppData\Local\Temp\ccCWXcVB.o
.debug_abbrev 0x00000000 0x6ba
.debug_abbrev 0x00000000 0x6a6 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.debug_abbrev 0x000006a6 0x14 C:\Users\PAUL_D~1\AppData\Local\Temp\cc21n1gw.o
.debug_abbrev 0x00000000 0x6c9
.debug_abbrev 0x00000000 0x6b5 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.debug_abbrev 0x000006b5 0x14 C:\Users\paul\AppData\Local\Temp\ccCWXcVB.o
.debug_loc 0x00000000 0x8e80
.debug_loc 0x00000000 0x8e80 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.debug_loc 0x00000000 0x910b
.debug_loc 0x00000000 0x910b C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.debug_aranges 0x00000000 0x218
.debug_aranges 0x00000000 0x230
.debug_aranges
0x00000000 0x1f8 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x00000000 0x210 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.debug_aranges
0x000001f8 0x20 C:\Users\PAUL_D~1\AppData\Local\Temp\cc21n1gw.o
0x00000210 0x20 C:\Users\paul\AppData\Local\Temp\ccCWXcVB.o
.debug_ranges 0x00000000 0xe08
.debug_ranges 0x00000000 0xe08 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.debug_ranges 0x00000000 0xe20
.debug_ranges 0x00000000 0xe20 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.debug_line 0x00000000 0x1bfa
.debug_line 0x00000000 0x1b07 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.debug_line 0x00001b07 0xf3 C:\Users\PAUL_D~1\AppData\Local\Temp\cc21n1gw.o
.debug_line 0x00000000 0x1c72
.debug_line 0x00000000 0x1b7f C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.debug_line 0x00001b7f 0xf3 C:\Users\paul\AppData\Local\Temp\ccCWXcVB.o
.debug_str 0x00000000 0x12b2
.debug_str 0x00000000 0x1249 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
0x1384 (size before relaxing)
.debug_str 0x00001249 0x69 C:\Users\PAUL_D~1\AppData\Local\Temp\cc21n1gw.o
.debug_str 0x00000000 0x12e0
.debug_str 0x00000000 0x127f C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
0x13b2 (size before relaxing)
.debug_str 0x0000127f 0x61 C:\Users\paul\AppData\Local\Temp\ccCWXcVB.o
.debug_frame 0x00000000 0x658
.debug_frame 0x00000000 0x658 C:\Users\PAUL_D~1\AppData\Local\Temp\ccu17E4l.ltrans0.ltrans.o
.debug_frame 0x00000000 0x6a8
.debug_frame 0x00000000 0x6a8 C:\Users\paul\AppData\Local\Temp\ccGCpWvS.ltrans0.ltrans.o
.stabstr 0x00000000 0x76
.stabstr 0x00000000 0x76 c:/arm/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v6-m\libnosys.a(getpid.o)

View File

@ -56,6 +56,66 @@ uint8_t write_page_verify( uint8_t addrH, buffer *buff, write_rv_funcptr wr_func
return SUCCESS;
}
uint8_t write_page_buffer( uint8_t addrH, buffer *buff, write_funcptr_pg wr_func )
{
uint16_t cur = buff->cur_byte;
uint8_t n = buff->cur_byte;
uint8_t i;
uint8_t rv;
uint8_t rv1;
// uint8_t read;
//
uint16_t addr = addrH<<8;
while ( cur <= buff->last_idx ) {
// wr_func( ((addrH<<8)| n), &(buff->data[n]) );
//write function returns when it's complete or errors out
//unlock and write data
snes_wr(0x8AAA, 0xAA, 0);
snes_wr(0x8555, 0x55, 0);
//write buffer write to SA
snes_wr(addr|n, 0x25, 0);
//write number of words - 1 to SA
snes_wr(addr|n, 31, 0);
//write first data to first address, then write others to their address
//snes_wr(addr|n, data, 0);
//write 31 more bytes of data
for (i=0;i<32;i++) {
snes_wr(addr+i+n, buff->data[n+i], 0);
}
//write program buffer command
snes_wr(addr|n, 0x29, 0);
//LED_IP_PU();
//LED_LO();
//LED_OP();
//LED_HI();
do {
rv = snes_rd(addr, 0);
rv1 = snes_rd(addr, 0);
usbPoll(); //orignal kazzo needs this frequently to slurp up incoming data
//wdt_reset();
////} while (rv != snes_rd(addr, 0));
} while (rv != rv1);
//n++;
n +=32;
cur += 32;
}
buff->cur_byte = n;
//TODO error check/report
return SUCCESS;
}
//only used by cninja currently..
uint8_t write_page_cninja( uint8_t bank, uint8_t addrH, uint16_t unlock1, uint16_t unlock2, buffer *buff, write_funcptr wr_func, read_funcptr rd_func )
@ -569,6 +629,22 @@ uint8_t flash_buff( buffer *buff ) {
//HIROM banks start at $XX:0000
write_page( addrH, buff, snes_3v_flash_wr);
}
if (buff->mapper == LOROM_3V_VERIFY) {
//LOROM banks start at $XX:8000
write_page_verify( addrH+0x80, buff, snes_3v_verify_wr);
}
if (buff->mapper == HIROM_3V_VERIFY) {
//HIROM banks start at $XX:0000
write_page_verify( addrH, buff, snes_3v_verify_wr);
}
if (buff->mapper == LOROM_3V_PAGE) {
//LOROM banks start at $XX:8000
write_page_buffer( addrH+0x80, buff, snes_3v_buffer_wr);
}
if (buff->mapper == HIROM_3V_PAGE) {
//HIROM banks start at $XX:0000
write_page_buffer( addrH, buff, snes_3v_buffer_wr);
}
if (buff->mapper == LOROM) {
addrH |= 0x80; //$8000 LOROM space

View File

@ -476,7 +476,7 @@ void sega_init()
// HADDR_ENABLE();
// HADDR_IP();
// HADDR_PU();
DATA16_ENABLE();
//TODO ERROR DATA16_ENABLE();
// DATA16_IP();
// DATA16_PU();
@ -582,7 +582,7 @@ uint8_t swim_init( uint8_t swim_lane )
EXP0_HI(); //set output high (deasserted)
EXP0_OP(); //enable as output to have above take effect
#endif
swim_pin = EXP0_;
swim_pin = EXP0;
swim_base = EXP0bank;
//swim_mask = 1<<EXP0;
break;
@ -628,10 +628,38 @@ uint8_t jtag_init( uint8_t jtag_lane )
//initialize PBJE
jtag_init_pbje();
break;
case JTAG_ON_SNES_CTL: //SNES v2.0proto2 SYSCLK-TCK, RESET/EXP0-TMS, WR-TDI, RD-TDO
#ifdef STM_INL6
//set base & masks
tdo_base = CSRDbank;
tdo_pin = CSRD;
tdi_base = CSWRbank;
tdi_pin = CSWR;
tms_base = EXP0bank;
tms_pin = EXP0;
tck_base = PRGRWbank; //TODO make better ctl pin definition for this pin!
tck_pin = PRGRW;
#else
//TODO
#endif
//enable GPIO banks
//EXP_ENABLE();
CTL_ENABLE(); //SYSCLK done..?
break;
default:
return ERR_UNKN_JTAG_LANE;
}
//initialize PBJE
jtag_init_pbje();
return SUCCESS;
}

View File

@ -24,6 +24,11 @@ uint8_t tck_pin;
uint8_t pbje_status; //only engine can write, read only by host
uint8_t pbje_command; //only host can write, read only by engine
uint8_t pbje_numclk; //numclk is a sticky value, don't modify!
//TODO I don't think there's much value in having the data array this big
//We can scan in/out smaller portions of a longer bit streams using the HOLD commands
//Thinking that 8Bytes may be better max length, which is also max lua int (64bit)
//But honestly could get by pretty well with 2-4Bytes
//need to size this down and retest, but works for now
#define PBJE_DATA_ARRAY_SIZE 32
uint8_t pbje_data[PBJE_DATA_ARRAY_SIZE];
uint8_t pbje_cmd_update_flag;
@ -50,8 +55,11 @@ uint8_t jtag_call( uint8_t opcode, uint8_t miscdata, uint16_t operand, uint8_t *
#define BYTE_LEN 1
#define HWORD_LEN 2
uint8_t temp;
switch (opcode) {
case PBJE_INIT: jtag_init_pbje(); break;
//case PBJE_INIT: jtag_init_pbje(); break;
//NOTE! INITIALIZE PBJE with IO dictionary!!!
case GET_CMD: rdata[RD0] = pbje_command;
rdata[RD_LEN] = BYTE_LEN; break;
@ -76,17 +84,24 @@ uint8_t jtag_call( uint8_t opcode, uint8_t miscdata, uint16_t operand, uint8_t *
case SET_NUMCLK: pbje_numclk = operand; break;
//GET & SET ARRAY DATA
case SET_2B_DATA: pbje_data[0] = operand;
pbje_data[1] = operand>>8;
//GET & SET ARRAY DATA, miscdata defines first byte index
case SET_2B_DATA: pbje_data[miscdata] = operand;
pbje_data[miscdata+1] = operand>>8;
break;
case GET_6B_DATA: rdata[RD0] = pbje_data[0];
rdata[RD1] = pbje_data[1];
rdata[RD2] = pbje_data[2];
rdata[RD3] = pbje_data[3];
rdata[RD4] = pbje_data[4];
rdata[RD5] = pbje_data[5];
rdata[RD_LEN] = 6;
case GET_8B_DATA: //copy over 8B of data starting at miscdata index
for (temp=RD0; temp<(RD0+8); temp++) {
rdata[temp] = pbje_data[temp-RD0+miscdata];
}
rdata[RD_LEN] = 8;
break;
case GET_32B_DATA:
//copy over 32B of data
for (temp=RD0; temp<(RD0+32); temp++) {
rdata[temp] = pbje_data[temp-RD0];
}
rdata[RD_LEN] = 32;
break;
@ -100,6 +115,7 @@ uint8_t jtag_call( uint8_t opcode, uint8_t miscdata, uint16_t operand, uint8_t *
}
//NOTE! MUST INITIALIZE JTAG in io.c before calling!!!!
void jtag_init_pbje()
{
uint8_t i;
@ -125,15 +141,11 @@ void jtag_init_pbje()
exp_byte = 0;
EXP_SET(exp_byte);
#endif
//enable TDO as input
TDO_IP_PU();
//PBJE initialization
//set status & command to INIT
pbje_status = PBJE_INIT;
//only the host writes to command
//pbje_command = PBJE_INIT;
//set NUM_CLK to max this engine can clock based on DATA_ARRAY bit size
pbje_numclk = 0; //byte variable, 0 -> 256
@ -143,6 +155,13 @@ void jtag_init_pbje()
pbje_data[i] = 0;
}
//SET STATE LAST to signal complete
//PBJE initialization
//set status & command to INIT
pbje_status = PBJE_INIT;
//only the host writes to command
//pbje_command = PBJE_INIT;
}
//actual JTAG engine

View File

@ -19,7 +19,8 @@
#define NES_CONN //famicom isn't actually present but a pin adapter should work
#endif
#if defined(STM_INL6) || defined(STM_INL6_PROTO)
//#if defined(STM_INL6) || defined(STM_INL6_PROTO)
#if defined(STM_INL6)
#define NES_CONN //includes famicom as definitions are effectively the same
#define SNES_CONN
#define SEGA_CONN
@ -27,6 +28,14 @@
#define N64_CONN
#endif
#if defined(STM_INL6_PROTO)
#define NES_CONN //includes famicom as definitions are effectively the same
#define SNES_CONN
// #define SEGA_CONN //don't feel like fixing these definitions right now..
#define GB_CONN
#define N64_CONN
#endif
#ifdef AVR_CORE
#include "avr_gpio.h"
#include <avr/wdt.h>
@ -1510,7 +1519,7 @@ void software_AXL_CLK();
//
// ---------------------------------------------------------------------------------------
#if defined (STM_INL6_PROTO) || defined(STM_INL6)
#if STM_INL6_PROTO
// PE0 "A0" mcupinC0
#define E0bank GPIOC
@ -1533,10 +1542,36 @@ void software_AXL_CLK();
#define E4 (12U)
#endif //STM_INL6 & PROTO
#endif //STM_INL6_PROTO
#ifdef STM_INL6
// PE0 "A0" mcupinC0
#define E0bank GPIOC
#define E0 (0U)
// PE1 "D0" mcupinB8
#define E1bank GPIOB
#define E1 (8U)
// PE2 "D8" mcupinB2
#define E2bank GPIOB
#define E2 (2U)
// PE3 "D9" mcupinB3
#define E3bank GPIOB
#define E3 (3U)
// PE4 "D10" mcupinB4
#define E4bank GPIOB
#define E4 (4U)
#endif //STM_INL6
#ifdef STM_NES
//TODO BLINDLY COPIED FROM STM6, will not work AS-IS
//TODO actually do this
// PE0 "A0" mcupinB2
// TODO!!!

View File

@ -258,12 +258,13 @@ uint8_t snes_page_rd_poll( uint8_t *data, uint8_t addrH, uint8_t romsel, uint8_t
}
//gameboy needed some extra NOPS
NOP();
NOP();
NOP();
NOP();
NOP();
NOP();
//I cut these back out because didn't want the delay in SNES
// NOP();
// NOP();
// NOP();
// NOP();
// NOP();
// NOP();
//latch data
DATA_RD(data[i]);
@ -338,5 +339,67 @@ void snes_3v_flash_wr( uint16_t addr, uint8_t data )
return;
}
/* Desc:SNES 3v ROM FLASH VERIFY Write
* NOTE: /ROMSEL is always taken low
* NOTE: if the byte isn't erased it will stop over current value
* NOTE: doesn't hang if write fails, just returns, goal is to be fast
* Pre: snes_init() setup of io pins
* desired bank must already be selected
* Post:Byte written and ready for another write
* Rtn: None
*/
uint8_t snes_3v_verify_wr( uint16_t addr, uint8_t data )
{
uint8_t rv;
//unlock and write data
snes_wr(0x8AAA, 0xAA, 0);
snes_wr(0x8555, 0x55, 0);
snes_wr(0x8AAA, 0xA0, 0);
snes_wr(addr, data, 0);
do {
rv = snes_rd(addr, 0);
usbPoll(); //orignal kazzo needs this frequently to slurp up incoming data
} while (rv != snes_rd(addr, 0));
return rv;
}
/* Desc:SNES 3v ROM FLASH BUFFER Write 32Bytes at a time
* NOTE: /ROMSEL is always taken low
* NOTE: if the byte isn't erased it will stop over current value
* NOTE: doesn't hang if write fails, just returns, goal is to be fast
* Pre: snes_init() setup of io pins
* desired bank must already be selected
* Post:Byte written and ready for another write
* Rtn: None
*/
void snes_3v_buffer_wr( uint16_t addr, uint8_t *data )
{
/* TODO, actually implement this, currently everything is done on flash.c side
uint8_t rv;
//unlock and write data
snes_wr(0x8AAA, 0xAA, 0);
snes_wr(0x8555, 0x55, 0);
//write buffer write to SA
snes_wr(addr, 0x25, 0);
//write number of words - 1 to SA
//write first data to first address
snes_wr(addr, data[1], 0);
do {
rv = snes_rd(addr, 0);
usbPoll(); //orignal kazzo needs this frequently to slurp up incoming data
} while (rv != snes_rd(addr, 0));
return;
*/
}
#endif //SNES_CONN

View File

@ -14,5 +14,7 @@ uint8_t snes_page_rd_poll( uint8_t *data, uint8_t addrH, uint8_t romsel, uint8_t
void snes_5v_flash_wr( uint16_t addr, uint8_t data );
void snes_3v_flash_wr( uint16_t addr, uint8_t data );
uint8_t snes_3v_verify_wr( uint16_t addr, uint8_t data );
void snes_3v_buffer_wr( uint16_t addr, uint8_t *data );
#endif

View File

@ -15,6 +15,7 @@ typedef struct setup_packet{
//typedef void (*write_funcptr) ( uint8_t addrH, uint8_t addrL, uint8_t data );
//typedef uint8_t (*read_funcptr) ( uint8_t addrH, uint8_t addrL );
typedef void (*write_funcptr) ( uint16_t addr, uint8_t data );
typedef void (*write_funcptr_pg) ( uint16_t addr, uint8_t *data );
typedef uint8_t (*write_rv_funcptr) ( uint16_t addr, uint8_t data );
typedef uint8_t (*read_funcptr) ( uint16_t addr );
typedef void (*write_snes_funcptr) ( uint16_t addr, uint8_t data, uint8_t romsel );

View File

@ -278,6 +278,7 @@ USBDESC const uint16_t string2_desc[STRING2_DESC_LEN] = {
// 1 bDescriptorType 1 Constant String Descriptor (0x03)
((uint16_t)DESC_TYPE_STRING<<8 | STRING2_DESC_LEN),
// 2 bString n Unicode Unicode Encoded String
'I','N','L',' ','R','e','t','r','o','-','P','r','o','g'};
'I','N','L',' ','R','e','t','r','o','-','P','r','o','g'}; //normal
//'I','N','L',' ','R','e','t','r','o','-','P','r','o','4'}; //numbered devices for mutliple on one machine
#endif

View File

@ -5,12 +5,18 @@ local ciccom = {}
-- import required modules
local dict = require "scripts.app.dict"
local time = require "scripts.app.time"
local help = require "scripts.app.help"
-- file constants
--local resetpin = "AFL" --v2.0
--local datapin = "GBP" --v2.0
local resetpin = "SWC" --v2.0N
local datapin = "FREE" --v2.0N
--local resetpin = "SWC" --v2.0N
--local datapin = "FREE" --v2.0N
--SNES v3.3
local resetpin = "AFL" --v2.0
local datapin = "SWC" --v2.0
--TODO move clock pin to a define & have the reset/data defines set based on the device
-- local functions
local function start( debug )
@ -63,125 +69,72 @@ local function start( debug )
dict.pinport( "CTL_SET_HI", resetpin)
--CIC is now waiting for data to be clocked in using CIC CLK & KEY_DATA_OUT
--CIC will latch data on rising edges of CLK
return
end
local function output_bit7(byte, debug)
if (byte & 0x80 == 0x80) then --output one/high
if debug then print ("output 1/HI") end
dict.pinport( "CTL_SET_HI", datapin)
dict.pinport( "ADDR_SET", 1)
dict.pinport( "ADDR_SET", 0)
else --output zero/low
if debug then print ("output 0/LO") end
dict.pinport( "CTL_SET_LO", datapin)
dict.pinport( "ADDR_SET", 1)
dict.pinport( "ADDR_SET", 0)
end
end
local function byte_to_ciccom(byte, debug)
local cnt = 8
while cnt > 0 do
if debug then print("outputting bit7 of:", help.hex(byte)) end
output_bit7(byte, debug)
byte = (byte << 1) & 0xFF
cnt = cnt - 1
end
end
local function char_to_ciccom( char, debug)
byte_to_ciccom(string.byte(char), debug)
end
local function set_opcode(opcode)
--KEY DATA IN is clocked in on rising edges of CIC CLK
--"M" 0x4D (0b0100_1101 needs to be written to CIC to cause it to toggle mirroring
--MSbit is latched first
if opcode == "M" then
dict.pinport( "CTL_SET_LO", datapin)
dict.pinport( "ADDR_SET", 1)
dict.pinport( "ADDR_SET", 0)
dict.pinport( "CTL_SET_HI", datapin)
dict.pinport( "ADDR_SET", 1)
dict.pinport( "ADDR_SET", 0)
dict.pinport( "CTL_SET_LO", datapin)
dict.pinport( "ADDR_SET", 1)
dict.pinport( "ADDR_SET", 0)
dict.pinport( "ADDR_SET", 1)
dict.pinport( "ADDR_SET", 0)
dict.pinport( "CTL_SET_HI", datapin)
dict.pinport( "ADDR_SET", 1)
dict.pinport( "ADDR_SET", 0)
dict.pinport( "ADDR_SET", 1)
dict.pinport( "ADDR_SET", 0)
dict.pinport( "CTL_SET_LO", datapin)
dict.pinport( "ADDR_SET", 1)
dict.pinport( "ADDR_SET", 0)
dict.pinport( "CTL_SET_HI", datapin)
dict.pinport( "ADDR_SET", 1)
dict.pinport( "ADDR_SET", 0)
char_to_ciccom(opcode)
end
--now that "M" is written to CIC, end OPCODE write sequence by taking CIC RESET LO
--now that opcode (ie "M") is written to CIC, end OPCODE write sequence by taking CIC RESET LO
dict.pinport( "CTL_SET_LO", resetpin)
end
local function write(data)
local function write(data, debug)
--debug = true
--now send operand "V" (0x56) or "H" (0x48)
if data == "H" then
--HORIZONTAL
dict.pinport( "CTL_SET_LO", datapin)
dict.pinport( "ADDR_SET", 1)
dict.pinport( "ADDR_SET", 0)
dict.pinport( "CTL_SET_HI", datapin)
dict.pinport( "ADDR_SET", 1)
dict.pinport( "ADDR_SET", 0)
dict.pinport( "CTL_SET_LO", datapin)
dict.pinport( "ADDR_SET", 1)
dict.pinport( "ADDR_SET", 0)
dict.pinport( "ADDR_SET", 1)
dict.pinport( "ADDR_SET", 0)
dict.pinport( "CTL_SET_HI", datapin)
dict.pinport( "ADDR_SET", 1)
dict.pinport( "ADDR_SET", 0)
dict.pinport( "CTL_SET_LO", datapin)
dict.pinport( "ADDR_SET", 1)
dict.pinport( "ADDR_SET", 0)
dict.pinport( "ADDR_SET", 1)
dict.pinport( "ADDR_SET", 0)
dict.pinport( "ADDR_SET", 1)
dict.pinport( "ADDR_SET", 0)
elseif data == "V" then
--VERTICAL
dict.pinport( "CTL_SET_LO", datapin)
dict.pinport( "ADDR_SET", 1)
dict.pinport( "ADDR_SET", 0)
dict.pinport( "CTL_SET_HI", datapin)
dict.pinport( "ADDR_SET", 1)
dict.pinport( "ADDR_SET", 0)
dict.pinport( "CTL_SET_LO", datapin)
dict.pinport( "ADDR_SET", 1)
dict.pinport( "ADDR_SET", 0)
dict.pinport( "CTL_SET_HI", datapin)
dict.pinport( "ADDR_SET", 1)
dict.pinport( "ADDR_SET", 0)
dict.pinport( "CTL_SET_LO", datapin)
dict.pinport( "ADDR_SET", 1)
dict.pinport( "ADDR_SET", 0)
dict.pinport( "CTL_SET_HI", datapin)
dict.pinport( "ADDR_SET", 1)
dict.pinport( "ADDR_SET", 0)
dict.pinport( "ADDR_SET", 1)
dict.pinport( "ADDR_SET", 0)
dict.pinport( "CTL_SET_LO", datapin)
dict.pinport( "ADDR_SET", 1)
dict.pinport( "ADDR_SET", 0)
if debug then print("ciccom write is type:", type(data)) end
if type(data) == 'number' then
if debug then print("writting number/byte") end
byte_to_ciccom(data, debug)
else
if debug then print("writting character") end
char_to_ciccom(data, debug)
end
end
@ -197,6 +150,8 @@ end
ciccom.start = start
ciccom.set_opcode = set_opcode
ciccom.write = write
ciccom.byte_to_ciccom = byte_to_ciccom
ciccom.char_to_ciccom = char_to_ciccom
ciccom.wotf = wotf
ciccom.rotf = rotf

View File

@ -9,6 +9,23 @@ local help = require "scripts.app.help"
-- local functions
-- file must already be open for writting in binary mode
-- read from something like the cart and get a number
-- send that number here to write to the file in binary (interpret as an ascii char)
local function wr_bin_byte(file, data)
data = data & 0x00FF --negative and overly large ints need trimmed to 8bits
file:write(string.char( data ))
end
--always forget how to read a byte from a file even though it's super simple...
--file must already be open for reading in binary mode
local function rd_bin_byte(file, debug)
--TODO test & support reading more than 1 byte
local num_bytes = 1
return string.byte(file:read(num_bytes))
end
--compare the two files return true if identical
--files should be closed prior to calling, files are closed after compared
@ -84,6 +101,106 @@ local function compare(filename1, filename2, size_must_equal, debug)
end
--reads file until finds a line that includes the token string
--the line with the token is consumed, the next line that you read from the
--file will be the line that follows the line with the token
--Created to find L00000 line in jedec files
--RETURN: the line in string format that matched the token
--addition of returning the string allows for verification of the user code
local function readtill_line(file, token, debug)
--local temp = string.byte(file:read(10))
local temp_line = "notnil" --= file:read("*line")
local line_num = 0
if debug then print("finding:", token) end
--while line_num < 100 do
local found_token = false
while not found_token do
temp_line = file:read("*line")
line_num = line_num + 1
-- if debug then print("line num", line_num, "reads:", temp_line) end
if temp_line then
if string.find(temp_line, token) then
if debug then print("found token in line num", line_num, "reads:", temp_line) end
found_token = true
end
else
print("reached end of file, could not find token", token)
return nil
end
end
-- temp = file:read("*line")
-- if debug then print("next line:", temp) end
return temp_line
end
local function nextline(file)
return file:read("*line")
end
--read 3 lines from jedec file and convert from binary to hex string
--input:
--10111111111001111111000111111111111111111111111111111110001111110000111110100000
--00011110110000110001100010000111111111111000110001111100000111111111100000111111
--111111111111
--output:
--FFFFC1FF83E31FFE118C37805F0FC7FFFFFFF8FE7FD
local function jedec_3ln_2hexstr(file, debug)
local line1 = nextline(file)
local line2 = nextline(file)
local line3 = nextline(file)
if debug then print(line1) print(line2) print(line3) end
local line1_len = string.len(line1) - 1
local line2_len = string.len(line2) - 1
local line3_len = string.len(line3) - 1
--these strings have extra newline character at the end
if debug then print("line 1,2,3 lengths:", line1_len, line2_len, line3_len) end
line1 = string.sub(line1, 1, line1_len)
line2 = string.sub(line2, 1, line2_len)
line3 = string.sub(line3, 1, line3_len)
if debug then print(line1) print(line2) print(line3) end
--contatenate all the lines together
--local padding = "1111" -- 172bits = 22.5 Bytes, pad with extra "F"
local padding = "" -- 172bits = 43 Nibbles no padding needed
local bin_line = padding .. line1 .. line2 .. line3
local bin_len = line1_len + line2_len + line3_len + string.len(padding)
if debug then print("bin len", bin_len, "bin data", bin_line) end
-- print(tonumber(line3,2))
--create a hex string that starts with last bit from 3rd line
local temp_nibble
local hex_str = ""
while bin_len > 0 do
--need to reverse the bit order
--temp_nibble = string.sub(bin_line, bin_len, bin_len) ..
-- string.sub(bin_line, bin_len-1, bin_len-1) ..
-- string.sub(bin_line, bin_len-2, bin_len-2) ..
-- string.sub(bin_line, bin_len-3, bin_len-3)
temp_nibble = string.reverse(string.sub(bin_line, bin_len-3, bin_len))
--temp_nibble = tonumber(string.sub(bin_line, bin_len-3, bin_len), 2) --2 is base (binary)
temp_nibble = tonumber(temp_nibble, 2) --2 is base (binary)
if debug then print("decimal", temp_nibble) end
temp_nibble =string.format("%1.1X", temp_nibble)
hex_str = hex_str .. temp_nibble
if debug then print("hex", temp_nibble) end
bin_len = bin_len - 4
end
if debug then print("hex string:", hex_str) end
return hex_str
end
-- global variables so other modules can use them
@ -93,6 +210,11 @@ end
-- functions other modules are able to call
files.compare = compare
files.wr_bin_byte = wr_bin_byte
files.rd_bin_byte = rd_bin_byte
files.readtill_line = readtill_line
files.nextline = nextline
files.jedec_3ln_2hexstr = jedec_3ln_2hexstr
-- return the module's table
return files

View File

@ -13,6 +13,7 @@ local function hex(data)
end
-- global variables so other modules can use them

View File

@ -4,6 +4,8 @@ local swim = {}
-- import required modules
local dict = require "scripts.app.dict"
local files = require "scripts.app.files"
local help = require "scripts.app.help"
--local buffers = require "scripts.app.buffers"
-- file constants
@ -164,6 +166,36 @@ local function unlock_flash(hspeed)
wotf(0x5062, 0xAE, hspeed)
end
local function fast_flash_mode(hspeed)
--set to fast flash mode
--;2. Write 0x10 in FLASH_CR2 (FPRG bit active), and 0xEF in FLASH_NCR2 (NFPRG bit
-- ;active).
-- mov FLASH_CR2, #0x10
-- mov FLASH_NCR2, #0xEF
wotf(0x505B, 0x10, hspeed)
wotf(0x505C, 0xEF, hspeed)
end
local function wait_till_eop_set(hspeed, debug)
local timeout = 0
local result, data = rotf(0x505f, hspeed, false )
while ((data & 0x04) ~= 0x04) do
result, data = rotf(0x505f, hspeed, false )
if debug then print("FLASH_IAPSR EOP bit wasn't set, polling again.") end
timeout = timeout+1
if (timeout == 20) then
print("EOP was never set after", timeout, "attempts. I quit..")
return
end
end
end
local function lock_flash_eeprom(hspeed)
--lock eeprom:
--Reset bit 3 (DUL)
@ -536,6 +568,89 @@ local function write_optn_bytes(rop, debug)
if debug then print("done with option byte programming") end
end
--erase 64Byte blocks starting at addr
--have to call separately for eeprom/flash, addr desides which to unlock
local function erase_blocks(addr, num_blocks, debug)
--TODO take this arg from calling function
local hspeed = true
local block_num = 0
local readdata = 0
local readresult = 0
if addr < 0x8000 then
unlock_eeprom(true)
else --flash
unlock_flash(true)
end
if debug then print("SWIM erasing", num_blocks, "* 64Byte blocks starting at:", help.hex(addr)) end
while (block_num < num_blocks) do
--enable block erase
wotf(0x505B, 0x20, hspeed)
wotf(0x505C, 0xDF, hspeed)
--write 0x00 to first 4 bytes of the block
wotf(addr, 0x00, hspeed)
wotf(addr+1, 0x00, hspeed)
wotf(addr+2, 0x00, hspeed)
wotf(addr+3, 0x00, hspeed)
--poll EOP
wait_till_eop_set(hspeed)
--next block
block_num = block_num+1
addr = addr + 64
end
end
local function erase_flash(debug)
erase_blocks(0x8000, 128, true)
end
local function erase_eeprom(debug)
--TODO take arg of device type, for now assume S003
--erase_blocks(0x4000, 2, true) --S001/3
erase_blocks(0x4000, 10, true)--S103
end
local function read_memory(file, addr, num_bytes, debug)
local toprint = debug
local buff_size = 1
local byte_num = 0
local readdata = 0
local readresult = 0
if debug then print("SWIM Dumping", num_bytes, "starting at:", help.hex(addr)) end
while (byte_num < num_bytes) do
local toprint = false
readresult, readdata = rotf(addr+byte_num, true, toprint )
byte_num = byte_num+1
files.wr_bin_byte(file, readdata)
end
end
local function dump_flash(file, debug)
read_memory(file, 0x8000, 8*1024, true)
end
local function dump_eeprom(file, debug)
--TODO flag for S001/3 or S103
--for now just assume 640Bytes like S103
read_memory(file, 0x4000, 640, true)
end
--takes ~37sec to flash entire 8KB, recommend calling fastblock below if flashing entire chip
local function write_flash(file, debug)
unlock_flash(true)
@ -567,6 +682,58 @@ local function write_flash(file, debug)
lock_flash_eeprom(true)
end
--erases then writes 8KByte of STM8 flash
--currently writes entire 8KB of flash, file must be exactly 8KByte
--testing in high speed mode single byte rotf: 5.5sec (same as dump speed)
--flashing the entire chip takes 37 seconds in single byte mode
--does not verify as flashing, recommend dumping and comparing files
local function write_flash_fastblock(file, debug)
--erase_blocks(0x8000, 128, true)
erase_flash()
unlock_flash(true)
local toprint = debug
local buff_size = 1
local byte_num = 0
local readdata = 0
local readresult = 0
print("Programming STM8 CIC flash")
--for byte in file:lines(buff_size) do
while (byte_num < 0x2000) do
--set to fast mode for each block
fast_flash_mode(true)
--write 64 bytes, then poll EOP
local byteinblock = 0
while byteinblock<64 do
local byte = file:read(1)
--local byte = files.rd_bin_byte(file)
local data = string.unpack("B", byte, 1)
-- print(data)
wotf(0x8000+byte_num, data, true, toprint)
--wotf(0x8000+byte_num, 0xFF, true, true)
-- readresult, readdata = rotf(0x8000+byte_num, true, toprint )
-- if readdata ~= data then
-- print("ERROR flashing byte number", byte_num, "to STM8 CIC", data, readdata)
-- end
byte_num = byte_num + 1
byteinblock = byteinblock + 1
end
--poll EOP till it's set
wait_till_eop_set(true)
end
print("Done with STM8 CIC flash")
lock_flash_eeprom(true)
end
local function snes_v3_prgm(debug)
--dict.pinport("CTL_IP_PU", "SNES_RST")
--reset_swim()
@ -604,6 +771,13 @@ end
-- functions other modules are able to call
swim.start = start
swim.write_flash = write_flash
swim.write_flash_fastblock = write_flash_fastblock
swim.read_memory = read_memory
swim.dump_flash = dump_flash
swim.dump_eeprom = dump_eeprom
swim.erase_blocks = erase_blocks
swim.erase_flash = erase_flash
swim.erase_eeprom = erase_eeprom
swim.write_optn_bytes = write_optn_bytes
swim.disable_ROP_erase = disable_ROP_erase
swim.printCSR = printCSR

View File

@ -5,7 +5,7 @@ local romonly = {}
local dict = require "scripts.app.dict"
local dump = require "scripts.app.dump"
local files = require "scripts.app.files"
local jtag = require "scripts.app.jtag"
local jtag = require "scripts.jtag.jtag"
-- file constants
local mapname = "ROMONLY"

193
host/scripts/jtag/jtag.lua Normal file
View File

@ -0,0 +1,193 @@
-- create the module's table
local jtag = {}
-- import required modules
local dict = require "scripts.app.dict"
local files = require "scripts.app.files"
local time = require "scripts.app.time"
local pbje = require "scripts.jtag.pbje"
--set cpld to which ever device is being used
--local cpld = require "scripts.jtag.lc4000v"
local cpld = require "scripts.jtag.machXO256"
local function check_IDCODE(debug)
local idcode_len = 32 --hex digits
--first put/verify jtag statemachine is in RESET
pbje.goto_state("RESET")
--by default jtag should be in IDCODE or BYPASS if IDCODE not present
--The TDI pin doesn't even have to be working to scan out IDCODE by this means
--let's just put in IDCODE mode
---[[
--Mach XO verify ID code
-- ! Check the IDCODE
--
-- ! Shift in IDCODE(0x16) instruction
-- SIR 8 TDI (16);
pbje.goto_state("SHIFT_IR") pbje.scan( 8, 0x16)
--return to default state after SIR
--doesn't appear to actually be needed
-- pbje.goto_state("PAUSE_IR")
-- SDR 32 TDI (FFFFFFFF)
-- TDO (01281043)
-- MASK (FFFFFFFF);
--pbje.goto_state("SHIFT_DR")
--rv = pbje.scan( 32, "HIGH", true)
--print("return data:", string.format(" %X, ",rv))
--]]
--change to SCAN-DR state
pbje.goto_state("SHIFT_DR")
--scan out 32bit IDCODE while scanning in 1's to TDI
rv = pbje.scan( 32, "HIGH", true )
if debug then print("return data:", string.format("%X",rv)) end
rv = string.format("%16.16X",rv)
if debug then print(rv) end
rv = string.sub(rv, ((64-idcode_len)/4)+1, 64/4)
--print("return data:", string.format(" %X, ",rv))
print("read idcode:", rv)
--if( rv == 0x1281043 ) then
if( rv == "01281043" ) then
-- Mach XO 256 01281043
-- 4032v (01805043)
-- 4064v (01809043)
--
-- 9536xl
-- //Loading device with 'idcode' instruction.
-- SIR 8 TDI (fe) SMASK (ff) ;
-- SDR 32 TDI (00000000) SMASK (ffffffff) TDO (f9602093) MASK (0fffffff) ;
--
-- 9572xl
-- //Loading device with 'idcode' instruction.
-- SIR 8 TDI (fe) SMASK (ff) ;
-- SDR 32 TDI (00000000) SMASK (ffffffff) TDO (f9604093) MASK (0fffffff) ;
-- test read gives 59604093
print("IDCODE matches MACHXO-256")
--elseif ( rv==0x01805043 ) then
elseif ( rv=="01805043" ) then
print("IDCODE matches LC4032V")
--elseif ( rv==0x01809043 ) then
elseif ( rv=="01809043" ) then
print("IDCODE matches LC4064V")
else
print("no match for IDCODE")
end
--xilinx IDCODE command is different
--//Loading device with 'idcode' instruction.
--SIR 8 TDI (fe) SMASK (ff) ;
--SDR 32 TDI (00000000) SMASK (ffffffff) TDO (f9602093) MASK (0fffffff) ;
-- pbje.goto_state("SHIFT_IR")
-- pbje.scan( 8, 0xfe)
-- pbje.goto_state("SHIFT_DR")
-- rv = pbje.scan( 32, "HIGH", true)
-- print("return data:", string.format(" %X, ",rv))
end
local function run_jtag( debug )
local rv
--setup lua portion of jtag engine
pbje.init("INLRETRO")
--initialize JTAG port on USB device
dict.io("JTAG_INIT", "JTAG_ON_EXP0_3") --NES
--dict.io("JTAG_INIT", "JTAG_ON_SNES_CTL") --SNES
--open jedec file
local filename = "ignore/TKROM_prod_p512_w8_crom256_v4_0_0_currelease.jed"
--local filename = "ignore/8mb_v2_0p.jed"
--first put/verify jtag statemachine is in RESET
pbje.goto_state("RESET")
check_IDCODE()
--cpld.erase()
---[[
--program CPLD
local jed_file = assert(io.open(filename, "rb"))
--find and consume the "L00000" start of usemap token in jedec file
files.readtill_line(jed_file, "L00000", false)
check_IDCODE()
cpld.program(jed_file, false)
--close jedec file
assert(jed_file:close())
--]]
--verify programming
--open jedec file
--local jed_file = assert(io.open("ignore/8mb_v2_0p.jed", "rb"))
--local jed_file = assert(io.open("ignore/TKROM_prod_p512_w8_crom256_v4_0_0_currelease.jed", "rb"))
local jed_file = assert(io.open(filename, "rb"))
--check_IDCODE()
--find and consume the "L00000" start of usemap token in jedec file
files.readtill_line(jed_file, "L00000")
--jed file needs to be read up to and consumed the L00000 command line so only the bit stream follows
cpld.verify(jed_file, false)
--close jedec file
assert(jed_file:close())
--[[
--secure CPLD
cpld.secure()
--can usercode be verified when secured..? NOPE!
--verify programming
--open jedec file
local jed_file = assert(io.open("ignore/8mb_v2_0p.jed", "rb"))
check_IDCODE()
--find and consume the "L00000" start of usemap token in jedec file
files.readtill_line(jed_file, "L00000")
--jed file needs to be read up to and consumed the L00000 command line so only the bit stream follows
cpld.verify(jed_file, false)
--close jedec file
assert(jed_file:close())
--]]
end
-- global variables so other modules can use them
-- call functions desired to run when script is called/imported
-- functions other modules are able to call
jtag.wait_pbje_done = wait_pbje_done
jtag.run_jtag = run_jtag
--jtag.sleep = sleep
-- return the module's table
return jtag

View File

@ -0,0 +1,702 @@
-- create the module's table
local lc4000v = {}
-- import required modules
local time = require "scripts.app.time"
local dict = require "scripts.app.dict"
local files = require "scripts.app.files"
local pbje = require "scripts.jtag.pbje"
--TODO this should report error/success if matches expected for this device
local function check_idcode(debug)
local idcode_len = 32 --hex digits
--first put/verify jtag statemachine is in RESET
pbje.goto_state("RESET")
--by default jtag should be in IDCODE or BYPASS if IDCODE not present
--The TDI pin doesn't even have to be working to scan out IDCODE by this means
--let's just put in IDCODE mode
---[[
--Mach XO verify ID code
-- ! Check the IDCODE
--
-- ! Shift in IDCODE(0x16) instruction
-- SIR 8 TDI (16);
pbje.goto_state("SHIFT_IR")
pbje.scan( 8, 0x16)
--return to default state after SIR
--doesn't appear to actually be needed
-- pbje.goto_state("PAUSE_IR")
-- SDR 32 TDI (FFFFFFFF)
-- TDO (01281043)
-- MASK (FFFFFFFF);
--pbje.goto_state("SHIFT_DR")
--rv = pbje.scan( 32, "HIGH", true)
--print("return data:", string.format(" %X, ",rv))
--]]
--change to SCAN-DR state
pbje.goto_state("SHIFT_DR")
--scan out 32bit IDCODE while scanning in 1's to TDI
rv = pbje.scan( 32, "HIGH", true )
if debug then print("return data:", string.format("%X",rv)) end
rv = string.format("%16.16X",rv)
if debug then print(rv) end
rv = string.sub(rv, ((64-idcode_len)/4)+1, 64/4)
--print("return data:", string.format(" %X, ",rv))
print("read idcode:", rv)
--if( rv == 0x1281043 ) then
if( rv == "01281043" ) then
-- Mach XO 256 01281043
-- 4032v (01805043)
-- 4064v (01809043)
--
-- 9536xl
-- //Loading device with 'idcode' instruction.
-- SIR 8 TDI (fe) SMASK (ff) ;
-- SDR 32 TDI (00000000) SMASK (ffffffff) TDO (f9602093) MASK (0fffffff) ;
--
-- 9572xl
-- //Loading device with 'idcode' instruction.
-- SIR 8 TDI (fe) SMASK (ff) ;
-- SDR 32 TDI (00000000) SMASK (ffffffff) TDO (f9604093) MASK (0fffffff) ;
-- test read gives 59604093
print("IDCODE matches MACHXO-256")
--elseif ( rv==0x01805043 ) then
elseif ( rv=="01805043" ) then
print("IDCODE matches LC4032V")
--elseif ( rv==0x01809043 ) then
elseif ( rv=="01809043" ) then
print("IDCODE matches LC4064V")
else
print("no match for IDCODE")
end
--xilinx IDCODE command is different
--//Loading device with 'idcode' instruction.
--SIR 8 TDI (fe) SMASK (ff) ;
--SDR 32 TDI (00000000) SMASK (ffffffff) TDO (f9602093) MASK (0fffffff) ;
-- pbje.goto_state("SHIFT_IR")
-- pbje.scan( 8, 0xfe)
-- pbje.goto_state("SHIFT_DR")
-- rv = pbje.scan( 32, "HIGH", true)
-- print("return data:", string.format(" %X, ",rv))
end
local function done_exit(debug)
--! Program DONE bit
--
--! Shift in ISC PROGRAM DONE(0x2F) instruction
--SIR 8 TDI (2F);
pbje.goto_state("SHIFT_IR")
pbje.scan( 8, 0x2F)
--RUNTEST IDLE 5 TCK 5.00E-002 SEC;
pbje.runtest( "IDLE", 5, 0.05 )
--IDK why this is done twice?! it's in original svf, so whatever..
--! Shift in ISC PROGRAM DONE(0x2F) instruction
--SIR 8 TDI (2F);
pbje.goto_state("SHIFT_IR")
pbje.scan( 8, 0x2F)
--RUNTEST IDLE 5 TCK 5.00E-002 SEC;
pbje.runtest( "IDLE", 5, 0.05 )
--! Shift in ISC DISABLE(0x1E) instruction
--SIR 8 TDI (1E);
pbje.goto_state("SHIFT_IR") pbje.scan( 8, 0x1E)
--RUNTEST IDLE 5 TCK 2.00E-001 SEC;
pbje.runtest( "IDLE", 5, 0.2 )
--! Shift in BYPASS(0xFF) instruction
--SIR 8 TDI (FF);
pbje.goto_state("SHIFT_IR") pbje.scan( 8, 0xFF)
--RUNTEST IDLE 32 TCK 1.00E-002 SEC;
pbje.runtest( "IDLE", 32, 0.01)
--! Shift in IDCODE(0x16) instruction
check_idcode()
--SIR 8 TDI (16)
-- TDO (1D)
-- MASK (FF);
--
--
--! Exit the programming mode
--
--! Shift in ISC DISABLE(0x1E) instruction
--SIR 8 TDI (1E);
pbje.goto_state("SHIFT_IR") pbje.scan( 8, 0x1E)
--RUNTEST IDLE 3 TCK 2.00E-001 SEC;
pbje.runtest( "IDLE", 3, 0.2)
end
local function erase(debug)
---[[ LATTICE LC4032V
-- ERASE THE CHIP
--! Program Bscan register
--
--! Shift in Preload(0x1C) instruction
--SIR 8 TDI (1C);
--SDR 68 TDI (00000000000000000);
--THIS MATTERS! tried machxo boundary scan of all high, and it didn't erase
pbje.goto_state("SHIFT_IR")
pbje.scan( 8, 0x1c)
pbje.goto_state("SHIFT_DR")
pbje.scan( 68, "LOW")
--
--
--! Enable the programming mode
--
--! Shift in ISC ENABLE(0x15) instruction
--SIR 8 TDI (15);
pbje.goto_state("SHIFT_IR")
pbje.scan( 8, 0x15)
pbje.runtest( "IDLE", 3, 0.1 )
--RUNTEST IDLE 3 TCK 2.00E-002 SEC;
--
--
--! Shift in ISC ERASE(0x03) instruction
--SIR 8 TDI (03);
pbje.goto_state("SHIFT_IR")
pbje.scan( 8, 0x03)
pbje.runtest( "IDLE", 3, 0.1 )
--RUNTEST IDLE 3 TCK 1.00E-001 SEC;
--! Shift in DISCHARGE(0x14) instruction
--SIR 8 TDI (14);
pbje.goto_state("SHIFT_IR")
pbje.scan( 8, 0x14)
pbje.runtest( "IDLE", 3, 0.1 )
--RUNTEST IDLE 3 TCK 1.00E-002 SEC;
--
--]]
-- ! Read the status bit
--
-- ! Shift in READ STATUS(0xB2) instruction
-- SIR 8 TDI (B2);
pbje.goto_state("SHIFT_IR")
pbje.scan( 8, 0xb2)
pbje.runtest( "IDLE", 5 )
-- RUNTEST IDLE 5 TCK 1.00E-003 SEC;
-- SDR 1 TDI (0)
-- TDO (0);
pbje.goto_state("SHIFT_DR")
rv = pbje.scan( 1, "LOW", true) % 2 --mask out all but the last bit
if( rv == 0 ) then
print("status bit clear as expected, for erasure") --seems the LC4032v has this bit as well.
else
print("ERROR status bit was set, think this indicates not erased...") --don't think it erased, or not yet done.?
end
end
local function check_usercode(expected, len, debug)
--first put/verify jtag statemachine is in RESET
pbje.goto_state("RESET")
--by default jtag should be in IDCODE or BYPASS if IDCODE not present
--The TDI pin doesn't even have to be working to scan out IDCODE by this means
--! Verify USERCODE
--
--! Shift in READ USERCODE(0x17) instruction
--SIR 8 TDI (17);
pbje.goto_state("SHIFT_IR")
pbje.scan( 8, 0x17)
--SDR 32 TDI (FFFFFFFF)
-- TDO (000005DE);
--change to SCAN-DR state
pbje.goto_state("SHIFT_DR")
--scan out 32bit IDCODE while scanning in 1's to TDI
rv = pbje.scan( len, "HIGH", true )
if debug then print("return data:", string.format(" %X, ",rv)) end
rv = string.format("%8.8X",rv)
--rv = string.sub(rv, ((64-len)/4)+1, 64)
--rv = string.sub(rv, 9, 16)
rv = string.sub(rv, ((64-len)/4)+1, 64/4)
if debug then print("read usercode:", rv) end
-- expected = string.format("%8.8X",expected)
if debug then print("expected usercode:", expected) end
if rv == expected then
if debug then print("verified usercode") end
return true
else
if debug then print("usercode didn't match expected") end
return false
end
--return rv
end
--len in bits
local function prgm_usercode(usercode, len, debug)
--first put/verify jtag statemachine is in RESET
-- goto_state("RESET")
--by default jtag should be in IDCODE or BYPASS if IDCODE not present
--The TDI pin doesn't even have to be working to scan out IDCODE by this means
--! Program USERCODE
--
--! Shift in ISC PROGRAM USERCODE(0x1A) instruction
--SIR 8 TDI (1A);
pbje.goto_state("SHIFT_IR")
pbje.scan( 8, 0x1A)
--SDR 32 TDI (000005DE);
pbje.goto_state("SHIFT_DR")
-- while len > 4 do
-- scan_hold( 16, tonumber(string.sub(usercode,len-3,len),16) )
-- len = len - 4
-- end
-- scan( 16, tonumber(string.sub(usercode,1,len),16) )
--scan in 16Bytes at a time
local send_data
local user_len = len/4 --4bits per hex char
while user_len > 4 do --4chars * 4bits/hexchar = 16bits will run 10x 16bits = 160bits
send_data = string.sub(usercode, user_len-3, user_len)
if debug then print("sending 16bits:", send_data) end
pbje.scan_hold(16, tonumber(send_data,16) )
user_len = user_len - 4
end
--16bits remain
send_data = string.sub(usercode, 1, user_len)
pbje.scan(user_len*4, tonumber(send_data,16))
--RUNTEST IDLE 3 TCK 1.30E-002 SEC;
pbje.runtest( "IDLE", 3, 0.013)
end
local function program_fuse_line(jed_file, debug)
--ispLEVER .jed files have 3 lines per fuse address
local rowdata = files.jedec_3ln_2hexstr(jed_file, false)
local fuse_len = string.len(rowdata) --4bits per hex character
if debug then print(fuse_len*4, "bits total, data:", rowdata) end
--! SHIFT IN DATA ROW = 1
pbje.goto_state("SHIFT_DR")
--SDR 172 TDI (FFFFC1FF83E31FFE118C37805F0FC7FFFFFFF8FE7FD);
--need to scan in fuse stream now
--if the data is all FF we can shift with TDI set to speed up process
--when testing SNES v2.0P2 prototype, this saved ~1sec of flash time 3.5->2.5sec
if rowdata == "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" then
if debug then print("row is all FF") end
pbje.scan(fuse_len*4, "HIGH") --4bits per hex char
--scan(172, "HIGH")
--RUNTEST IDLE 3 TCK 1.30E-002 SEC;
pbje.runtest( "IDLE", 3, 0.013) --appear to actually need this delay..
return --nothing else needed
end
--scan in 16Bytes at a time
local send_data
local FFFF_count --number of chunks that are 0xFFFF
local next_data --look ahead for speed up of high FFFF data
while fuse_len > 4 do --4chars * 4bits/hexchar = 16bits will run 10x 16bits = 160bits
send_data = string.sub(rowdata, fuse_len-3, fuse_len)
if debug then print("sending 16bits:", send_data) end
--if the data is all FF we can shift with TDI set to speed up process
--this didn't give any speedup probably because it's still a data transfer of same size
--to get actual speed up would have to look ahead, and see how many FFFF chunks there are and combine
--this is all working now, and maximizes TDI "HIGH" clockings without transferring data
--but it didn't give much speed up on the LC4032V SNES board, thinking it might give better speed up on MachXO256
--LC4032V sometimes got down to 2.1sec from 2.5sec, but not consistent
if send_data == "FFFF" then
if debug then print("found 0xFFFF block") end
FFFF_count = 1
fuse_len = fuse_len - 4
next_data = string.sub(rowdata, fuse_len-3, fuse_len)
--look ahead to see if next 16bits are also high
while next_data == "FFFF" and fuse_len > 4 do
if debug then print("found more than 1 0xFFFF block") end
FFFF_count = FFFF_count + 1
fuse_len = fuse_len - 4
next_data = string.sub(rowdata, fuse_len-3, fuse_len)
-- if next_data ~= "FFFF" then
-- FFFF_count = FFFF_count - 1
-- end
end
--send total count that was 0xFFFF
if debug then print("found", FFFF_count, "total FFFF blocks") end
--REPORTING uncomment to get idea of how much savings there ends up being
--if FFFF_count > 1 then print(FFFF_count, "total FFFF blocks") end
--most are only 3-4 not a lot of savings on LC4032V
pbje.scan_hold(16*FFFF_count, "HIGH") --scan 16 bits with TDI forced high
--fuse_len = fuse_len - 4*FFFF_count
else
pbje.scan_hold(16, tonumber(send_data,16) )
fuse_len = fuse_len - 4
end
end
--12bits remain
send_data = string.sub(rowdata, 1, fuse_len)
pbje.scan(fuse_len*4, tonumber(send_data,16))
--RUNTEST IDLE 3 TCK 1.30E-002 SEC;
pbje.runtest( "IDLE", 3, 0.013) --appear to actually need this delay..
end
--erase & program the device
local function program(jed_file, debug)
--! Program Bscan register
--
--! Shift in Preload(0x1C) instruction
--SIR 8 TDI (1C);
--SDR 68 TDI (00000000000000000);
--
--
--! Enable the programming mode
--
--! Shift in ISC ENABLE(0x15) instruction
--SIR 8 TDI (15);
pbje.goto_state("SHIFT_IR")
pbje.scan( 8, 0x15)
--RUNTEST IDLE 3 TCK 2.00E-002 SEC;
pbje.runtest( "IDLE", 3, 0.02 )
--
--
--! Erase the device
erase()
--
--! Shift in ISC ERASE(0x03) instruction
--SIR 8 TDI (03);
--RUNTEST IDLE 3 TCK 1.00E-001 SEC;
--! Shift in DISCHARGE(0x14) instruction
--SIR 8 TDI (14);
--RUNTEST IDLE 3 TCK 1.00E-002 SEC;
--
--
--! Full Address Program Fuse Map
--
--! Shift in ISC ADDRESS INIT(0x21) instruction
--SIR 8 TDI (21);
pbje.goto_state("SHIFT_IR")
pbje.scan( 8, 0x21)
--STATE IDLE;
pbje.goto_state("IDLE")
--! Shift in ISC PROGRAM INCR(0x27) instruction
--SIR 8 TDI (27);
pbje.goto_state("SHIFT_IR")
pbje.scan( 8, 0x27)
--Now we need to program 100 lines 172bits/line (LC4032V)
local fuse_lines = 100
local errors = 0
time.start()
while fuse_lines > 0 do
program_fuse_line(jed_file, false)
fuse_lines = fuse_lines-1
end
time.report(172*100/8/1024) --172 bits/line, 100 lines, 8bit/byte, 1024byte/KB
--! SHIFT IN DATA ROW = 1
--SDR 172 TDI (FFFFC1FF83E31FFE118C37805F0FC7FFFFFFF8FE7FD);
--RUNTEST IDLE 3 TCK 1.30E-002 SEC;
--! Shift in Data Row = 2
--SDR 172 TDI (FFFFC1FF83E31FFE118C7F807F0FC7FFFFFFF8FE7FF);
--RUNTEST IDLE 3 TCK 1.30E-002 SEC;
--! Verify USERCODE
--
--! Shift in READ USERCODE(0x17) instruction
--SIR 8 TDI (17);
--SDR 32 TDI (FFFFFFFF)
-- TDO (000005DE);
--need to read expected user code from jedec file
local filecode = files.readtill_line(jed_file, "UH")
if debug then print("file usercode line:", filecode) end
filecode = string.sub(filecode, 3, 10)
if debug then print("hex usercode:", filecode) end
prgm_usercode(filecode, 32, true)
--local usercode = check_usercode(0x000005DE, 32)
if check_usercode(filecode, 32) then
print("SUCCESS! VERIFIED USER CODE")
else
print("FAILED! USER CODE VERIFICATION")
end
--The svf file leaves CPLD in this state while verifying, but
--the verify svf proves we should be able to leave this state during verification steps
done_exit(debug)
end
local function secure(debug)
--! Enable the programming mode
--
--! Shift in ISC ENABLE(0x15) instruction
--SIR 8 TDI (15);
pbje.goto_state("SHIFT_IR") pbje.scan( 8, 0x15)
--RUNTEST IDLE 3 TCK 2.00E-002 SEC;
pbje.runtest( "IDLE", 3, 0.02)
--! Secure device
--
--! Shift in ISC PROGRAM SECURITY(0x09) instruction
--SIR 8 TDI (09);
pbje.goto_state("SHIFT_IR") pbje.scan( 8, 0x09)
--RUNTEST IDLE 3 TCK 5.00E-002 SEC;
pbje.runtest( "IDLE", 3, 0.05)
pbje.goto_state("IDLE")
--STATE IDLE;
--
done_exit(debug)
end
local function verify_fuse_line(jed_file, debug)
--! Shift Out Data Row = 1
--SDR 172 TDI (0000000000000000000000000000000000000000000)
pbje.goto_state("SHIFT_DR")
-- TDO (FFFFC1FF83E31FFE118C37805F0FC7FFFFFFF8FE7FD);
-- FFFFFF8FE7FD,
-- FC7FFFFFFF8FE7FD
local dout
local read_str
dout = pbje.scan_hold( 64, "LOW", true)
read_str = string.format("%16.16X",dout)
if debug then print("return data:", string.format(" %16.16X, ",dout)) end
dout = pbje.scan_hold( 64, "LOW", true)
read_str = string.format("%16.16X",dout) .. read_str
if debug then print("return data:", string.format(" %16.16X, ",dout)) end
dout = pbje.scan( 44, "LOW", true)
if debug then print("return data:", string.format(" %16.16X, ",dout)) end
--print("return data:", string.sub(string.format("%16.16X", dout) , 6, 16))
if debug then print("return data:", string.sub(string.format("%16.16X", dout) , ((64-44)/4)+1, (64/4))) end
read_str = string.sub(string.format("%16.16X", dout) , ((64-44)/4)+1, (64/4)) .. read_str
if debug then print(read_str) end
--
--RUNTEST IDLE 3 TCK 1.00E-003 SEC;
pbje.runtest( "IDLE", 3, 0.001)
-- goto_state("SHIFT_DR")
-- --! Shift Out Data Row = 2
--ispLEVER .jed files have 3 lines per fuse address
local tempdata = files.jedec_3ln_2hexstr(jed_file, false)
if debug then print (tempdata) end
if string.match(tempdata, read_str) and (string.len(tempdata) == string.len(read_str)) then
if debug then print("verified line!") end
return true
else
if debug then print("failed to verify line") end
return false
end
-- tempdata = files.jedec_3ln_2hexstr(jed_file, false)
-- print (tempdata)
-- tempdata = files.jedec_3ln_2hexstr(jed_file, false)
-- print (tempdata)
-- tempdata = files.jedec_3ln_2hexstr(jed_file, false)
-- print (tempdata)
--
--RUNTEST IDLE 3 TCK 1.00E-003 SEC;
-- runtest( "IDLE", 3, 0.001)
-- goto_state("SHIFT_DR")
-- --! Shift Out Data Row = 2
-- dout = pbje.scan_hold( 64, "LOW", true)
-- print("return data:", string.format(" %X, ",dout))
-- dout = pbje.scan_hold( 64, "LOW", true)
-- print("return data:", string.format(" %X, ",dout))
-- dout = pbje.scan( 44, "LOW", true)
-- print("return data:", string.format(" %X, ",dout))
--SDR 172 TDI (0000000000000000000000000000000000000000000)
-- TDO (FFFFC1FF83E31FFE118C7F807F0FC7FFFFFFF8FE7FF);
--RUNTEST IDLE 3 TCK 1.00E-003 SEC;
--! Shift Out Data Row = 3
--SDR 172 TDI (0000000000000000000000000000000000000000000)
-- TDO (BFFFC1FF83E31FFE118C7E807F0FC7FFFFFFF8FE7FF);
--RUNTEST IDLE 3 TCK 1.00E-003 SEC;
--! Shift Out Data Row = 4
--SDR 172 TDI (0000000000000000000000000000000000000000000)
-- TDO (FFFFC1FF83E31FFE118C6F807F0FC7FFFFFFF8FE7FB);
--RUNTEST IDLE 3 TCK 1.00E-003 SEC;
--! Shift Out Data Row = 5
--SDR 172 TDI (0000000000000000000000000000000000000000000)
-- TDO (FFFFC1FF83E31FFE118C7F807F0FC7FFFFFFF8FE7FF);
--RUNTEST IDLE 3 TCK 1.00E-003 SEC;
-- ....
end
local function verify(jed_file, debug)
--! Check the IDCODE
--
--! Shift in IDCODE(0x16) instruction
--SIR 8 TDI (16);
--STATE IDLE;
--SDR 32 TDI (FFFFFFFF)
-- TDO (01805043)
-- MASK (0FFFFFFF);
check_idcode()
--
--! Program Bscan register
--
--! Shift in Preload(0x1C) instruction
--SIR 8 TDI (1C);
pbje.goto_state("SHIFT_IR")
pbje.scan( 8, 0x1C)
--SDR 68 TDI (00000000000000000);
pbje.goto_state("SHIFT_DR")
pbje.scan( 68, "LOW")
--local function scan( numbits, data_in, data_out, debug )
--
--
--! Enable the programming mode
--
--! Shift in ISC ENABLE(0x15) instruction
pbje.goto_state("SHIFT_IR")
pbje.scan( 8, 0x15)
--SIR 8 TDI (15);
--RUNTEST IDLE 3 TCK 2.00E-002 SEC;
pbje.runtest( "IDLE", 3, 0.02 )
--
--
--! Full Address Verify Fuse Map
--
--! Shift in ISC ADDRESS SHIFT(0x01) instruction
--SIR 8 TDI (01);
pbje.goto_state("SHIFT_IR")
pbje.scan( 8, 0x01)
--SDR 100 TDI (8000000000000000000000000);
pbje.goto_state("SHIFT_DR")
-- HERE
pbje.scan_hold( 84, "LOW")
pbje.scan( 16, 0x8000)
--! Shift in ISC READ INCR(0x2A) instruction
--SIR 8 TDI (2A);
pbje.goto_state("SHIFT_IR")
pbje.scan( 8, 0x2A)
--RUNTEST IDLE 3 TCK 1.00E-003 SEC;
pbje.runtest( "IDLE", 3, 0.001)
--Now we need to read and verify 100 lines 172bits/line (LC4032V)
local fuse_lines = 100
local errors = 0
time.start()
while fuse_lines > 0 do
if not verify_fuse_line(jed_file, false) then
print("FAILED TO VERIFY LINE", fuse_lines)
errors = errors+1
end
fuse_lines = fuse_lines-1
end
if errors == 0 then
print("SUCCESSFULLY Verified all fuse lines!")
else
print(errors, "errors were found when trying to verify all fuse lines. FAILED!")
end
time.report(172*100/8/1024) --172 bits/line, 100 lines, 8bit/byte, 1024byte/KB
--! Verify USERCODE
--
--! Shift in READ USERCODE(0x17) instruction
--SIR 8 TDI (17);
--SDR 32 TDI (FFFFFFFF)
-- TDO (000005DE);
--need to read expected user code from jedec file
local filecode = files.readtill_line(jed_file, "UH")
if debug then print("file usercode line:", filecode) end
filecode = string.sub(filecode, 3, 10)
if debug then print("hex usercode:", filecode) end
--local usercode = check_USERCODE(0x000005DE, 32)
if check_usercode(filecode, 32) then
print("SUCCESS! VERIFIED USER CODE")
else
print("FAILED! USER CODE VERIFICATION")
end
done_exit(debug)
--
--
--! Exit the programming mode
--
--! Shift in ISC DISABLE(0x1E) instruction
--SIR 8 TDI (1E);
--RUNTEST IDLE 3 TCK 2.00E-001 SEC;
--
--
--
--! Shift in IDCODE(0x16) instruction
--SIR 8 TDI (16)
-- TDO (1D)
-- MASK (FF);
check_idcode()
end
-- global variables so other modules can use them
-- call functions desired to run when script is called/imported
-- functions other modules are able to call
lc4000v.done_exit = done_exit
lc4000v.erase = erase
lc4000v.program = program
lc4000v.verify = verify
lc4000v.secure = secure
-- return the module's table
return lc4000v

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,19 @@
-- PAUL'S BASIC JTAG ENGINE
-- this module keeps track of JTAG statemachine current state
-- so it can then know how to get to a different state
-- This module is responsible for generating the TMS, TCK, TDI, TDO
-- pin toggling sequences necessary and send basic commands over
-- to the PBJE running on the INLretro, or the cartridge mcu
-- The actual engine running on the INLretro/cartridge is pretty dumb
-- but has the hardware/physical interface, and the 'intelligence' resides here.
-- create the module's table
local jtag = {}
local pbje = {}
-- import required modules
local dict = require "scripts.app.dict"
local files = require "scripts.app.files"
local time = require "scripts.app.time"
-- file constants
local pbje_loc --physical location of PBJE engine so this script known how to set engine registers
@ -25,7 +35,7 @@ end
-- inside the board itself (ie CIC mcu) instead of on the inlretro programmer
-- in these types of cases, want the jtag high level functions to be independent of
-- where the PBJE engine is located physically.
local function init_jtag_lua( location )
local function init( location )
pbje_loc = location
@ -119,6 +129,7 @@ local function set_run_get_cmd( command )
print("ERROR, pbje location must be initialized prior to setting registers")
elseif( pbje_loc == "INLRETRO" ) then
--TODO provide flag if don't want to wait on immediate processing (for long data streams)
rv = dict.jtag("SET_CMD_WAIT", command)
--verify command was done
if(rv ~= op_jtag["PBJE_DONE"]) then print("error JTAG not done, status: ", rv) end
@ -405,12 +416,22 @@ local function scan( numbits, data_in, data_out, debug )
--scan out with TDI high
if( data_in == "HIGH" and data_out ) then
set_run_get_cmd("PBJE_TDO_SCAN1")
data_out = dict.jtag("GET_6B_DATA")
data_out = dict.jtag("GET_8B_DATA")
-- if numbits <= 6*8 then
-- data_out = dict.jtag("GET_8B_DATA")
-- else
-- data_out = dict.jtag("GET_32B_DATA")
-- end
--scan out with TDI low
elseif( data_in == "LOW" and data_out ) then
set_run_get_cmd("PBJE_TDO_SCAN0")
data_out = dict.jtag("GET_6B_DATA")
data_out = dict.jtag("GET_8B_DATA")
-- if numbits <= 6*8 then
-- data_out = dict.jtag("GET_8B_DATA")
-- else
-- data_out = dict.jtag("GET_32B_DATA")
-- end
--scan in with TDI high
elseif( data_in == "HIGH" and not data_out ) then
@ -422,6 +443,7 @@ local function scan( numbits, data_in, data_out, debug )
--scan in ignoring TDO
elseif( data_in and not data_out ) then
--TODO support more than 16/64bits by calling TDI_SCAN_HOLD
set_data_2B(data_in)
set_run_get_cmd("PBJE_TDI_SCAN")
@ -429,7 +451,12 @@ local function scan( numbits, data_in, data_out, debug )
elseif( data_in and data_out ) then
set_data_2B(data_in)
set_run_get_cmd("PBJE_FULL_SCAN")
data_out = dict.jtag("GET_6B_DATA")
data_out = dict.jtag("GET_8B_DATA")
-- if numbits <= 6*8 then
-- data_out = dict.jtag("GET_8B_DATA")
-- else
-- data_out = dict.jtag("GET_32B_DATA")
-- end
else
print("ERROR, bad arguements to jtag scan function")
@ -450,6 +477,83 @@ local function scan( numbits, data_in, data_out, debug )
end
--similar to scan above, but it doesn't exit SHIFT-DR state so we can call it over and over again
local function scan_hold( numbits, data_in, data_out, debug )
--check to ensure current state is SHIFT-IR/DR
if not( cur_jtag_state == "SHIFT_IR" or cur_jtag_state == "SHIFT_DR") then
print("ERROR, jtag state must be SHIFT-IR/DR in order to scan data in/out")
return nil
end
--TODO analyze numbits to determine if needs to be split into several shorter scans
--currently all scans exit at end of shift
set_clk(numbits)
--scan out with TDI high
if( data_in == "HIGH" and data_out ) then
set_run_get_cmd("PBJE_TDO_SCAN1_HOLD")
data_out = dict.jtag("GET_8B_DATA")
-- if numbits <= 6*8 then
-- data_out = dict.jtag("GET_8B_DATA")
-- else
-- data_out = dict.jtag("GET_32B_DATA")
-- end
--scan out with TDI low
elseif( data_in == "LOW" and data_out ) then
set_run_get_cmd("PBJE_TDO_SCAN0_HOLD")
data_out = dict.jtag("GET_8B_DATA")
-- if numbits <= 6*8 then
-- data_out = dict.jtag("GET_8B_DATA")
-- else
-- data_out = dict.jtag("GET_32B_DATA")
-- end
--scan in with TDI high
elseif( data_in == "HIGH" and not data_out ) then
set_run_get_cmd("PBJE_TDO_SCAN1_HOLD")
--scan in with TDI low
elseif( data_in == "LOW" and not data_out ) then
set_run_get_cmd("PBJE_TDO_SCAN0_HOLD")
--scan in ignoring TDO
elseif( data_in and not data_out ) then
--TODO support more than 16/64bits by calling TDI_SCAN_HOLD
set_data_2B(data_in)
set_run_get_cmd("PBJE_TDI_SCAN_HOLD")
--scan in data and capture scan out
elseif( data_in and data_out ) then
set_data_2B(data_in)
set_run_get_cmd("PBJE_FULL_SCAN_HOLD")
data_out = dict.jtag("GET_8B_DATA")
-- if numbits <= 6*8 then
-- data_out = dict.jtag("GET_8B_DATA")
-- else
-- data_out = dict.jtag("GET_32B_DATA")
-- end
else
print("ERROR, bad arguements to jtag scan function")
return nil
end
-- --currently all scans exit at end of shift
-- --state has now shifted to EXIT1
-- if( cur_jtag_state == "SHIFT_IR" ) then
-- cur_jtag_state = "EXIT1_IR"
-- elseif( cur_jtag_state == "SHIFT_DR" ) then
-- cur_jtag_state = "EXIT1_DR"
-- end
--TODO only return the number of bits scanned, mask away everything else
return data_out
end
local function runtest( state, clks, time, debug )
--check that state is a stable state
@ -487,206 +591,6 @@ local function runtest( state, clks, time, debug )
end
local function run_jtag( debug )
local rv
--setup lua portion of jtag engine
init_jtag_lua("INLRETRO")
--initialize JTAG port on USB device
dict.io("JTAG_INIT", "JTAG_ON_EXP0_3")
--first put/verify jtag statemachine is in RESET
goto_state("RESET")
--by default jtag should be in IDCODE or BYPASS if IDCODE not present
--The TDI pin doesn't even have to be working to scan out IDCODE by this means
--change to SCAN-DR state
goto_state("SHIFT_DR")
--scan out 32bit IDCODE while scanning in 1's to TDI
rv = scan( 32, "HIGH", true )
print("return data:", string.format(" %X, ",rv))
if( rv == 0x1281043 ) then
-- Mach XO 256 01281043
-- 4032v (01805043)
-- 4064v (01809043)
--
-- 9536xl
-- //Loading device with 'idcode' instruction.
-- SIR 8 TDI (fe) SMASK (ff) ;
-- SDR 32 TDI (00000000) SMASK (ffffffff) TDO (f9602093) MASK (0fffffff) ;
--
-- 9572xl
-- //Loading device with 'idcode' instruction.
-- SIR 8 TDI (fe) SMASK (ff) ;
-- SDR 32 TDI (00000000) SMASK (ffffffff) TDO (f9604093) MASK (0fffffff) ;
-- test read gives 59604093
print("IDCODE matches MACHXO-256")
else
print("no match for IDCODE")
end
--Mach XO verify ID code
-- ! Check the IDCODE
--
-- ! Shift in IDCODE(0x16) instruction
-- SIR 8 TDI (16);
goto_state("SHIFT_IR")
scan( 8, 0x16)
--return to default state after SIR
--doesn't appear to actually be needed
-- goto_state("PAUSE_IR")
-- SDR 32 TDI (FFFFFFFF)
-- TDO (01281043)
-- MASK (FFFFFFFF);
goto_state("SHIFT_DR")
rv = scan( 32, "HIGH", true)
print("return data:", string.format(" %X, ",rv))
--xilinx IDCODE command is different
--//Loading device with 'idcode' instruction.
--SIR 8 TDI (fe) SMASK (ff) ;
--SDR 32 TDI (00000000) SMASK (ffffffff) TDO (f9602093) MASK (0fffffff) ;
-- goto_state("SHIFT_IR")
-- scan( 8, 0xfe)
-- goto_state("SHIFT_DR")
-- rv = scan( 32, "HIGH", true)
-- print("return data:", string.format(" %X, ",rv))
--MACH XO 256
--! Program Bscan register
--
--! Shift in Preload(0x1C) instruction
--SIR 8 TDI (1C);
--SDR 160 TDI (FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);
--the HIGHZ instruction seems more fitting... 0x18
goto_state("SHIFT_IR")
scan( 8, 0x1c)
goto_state("SHIFT_DR")
scan( 160, "HIGH")
-- ! Enable the programming mode
--
-- ! Shift in ISC ENABLE(0x15) instruction
-- SIR 8 TDI (15);
goto_state("SHIFT_IR")
scan( 8, 0x15)
-- RUNTEST IDLE 5 TCK 1.00E-003 SEC;
runtest( "IDLE", 5 )
--
--
-- ! Erase the device
--
-- ! Shift in ISC SRAM ENABLE(0x55) instruction
-- SIR 8 TDI (55);
goto_state("SHIFT_IR")
scan( 8, 0x55)
runtest( "IDLE", 5 )
-- RUNTEST IDLE 5 TCK 1.00E-003 SEC;
--
-- ! Shift in ISC ERASE(0x03) instruction
-- SIR 8 TDI (03);
goto_state("SHIFT_IR")
scan( 8, 0x03)
runtest( "IDLE", 5 )
-- RUNTEST IDLE 5 TCK 1.00E-003 SEC;
--
-- ! Shift in ISC ENABLE(0x15) instruction
-- SIR 8 TDI (15);
goto_state("SHIFT_IR")
scan( 8, 0x15)
runtest( "IDLE", 5 )
-- RUNTEST IDLE 5 TCK 1.00E-003 SEC;
--
-- ! Shift in ISC ERASE(0x03) instruction
-- SIR 8 TDI (03);
goto_state("SHIFT_IR")
scan( 8, 0x03)
--runtest( "IDLE", 5, 1 ) --seems to fail if under ~0.5sec
runtest( "IDLE", 5, 0.7 )
-- RUNTEST IDLE 5 TCK 1.00E+001 SEC;
-- SDR 1 TDI (0)
-- TDO (1); TDO must be set
goto_state("SHIFT_DR")
rv = scan( 1, 0x0, true) % 2 --mask out all but the last bit
if( rv == 1) then
print("MachXO-256 CPLD erasure success!!!")
else
print("failed to erase MachXO-256 CPLD")
end
-- ! Read the status bit
--
-- ! Shift in READ STATUS(0xB2) instruction
-- SIR 8 TDI (B2);
goto_state("SHIFT_IR")
scan( 8, 0xb2)
runtest( "IDLE", 5 )
-- RUNTEST IDLE 5 TCK 1.00E-003 SEC;
-- SDR 1 TDI (0)
-- TDO (0);
goto_state("SHIFT_DR")
rv = scan( 1, "LOW", true) % 2 --mask out all but the last bit
if( rv == 0 ) then
print("status bit clear as expected")
else
print("ERROR status bit was set, not sure what this means...")
end
--! Program Fuse Map
--
--! Shift in INIT ADDRESS(0x21) instruction
--SIR 8 TDI (21);
--RUNTEST IDLE 5 TCK 1.00E-003 SEC;
--! Shift in BYPASS(0xFF) instruction
--SIR 8 TDI (FF);
--RUNTEST IDLE 5 TCK 1.00E-003 SEC;
--! Shift in DATA SHIFT(0x02) instruction
--SIR 8 TDI (02);
--! Shift in Row = 1
--SDR 192 TDI (FFF7BFF3DEFFCEEFFF3BBFFCEEFFF3DFFFFDEFFF3BBFFCFF);
--! Shift in LSCC PROGRAM INCR RTI(0x67) instruction
--SIR 8 TDI (67);
--RUNTEST IDLE 5 TCK 1.00E-002 SEC;
--STATE DRPAUSE;
--! Shift in DATA SHIFT(0x02) instruction
--SIR 8 TDI (02);
--! Shift in Row = 2
--SDR 192 TDI (FFF7BFF3DEFFCEEFFF37BFFCF7FFFFBBFFCEEFFF37BFFCFF);
--! Shift in LSCC PROGRAM INCR RTI(0x67) instruction
--SIR 8 TDI (67);
--RUNTEST IDLE 5 TCK 1.00E-002 SEC;
--STATE DRPAUSE;
--! Shift in DATA SHIFT(0x02) instruction
--SIR 8 TDI (02);
--! Shift in Row = 3
--SDR 192 TDI (FFBFFFFFDEFFCFFFFFFBBFFCFFFFFF5FFFCFFFFFFFFFFFFF);
--! Shift in LSCC PROGRAM INCR RTI(0x67) instruction
--SIR 8 TDI (67);
--RUNTEST IDLE 5 TCK 1.00E-002 SEC;
--STATE DRPAUSE;
--! Shift in DATA SHIFT(0x02) instruction
--SIR 8 TDI (02);
--! Shift in Row = 4
--SDR 192 TDI (FFFFFFFFDEFFCFFFFFFBBFFCFFFFFFBBFFCFFFFFFFFFFFFF);
--
-- ....
end
-- global variables so other modules can use them
@ -694,9 +598,13 @@ end
-- functions other modules are able to call
jtag.wait_pbje_done = wait_pbje_done
jtag.run_jtag = run_jtag
jtag.sleep = sleep
--jtag.wait_pbje_done = wait_pbje_done
pbje.sleep = sleep
pbje.init = init
pbje.goto_state = goto_state
pbje.scan = scan
pbje.scan_hold = scan_hold
pbje.runtest = runtest
-- return the module's table
return jtag
return pbje

View File

@ -0,0 +1,365 @@
-- create the module's table
local genesis_v2 = {}
-- import required modules
local dict = require "scripts.app.dict"
local dump = require "scripts.app.dump"
-- file constants
-- local functions
-- Desc: attempt to read flash rom ID
-- Pre: snes_init() been called to setup i/o
-- Post:Address left on bus memories disabled
-- Rtn: true if proper flash ID found
local function rom_manf_id( debug )
local rv
--enter software mode A11 is highest address bit that needs to be valid
--datasheet not exactly explicit, A11 might not need to be valid
--part has A-1 (negative 1) since it's in byte mode, meaning the part's A11 is actually A12
--exit software mode/reset chip incase locked up
dict.sega("SET_ADDR", 0x0555)
dict.sega("SEGA_WR", 0x00AA)
dict.bootload("SET_PTR_HI", 0x4800)
dict.bootload("SET_PTR_LO", 0x0000)
rv = dict.bootload("RD_PTR_OFFSET", 0x0001) --read upper half word of register
print("PORT A hi:", string.format("%X", rv))
rv = dict.bootload("RD_PTR_OFFSET", 0x0000)
print("PORT A lo:", string.format("%X", rv))
rv = dict.bootload("RD_PTR_OFFSET", 0x0401) --read upper half word of register
print("PORT B hi:", string.format("%X", rv))
rv = dict.bootload("RD_PTR_OFFSET", 0x0400)
print("PORT B lo:", string.format("%X", rv))
rv = dict.bootload("RD_PTR_OFFSET", 0x0414) --ODR PORTB
print("PORT B ODR:", string.format("%X", rv))
rv = dict.bootload("RD_PTR_OFFSET", 0x0014) --ODR PORTA
print("PORT A ODR:", string.format("%X", rv))
rv = dict.bootload("RD_PTR_OFFSET", 0x0410)
print("PORT B IDR:", string.format("%X", rv))
rv = dict.bootload("RD_PTR_OFFSET", 0x0010)
print("PORT A IDR:", string.format("%X", rv))
dict.sega("SET_ADDR", 0x02AA)
dict.sega("SEGA_WR", 0x0055)
dict.sega("SET_ADDR", 0x0555)
dict.sega("SEGA_WR", 0x0090)
-- --WR $AAA:AA $555:55 $AAA:AA
-- dict.sega("SNES_SET_BANK", 0x00)
--
-- dict.sega("SNES_ROM_WR", 0x8AAA, 0xAA)
-- dict.sega("SNES_ROM_WR", 0x8555, 0x55)
-- dict.sega("SNES_ROM_WR", 0x8AAA, 0x90)
--read manf ID
local manf_id = dict.sega("SEGA_RD", 0x0000) --0x01 Cypress Manf ID
-- 0xBF SST Manf ID
if debug then print("attempted read SNES ROM manf ID:", string.format("%X", manf_id)) end
--read prod ID
local prod_id = dict.sega("SEGA_RD", 0x0001) --0x7E Prod ID S29GL
--SST x16 0x235D or 0x235C product ID
if debug then print("attempted read SNES ROM prod ID:", string.format("%X", prod_id)) end
-- local density_id = dict.sega("SEGA_RD", 0x801C) --density 0x10=8MB 0x1A=4MB
-- if debug then print("attempted read SNES density ID: ", string.format("%X", density_id)) end
--
-- local boot_sect = dict.sega("SEGA_RD", 0x801E) --boot sector 0x00=top 0x01=bottom
-- if debug then print("attempted read SNES boot sect ID:", string.format("%X", boot_sect)) end
--
-- --exit software
-- dict.sega("SNES_ROM_WR", 0x8000, 0xF0)
--
-- --return true if detected flash chip
-- if (manf_id == 0x01 and prod_id == 0x49) then
-- print("2MB flash detected")
-- return true
-- elseif (manf_id == 0x01 and prod_id == 0x7E) then
-- print("4-8MB flash detected")
-- return true
-- else
-- return false
-- end
end
local function unsupported(operation)
print("\nUNSUPPORTED OPERATION: \"" .. operation .. "\" not implemented yet for Sega Genesis.\n")
end
-- Compute Genesis checksum from a file, which can be compared with header value.
local function checksum_rom(filename)
local file = assert(io.open(filename, "rb"))
local sum = 0
-- Skip header
file:read(0x200)
while true do
-- Add up remaining 16-bit words
local bytes = file:read(2)
if not bytes then break end
sum = sum + string.unpack(">i2", bytes)
end
-- Only use the lower bits.
return sum & 0xFFFF
end
--/ROMSEL is always low for this dump
local function dump_rom( file, rom_size_KB, debug )
local KB_per_bank = 128 -- A1-16 = 64K address space, 2Bytes per address
local addr_base = 0x0000 -- control signals are manually controlled
local num_reads = rom_size_KB / KB_per_bank
local read_count = 0
while (read_count < num_reads) do
if debug then print( "Dumping ROM part ", read_count + 1, " of ", num_reads) end
-- A "large" Genesis ROM is 24 banks, many are 8 and 16 - status every 4 is reasonable.
-- The largest published Genesis game is Super Street Fighter 2, which is 40 banks!
-- TODO: Accessing banks in games that are >4MB require using a mapper.
-- See: https://plutiedev.com/beyond-4mb
if (read_count % 4 == 0) then
print("dumping ROM bank: ", read_count, " of ", num_reads - 1)
end
-- Select desired bank.
dict.sega("SET_BANK", read_count)
dump.dumptofile(file, KB_per_bank/2, addr_base, "GENESIS_ROM_PAGE0", debug)
dump.dumptofile(file, KB_per_bank/2, addr_base, "GENESIS_ROM_PAGE1", debug)
read_count = read_count + 1
end
end
-- Helper to extract fields in internal header.
local function extract_field_from_string(data, start_offset, length)
-- 1 is added to Offset to handle lua strings being 1-based.
return string.sub(data, start_offset + 1, start_offset + length)
end
-- Populates table with internal header contents from dumped data.
local function extract_header(header_data)
-- https://plutiedev.com/rom-header
-- https://en.wikibooks.org/wiki/Genesis_Programming#ROM_header
-- TODO: Decode publisher from t-series in build field
-- https://segaretro.org/Third-party_T-series_codes
local addr_console_name = 0x100
local addr_build_date = 0x110
local addr_domestic_name = 0x120
local addr_intl_name = 0x150
local addr_type_serial_version = 0x180
local addr_checksum = 0x18E
local addr_device_support = 0x190
local addr_rom_addr_range = 0x1A0
local addr_ram_addr_range = 0x1A8
local addr_sram_support = 0x1B0
local addr_modem_support = 0x1BC
local addr_region_support = 0x1F0
local len_console_name = 16
local len_build_date = 16
local len_name = 48
local len_type_serial_version = 14
local len_checksum = 2
local len_device_support = 16
local len_addr_range = 8
local len_sram_support = 12
local len_modem_support = 12
local len_region_support = 3
local header = {
console_name = extract_field_from_string(header_data, addr_console_name, len_console_name),
-- TODO: Decode T-Value and build info.
build_date = extract_field_from_string(header_data, addr_build_date, len_build_date),
domestic_name = extract_field_from_string(header_data, addr_domestic_name, len_name),
international_name = extract_field_from_string(header_data, addr_intl_name, len_name),
-- TODO: Decode Type, serial and revision.
type_serial_version = extract_field_from_string(header_data, addr_type_serial_version, len_type_serial_version),
checksum = string.unpack(">i2", extract_field_from_string(header_data, addr_checksum, len_checksum)),
-- TODO: Decode device support.
io_device_support = extract_field_from_string(header_data, addr_device_support, len_device_support),
-- TODO: Decode SRAM support.
sram_support = extract_field_from_string(header_data, addr_sram_support, len_sram_support),
-- TODO: Decode modem support.
modem_support = extract_field_from_string(header_data, addr_modem_support, len_modem_support),
-- TODO: Decode region support.
region_support = extract_field_from_string(header_data, addr_region_support, len_region_support),
}
-- ROM range can be used to autodetect the rom size.
local rom_range = extract_field_from_string(header_data, addr_rom_addr_range, len_addr_range)
local rom_start = string.unpack(">i4", string.sub(rom_range, 1, 4))
local rom_end = string.unpack(">i4", string.sub(rom_range,5, 8))
header["rom_size"] = (rom_end - rom_start + 1) / 1024
-- These should be the same in every cart according to docs, but decode in case its not. (64 Kb)
local ram_range = extract_field_from_string(header_data, addr_ram_addr_range, len_addr_range)
local ram_start = string.unpack(">i4", string.sub(ram_range, 1, 4))
local ram_end = string.unpack(">i4", string.sub(ram_range,5, 8))
header["ram_size"] = (ram_end - ram_start + 1) / 1024
return header
end
-- Make a human-friendly text representation of ROM Size.
local function str_rom_size(rom_size_kb)
local mbit = rom_size_kb / 128
if mbit < 1 then
mbit = "<1"
end
return "" .. rom_size_kb .. " kB (".. mbit .." mbit)"
end
-- Prints parsed header contents to stdout.
local function print_header(genesis_header)
print("Console Name: \t" .. genesis_header["console_name"])
print("Domestic Name: \t" .. genesis_header["domestic_name"])
print("Release Date: \t" .. genesis_header["build_date"])
print("Rom Size: \t" .. str_rom_size(genesis_header["rom_size"]))
print("Serial/Version: " .. genesis_header["type_serial_version"])
print("Checksum: \t" .. hexfmt(genesis_header["checksum"]))
end
-- Reads and parses internal ROM header from first page of data.
local function read_header()
dict.sega("SET_BANK", 0)
local page0_data = ""
dump.dumptocallback(
function (data)
page0_data = page0_data .. data
end,
64, 0x0000, "GENESIS_ROM_PAGE0", false
)
local header_data = string.sub(page0_data, 1, 0x201)
local genesis_header = extract_header(header_data)
return genesis_header
end
-- Test that cartridge is readable by looking for valid entries in internal header.
local function test(genesis_header)
local valid = false
-- Trailing spaces are required! Field length is 16 characters.
if genesis_header["console_name"] == "SEGA GENESIS " then valid = true end
if genesis_header["console_name"] == "SEGA MEGA DRIVE " then valid = true end
return valid
end
--Cart should be in reset state upon calling this function
--this function processes all user requests for this specific board/mapper
local function process(process_opts, console_opts)
local file
-- Initialize device i/o for SEGA
dict.io("IO_RESET")
dict.io("SEGA_INIT")
-- local genesis_header = read_header()
if process_opts["test"] then
-- If garbage data is in the header, it's a waste of time trying to proceed doing anything else.
-- local valid_header = test(genesis_header)
-- if valid_header ~= true then print("Unreadable cartridge - exiting! (Try cleaning cartridge connector?)") end
-- assert(valid_header)
-- print_header(genesis_header)
print("geny flash cart test")
dict.sega("SET_BANK", 0)
print(dict.sega("SEGA_RD", 0x0120))
print(dict.sega("SEGA_RD", 0x0122))
print(dict.sega("SEGA_RD", 0x0124))
print(dict.sega("SEGA_RD", 0x0090)) --read "SONIC" from 0x0120 >> 1
print(dict.sega("SEGA_RD", 0x0091))
print(dict.sega("SEGA_RD", 0x0092))
--dict.sega("SET_ADDR", 0)
rom_manf_id(true)
end
-- TODO: dump the ram to file
if dumpram then
unsupported("dumpram")
end
-- Dump the cart to dumpfile.
if process_opts["read"] then
-- If ROM size wasn't provided, attempt to use value in internal header.
local rom_size = console_opts["rom_size_kbyte"]
if rom_size == 0 then
print("ROM Size not provided, " .. str_rom_size(genesis_header["rom_size"]) .. " detected.")
rom_size = genesis_header["rom_size"]
end
print("\nDumping SEGA ROM...")
file = assert(io.open(process_opts["dump_filename"], "wb"))
--dump cart into file
dump_rom(file, rom_size, false)
--close file
assert(file:close())
print("DONE Dumping SEGA ROM")
print("Computing checksum...")
local checksum = checksum_rom(process_opts["dump_filename"])
if checksum == genesis_header["checksum"] then
print("CHECKSUM OK! DUMP SUCCESS!")
else
print("CHECKSUM MISMATCH - BAD DUMP! (Try cleaning cartridge connector?)")
end
end
-- TODO: erase the cart
if process_opts["erase"] then
unsupported("erase")
end
-- TODO: write to wram on the cart
if writeram then
unsupported("writeram")
end
-- TODO: program flashfile to the cart
if process_opts["program"] then
unsupported("program")
end
-- TODO: verify flashfile is on the cart
if process_opts["verify"] then
unsupported("verify")
end
dict.io("IO_RESET")
end
-- global variables so other modules can use them
-- NONE
-- call functions desired to run when script is called/imported
-- NONE
-- functions other modules are able to call
genesis_v2.process = process
-- return the module's table
return genesis_v2

View File

@ -181,6 +181,7 @@
#define MM2 253
#define DPROM 254 //just a random mapper number for whatever I need it for
#define MMC3S 252
// UNKNOWN 255 don't assign to something meaningful
//operand LSB mapper variant
#define NOVAR 0
@ -197,6 +198,12 @@
#define LOROM_3VOLT 6
#define HIROM_3VOLT 7
#define LOROM_3V_PAGE 8
#define HIROM_3V_PAGE 9
#define LOROM_3V_VERIFY 10 //same as 3VOLT above, but verifies each byte while writing
#define HIROM_3V_VERIFY 11
//set function
//miscdata: buffer number

View File

@ -63,7 +63,8 @@
//communications with
#define JTAG_INIT 4
// don't define 0x00 to protect from forgetting to pass jtag lane
#define JTAG_ON_EXP0_3 0x01 //Most NES carts with CPLDs
#define JTAG_ON_EXP0_3 0x01 //Most NES carts with CPLDs EXP0-TDO, EXP1-TDI, EXP2-TMS, EXP3-TCK
#define JTAG_ON_SNES_CTL 0x02 //SNES v2.0proto2 SYSCLK-TCK, RESET/EXP0-TMS, WR-TDI, RD-TDO

View File

@ -31,15 +31,20 @@
//set to zero if would like 256 clocks to be performed
//range is 1-255, 0 equates to 256 clocks
#define SET_2B_DATA 7
#define GET_6B_DATA 8 //RL=8
#define SET_2B_DATA 7 //miscdata defines the first byte index
//0=first 2 bytes (16bits) of DATA array
//if undefined, should be 0 (first 2 bytes)
#define GET_8B_DATA 8 //RL=10 max lua int, miscdata gives offset of first byte
#define GET_32B_DATA 9 //RL=34
//PBJE Paul's Basic Jtag engine commands & status'
#define PBJE_STATE_CHG 0x01 //data array holds TMS values to clock values bit packed, TDI undefined
//TMS s bit packed, better for USB data compression (contrary to notes)
//DATA SCAN commands, these end with settting TMS to 1 to exit SHIFT-IR/DR completing the SCAN.
//DATA SCAN commands, these end with setting TMS to 1 to exit SHIFT-IR/DR completing the SCAN.
//If need to make multiple smaller scans to make up one big scan, this would be the last scan, "HOLD" scans
//lower down would be the first to second to last scans
#define PBJE_TDI_SCAN 0x02 //ignore TDO 256max
@ -64,14 +69,16 @@
#define PBJE_FULL_SCAN_HOLD 0x10 //TDI = entire data array, TDO dumped into array stomping TDI, TMS=0 256max
//TODO, why don't we get unknown opcode when accidentally sending a command as an opcode..? ie dict.jtag("PBJE_INIT")
//that freezes instead of sending back unknown opcode, because it is known you idiot!...
//Statuses & commands to get to the status
#define PBJE_INIT 0x80
#define PBJE_INIT 0x80 //STATE ONLY! DON'T USE AS COMMAND!!l init with io dict, this is the state only
#define PBJE_PROC 0x81
#define PBJE_DONE 0x82
#define PBJE_CMD_RX 0x83
#define PBJE_UNKN_CMD 0xEE
#define PBJE_OFF 0xF0
#define PBJE_SHUTDOWN 0xFF
#define PBJE_OFF 0xF0 //STATE: mcu isn't running the PBJE
#define PBJE_SHUTDOWN 0xFF //COMMAND: tell mcu to shutoff PBJE