Commit Graph

19 Commits

Author SHA1 Message Date
Paul Win10 shuttle PC 88a2d30858 Massive commit with bunch of random junk..
Added windows driver package, just have to run InstallDriver.exe to
get drivers installed on windows 10 (and others I believe)

Created dictionaries for all remaining cart connectors.
Nothing useful there yet, just wanted to get the files created
and dictionaries working.

Added bunch of notes to shared_dictionaries to explain how to go
about creating new dictionaries and some opcode details.

Have STM8 cic communications working "CICCOM" to change between H/V
mirroring on new discrete boards.  Currently these operations are handled
entirely from the host scripts and opcode/operands are mostly hard coded.
Need to move these to more generic functions in the ciccom dictionary
which will also speed things up moving to the firmware which will speed
things up.

Some changes to mapper 30 script to eat the ines header, and test CHR-RAM
banking.

Some updates to snes flashing operations, still a work in progress to
fully support prior SNES board designs.
2018-09-06 23:01:59 -05:00
Paul Black ASUS win7 9c57f1bdb3 Massively overdue commit of several months worth of random work.
Mostly adding support for mappers as I needed it for my own hardware
builds:
-MMC1
-mapper 30
-easy NSF (still need to update for mapper verilog fix)
-action53 (still need to update for mapper verilog fix)
-dual port board flashing
-colordreams, not sure if I actually got this working
-color ninja, just a special CPLD version of colordreams for ninja boards

Just started working on SNES code.  slowly getting things up and working
outside of main inlretro.lua script similar to how NES has been handling
everything with it's own script.  Able to flash v3 boards fine.  v1 boards
flash without errors, but still having some mapping problems where it
verifies but won't boot.  v2 prototype flashes most bytes but not all,
seems v2 boards are much slower to output valid data..  But that may just
be the manufacturer ID codes..?

TODO next:
-bootloader dictionary that jumps to bootloader so don't have to manually
close jumper on the board.
-turn on the watchdog timer for stm32
-create some sort of host timeout so reset button on programmer isn't as
useful
-allow firmware programing algos to be uploaded and executed from SRAM for
faster code that also doesn't require specific firmware builds to support
new mapers.
-Finish JTAG to simplify programing NES & SNES CPLDs
-Sort out swim issue with stm8s001 CICs
-add SWIM support for avr
2018-07-08 20:23:44 -05:00
Paul blue asus 3c359ac5ca Double and long overdue commit..
Various changes to STM8 SWIM code to make more versatile allowing SWIM
pin to be located effectively on any STM32 GPIO pin.  Still haven't
touched an AVR implementation, but made place holders so it can compile
for AVR at least.  These SWIM changes aren't heavily tested, mostly just
made sure could flash SOIC-8 STM8 CIC via CIC CLK.

Beginings of JTAG code to configure CPLDs.  Currently only tested state
change and scan out reading MachXO-256, 4032/64v, & XC9572/36XL CPLDs
Tested and working on inlretro6 v1.0p, stm adapter, & avr kazzos.
Older devices with flipflops will apply 5v signals to JTAG pins but time
is mostly minimized by keeping signals defaulted low unless actively
changing states or scanning data.

Still need to verify scan in working, probably move TDI/TDO long strings
to buffers instead of 32byte PBJE data array.  Also need smarter PBJE
host code to keep track of current state and come up with PBJE register
values without hard coding them..

But things are working fairly well so far with SWIM & JTAG
implementations.  Had some issues where I thought jtag pin toggling was
getting optimized out, but I must have simply had the logic analyzer
speed set too low and was missing pin changes that can be as quick as
40nsec with space optimized code.  Current inl6 code is ~4400Bytes,
without optimization it's nearly 50% larger at ~6550Bytes..!
Optimizations seem fine in testing and with logic analyzer running at
50Mhz which is good because the GPIO registers are set as volatile so
they better not be getting optimized away!
2018-01-01 23:32:09 -06:00
Paul Molloy 0dd8828744 Long over due commit...
-Updated STM devices to always run @ 48MHz
 Doesn't seem to cause any problems with SNES flashing couple thousand SF2
 boards have been flashed with this build without issues
