Commit Graph

6 Commits

Author SHA1 Message Date
Paul XPS e3d0ec434e Have the USB code effectively separated from the main application code!
Need to physically separate them now.  Then can focus on erasing &
flashing ourselves.

Added some speed checks to bnrom.lua script that I was testing usb code
with.  Was able to verify read/write speeds were no affected by changes
in this commit.  Did some testing against older firmware v2.2 though
there does seem to have been a slight slow down on write speeds.
Although, perhaps that's because of the nrom flash verifications that
are also included in this build (but not commited)..?
2018-11-27 23:26:26 -06:00
Paul XPS d0c8ab82fe Moved usbMsgPtr to usb_buff ram successfully.
Deleted shared_usb.h because it was a copy of shared_dict_usb.h

This build_stm .hex does include some NROM flash updates to allow
checking if the last byte programmed successfully because was having
weird problems with that.  But not ready to commit all those changes and
they're highly unrelated to this commit.

Now that usb code doesn't use any .data nor .bss need to fully separate
the USB firmware code from the application.  Main way to do this will be
to have usb code be effectively entirely interrupt driven.

Thinking the best way to initialize usb will to have the application
code jump to the USB ISR and maybe use some messaging system with the 2
unused usb_buff indexes (4Bytes).

The USB code will include the vector table, so it will point to the
reset handler, but that will point to the application code's reset
handler, just need to make sure that's at a fixed location.

The USB code is just over 1KByte last I checked, so dedicating 2KByte
should be good.  Erase granularity is 1 page (1KB on C6, 2KB on RB).  So
that will work well.  Write protection granularity is 4KByte, but really
we shouldn't need to use write protection as there will always be the
built in bootloader to save a bricked device.
2018-11-27 02:00:47 -06:00
Paul XPS a8d9fe55bb Moving usb code static variables from system ram to USB buffer ram.
In effort to remove USB firmware driver's dependance on .data/.bss
Started by fixing bug that wasn't allowing USB_BTABLE to be relocatable
Was neglecting byte addressing vs usb_buff[] array indexing of 16bit
half words.

Still have 4 bytes of .bss for usbMsgPtr, need to modify the
communication protocol between application code and usb code to
move/remove this pointer out of .bss there are 4 bytes of usb_buff
ram available for it to be moved into but need to ensure only 16bit
access is made.

Once that's done can separate usb code from application code and have
usb code only interrupt driven, with application code polling.
Then the usb code can sniff out firmware update packets and update
application code behind it's back.

Removed logging of transfer count since it wasn't being used

num_bytes_expecting isn't used but breaks device descriptors if cut for
some reason... so I just moved it and kept it...

Another weird issue is after reflashing the mcu via stlink the first
inlretro.exe excecution fails due to some usb error.  Not sure if it's
related to the usb code changes I just made, or possibly some other
recent updates to inlretro executable..?  I think this issue has existed
forever, but was hard to pin down and always went away after a reset.
2018-11-26 01:59:04 -06:00
Paul Molloy dfeaf960ef commiting files as they were left a couple weeks ago..
Not 100% sure what all happened with this update.. :/

Tested and have all 3 recent kazzos flashing and dumping PRG-ROM and
CHR-ROM on NROM NES board.  Pretty sure I tested purple and green kazzos
too as I had left those on in pinport and seem to recall having them all
working when I tweeted 2 weeks ago..

Created new status_wait for buffers so can wait for them to finish
dumping/flashing before starting/ending operations.  That cleaned up
dump/flash code a fair amount.

On first tests today I had issues where setting flash operation would hang
and fail with both stm kazzos.  As I started to debug the issue it
disappeared, so IDK what that was all about..  I think there might be an
issue with my stm32 usb drivers..  Those were updated in this commit to
properly allow write "OUT" packets to be supported.

Planning to start tinkering with SNES in prep for the no save boards
arriving tomorrow!
2017-08-20 16:38:12 -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 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