Commit Graph

130 Commits

Author SHA1 Message Date
Doug Brown
87e074413c
Remove mention of Quadra from compatibility
I don't think the existing pinout is 100% compatible.
2023-09-11 20:44:17 -07:00
Doug Brown
4221c18682 Bump version to 1.5.1
This new version number doesn't add anything to the AVR version of the
firmware. However, it signifies the release of the ARM version.
2023-09-10 05:02:44 -07:00
Doug Brown
e06bbe5137 Update documentation for M258KE build
Also, do a few random cleanups while I'm at it.
2023-09-10 05:02:44 -07:00
Doug Brown
c46b9d5e5f Don't assert OE and CS simultaneously during electrical test
If you do, and a SIMM is installed in the socket, you will get an
erroneous short detected for any data pins that are currently outputting
a 0. Avoid this by testing OE and CS for 5V shorts separately.
2023-09-10 05:02:44 -07:00
Doug Brown
0b88f61542 Mark the M258KE board as having pulldown support 2023-09-10 05:02:44 -07:00
Doug Brown
96b5b2034b Add pulldown (5V short detection) to SIMM electrical test 2023-09-10 05:02:44 -07:00
Doug Brown
c6313d0859 Hook up pulldowns in M258KE ParallelBus implementation 2023-09-10 05:02:44 -07:00
Doug Brown
01368fb9b8 Add dummy AVR pulldown functions for ParallelBus 2023-09-10 05:02:44 -07:00
Doug Brown
843787ffc6 Add prototypes for pulldown control in ParallelBus 2023-09-10 05:02:44 -07:00
Doug Brown
a4e6cf4809 Add support for GPIO pulldown control
Note that it does nothing on the AVR, which doesn't support it.
2023-09-10 05:02:44 -07:00
Doug Brown
7e5639c792 Exclude M258KE code from Eclipse AVR builds 2023-09-10 05:02:44 -07:00
Doug Brown
2d219f045f Hook up the M258KE port
Note that ASM has to be enabled as a project language because the M258KE
startup code is an assembly file.
2023-09-10 05:02:44 -07:00
Doug Brown
a5087e16f6 Add cmake source/options includes for M258KE port 2023-09-10 05:02:44 -07:00
Doug Brown
d14ca13dd8 Disable watchdog timer when the firmware boots
If it gets this far, the firmware is at least sort of running, so the
watchdog has served its purpose of resetting to the bootloader if
there's invalid firmware flashed to the device.
2023-09-10 05:02:44 -07:00
Doug Brown
9df4cd0c84 Enable timer, use for delay functions 2023-09-10 05:02:44 -07:00
Doug Brown
6a9b75d01b Implement M258KE board functions 2023-09-10 05:02:44 -07:00
Doug Brown
da015217f3 Add initial hardware.h for M258KE
Delay functions aren't implemented yet; they will be coming later.
2023-09-10 05:02:44 -07:00
Doug Brown
c211ab31bf Add implementation of ParallelBus for M258KE 2023-09-10 05:02:44 -07:00
Doug Brown
b1ab4ece95 Add ability for status LED to be inverted 2023-09-10 05:02:44 -07:00
Doug Brown
df5c50ffee Add GPIO driver
Provide the basic functionality for setting direction, turning on and
off, toggling, reading inputs, and enabling/disabling pullups.