-Added note to usb_operations.c as manf/prod ID can't be read if drivers
 aren't installed.  Caused issues for Todd as he hadn't installed drivers
 for new hardware.
-STM swim operations are working pretty well for SNES v2 and v3 boards
 Haven't even touched SWIM on AVR core yet...
 SWIM is pretty pin independent but only implemented on EXP0 so far
 Reads "ROTF" aren't bullet proof but they're pretty good.  Biggest
 room for improvement aside from adding a legit pullup would be to have
 an interrupt trigger the device header bit falling edge instead of the
 current polling method which has decent amount of jitter.
 Implementing interrupts would also probably allow for more easily
 supporing reads longer than a single byte...
2017-10-22 17:09:21 -05:00
Paul Molloy 7e8ad86d3a Big update, have PRG-ROM dumping on NROM working for all devices!
tested and verified on purple, green, and yellow/orange avr kazzos and
stm32 inlretro6 proto, and stm32 adapter with yellow kazzo board

AVR takes ~17.5sec to dump 256KB -> 1:10 for 1MByte = 14.6KBps
STM takes  ~8.5sec to dump 1MByte = 120KBps
STM32 usb driver is far from optimal as it's setup to be minimal with only
8byte endpoint0 to make an effort to align avr and stm.  Larger endpoints
and bulk transfers should greatly speed up stm usb transfers

refactored firmware buffer.c and implemented most of the required opcodes
added check that should cover if device isn't ready for a IN/OUT
transfer.  Does this by usbFunctionSetup returning zero which causes the
device to ignore the host.  Don't think I've got the stm32 usb driver
setup properly to handle this not sure I fully understand Vusb driver
either.  Anyway, hopefully it works well enough for now and keep this in
mind if issues crop up in future.

Still haven't implemented usbFunctionWrite, not sure stm usb driver is
setup properly yet either..

build sizes:
avr yellow/orange: avr-size build_avr/avr_kazzo.elf
   text    data     bss     dec     hex filename
   5602       6     674    6282    188a build_avr/avr_kazzo.elf

previous builds of avr code size was ~6.4KB when flashing and dumping was working.
AVR bootloader is 1.7KB taking up majority of 2KB boot sector.
So AVR has 16KB - 2KB boot = 14KB available, using ~44% of non-boot sector
available flash Have 4 buffers defined, and 512B of raw buffer defined so using
~65% SRAM Making pretty good use of the chip just for basic framework.
Not a ton of room for board/mapper specific routines, so will have to keep this
in mind.  Creating more generic routines to save flash will come with a speed
hit, but perhaps we shouldn't worry too much about that as devices below
really boost speed without even trying.  There is some sizable amount of
SRAM available could perhaps load temporary routines into SRAM and execute
Also have ability to decrease buffer sizes/allocation.  Perhaps routines
could actually be store *IN* the raw buffers.. ;)

stm adapter: arm-none-eabi-size -t build_stm/inlretro_stm.elf
   text    data     bss     dec     hex filename
   7324       0     680    8004    1f44 build_stm/inlretro_stm.elf
Currently targetting STM32F070C6 which has 32KB flash, 6KB SRAM
Could upgrade to STM32F070CB in same LQFP-48 package w/ 128KB/16KB
Don't think that'll be of much value though especially with limitation
on connectors for adapter.
So currently don't have user bootloader, only built in ones.
8KB of 32KB avaiable flash = 25% utilization
680B of 6KB available sram = 11% utilization
32KB device doubles amount of available flash compared to AVR, although
stm32 code isn't quite a condensed compared to AVR.

stm inlretro6: arm-none-eabi-size -t build_stm/inlretro_stm.elf
   text    data     bss     dec     hex filename
   6932       0     680    7612    1dbc build_stm/inlretro_stm.elf
Mostly limited to STM32F070RB as choosing device requiring XTAL, and
desire large number of i/o.  This device provides 128KB flash, 16KB SRAM
Currently using 7.6KB/128KB flash = 6% utilization
Currently using 680B/16KB SRAM = 4.1% utilization
LOTS of room for growth in this device!!  Part of why I choose it over
crystalless 072 version, as it came with more flash for less cost.

