AgeCommit message (Collapse)AuthorFilesLines
39 hoursremove unused make defineHEADmasterKévin Redon1-3/+1
Change-Id: Ia9ef8ce705803df06cf1e4c3ac9731ce69e5e6c5
39 hoursadd make DEFINE to remove assert ERASE codeKévin Redon3-1/+17
remove code to assert peer ERASE line by default. see README for more information. Change-Id: I5f88ecf1e2dcf00c0297597f88dd361a6e088c1e
39 hoursmake peer ERASE more robustKévin Redon1-3/+22
adds command 'a' to allow setting/asserting the peer SAM3S ERASE line on the next command. this prevents against accidental erase since only the command 'y' was required, without confirmation. this could happen not only through accidental user input, but noise on the serial line (noise would still cause other issues, but at least now it will not "brick" the device). now the sequence 'ay' is required, as any other command following 'a' would clear the permission again. note: since ERASE is only setting a GPIO within this command parsing function, not accidental function pointer problem calling 'board_exec_dbg_cmd' should cause accidental ERASE since it would need to be called two times with the exact sequence Change-Id: I06bfeaef09a397bd554bec84321e0dd64ccc3aac
2019-02-28Add freq_ctr appHarald Welte4-0/+122
The freq_ctr app is a small application that is implementing a simplistic direct-mode frequency counter using the internal 32.768kHz oscillator and two TC blocks. One of them is used to generate a 1Hz signal, which is then subsequently used by the other TC to trigger a counter read after exactly 1s. This is in itself not something useful on a simtrace2 device. However, it is a separate 'app' and I prefer to have the code here in master over some obscure branch that's easy to forget about. Change-Id: I2249bfb8dd6a88d85d406f3b33537377133d0939
2019-02-28Add minimal board-support for Olimex SAM3-P256Harald Welte3-33/+605
This is a general purpose evaluation board, and it makes sense to support it particularly for the DFU bootloader. Change-Id: I85aea8f1441158f991493c5fc767fdcad405545e
2018-10-25cardem: add more debug information for TPDU stateKévin Redon1-14/+79
this just adds the name of the TPDU state on top of the state number. the ISO state is cleaned up accordingly Change-Id: Id5104a2c3579dedb092c179748e9ed525673841c
2018-10-21remsim: fix TPDU response size transmissionKévin Redon1-1/+1
the TDPU response data size can be up to 256. this length cannot be stored in a uint8_t, which would cause the length to become 0, no data being send, and the reader reset the card because of misbehaviour of the card (i.e. no/malformed response leading to the timeout of the waiting time). Change-Id: Iae7671085aaa3115a02d82530dd7a0e7e2d4155e
2018-10-21remsim: update copyrightKévin Redon1-2/+4
Change-Id: Ibcf093877ee53f8446c97bfa50c8370ceda24c53
2018-10-21remsim: add already parsed USB path argument infoKévin Redon1-0/+1
Change-Id: I03de93ebb92b1d1b5004cbe865cdf1fa0b2b23ac
2018-10-13Fix compiler warning: no-return-in-nonvoid-function simtrace2_usb.cMartin Hauke1-0/+1
RPM post-build-checks found some issue and marks these as error: [ 61s] I: Program returns random data in a function [ 61s] E: simtrace2 no-return-in-nonvoid-function simtrace2_usb.c:88 Change-Id: Id16fb7fc4f13176b2b6443af02a5848d8fcfb069
2018-10-12libusb_util.c: Avoid gcc warning about strncpy()Harald Welte1-1/+1
What we're doing is actually legal: We copy the full size of the destination array, and then overwrite the last byte with NUL. However, gcc isn't smart enough to see that: libusb_util.c:162:5: warning: ‘strncpy’ specified bound 20 equals destination size [-Wstringop-truncation] strncpy(out[out_idx].path, path, sizeof(out[out_idx].path)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Let's copy one byte less to make it happy. Change-Id: I30ddacdc73e5245c7c38b92d1e94e39b13fae7d3
2018-09-23debian/control: Add dependency to libpcsclite-devHarald Welte1-0/+1
The host utilities use libpcsclite, and the missing build dependency causes build failures in our nightly OBS builds since commit faf1e88e48c216456bdea6060a623b7c31f07c70 was merged: [ 131s] cc -o simtrace2-remsim simtrace2-remsim.o apdu_dispatch.o simtrace2-discovery.o libusb_util.o -Wl,-z,relro `pkg-config --libs libusb-1.0 libosmocore` -pthread `pkg-config --libs libosmosim libpcsclite` [ 131s] Package libpcsclite was not found in the pkg-config search path. [ 131s] Perhaps you should add the directory containing `libpcsclite.pc' [ 131s] to the PKG_CONFIG_PATH environment variable [ 131s] No package 'libpcsclite' found Change-Id: I29adfc629e5e4ffd0bf8b9035ef9138fe7693d96
2018-09-08owhw: set the right simtrace USB ID in usb2udpKévin Redon1-2/+2
Change-Id: I0b54c2eb98b3fad1e2afaf9b81fbe4518b01fbda
2018-09-06host: clean library dependenciesKévin Redon1-2/+2
remsim also needs libpcsclite `pkg-config --libs libosmocore` and -losmocore are duplicates `pkg-config --libs libosmosim` is equivalent to -losmosim pthread it needed (by most applications) for static compilation LDFLAGS+= allows static compilation when running LDFLAGS="-static" make Change-Id: Ic7bd6f2be074d6f652d4f84f4996c8588ea5f851
2018-09-06owhw: add missing function board_main_topKévin Redon1-0/+8
the board_main_top function was not defined, causing a hard fault when initializing the board Change-Id: Ib92003416648822c4115472992850c592bc4047a
2018-09-06owhw: add missing function board_exec_dbg_cmdKévin Redon1-0/+18
the board_exec_dbg_cmd function was not defined, causing a hard fault on user input Change-Id: I3ecc1f7bdb2484f5a67c36163d33ebc065e4e709
2018-09-06minor: update copyrightKévin Redon6-0/+8
Change-Id: Iafcd029be9b3f8cf2e90f08d5e9802912d6a59b1
2018-09-06minor: fix typo in commentKévin Redon1-2/+1
Change-Id: I3edb50abe93bc8574c9c1f25b34f75dab2e8f0ce
2018-09-06minor: add checks on configurations and functionsKévin Redon1-5/+17
these checks prevent out of bounds access and running unset function pointers. Change-Id: Ida889d40b898fc1ab8b885800431833570fdaafe
2018-09-04qmod: add LED user controlKévin Redon1-0/+21
this is used during board testing Change-Id: I4ccd787f6e307f523821725de158e3c6f1508ee2
2018-09-04EEPROM: fix Wformat compile warningKévin Redon1-2/+2
Change-Id: I86434a46a75f2acc30e20c33edab6dd3f87e052b
2018-09-03qmod: output EEPROM data only on debug level, and add completion outputKévin Redon1-3/+5
the EEPROM byte output was causing data loss on the serial output, resulting is automatic tests failing. instead an end text will be output to detect the end of the procedure. Change-Id: Ib8d3cbd01d0e34432d424355f4fafb24bc5273a1
2018-09-03DFU: fix Wformat compile warningKévin Redon1-1/+1
Change-Id: I8c422d8a709f8311c40d37e1f1f01dcd3a199b6f
2018-09-03stdio: fix detection of malformated format stringsKévin Redon1-8/+18
the error code returned by vsnprintf was ignored, resulting in printing the string from a previous print. Change-Id: I8506b05d56da55d1357a1234917adf341b46e1db
2018-08-28stdio: add void 'l' format string qualifierKévin Redon1-13/+16
Wformat requires uint32_t to be used in format string with the 'l' qualifier (l = long = at least 32 bits). this qualifier was not handled before. since on ARM 32-bit int == long we can simply ignore it (stdio already does not support 64-bit data). Change-Id: Ib506a66f68712c6b3eeb5129a39abf47ec86a2a7
2018-08-28UART: switch baud rate to 921600 bpsKévin Redon2-3/+8
the higher baud rate allows for more debugging (without dropping data) and is well supported by USB for UART adapters (this standard baud rate is 8 x 115200). the closest matching integer value is calculated for UART CR. no floating point calculation can be used since this would increase the size of the resulting binary by ~ 2kB (for the softfp). this is not possible for the DFU since it already is close to the maximum size of 16 kB. Change-Id: I82b74f697342d580ccb79ada4715f35f4e8cca86
2018-08-28set main clock for using UART at 921600 bpsKévin Redon5-25/+31
UART baud rate is main clock (MCK) divided by CR*16. The MCK values are chosen >= 48 MHz and <= 64 MHz to have a near integer value CR for a baud rate of 921600 bps. The end MCK frequency between simtrace and qmod differ slightly but are close to 58 MHz. Change-Id: Iaa4a97fc68494c93b9d128503515d88049de506c
2018-08-26tag debian release Welte1-1/+7
Change-Id: Id6559b1019353815eea9f6653b6560e9a8aab23a
2018-08-26simtrace2-sniff: Fix build with released libosmocore versionsHarald Welte1-0/+13
There's still no released libosmocore defining the GSMTAP_TYPE_SIM sub-types (Change-Id: I5bd0dff5a4a90cfe96d9c4f3dec6657e1d85bf7a dated Jul 26, 2018). Let's make sure users don't need an unreleased version of the library if it's only about a few #defines that we can just copy here for backwards compatibility. Change-Id: I2fd9e14873711d60f194bb404420bbfbb0a00f48
2018-08-26Revert "debian/control: Depend on libosmocore >= 0.12.1"Harald Welte1-1/+1
This reverts commit 77ff745ccad6b0dd58e4476c1b82de70f034f7af. libosmocore 0.12.1 is not recent enough, I misread the 'gitk' output. Change-Id: I87a8e5bbb4aea0c991abe5372f840d76f17378eb
2018-08-26debian/control: Depend on libosmocore >= 0.12.1Harald Welte1-1/+1
Only this version includes the GSMTAP_SIM_ATR and GSMTAP_SIM_APDU definitions. Change-Id: I988cad56aed755af416fc7f23822dcf0229dbb7d
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