Commit Graph

34 Commits

Author SHA1 Message Date
Kévin Redon
4136c242a8 USBD: send empty packet when non-existing descriptor string is requested
Sometimes descriptor string 0xee is requested.
This is a mechanism used by Microsoft Windows to further identify the USB device.
Instead of stalling, as is the original code, leading to an USB reset, we send an empty packet.
I am not sure if sending an empty string would be better, but an empty packet seems sufficient.
2018-06-29 20:07:31 +02:00
Kévin Redon
a38a126361 fix: initialize uninitialized variable in USBDFU_DFU_RequestHandler 2018-06-29 20:07:31 +02:00
Harald Welte
7f62c24532 USB: Handle DFU requests by USBD.c to keep application callback
e.g. in CCID mode we need to treat class-specific control requests,
and we want to do this in a way how the CCID code doesn't need to
understand about DFU.
2017-11-29 00:24:28 +01:00
Harald Welte
f231541601 Fix typos in usb.c, llist_irqsafe.h and dfu.h 2017-11-28 19:16:57 +01:00
Harald Welte
f8c83a4d64 Make hardfault handler a bit more verbose 2017-05-07 23:10:02 +02:00
Harald Welte
e8869fb8ff DFU: Resolve DFU runtime descriptor dynamically from descriptors
We cannoy simply use the DFU runtime descriptor of the DFU mode, but we
have to use the descriptor of the specific currently-selected runtime
configuration.  Let's iterate over the descriptors of a configuration
and find the DFU runtime descriptor in it.
2017-03-06 22:44:42 +01:00
Harald Welte
c6e482d581 qmod eeprom/i2c: Re-start watchdog while slow bit-banging 2017-03-05 16:24:29 +01:00
Harald Welte
2363fa0327 Generate USB Strings from apps/*/usb_strings.txt files at compile time
This way we can skip the manually-crafted USB string definitions in the
dfu_desc.c and usb.c files.
2017-03-05 10:16:25 +01:00
Harald Welte
1405100dff DFU: Introduce board/app-specific override for booting in DFU mode
Using the USBDFU_OverrideEnterDFU() function, a board/application can
define extra conditions when the system should boot in DFU mode, even if
it was not explicitly switched to DFU mode from the application.

The app/dfu/main.c uses this mechanism to boot into DFU mode if the
stack + reset vector addresses are not plausible (i.e. some random junk
appears to be flashed in the application partition) or if the user
places a jumper accross the RxD+TxD lines of the debug UART.  The idea
is that the system can be recovered by placing this jumper and then
re-installing the application from DFU.
2017-03-04 19:17:27 +01:00
Harald Welte
0de99cd069 DFU: String descriptors for DFU alt-interfaces
they are only shown in DFU mode for now, until we find a way to export
them over to the runtime.
2017-03-03 01:20:19 +01:00
Harald Welte
ac4f66e5d1 DFU: Set 10ms bwPollTimeout (lowest possible as per spec) 2017-03-03 01:13:34 +01:00
Harald Welte
91fc40240e DFU: make sure to properly initialize g_dfu pointer before using it 2017-03-03 01:05:22 +01:00
Harald Welte
b04f4f0ee8 DFU Runtime: Add missing return after handling USB standard requests
the same as 479e97e338 but this time for
the runtime, not for DFU.
2017-03-03 00:36:39 +01:00
Harald Welte
d1e963479e DFU: fix transitions between runtime and DFU mode
we now always go through a processor reset to avoid any state that might
be persistent/left-over during the switch.
2017-03-03 00:34:17 +01:00
Harald Welte
0af4948211 cstartup / USBD: Use correct Makefile conditionals for DFU 2017-03-02 23:18:02 +01:00
Harald Welte
cab66419d6 flashd: Set 6 Wait states as per Errata requiremens for Revision A
It is utterly unacceptable that Atmel is shipping example code in 2011,
which doesn't support parts that are shipped still in 2016.  They would
have had five years to fix their code to implement the chip errata :(
2017-03-02 19:22:50 +01:00
Harald Welte
479e97e338 DFU: Add missing 'return' after handling generic USB control request 2017-03-02 16:53:13 +01:00
Harald Welte
203abf5f6e dfu_desc: Add some string descriptors and fix configuration desc table 2017-03-02 16:52:48 +01:00
Harald Welte
b2ad7f76a1 dfu_des.c: Cosmetic changes, use named initializers 2017-03-01 22:15:28 +01:00
Harald Welte
adba0ce80b fix g_dfu access from both DFU and runtime access
We need to refer to g_dfu as a pointer from all code.  In DFU mode, it
gets assigned to the address of _g_dfu, which is placed by the linker
script at the start of RAM.  In runtime mode, the pointer is statically
defined to point at the start of RAM.  The linker script for the runtime
(dfu environment) is adjusted to save the first 32 bytes for the _g_dfu
structure.
2017-02-28 01:10:32 +01:00
Harald Welte
65cca7cccc ensure g_dfu is linked to start of RAM when building DFU loader 2017-02-28 01:10:27 +01:00
Harald Welte
32852bc1d9 DFU: towards a more complete implementation
* we now actually route the EP0 control requests in DFU mode to the
  correct handler (weak linker symbols are tricky)
* we now actually call code to read/write data from/to RAM/FLASH
2017-02-28 01:10:23 +01:00
Harald Welte
37b6e41f84 move last few files from src_board / include_board 2017-02-27 23:20:38 +01:00
Harald Welte
964f509f59 remove pio_capture, we don't use it
As it registers a non-weak exception handler, it consumes memory in
every build
2017-02-27 23:14:16 +01:00
Harald Welte
d8a003dfd7 Structure build system to build for multiple boards/apps/environments 2017-02-27 22:18:45 +01:00
Harald Welte
3f5e3ddffc Change directory structure to align with Atmel softpack
This way we can easily check with 'diff' for differences in our code and
Atmel softpack.  Also, this layout is more suitable for building various
different firmware images (e.g. factory-test, dfu-loader, main
application) for a variety of different boards (simtrace, owhw, qmod).
2017-02-27 14:24:11 +01:00
Harald Welte
7ed6f3bc37 WIP: Introduce USB DFU code from my at91lib DFU port 2017-02-27 09:28:34 +01:00
Christina Quast
ae82155866 USBDDriver.c: swaped args to memset 2015-05-08 16:45:15 +02:00
Christina Quast
590c221893 Remove redundant ccid files in atmel lib 2015-04-09 17:06:16 +02:00
Christina Quast
86bf2c3f4d atmellib: Remove pngs in usb/ 2015-04-07 21:03:12 +02:00
Christina Quast
0cc6142506 Remove USBLib_Trace.h 2015-04-07 20:53:45 +02:00
Christina Quast
b0bbb1b52e Removed sym links, replaced them with actual folders 2015-04-07 20:04:19 +02:00
Christina Quast
d0339af87b Removed unused code and header files from atmel lib
Also, remove includes of unused header files in chip.h
2015-04-07 19:30:47 +02:00
Christina Quast
5a67c0fef3 Renamed main folder to firmware 2015-04-07 18:24:06 +02:00