Also hardly making use of 1KB of USB dedicated SRAM:
32B buffer table entries
16B endpoint0 IN/OUT
48B of 1024B available = 4.6% utilization
2017-08-07 16:06:23 -05:00
Paul Molloy 8b5650b75f Well over due commit with lots of updates..
Have separate lua modules now in scripts/app folder
Dictionary calls are now their own lua module
firmware now capable of calling multiple different dictionaries
have firmware & lua io and nes dictionaries, able to detect
NES and famicom carts.  Created expansion port abstraction so most kazzo
versions behave identically.
Created separate make file for stm adapter and inl6
added PURPLE_KAZZO and GREEN_KAZZO defines back in.  They work well enough
for sensing NES vs famicom carts so far.  GREEN_KAZZO requires
PURPLE_KAZZO to also be defined.  GREEN_KAZZO is also only compatible with
AVR_CORE due to software_AHL/AXL functions specifically written for AVR.
I think things will work if a STM_ADAPTER is placed on a PURPLE_KAZZO and
both those defines are made as only real difference is software tying of
AXL and X_OE.  But haven't tested this aside from ensuring it compiles.
Have correction to pinport_al.h that will commit immediately after this.
2017-08-05 16:04:59 -05:00
Paul Molloy 1e5ea8cc7e Have USB drivers successfully calling usbFunctionSetup when vendor setup
packet arrives.  Had issue with return data on STM32 not being properly
aligned when the rv array was only 8bit.  So defining it as a 16bit array
and then pointing a 8bit pointer to it seems to be an easy fix for now.

Ready to start working on pinport dictionary.  Need to get lua code
working on a lower level handling the dictionary calls.  Need it do do
things like fill out the wLength and everything for me so one doesn't have
to remember every detail about an opcode/dictionary before calling it.
Realizing code was heavily segmented based on how big/many operands there
were and how big the return data was.  This is hard to maintain, need lua
to resolve this issue, and make everything easier to script.  Thinking
opcode/dictionary calls need to be more like a function call.  Passing in
necessary args only, and returning data instead of succeed/fail.
2017-07-24 21:56:34 -05:00
Paul Molloy ea5f1d9842 Creation of pinport abstraction layer to make firmware more generic to the
underlying hardware/mcu.  Created avr_gpio.h to define AVR pin registers
in a struct fashion similar to what's common with ARM code.  Doing that
makes things much easier to abstract in pin macro 'functions'.

Added define to Makefiles that flags pinport_al.h which board is targetted
for build.

Tested and able to turn on/off and pull-up LED on all 3 builds.
2017-07-22 23:58:16 -05:00
Paul Molloy 3779afe88d Successfully building avr & stm core with one set of files.
Two different Makefiles, specify which with -f file flag:
make -f Make_avr clean program
make -f Make_stm clean program

made release dir to put released .hex firmware files
Need to make separate avr build folder
Need to make one master Makefile that calls one of the other makefiles as
instructed.

Currently device is recognized by PC but does nothing else other than
being recognized by app during connection process:

arm-none-eabi-size -t build_stm/inlretro_stm.elf
text    data     bss     dec     hex filename
1332       0      20    1352     548 build_stm/inlretro_stm.elf
1332       0      20    1352     548 (TOTALS)

avr-size avr_kazzo.elf
text    data     bss     dec     hex filename
1496       2      43    1541     605 avr_kazzo.elf
2017-07-22 17:03:23 -05:00
Paul Molloy 895bd6a737 Completely trimmed avr build down to bare bones, only completing
enumeration with host, no vendor/class requests handled.
move avr builds into avr_release dir
move original source files into source/old for future reference.

avr-size avr_kazzo.elf
text    data     bss     dec     hex filename
1496       2      43    1541     605 avr_kazzo.elf
2017-07-22 14:30:03 -05:00
Paul Molloy 937435220a Some early dumping functionality working.
buffer opcode updates to transfer payloads
including stuffing two bytes of write transfers in setup packet.
Calling specific buffers with miscdata or opcode.

new dump and flash modules for firmware.

new buffer function update_buffers called during main to monitor and
manage buffer objects when not being loaded/unloaded from USB.
2016-11-30 22:52:43 -06:00
Paul Molloy fe1b0e0ba5 AVR Memory Usage
----------------
Device: atmega164a

