Commit Graph

728 Commits

Author SHA1 Message Date
Kevin Redon 869dbfafe4 DFU: incread watchdog timeout and restart watchdog before writing in flash to prevent the watchdog to trigger while flashing 2018-06-29 20:07:31 +02:00
Kevin Redon 80303c135b DFU: only boot the application if it has a valid start 2018-06-29 20:07:31 +02:00
Kevin Redon d86cab0080 DFU: uncomment print message when DFU is forced using the button 2018-06-29 20:07:31 +02:00
Kevin Redon b73f0a00bc DFU: unlock the flash before writing, verify written data, and relock it 2018-06-29 20:07:31 +02:00
Kevin Redon f5869d4a59 USB: implement USB reset by setting the on-board pull-up on D+ low 2018-06-29 20:07:31 +02:00
Kevin 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
Kevin Redon 318309f30f dfu: fix address destination check and add stack overwrite check in USBDFU_handle_dnload
During DFU download the destination start address is checked to not exceed the
RAM or flash end address, but it is also necessary to check if the end of the
data to be downloaded is also within the allowed range.
When downloading to RAM it is also necessary to check if the data to be
downloaded does not overwrite (i.e. corrupt) the stack.
2018-06-29 20:07:31 +02:00
Kevin Redon 0828b914e7 README: rewrite to better explain environment variables and point to the wiki for flashing 2018-06-29 20:07:31 +02:00
Kevin Redon 76be7c806e fix pointer casting warning
fixes following warning:
libboard/common/source/board_cstartup_gnu.c:137:11: warning: assignment to 'void (*)(void)' from 'unsigned int' makes pointer from integer without a cast [-Wint-conversion]
  appReset = pSrc[1];
