Commit Graph

14 Commits

Author SHA1 Message Date
Doug Brown
7dd0f3f9db Include usbd.h
Since I stripped the peripheral header includes from M251.h, I have to
include it manually instead.
2023-06-25 11:41:19 -07:00
Doug Brown
5fbc982c31 Fix const correctness of S_USBD_INFO_T struct 2023-06-25 11:41:19 -07:00
Doug Brown
ce8932e80f 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-06-25 11:41:19 -07:00
Doug Brown
c50da81d8c 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-06-25 11:41:19 -07:00
Doug Brown
5fc45624ef 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-06-25 11:41:19 -07:00
Doug Brown
257d395cd2 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-06-25 11:41:19 -07:00
Doug Brown
71af23b33e 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-06-25 11:41:19 -07:00
Doug Brown
3a7e3bf69f 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-06-25 11:41:19 -07:00
Doug Brown
9f0299a9c4 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-06-25 11:41:19 -07:00
Doug Brown
7c368aa816 Fix issue with linker script allowing data section to overflow flash 2023-06-25 11:41:19 -07:00
Doug Brown
7a77d583da Update linker scripts with correct RAM/flash sizes
Change code style so that it's easy to see the number of kilobytes too.
2023-06-25 11:41:19 -07:00
Doug Brown
e1e1523a99 Add README explaining the Nuvoton directory 2023-06-25 11:41:19 -07:00
Doug Brown
30e8baef89 Initial commit of Nuvoton USBD driver 2023-06-25 11:41:19 -07:00
Doug Brown
979f531bdf Initial commit of register defines, CMSIS code from Nuvoton BSP 2023-06-25 11:41:19 -07:00