Program:    4092 bytes (25.0% Full)
(.text + .data + .bootloader)

Data:        445 bytes (43.5% Full)
(.data + .bss + .noinit)

upgraded windows machine to avr-gcc (GCC) 6.1.1 20160627
dropped .hex down to within 2 bytes of linux machine running 4.8.2

changed main to remove avr-gcc 6.1.1 warnings
2016-11-28 22:53:12 -06:00
Paul Molloy 7d00145431 Big step in confirmation of pin manipulations working on kazzo.
Able to read PRG-ROM flash chip's manf and device ID from commandline.

New dictionaries io and nes along with firmware files to support.
now have io_reset, nes_init, and snes_init io.c functions
nes.c functions including discrete_exp0_prgrom_wr and emulate_nes_cpu_rd.

New dictionary.c/.h for host to make dictionary calls easier including
setting proper return data lengths based on opcode.

adding nop command to pinport.h

AVR Memory Usage
----------------
Device: atmega164a

Program:    2960 bytes (18.1% Full)
(.text + .data + .bootloader)

Data:         53 bytes (5.2% Full)
(.data + .bss + .noinit)
2016-11-27 00:18:46 -06:00
paul eeepc dae63f73b0 Tons of edits...
rearranged some of the .h files, created dictionary file to list all dictionaries of opcodes.
        moved error codes to shared file so host can interpret firmware error codes.
        created firmware usb.c/h to handle usb operations (didn't move as git seems to think..)
	cleaned up fw main function and file.
	host usb_operations, created USBrequest struct type to more easily handle all transfer info.

Currently able to send pinport commands and read back return values from retro prog.
Just need to start writting functions to send opcodes and start actually preforming some cartridge operations.
2016-11-25 19:50:43 -06:00
Paul Molloy 31678bacfe renamed: host/source/pinport.h -> shared/shared_pinport.h
modified:   firmware/source/pinport.c
modified:   firmware/source/pinport.h
	-creating shared_pinport.h which is effectively a dictionary for
	pinport opcodes
	-file gets copied to host and firmware source dirs when compilied.
	-hardware macros had to be renamed to include underscore to
	differentiate opcode name from hardware macro.
	-pinport.c now is a nice clean switch between opcode name and
	macro with all literal numbers removed.
	-now don't have to manually track/update opcode numbers between
	multiple locations.

modified:   firmware/source/io.c
modified:   firmware/source/main.c
	-updates to add underscore pre-fix to hardware macros.
2016-11-23 18:12:50 -06:00
paul eeepc b43b3c0756 modified: Makefile
-modified to caluclate ROM/RAM usage of atmega164a

new file:   source/io.h
new file:   source/logic.h
	-created files

modified:   source/io.c
modified:   source/main.c
	-created io_pullup going to make separate io inits based on cartridge inserted
	-modifing for io.h

modified:   source/pinport.h
	-File mostly complete with all possible pin manipulations
2016-11-22 20:27:52 -06:00
paul eeepc 5620b34a9e new file: io.c
-creation of io file
modified:   main.c
	-moving io setup to io.c
new file:   pinport.h
	-creation of pinport file, intended to be avr specific code from macro.h
2016-11-21 17:54:29 -06:00
Paul Molloy b8be4b768a new file: shared/usb_commands.h
-shared .h files used in both firmware and host app
modified:   firmware/Makefile
modified:   host/Makefile
	-added shared dependency to copy shared files to source prior to
	building
modified:   host/source/usb_operations.h
modified:   firmware/source/main.c
	-removing usb commands (now in shared)
modified:   host/include/dbg.h
	-adding SUCCESS defintion
modified:   host/source/inlprog.c
	-calling write file if write arg sent
new file:   host/source/write_operations.c
new file:   host/source/write_operations.h
	-creation of write operations files
	-opens file and reads header
	-some skeleton comments
	-lots of work left to do here
new file:   roms/nrom_v_test.nes
	-adding NROM test rom file
2016-11-20 23:57:09 -06:00
Paul Molloy 6a370d3893 Moving source code to source folder
Modifing Makefile to support
2016-11-20 20:11:05 -06:00