aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2018-08-26v0.5 debian package release0.5Harald Welte1-3/+3
Change-Id: Iaf56c03f966a5dfc8b750d926f0429223aeec54e
2018-08-26Add Debian packaging rulesHarald Welte6-0/+42
Change-Id: Iece115e4dde87bff5dc36286668f50de0abdcb9e
2018-08-26owhw: Fix cardem GPIO initialization pointer valueHarald Welte1-1/+1
This fixes a bug, identified by the below compiler warning: libboard/owhw/source/owhw.c: In function 'cardsim_gpio_init': libboard/owhw/source/owhw.c:39:16: warning: passing argument 1 of 'PIO_Configure' from incompatible pointer type [-Wincompatible-pointer-types] PIO_Configure(&pins_cardsim, ARRAY_SIZE(pins_cardsim)); ^ In file included from ./atmel_softpack_libraries/libchip_sam3s/chip.h:45:0, from libboard/owhw/source/owhw.c:20: ./atmel_softpack_libraries/libchip_sam3s/include/pio.h:189:16: note: expected 'const Pin * {aka const struct _Pin *}' but argument is of type 'const Pin (*)[2] {aka const struct _Pin (*)[2]}' extern uint8_t PIO_Configure( const Pin *list, uint32_t size ) ; ^~~~~~~~~~~~~ Change-Id: I4c1de66c0b8475bb355b1d128f6ec88b2f2a7fcf
2018-08-26firmware: Enable -Wformat and resolve all related compiler warningsHarald Welte13-23/+24
There have been tons of format-string related bugs in our code which we never discovered due to disabling -Wformat. Let's fix that. Change-Id: I5ec466361bcc526fac1f4897673264ee5af3458b
2018-08-26add master Makefile to build firmware and host toolsHarald Welte1-0/+27
Change-Id: I715d3fdaff9d80673bb2208ea9d56637f4e459af
2018-08-26Makefiles: Add "make install" targetHarald Welte2-2/+12
Change-Id: Ic6835ce55930c60f909e140878c4abab8628e077
2018-08-26host: Fix "make clean": remove simtrace2-sniffHarald Welte1-1/+1
Change-Id: Ib233b6a4b3976286196da95036cadcf2d3382f77
2018-08-07jenkins: add simtrace/trace to the buildsKévin Redon1-1/+1
trace is now stable enough on simtrace to be built and uploaded. Change-Id: I157fff9930d03a7ec52ecac4a1be0511ea66c010
2018-08-07jenkins: clean after uploadKévin Redon1-9/+14
the upload failed because after the firmware were built (make), they where removed (make clean). now they are removed only after the upload. Change-Id: Ie4421a6fa9207eb541107de9c14f265626f6be96
2018-08-07qmod: error on EEPROM erase failKévin Redon1-3/+5
repeating the EEPROM erase (byte write) in case of byte write failure could lead in an infinite loop. log the error an return error code instead. Change-Id: Id6f3654d877ca772ba04237da91a6e86e3f441ec
2018-08-07jenkins: fix publishKévin Redon1-0/+1
the script argument was not saved in the publish variable used later to decide if publishing/uploading is needed. Change-Id: Ic768a8e96e5e4d72acf3979da1412d683f79ec55
2018-08-07USB: increase USB reset timeKévin Redon4-9/+23
USB reset can be signaled by pulling low USB D+ for at least 10 ms, according to the USB specification. This force a re-enumeration. This time is increased to 20 ms to work with more USB HUBs. Some SAM3S based board have external D+ pull-up mechanism (such as SIMtrace) which needs to be used to pull D+ low. This is a legacy mechanism from SAM7S history. This mechanism is not required anymore on the SAM3S, and the qmod does not use it. When the USB HAL is suspended, the transceiver is disabled, causing D+ and D- to be pulled low. Then the HAL is activated again. This is particularly required when DFU is started (and enumerated), and after flashing the SAM3S switched to the main application (without reset), so it can properly re-enumerate. This board difference is now defined on the board header. Change-Id: I9b58d8101c2fcf5595026b675728826af26127a3
2018-08-07qmod: Add 'e' command for erasing the EEPROMHarald Welte1-0/+24
Change-Id: Id7cb0db568dd3e9d796829bf0019d63048612998
2018-08-06gcc: fix warningKévin Redon1-1/+1
moving the define after the header fixes the following warning: from ./atmel_softpack_libraries/libchip_sam3s/source/exceptions.c:46: libcommon/include/stdio.h:63:12: warning: redundant redeclaration of 'printf_sync' [-Wredundant-decls] signed int printf_sync(const char *pFormat, ...); ^~~~~~~~~~~ ./atmel_softpack_libraries/libchip_sam3s/source/exceptions.c:45:16: note: previous declaration of 'printf_sync' was here #define printf printf_sync ^~~~~~~~~~~ libcommon/include/stdio.h:51:12: note: in expansion of macro 'printf' signed int printf(const char *pFormat, ...); Change-Id: I21a8de325e8f8b91297dd157f2d6a0f64434bb28
2018-08-06jenkins: add build uploadsKévin Redon1-0/+16
firmware binaries should be uploaded to https://ftp.osmocom.org/binaries/simtrace2/firmware/ this directory wiki be documented in the SIMtrace 2 wiki for users to get the latest firmware images without having to cross-compile themselves. Change-Id: I589531f59e54a0997b012bdd91e3bef9f847f517
2018-08-04remsim: fix USB hanging USB transferKévin Redon1-2/+2
After a couple of seconds of USB data exchange between remsim and cardem, the USB transfer hangs. On host side (remsim) I can see the USB BULK IN request. On device side (cardem) I see that data has been submitted and "sent" over USB, but on wireshark with USBmon I don't see the corresponding USB BULK IN response. When exiting remsim or just after powering of qmod (causing an error in remsim) the USB BULK IN is show in wireshark. Thus it must have been in a buffer, but not read by libusb_bulk_transfer. By shortening the timeout a new libusb_bulk_transfer is made more frequently, and the data gets read successfully. T;his change also fixes the URB data display. Change-Id: I1d124a41cc90893506933f6d76dc7331e52a74f9
2018-08-04cardem (minor): trace tx data send over USBKévin Redon1-0/+3
Change-Id: I69cef43dd5a78e9f82cc045cdb90c326b03d1f68
2018-08-04add libosmcore utilitiesKévin Redon1-0/+632
osmo_hexdump is particularly useful. previously it was only defined, but not implemented. this cause random behaviour upon call, often resulting in memory corruption. Change-Id: Ifd9120fa951f41693903fb657d10826959f1599f
2018-08-04cardem: add state name in traceKévin Redon1-2/+19
this helps reading the output while debugging quite a lot Change-Id: Idf301e09cf14e2412e29dcb252563bc6e4e5c630
2018-08-04cardem (minor): remove to verbose log traceKévin Redon1-1/+0
Change-Id: Ie43a33af3728c0700f71527ca75d909a9ebd2529
2018-08-04cardem: minor typo fix in commentKévin Redon1-2/+2
Change-Id: Ib1dee95e15db1c6bb3b45920d7c1a567e2ba474b
2018-08-04add synchronous UART transmission and use it in exceptionsKévin Redon6-9/+108
The default ISR (particularly the HardFault handler) print information, but this information was not displayed on the console because the UART IRQ is lower than some default blocking IRQ. Allowing to set synchronous transfer corrects this. The underlying Atmel exception library had to be modified to use the synchronous output. Making UART_PutChar always synchronous when called from an ISR is not desired because we use TRACE_ macros is some ISR. The synchronous output must be set explicitly. Change-Id: I1b4ace5185cf2dc32684934ed12bf6a8682e9bad
2018-08-01sniff: send incomplete TPDU when reset is assertedKévin Redon1-0/+17
Change-Id: I8d7e4d604cded535e40d27c2be872268e0f24c20
2018-07-30cardem: use TC2 as WI and update WT after ATRKévin Redon1-5/+33
Change-Id: I3e51b16d557bc664f87563e1a3dce6642de474d2
2018-07-30remsim: fix payload overwritingKévin Redon1-5/+0
The slot number is in the header, and correctly set in st_push_hdr. Setting the slot in st_slot_tx_msg will overwrite the payload data. This caused bytes three of the ATR to be changed from 0x96 to 0x00, corrupting the ATR. This corruption is caught by the ATR checksum, and the modem would reset the card (2 additional times) to try to get correct ATR. Change-Id: If971699993617fc50557d20582c344ea06645a3f
2018-07-30cardem: use TC_ETU to trigger ATR sendingKévin Redon4-30/+104
this changes how ATR is handled. the ATR is also printed when set (as important debug information). the test is also updated to correspond to the new mechanism ( simulating the timeout before sending the ATR) Change-Id: I69df797e2feadffa9f5f977cb71b69386cee7cd0
2018-07-29cardem: increase watchdog to 2 secondsKévin Redon1-2/+2
a lot of the procedures are done in ISRs, but the watchdog is only reset in the main loop. this causes frequent reset, particularly at the beginning were states have to the initialized. Change-Id: Iad364444fca9d18f9a8cf47d5e0840ccd7bac2ef
2018-07-29cardem: show detailed reset causeKévin Redon1-1/+15
this helps detecting when a reset was due to the watchdog Change-Id: I2d59c2f2c8fe9e559eddfafacf25879263ef81ff
2018-07-29sniff: increase debug outputKévin Redon1-1/+3
Change-Id: Ife0bbcf4a25aaa445a36768c00004e6e0d9a4947
2018-07-28sniff: fix ATR checksum calculationKévin Redon1-1/+1
this issue also cause the sent ATR to be empty Change-Id: I6edff7aeb3185c835656acde75886fb6c90c0582
2018-07-28sniff: ensure the checksum error flag is also printedKévin Redon2-18/+37
the firmware now also use a generic value_string array (as does the host application) Change-Id: I861bd8b52e8f2f2a4786bbe1cc834917119dc394
2018-07-26sniff: rename reset hold/release to assert/deassertKévin Redon3-10/+10
this change is to match the nomenclature used in cardem Change-Id: Ide99e731cad26aec949ad14d54f46fa611a0b7f8
2018-07-26sniff: send ATR over GSMTAPKévin Redon1-5/+14
Change-Id: Id35129883f08002a4a796b56954a128e2b533245
2018-07-24USB: print decoded USB errorKévin Redon1-5/+10
In case of error it also ensures the returned value is NULL. Else a segfault would occur because the caller (e.g. remsim) continued on with a free handler. Change-Id: Ie7f20e3eff03acf77eb08283747ca8e032b9b4c8
2018-07-24I2C: return error after failed writeKévin Redon1-7/+7
The previous mechanism of retrying a failed write could become a infinite blocking loop (until watchdog tiemout). Also the array size is used to know how much data to write and verify instead of a constant. Change-Id: I8d2d090c5f4d1195f4c7eb29b3958a7bb05f56ec
2018-07-24I2C: add wait time after write to let EEPROM writeKévin Redon1-0/+2
The Atmel AT24C02 defines a maximum tWR waiting time after a byte write of 5 ms before a next write. Enforcing this wait time also fixed the failed verification in qmod, where it was reading 0xffff instead of the written value. Change-Id: I42c90b8d0329e425f275067e87d584212a43a90b
2018-07-18cardem: fix USB message parsingKévin Redon1-1/+1
the msg->l2h pointer was not set but used later on, e.g. in dispatch_usb_command_cardem, case SIMTRACE_MSGT_DT_CEMU_SET_ATR): > case SIMTRACE_MSGT_DT_CEMU_SET_ATR: > > atr = (struct cardemu_usb_msg_set_atr *) msg->l2h; > > card_emu_set_atr(ci->ch, atr->atr, atr->atr_len); l2h is by default 0, thus not pointing to the actual message l2h. I wonder how cardem worked worked before with this issue though. Change-Id: Ifbb53dbf478d8dade82251f769e78e1306e77434
2018-07-18cardem: fix typoKévin Redon2-8/+8
Change-Id: Ibeeb01b21a3ccfa74642f13694a20054e920837e
2018-07-11sniff: add checksum verification for ATR and PPSKévin Redon3-3/+28
a checksum error is only signaled in the USB message with the corresponding flag. Change-Id: I277868267c3199eea216ab47bdd09fb2fb944b06
2018-07-11fix 'ISO_S_IN_ATR not handled' gcc warningKévin Redon1-8/+4
when building the cardem application GCC would output the following warning: libcommon/source/card_emu.c: In function 'card_emu_process_rx_byte': libcommon/source/card_emu.c:764:2: warning: enumeration value 'ISO_S_IN_ATR' not handled in switch [-Wswitch] switch (ch->state) { ^~~~~~ in card emulation the reader should not send data while the card is sending its ATR. this is true for other states already handled (RESET, ...). in these cases an error message is output. this behaviour is now the default case as data from the reader is only expected in 3 cases: ISO_S_WAIT_TPDU, ISO_S_IN_TPDU, and ISO_S_IN_PTS. Change-Id: Ifbc8dbe1c9f176343304f211c7e6068fb977961e
2018-07-11make adc2uv commonKévin Redon3-9/+3
when building the trace app for the simtrace board gcc was outputing the following error: libboard/common/source/boardver_adc.c:20:17: warning: 'adc2uv' defined but not used [-Wunused-function] static uint32_t adc2uv(uint16_t adc) adc2uv is used by qmod, and defined in two places: in boardver_adc.c and mode_cardemu.c. this change will have adc2uv only defined in boardver_adc.c and make available in the header to be used by mode_cardemu.c. Change-Id: I8a772638fa8dd02d8bc8b7631de5af5a22647c55
2018-07-11host sniff: add functions to print flagsKévin Redon1-29/+61
Change-Id: If3c0a4790662bcc64db5ff03adcc033836e16ad0
2018-07-11host sniff: process remaining usb messages in bufferKévin Redon1-3/+6
Change-Id: I1746c0187b2e5dbef44b4b336fee3bd9ded15079
2018-07-11sniffer: fix inverted reset meaningKévin Redon1-7/+7
Change-Id: I860e2e29c059e1e0ec126695bb68d489891a17da
2018-07-11sniffer: only allocate USB message if queue is not too longKévin Redon1-0/+8
When the host does not retrieved the USB messages, they keep getting queue in the firmware, filling the RAM, and preventing further memory to be allocated. Change-Id: I0e447acdf757dcb5dc5c4d8b84a4235866914cad
2018-07-11sniffer: also send malformed message over USBKévin Redon1-1/+15
Change-Id: I124c8db1d2f836e185630bbe8b5e52eb085d702a
2018-07-11minor: fix linker warningKévin Redon1-1/+1
linker warning: obj/simtrace/dfu_sniffer.o: In function `usb_send_data': /media/data/work/simtrace2/simtrace2/firmware/libcommon/source/sniffer.c:338: warning: undefined reference to `putchar' Change-Id: I934f3fcb474d4046e921511a024c3a0b8533c782
2018-07-11sniffer: set LED patternKévin Redon2-3/+8
The red and green LEDs are now used as follows: - red on = power (firmware is running) - red blink = error detected (e.g. during ISO-7816 parsing) - green on = running (sniffer mode is running) - green blink = activity (e.g. USB message sent) Change-Id: Ib1b6ff87fb92d6ed3ecae4bc89386206aaab508e
2018-07-11LED: add need patternKévin Redon2-0/+13
new LED pattern: off for 200 ms and then on Change-Id: Id2c40dc20d75ed6f38b735164ad1eb2860dc480c
2018-07-11sniffer: move reset handling from ISR to main loopKévin Redon1-8/+16
Change-Id: Ia88fb4baf49017524bb201123da3511e5342ba48