Kevin Redon
fe763b7698
sniffing: decrease USB IRQ prioprity to prevent USART overrun
...
Handling the USB message queue is done in an ISR and take quite some time.
This can cause a USART/SIM sniffing buffer overrun, resulting in data loss.
By setting the USB IRQ lower than the USART IRQ, the USB ISR can be
interrupted (for short) and no data gets lost.
Change-Id: I870a0aa8e251bbb53249c54bfcaa45de5b5a9486
2018-07-04 17:55:20 +02:00
Kevin Redon
c9bd715289
sniffing: fix procedure byte handling and make TPDU parsing more strict
...
Change-Id: If991152f11c4b864ab1386f21dc13c335e6b281f
2018-07-04 17:55:20 +02:00
Kevin Redon
35e8bdf879
sniffer: also send incomplete (e.g. timeout) data (PPS/ATR/TPDU)
...
Change-Id: Ib070aca181042b477f1ffec48d63dc56c1e4609a
2018-07-04 17:55:20 +02:00
Kevin Redon
709a431ab9
sniffing: move conversion convertion and flag processing from ISR to main loop to keep ISR fast and focus on data capture
...
Change-Id: Ieefa8a5f81dbcc12c1ad3059660dbffa0c1a4961
2018-07-04 17:55:20 +02:00
Kevin Redon
30f90a78fc
console: drop data to be send when buffer is already full
...
don't wait for space to be available in the buffer since since would
prevent from processing non-console (e.g. debug) more important data
Change-Id: Ia625b09eb30bb7b43edd3989f697d8ef33200f28
2018-07-04 17:10:08 +02:00
Kevin Redon
7406337a7f
sniffer: display F and D values frim PPS
...
Change-Id: I3641dcb6c24695a6d3dd3a1ee4333f56a07c99f0
2018-07-04 17:10:08 +02:00
Kevin Redon
6e3f1121e6
host USB: add host application to receive and display USB sniffing messages sent by firmware
...
Change-Id: Idefbf21e0bbd2a1e3647fe9aebaf88d1b62dae2d
2018-07-04 17:10:08 +02:00
Kevin Redon
de97fd25bd
sniffer USB: implement USB communication and send parsed messages
...
Change-Id: Ice7817480705f2124b08c1ff9a8826558b6d8b2b
2018-07-04 17:10:08 +02:00
Kevin Redon
012940f48e
USB device: add USB message structure for sniffer communication
...
Change-Id: Id2c6f32ade2fec9b9ef91bd8c5e1fd195f2d7351
2018-07-04 17:10:08 +02:00
Kevin Redon
e2f84f6a8b
host USB: use central SIMtrace USB ID definition header
...
Change-Id: Id18e64fba0a2c308a8aef7d3865200bf0237cae9
2018-07-04 17:10:08 +02:00
Kevin Redon
4d6a4b949c
host usb_util fix: used provided class, sub-class, and interfave when finding matching interfaces
...
Change-Id: Ibc06e751e6ca0f9e9a40d82c4eeddfb975240f91
2018-07-04 17:10:08 +02:00
Kevin Redon
a1012b170a
USB: add central file to define USB IDs, classes, and endpoints
...
Change-Id: Iba81f32a92c68a973e8e7adbc4c2a1064ba5290f
2018-07-04 17:10:06 +02:00
Kevin Redon
42bd026416
minor: fix typos in comment
...
Change-Id: I01b49e047a586dff449d4e134751108e391a8822
2018-07-04 16:33:00 +02:00
Kevin Redon
638cec820f
sniff: add WT timeout detection using USART timeout (TC is not required)
...
Change-Id: I4ec6e812e7e1eb91005027d2e864fc315550d79c
2018-07-04 16:33:00 +02:00
Kevin Redon
00ec89d73f
sniff: add TPDU parsing (TPDUs become APDUs on the upper layer)
...
Change-Id: I09d050d95bd2ab140fe6b4926a37278eb08cc347
2018-07-04 16:33:00 +02:00
Kevin Redon
cf59919494
sniff: print parsed ATR and PPS; use red LED to show main application is running; use green LED to indicate activity (message parsed)
...
Change-Id: I8e906bdbf2c91e608757ae442dfb241f981b8f1e
2018-07-04 16:33:00 +02:00
Kevin Redon
11914d9658
LED: add short LED pulse blinking pattern
...
Change-Id: I0fdc2f902a3b92da6aa9b9c8500abae8a2f79447
2018-07-04 16:32:54 +02:00
Kevin Redon
3113e3d2e5
update_fidi: remove debug output since this function is called in time critical ISR
...
Change-Id: I08f407d407a18dae3f360ddc64769ddfaeb5b559
2018-07-04 14:29:28 +02:00
Kevin Redon
9def7631ba
DFU: switch green LED on to indicate DFU mode, and red LED to indicate flashing activity
...
Change-Id: I8e34fd869ed94ad122d6a17f5a432f5a09b820bb
2018-07-04 14:29:28 +02:00
Kevin Redon
ca9e4bf4ba
board: fix LED pin definition
...
Change-Id: Ia6c80c0268dec708845e1dad281caaa42027f9db
2018-07-04 14:29:28 +02:00
Kevin Redon
8210ec3f62
DFU: remove force bootloader button debug message since the console is output message is not initialized yet
...
Change-Id: Ibea0105929a8dc38b43dacd9d1e576d7b51d0c6a
2018-07-04 14:29:28 +02:00
Kevin Redon
8fa6ff5979
sniffer: use ISR to store sniffed data in buffer, add ATR and PPS parsing, and PPS related FiDi update
...
Change-Id: I4b38ce1d80e370fda6aa181e959ba3f1286bb922
2018-07-04 14:29:28 +02:00
Kevin Redon
866d20b10e
trace: increase watchdog for 500 to 2000 ms to provide more time handling buffered data
...
Change-Id: Iacd85525f05e692b44183bd4c4585b9e70865cfe
2018-07-04 14:29:28 +02:00
Kevin Redon
4fe99fad59
ISO7816: change update_fidi to use provided USART
...
Also disables write protection for USART register if required
Change-Id: I716f4bc3a22800cbce402b146f14ef8b2aab2a98
2018-07-04 14:29:28 +02:00
Kevin Redon
7be52ec1ce
SIMtrace: enable interrupt on edge dection for SIM_RST pin to reset the sniffer ISO state
...
Change-Id: I92ff29abd6a8690dd033d8cf13ad0d1ff9740fe5
2018-07-04 14:29:28 +02:00
Kevin Redon
a2b367633c
SIMtrace: fix default SIM_RST pin state to allow phone controlled reset
...
Change-Id: I1942ec6bd499cb2e14f6d7699a2b2d9b4197e654
2018-07-04 14:29:28 +02:00
Kevin Redon
927ffb46eb
SIMtrace: only enable main sniffing mode on SIMtrace board
...
Change-Id: Iff6ebb1d98aa0c31f6d78508afde8f1b05f0f85b
2018-07-04 14:29:28 +02:00
Kevin Redon
d7a6de57d2
sniffer: add state definitions, improve IRQ handling, update pins configuration
...
Change-Id: I6b5dfd6d573ac122a60585a24c8a620642805ad5
2018-07-04 14:29:27 +02:00
Kevin Redon
353351ddf4
simtrace: add support for sniffing on both USART
...
Change-Id: I69eb458e7cb186c990e5d6fbc780f37fdd0cd884
2018-07-04 14:28:19 +02:00
Kevin Redon
4091d78c4b
board: comment USART definitions and add corresponding IRQ numbers
...
Change-Id: I3c38e7d75bc7b511827c33af69e335e50d0b35d2
2018-07-04 14:28:19 +02:00
Kevin Redon
ee62a9da56
simtrace: add dedicated power pins configuration for sniffing
...
Change-Id: Ie37edbae6ea42d2b0c2a30eb5590afd0be797d39
2018-07-04 14:28:17 +02:00
Kevin Redon
45ad62d8d4
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.
Change-Id: I0597ec723cb2225540c89c3821b91d8a45adfcd6
2018-07-04 11:24:13 +00:00
Kevin Redon
2c4e2af21f
SIMtrace board: comment and fix pin definition
...
Change-Id: Ic77ad5bf6c00c9122c6bb0e12b90e6c5406855fd
2018-07-04 11:24:13 +00:00
Kevin Redon
7b73462442
sniff mode: handle USART 1 RX interrupt to show sniffer data
...
Change-Id: I5504369aed39844b7cf21e5b3ccb542daa6b946e
2018-07-04 11:24:13 +00:00
Kevin Redon
36abece0b1
enable (empty) sniffer support for SIMtrace board
...
Change-Id: I51619135fd6f5423542f261e7d76bab1a5713e2b
2018-07-04 11:24:13 +00:00
Kevin Redon
f9997e9d26
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.
Change-Id: I24b3500a0905cbd622507722280b3c7e7f188bde
2018-07-04 11:24:13 +00:00
Harald Welte
05cc7f6531
ringbuffer: Don't print/TRAC from ringbuffer
...
In commit eac1bec428
we start to use the
ringbuffer inside the console printing code. As a result, we must not
use TRACE_*() or printf() from within ringbuffer.c code to avoid
infinite recursion.
Instead, let rbuf_write() return a negative return value in case the
ring buffer overflows. This way, the callers (outside the
console/stdout code) can print an error message themselves.
Change-Id: Ib009f013be119dbad22fa2b7d60ec8dee59baee5
2018-07-04 04:42:22 +02:00
Harald Welte
46893451de
echo all command characters entered on serial console
...
This is required to make python pexpect.fdexpect happy, as it
requires that all characters are echo-ed back in order to detect
when the output of a given command starts.
Change-Id: I73b24e43f6c8b86a2766aba67d8307c184448aa0
2018-07-03 22:30:30 +02:00
Harald Welte
cb6e20596e
contrib/jenkins.sh: Also run firmware tests + build-test host software
...
Change-Id: Ie53857164d0a21daac334057c5bafbfd9912bf4b
2018-07-01 16:33:25 +02:00
Harald Welte
bb2eb19fb1
firmware/test: Add more include paths
...
Change-Id: I4287fbae6921ed0605265812df5d7243e8857864
2018-07-01 08:47:39 +02:00
Harald Welte
9d90d284ed
Use system include <foo.h> notation for libosmocore headers
...
the curent local copies of libosmocore headers + source is a temporary
hack anyway. We should instead rely on a system-wide install of
libosmocore cross-compiled for arm-none-eabi. But leave that as a
second (later) step beyond this patch.
Change-Id: Ia63fd842d45a2b404233b4326050e7eda0604cf0
2018-06-29 22:26:57 +02:00
Harald Welte
ebe8b2069c
Makefile: fix automatic creation of obj directory
...
since we're using obj/$BOARD, we must use "-p" to create the directory
recursively
2018-06-29 21:44:12 +02:00
Harald Welte
105c1dce4f
add contrib/jenkins.sh for build verification
...
The contrib/jenkins.sh script will build all supported apps for all
supported builds. It will be used by jenkins/gerrit build testing.
2018-06-29 21:39:42 +02:00
Harald Welte
1cfc2614dd
apps/dfu/main.c: Avoid variable declaration in for loop initial
...
This fixes the following compile error:
apps/dfu/main.c:73:3: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
for (unsigned int i=0; i<len; i++) {
^
apps/dfu/main.c:73:3: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code
which was recently introduced in b73f0a00bc
2018-06-29 21:07:41 +02:00
Kevin Redon
a9bca48914
ring buffer: increase buffer size from 128 to 256 to cope with large debug output
2018-06-29 20:07:31 +02:00
Kevin Redon
eac1bec428
console: use buffer and interrupts instead of busy loops for UART debug output
2018-06-29 20:07:31 +02:00
Kevin Redon
51c128bc35
DFU: fix typo in USB strings
2018-06-29 20:07:31 +02:00
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