2018-06-29 20:07:31 +02:00
Kevin Redon a38a126361 fix: initialize uninitialized variable in USBDFU_DFU_RequestHandler 2018-06-29 20:07:31 +02:00
Kevin Redon a484b02271 sniffer: use ISR to store sniffed data in buffer, add ATR and PPS parsing, and PPS related FiDi update 2018-06-25 16:00:33 +02:00
Kevin Redon 8643420daa trace: increase watchdog for 500 to 2000 ms to provide more time handling buffered data 2018-06-25 15:57:44 +02:00
Kevin Redon 0aafbac7eb ring buffer: increase buffer size from 128 to 256 to cope with large debug output 2018-06-25 15:56:33 +02:00
Kevin Redon 67e181fb15 console: use buffer and interrupts instead of busy loops for UART debug output 2018-06-25 15:55:33 +02:00
Kevin Redon 2bac56494f ISO7816: change update_fidi to use provided USART, and disable write protection for USART register if required 2018-06-25 15:53:19 +02:00
Kevin Redon f908f659fc SIMtrace: enable interrupt on edge dection for SIM_RST pin to reset the sniffer ISO state 2018-06-25 15:49:28 +02:00
Kevin Redon 42af4949a7 SIMtrace: fix default SIM_RST pin state to allow phone controlled reset 2018-06-24 11:31:36 +02:00
Kevin Redon 4814b15bbf SIMtrace: only enable main sniffing mode on SIMtrace board 2018-06-24 11:30:31 +02:00
Kevin Redon 78a8ab71e1 DFU: fix typo in USB strings 2018-06-24 11:27:09 +02:00
Kevin Redon 6b38297e20 DFU: incread watchdog timeout and restart watchdog before writing in flash to prevent the watchdog to trigger while flashing 2018-06-17 22:36:44 +02:00
Kevin Redon 3f8a4c28e8 DFU: only boot the application if it has a valid start 2018-06-17 22:35:17 +02:00
Kevin Redon 41d01b9d54 DFU: uncomment print message when DFU is forced using the button 2018-06-17 22:34:47 +02:00
Kevin Redon 88b2b077ef DFU: unlock the flash before writing, verify written data, and relock it 2018-06-17 22:33:29 +02:00
Kevin Redon 9a921ac630 USB: implement USB reset by setting the on-board pull-up on D+ low 2018-06-17 22:31:21 +02:00
Kevin Redon 2ab8f8e3fd sniffer: add state definitions, improve IRQ handling, update pins configuration 2018-06-11 13:46:35 +02:00
Kevin Redon a34471d923 simtrace: add support for sniffing on both USART 2018-06-11 13:45:16 +02:00
Kevin Redon 762276e271 board: comment USART definitions and add corresponding IRQ numbers 2018-06-11 13:43:27 +02:00
Kevin Redon 2d972f5910 simtrace: add dedicated power pins configuration for sniffing 2018-06-11 13:42:23 +02:00
Kevin Redon d0b4a9da81 sniff: use USART 0 instead of USART 1
Use USART 0 connected to the SIM card side to sniff the communication.
The card side can also measure ETU times.
Do proper pin initialization.
This code can already capture the ATR communication between phone and card.
2018-06-07 18:56:47 +02:00
Kevin Redon 7f4f8983dd 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-06 17:03:24 +02:00
Kevin Redon 86ea4faef6 SIMtrace board: comment and fix pin definition 2018-06-06 17:02:33 +02:00
Kevin Redon a1f198276d sniff mode: handle USART 1 RX interrupt to show sniffer data 2018-06-06 16:13:48 +02:00
Kevin Redon b53ab5b4ef add more USB configuration checks and error messages 2018-06-04 16:30:48 +02:00
Kevin Redon 38a467e630 enable (empty) sniffer support for SIMtrace board 2018-06-04 16:30:01 +02:00
Kevin Redon 7b51f72e83 copy working cardem app to trace
because the applications share the board capabilities defined in
libboard/*/include/board.h and USB configurations are enabled according
to the previously defined capabilities in libcommon/source.usb.c, all
applications actually offer the same functions.
thus creating the trace application is only mainly a cosmetic change, as the
sniffer function will also be present and enabled in the cardem application.
2018-06-04 16:21:34 +02:00
Kevin Redon f79ae1c54a dfu: fix address destination check and add stack overwrite check in USBDFU_handle_dnload
During DFU download the destination start address is checked to not exceed the
RAM or flash end address, but it is also necessary to check if the end of the
data to be downloaded is also within the allowed range.
When downloading to RAM it is also necessary to check if the data to be
downloaded does not overwrite (i.e. corrupt) the stack.
2018-06-01 11:02:56 +02:00
Kevin Redon de2d03ca22 README: rewrite to better explain environment variables and point to the wiki for flashing 2018-05-21 19:35:56 +02:00
Kevin Redon fe72bf11fd fix pointer casting warning
fixes following warning:
libboard/common/source/board_cstartup_gnu.c:137:11: warning: assignment to 'void (*)(void)' from 'unsigned int' makes pointer from integer without a cast [-Wint-conversion]
  appReset = pSrc[1];
2018-05-21 19:34:01 +02:00
Kevin Redon 0471d2a390 fix: initialize uninitialized variable in USBDFU_DFU_RequestHandler 2018-05-21 18:52:06 +02:00
Kevin Redon 5be1b612f7 fix: remove unused code
adc2uv is not used in boardver_adc.c.
a FIXME comment says it should be shared with mode_cardemu.c.
the exact same code is already available in mode_cardemu.c
2018-05-21 17:51:34 +02:00
Kevin Redon 6822716428 add printf attribute declaration to remove warning
the __attribute__ ((format (printf, 1, 0))) declaration remove the following
compilation warning:
warning: function 'osmo_panic' might be a candidate for 'gnu_printf' format
 attribute [-Wsuggest-attribute=format]
   osmo_panic_default(fmt, args);
2018-05-21 17:18:58 +02:00
Kevin Redon a93f7273b3 fix: remove duplicate volatile declaration 2018-05-21 17:17:20 +02:00
Kevin Redon 432ba5140e add copyright notice
The original board startup script is provided by Atmel.
It has been modified to handle application or DFU booting.
The copyright notice has been updated to reflect this change.
2018-05-21 17:13:50 +02:00
Harald Welte 849d20e29e Add firmware/TODO.txt that was not committed so far 2018-05-11 15:49:31 +02:00
Harald Welte e48d6f2321 Add README.md 2018-05-11 15:48:54 +02:00
Harald Welte af616ec4e2 CCID driver: Use USBD_GetDriver() instead of non-initialized state variable 2017-11-29 00:45:23 +01:00
Harald Welte 6051e126da CCID: re-enable control request handler for CCID class requests 2017-11-29 00:26:34 +01: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 75cf93e04d rename ccid.c to mode_ccid.c to align with mode_cardemu.c 2017-11-28 23:00:40 +01:00
Harald Welte 2afd57f00a cardem: Don't dispatch UART IRQs to possible NULL pointers
A given configuration might not expose callback functions for
the UART interrupts.
2017-11-28 22:52:56 +01:00