Commit Graph

11 Commits

Author SHA1 Message Date
Doug Brown
8b1cd63210 Change license to GPLv3
I can't use GPLv2 as soon as I need to start using the Nuvoton sample
code which is licensed with an Apache 2.0 license.
2023-09-10 05:02:44 -07:00
Doug Brown
81b3d28ffb Add get firmware version command 2023-08-26 21:01:09 -07:00
Doug Brown
1e63f3aea4 Use erase sector layout from programmer software when erasing portion
This should result in much better erase performance on larger SIMMs.
2023-08-26 21:01:09 -07:00
Doug Brown
2c88900d11 Read sector layout from programmer software 2023-08-26 21:01:09 -07:00
Doug Brown
a113d4da0d Don't restrict to erasing the first 2 MB of a "2 MB" SIMM
The problem is that over time, the meaning of curChipType has changed.
It was originally meant to exactly map to chips (four SST39SF040 chips
or four M29F160FB5AN6E2 chips) but over time its meaning has shifted to
simply indicating whether the unlock address needs to be shifted or not.

When curChipType is ParallelFlash_SST39SF040_x4, sometimes the
programming size is 4 MB or 8 MB. So don't restrict it to 2 MB.

Note that the erase sector sizes are just plain wrong in this case. In
the future I should read the chip ID and keep a table of sector sizes
for each known chip ID.
2023-08-02 21:01:30 -07:00
Doug Brown
8f3c74a14e Update copyright date 2023-06-25 11:38:41 -07:00
Doug Brown
14cf8505f7 Break out bootloader entry into HAL
For some reason, I didn't have this as part of the HAL, so the main
program still had AVR dependencies.
2023-05-28 19:34:02 -07:00
Doug Brown
8aec8807c9 Fix line endings
A whole bunch of files in this project had DOS line endings. This is due
to how I started working on it on a Windows machine with little Git
experience. Now it's inconsistent so I'm fixing it.
2023-05-28 19:34:02 -07:00
Doug Brown
2943b80c42 Optimize reading of 1024 byte chunks
This was a suggestion from bigmessowires. Do a tight loop when reading
a chunk of 1024 bytes. It's faster.
2020-11-27 00:16:35 -08:00
Doug Brown
3df4c40f38 Add/update copyright
This just makes sure everything is up to date with copyrights.
2020-11-27 00:16:35 -08:00
Doug Brown
7425af761a Break out code into a HAL, optimize flash operations
This makes the code pretty easily portable to other architectures if someone
wants to make a more modern SIMM programmer. I also was pretty careful to split
responsibilities of the different components and give the existing components
better names. I'm pretty happy with the organization of the code now.

As part of this change I have also heavily optimized the code. In particular,
the read and write cycle routines are very important to the overall performance
of the programmer. In these routines I had to make some tradeoffs of code
performance versus prettiness, but the overall result is much faster
programming.

Some of these performance changes are the result of what I discovered when
I upgraded my AVR compiler. I discovered that it is smarter at looking at 32-bit
variables when I use a union instead of bitwise operations.

I also shaved off more CPU cycles by carefully making a few small tweaks. I
added a bypass for the "program only some chips" mask, because it was adding
unnecessary CPU cycles for a feature that is rarely used. I removed the
verification feature from the write routine, because we can always verify the
data after the write chunk is complete, which is more efficient. I also added
assumptions about the initial/final state of the CS/OE/WE pins, which allowed me
to remove more valuable CPU cycles from the read/write cycle routines.

There are also a few enormous performance optimizations I should have done a
long time ago:

1) The code was only handling one received byte per main loop iteration. Reading
   every byte available cut nearly a minute off of the 8 MB programming time.
2) The code wasn't taking advantage of the faster programming command available
   in the chips used on the 8 MB SIMM.

The end result of all of these optimizations is I have programming time of the
8 MB SIMM down to 3:31 (it used to be 8:43).

Another minor issue I fixed: the Micron SIMM chip identification wasn't working
properly. It was outputting the manufacturer ID again instead of the device ID.
2020-11-27 00:16:35 -08:00