Bug #6026
closedsimtrace2 cardem firmware stops card communication early
100%
Description
The latest (08052023) version of the simtrace cardem firmware seems to be broken. The card communication seems normal at first but then suddenly stops early.
Attached one finds two firmware images:
Latest firmware from 08.05.2023: simtrace-cardem-dfu-latest.bin (does not work)
Firmware image from last year: simtrace-cardem-dfu-0.8.1.33-9088.bin (works, even with current master host utils)
$ simtrace2-cardem-pcsc -V 1d50 -P 60e3 -C 1 -I 0 -H "2-1" -n 2 simtrace2-cardem-pcsc - Using PC/SC reader as SIM (C) 2010-2022, Harald Welte <laforge@gnumonks.org> (C) 2018, sysmocom -s.f.m.c. GmbH, Author: Kevin Redon <kredon@sysmocom.de> DLINP NOTICE [0] <= osmo_st2_cardem_request_config(features=00000001) DLINP NOTICE [0] <= osmo_st2_cardem_request_card_insert(inserted=1) DLINP NOTICE [0] <= _modem_sim_select(remote_sim=1) DLINP NOTICE [0] <= osmo_st2_cardem_request_set_atr(3b 9f 96 80 1f c7 80 31 a0 73 be 21 13 67 43 20 07 18 00 00 01 a5 ) DLINP NOTICE [0] <= _modem_reset(asserted=2, pulse_ms=300) Entering main loop DLGLOBAL NOTICE => IRQ STATUS: flags=0x13, fi=1, di=1, wi=10 wtime=9600 (RESET VCC CLK ) DLGLOBAL NOTICE => IRQ STATUS: flags=0x3, fi=1, di=1, wi=10 wtime=9600 (VCC CLK ) DLGLOBAL NOTICE Warm Resetting card in reader... DLGLOBAL NOTICE => PTS req: ff 10 96 79 DLGLOBAL INFO => DATA: flags=0x01 (HDR ), 00 a4 00 04 02 DLINP DEBUG [0] <= osmo_st2_cardem_request_pb_and_rx(pb=a4, le=2) DLGLOBAL INFO => DATA: flags=0x02 (FINAL ), 3f 00 DLINP DEBUG [0] <= osmo_st2_cardem_request_sw_tx(sw=6156) DLGLOBAL INFO => DATA: flags=0x01 (HDR ), 00 c0 00 00 56 DLINP DEBUG [0] <= osmo_st2_cardem_request_pb_and_tx(pb=c0, tx=62 54 82 02 78 21 83 02 3f 00 a5 19 80 01 71 83 02 7f ff cb 0d 00 00 00 00 00 00 00 00 00 00 00 00 00 ca 01 82 8a 01 05 ab 1b 84 01 2e 90 00 84 01 88 a4 06 83 01 01 95 01 08 84 01 fc a4 06 83 01 0a 95 01 08 c6 0f 90 01 70 83 01 01 83 01 0a 83 01 0b 83 01 81 , len=86) DLINP DEBUG [0] <= osmo_st2_cardem_request_sw_tx(sw=9000) DLGLOBAL NOTICE => IRQ STATUS: flags=0x13, fi=9, di=6, wi=10 wtime=9600 (RESET VCC CLK ) DLGLOBAL NOTICE => IRQ STATUS: flags=0x12, fi=9, di=6, wi=10 wtime=9600 (RESET CLK ) DLGLOBAL NOTICE => IRQ STATUS: flags=0x10, fi=9, di=6, wi=10 wtime=9600 (RESET )
Files
Updated by dexter 20 days ago
I have now tried to narrow down the problem. Unfortunately the problem is somehow LLVM related. When I checkout the commit [1] where USE_CLANG was introduced the problem is still persistent. When I compile with GCC, then cardem works as expected, even with current master.
My best guess here is that the firmware crashes after the first transaction and that this is the reason why simtrace2-cardem-pcsc stops.
We now have two options here: We could add options to the makefiles that allow us to build cardem with GCC. This could be a quickfix to get working latest/nightly firmware binaries again. However, I assume that we have decided to use LLVM for a reason and that we should debug this properly.
I was using arm-none-eabi 7.3.1 and arm-llvm 14.0.0
[1] a65fb1e319ad71d576729019c0f25b087644d136 clang build support
Updated by Hoernchen 20 days ago
As of f52b8b1a2ec89af712eaedd7e25077f432236308:
works with Os:
PATH=$PATH:/work/octsim/osmo-ci/scripts:/work/octsim/arm-none-eabi/bin:~/embedded/LLVM-embedded-toolchain-for-Arm/install-13.0.0/LLVMEmbeddedToolchainForArm-13.0.0/bin MAKE=make PARALLEL_MAKE=-j8 USE_CLANG=1 BOARD="simtrace" APP="cardem" OPTIMIZATION="-Os" make
broken with Oz, which is currently default:
OPTIMIZATION="-Oz" make
Probably timing related.
Updated by Hoernchen 19 days ago
- Status changed from New to Resolved
- % Done changed from 0 to 100
Applied in changeset simtrace2|749dcdc27718c301c2370a78b4c24d19446e3085.