This chip also provides pulldowns, so in the future I will also
implement pulldown control so we can detect shorts to 5V.
2023-09-10 05:02:44 -07:00
Doug Brown
d1ef87a3f6 Implement stubbed-out SPI driver
SPI isn't needed on this platform because we don't need an I/O expander.
So this can be a bunch of stub functions that do nothing. They will be
optimized out during the linking process anyway.
2023-09-10 05:02:44 -07:00
Doug Brown
a274aa862b Add cmake toolchain file for M258KE build 2023-09-10 05:02:44 -07:00
Doug Brown
5e8224e35e Add USB CDC serial port code
This implements a USB CDC serial port using the Nuvoton USBD driver. The
USB handling is based on Nuvoton's BSP sample code, especially the IRQ
handlers and descriptor buffer configuration. The descriptors have been
adapted to be similar to the AVR version, and RX/TX functions have been
written to implement an API closer to LUFA, which is what the SIMM
programmer common code needs.
2023-09-10 05:02:44 -07:00
Doug Brown
abb1352f30 Include usbd.h
Since I stripped the peripheral header includes from M251.h, I have to
include it manually instead.
2023-09-10 05:02:44 -07:00
Doug Brown
c94f064340 Fix const correctness of S_USBD_INFO_T struct 2023-09-10 05:02:44 -07:00
Doug Brown
0db1710871 Disable unnecessary interrupt
I don't really need to bother with VBUS or "no-event-wake-up"
interrupts. This allows me to strip out more code in the IRQ handler.
2023-09-10 05:02:44 -07:00
Doug Brown
f68c1d1d44 Change USBD_MemCopy to not be static inline
I'm sure it's slightly more efficient as a static inline function, but
it results in less flash usage as a separate function. This is important
for the bootloader where every byte matters.
2023-09-10 05:02:44 -07:00
Doug Brown
2c35f61c88 Strip out unnecessary callbacks and code in USBD driver
This is important for the bootloader. There's a bunch of stuff here we
don't need that unnecessarily bloats the code.
2023-09-10 05:02:44 -07:00
Doug Brown
2a96427047 Bypass GCC built-in startup code
Nuvoton's sample startup_M251.S file handles enough initialization for
my purposes, so I can completely bypass _start and jump directly to
main. Note that I also had to add a define to enable clearing of BSS.
2023-09-10 05:02:44 -07:00
Doug Brown
06f9bbcbe7 Strip out unnecessary clock and UART code
The default values for SystemCoreClock, CyclesPerUs, and PllClock work
fine for my purposes of running from the 48 MHz HIRC. Remove unnecessary
initialization code. This is especially useful for the bootloader where
flash space is at a premium.

Also strip out unneeded UART setup code.
2023-09-10 05:02:44 -07:00
Doug Brown
0470b9960c Don't include peripheral header files in M251.h
I don't want to include all of Nuvoton's peripheral drivers, but I do
want to use this header file. Remove the unnecessary peripheral
includes.
2023-09-10 05:02:44 -07:00
Doug Brown
a702106bb3 Reserve 4 bytes at end of RAM for magic number
This will be used during firmware updates so that the main firmware can
communicate to the bootloader that it should stay in the bootloader for
a firmware update rather than run the main firmware again.
2023-09-10 05:02:44 -07:00
Doug Brown
34f2364840 Fix issue with linker script allowing data section to overflow flash 2023-09-10 05:02:44 -07:00
Doug Brown
78c4068071 Update linker scripts with correct RAM/flash sizes
Change code style so that it's easy to see the number of kilobytes too.
2023-09-10 05:02:44 -07:00
Doug Brown
bc9b0245ba Add README explaining the Nuvoton directory 2023-09-10 05:02:44 -07:00
Doug Brown
a4b17f6601 Initial commit of Nuvoton USBD driver 2023-09-10 05:02:44 -07:00
Doug Brown
81bba67ee3 Initial commit of register defines, CMSIS code from Nuvoton BSP 2023-09-10 05:02:44 -07:00
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
7851bb2d10 Update README with build instructions
This README contains an overall summary of the entire project, but it
was missing build instructions for the firmware. Add them now that cmake
is all set up.
2023-06-25 11:38:41 -07:00
Doug Brown
afeeb5bfe7 Ignore CMakeLists.txt.user generated by Qt Creator 2023-06-25 11:38:41 -07:00
Doug Brown
bf1031127d Set up CMake build
This allows building with CMake instead of Eclipse. The reasoning behind
this is to make the code more easily portable to other architectures,
and to move away from being dependent on Eclipse.
2023-06-25 11:38:41 -07:00
Doug Brown
174bcdb370 Add CMake toolchain for AVR compilation 2023-06-25 11:38:41 -07:00
Doug Brown
baf0937589 Switch to config header for LUFA
This eliminates the need for a bunch of extra defines added to the
compile command.
2023-06-25 11:38:41 -07:00
Doug Brown
b627ef9020 Move descriptors to RAM
This ensures they will work properly on the AT90USB128x, especially in
the bootloader where they will be in the upper 64 KB.
2023-05-28 19:34:02 -07:00
Doug Brown
3a8e006925 Manually control USB PLL
The 646 and 1286 have different required USB PLL values when you have a
16 MHz crystal. Detect the chip at runtime to set up the PLL correctly.
This requires taking over control of the PLL from LUFA.
2023-05-28 19:34:02 -07:00