Commit Graph

1085 Commits

Author SHA1 Message Date
Harald Welte ee9ddb8da1 host: Always initialize libosmocore logging before using it
This avoids related ASSERTs or error messages in case any of the
libosmocore / libosmousb API functions internally tries to log
something.

Change-Id: I611c435516856c5c8928d7810fd9a9b831adc199
2022-03-03 15:27:13 +01:00
Harald Welte 039680a8d4 cardem: set more reasonable interrupt priorities
the ISO7816 UARTs have highest priority, while console has lowest.

remaining sources (USB, ADC, GPIO) are in between.

Change-Id: Ie6c97d61d8da3990b6e44144f36cb6d37d194307
2022-02-21 23:24:20 +01:00
Harald Welte 8680677256 card_emu_uart_interrupt: ASSERT if we get called with wrong uart_chan
This is what we do in all other functions, not sure why this one
wants to silently ignore any such programming errors.

Change-Id: I022eee86a5a3b5077abe59897161578ed960f1b1
2022-02-14 10:18:45 +00:00
Harald Welte 20bc014b82 cardem: Report the VCC voltage (if supported)
The SIMtrace2 protocol alwasy contained a field for the VCC voltage,
the cardem firmware just never populated that field, even on those
boards that use the ADC to determine its voltage.

Change-Id: Idcecad553fb36380e916378e1420488acbbfa8e3
2022-02-14 10:18:39 +00:00
Eric Wild 3a6f1adc2e lua dissector: adjust usage instructions
...as originally described in the first commit that added the file.

Change-Id: I67918f0f62b1619786324ae84276a46d7c64eee5
2022-02-02 11:48:05 +01:00
Harald Welte 70e60aa1de contrib/simtrace.lua: Register for "decode as..."
This allows to manually decode traces that don't contain the vid/pid information

Change-Id: Idd605f63f01f005f07a4c329847d08331bfdc9e8
2022-01-26 16:10:27 +01:00
Harald Welte 4775a94959 contrib/simtrace.lua: Dissect some more cardem related message types
Change-Id: I1892c1e154130d8048e99fd1d8f8809f00366e80
2022-01-26 16:10:27 +01:00
Harald Welte d3b9d95b34 contrib/simtrace.lua: Don't print SIMTRACE_MSGT_ in every COL_INFO
this is redundant.  We care about *which* message type, and not about
wasting horizontal screen real-estate.

Change-Id: I98f90561b39401f1c2339f79a3cb40574bb03b2d
2022-01-26 16:10:27 +01:00
Harald Welte 408889d8b2 contrib/simtrace.lua: print length + slot-number in decimal only
Change-Id: Ia9a969b88170c49f8bb1cb0cda6918d6a894d3ba
2022-01-26 15:06:06 +00:00
Harald Welte 7b160b5ed7 contrib/simtrace.lua: Add header with author/description/usage
Change-Id: I56574741cd77436f9f452420677c00d8049a50cc
2022-01-26 15:06:02 +00:00
Harald Welte 15a3ef25a2 cosmetic: contrib/simtrace.lua: more consistent formatting
Change-Id: If842dd95c7244ebe33579ed104247c66682ed4d4
2022-01-26 15:05:17 +00:00
Harald Welte 5820eacf57 contrib/simtrace.lua: Add VID/PID of all currentl simtrace2 devices
Change-Id: Ie425f8dbd3a02c6bdcdaeaafaf0d5b4fb351ec4d
2022-01-26 15:04:52 +00:00
Harald Welte 94cc319b8e host: properly zero-initialize interface match structures
This can lead to some fields not properly zero-initialized, fooling
our matching code into the application having requested certain
fields to match ('0' is usually assumed to be unspecified).

Change-Id: I304d55b584e37d9dccb75b24057bb682f799beb2
2022-01-25 16:40:27 +01:00
Harald Welte 7a450041bf cosmetic: Fix indent of printf() statement
Change-Id: I9f5c9f7720b3bc3c8d5df9750b031d8bcf2dd435
2022-01-25 16:39:46 +01:00
Harald Welte 3f0d92f282 host: Print strerror(errno) in case of problems opening the USB device
Change-Id: If446bf08655739281f616df952714751fe9a3b18
2022-01-25 16:09:55 +01:00
James Tavares ea9a91f5ce gitignore: add missing entries binaries
Add missing entries for simtrace2-tool, crctool, and host/tests

Change-Id: I23f4b387f220146bccf7d723cc773a72d8e17a65
2022-01-11 17:09:38 +00:00
James Tavares 91a93bc5de firmware: add definition for main osc bypass when using external osc
Add new board.h definition BOARD_MAINOSC_BYPASS to configure the clock module to use an external oscillator rather than a crystal. The qmod board is one such board.
Change-Id: If62f55cd4c8b0cf758534f09d25a9bcb028814a7
2022-01-11 13:10:34 +00:00
James Tavares aeaf12853e simtrace2-tool: add "modem sim-card (insert|remove)" command
Add a new command to request that the simtrace2 firmware manipulate the
card detect signal, causing the downstream cellular modem to believe
that the SIM card has been inserted or removed, respectfully.

Change-Id: I8c79eb29379a789d9d0d21495e30d66ddbdfb022
2022-01-10 18:06:45 -05:00
Eric Wild 7fde63b7c6 wireshark lua dissector: dissect more
Change-Id: If81812b6330205a65c1c9b7d4240094b71f3c757
2021-12-15 14:10:19 +00:00
Eric Wild cb655f9774 firmware: add crc stub to all dfu apps to ensure reliable loading
DFU flashing of apps sometimes aborts, and although rare this leads to
broken devices if no boot button or serial/jtag access exists, because
the bootloader will keep trying to start a half-flashed app that then
crashes at some point.

The easiest fix that works with existing bootloaders is to prepend a
small 512 byte stub that calculcates the crc and compares it with the
crc calculated at build time, and then either starts the actual app, or
sets the dfu flag and resets. This ensures we either have a working,
running app, or end up in the bootloader, ready to flash again.

For obvious reasons this only applies to dfu apps, and not to flash
targets like the actual bootloader itself.

Change-Id: Id6df0486c8b779889d21800dc2441b3aa9af8a5f
2021-12-15 14:04:20 +00:00
Oliver Smith f721e69bc1 treewide: remove FSF address
Remove the paragraph about writing to the Free Software Foundation's
mailing address. The FSF has changed addresses in the past, and may do
so again. In 2021 this is not useful, let's rather have a bit less
boilerplate at the start of source files.

Change-Id: Ie0a3b2273383adbb3303faffd6ff96be7f4cae99
2021-12-14 11:47:21 +01:00
Oliver Smith 8dada9b454 host/contrib/simtrace2.spec.in: update
Apply various improvements from Martin Hauke, thanks!

* Put sover into a variable
* Sync BuildRequires with configure.ac
* Update libosmo-simtrace2 summary
* Use %make_build instead of make %{?_smp_mflags}

Change-Id: I35ce3865702f72365b38b0eaa8b28f332dabcd1f
2021-12-10 14:50:18 +01:00
Oliver Smith afd23660b3 Bump version: 0.8.0.1-8281 → 0.8.1
Change-Id: I6bcc798db9f4ab2b91711daebeba98abebd55e92
2021-12-10 10:04:28 +01:00
Oliver Smith 24a9ee8ae6 host/contrib/simtrace2.spec.in: fix soname
Adjust the soname in the rpm recipe too, to fix:
  error: File not found: /home/abuild/rpmbuild/BUILDROOT/simtrace2-0.8.0.202112100026-1.1.x86_64/usr/lib64/libosmo-simtrace2.so.0*

Change-Id: I748f44409ac736abbd5c18e31ae02d025dee2c77
2021-12-10 10:04:13 +01:00
Harald Welte 45a8f2beee Bump version: 0.7.0.166-61b4-dirty → 0.8.0
Change-Id: I1650f7181cf514ba00e6f70e8133ee88780ebf41
2021-12-09 08:12:56 +01:00
Harald Welte 155c237504 host: Upgrade libosmocore dependency to 1.4.0
1.4.0 contains the most recent changes to libosmousb, so let's use
that as a minimum basis.

Change-Id: Ia44377cd6a8d7998c6995a3f89adb22cdc675601
2021-12-09 08:05:58 +01:00
Eric Wild 61b4aad46f firmware: remove dfu-dfu default target
It's useless, since blupdate does the same thing, just much faster and
easier.

Change-Id: I86dddfacea2e35f4d5a7f23ee4b3d12e3f1d35f1
2021-11-24 17:22:01 +00:00
Eric Wild 23125d05f7 jenkins: build bootloader updater
Change-Id: I8b2023921a67b0e8945d8f24e4c8076de3e12acf
2021-11-02 10:50:36 +00:00
Eric Wild 7ac85188f4 firmware: add missing usb strings to blupdate that prevented building it
Change-Id: I8d0d9bf98748d475427d9b0c78f2e0532ee4bca1
2021-11-02 09:54:55 +00:00
Eric Wild 23eb56319c add our default clang-format file
Change-Id: I77aab70400bdbb46cbdd83e428e2a28ebf29b8dd
2021-11-01 14:35:14 +01:00
Eric Wild c85f52d5d5 firmware: drop cref printing
No one reads this, no one wants to know this.

Change-Id: Ie2281e207164f82d8ee29bd596a5593c22aaf198
2021-11-01 14:35:14 +01:00
Eric Wild a079e2b4ee firmware: increase reset delay before usb reattach
The previous value was way too low and led to reenumeration issues when
switching from app to bl because the hosts are fairly lenient and
feature long delays until they accept disappearing devices as gone for
good instead of ignoring a presuambly flaky usb cable or connection.

Related: SYS5061
Change-Id: I9b8c8bf794ad5b94fc7ea2a01d1ebf4e36862c36
2021-11-01 14:35:14 +01:00
Eric Wild f83d42ce51 firmware: remove usb pullup that dates back to simtrace1
All the parts are DNP and never existed on the simtrace2 with sam3; the
sam3 has internal pullups that are part of the usb peripheral.

Change-Id: I04a703a2eba6ff1dc64692c089213389d0c1066d
2021-11-01 14:35:14 +01:00
Eric Wild a7e306f745 firmware: add bootloader update "app"
This bl updater can be flashed as app and will update the bootloader and
then
delete itself before resetting the sam3, so the device will end up in
the newly
updated dfu bootloader afterwards, without having to press the
bootloader button
or requring any other manual interaction, ready to receive a new
application image.

Building the blupdater requires a previously built dfu-flash bootloader
bin file that
will then be embedded into the app during building.

Related: OS#1704
Related: SYS5061
Change-Id: I53dea57bba790a2ab3245d9483e0ff1c8d19d5e3
2021-11-01 12:03:38 +00:00
Harald Welte 020edca678 cardem-pcsc: Fix return of uninitialized variable
Fixes: CID#240740
Change-Id: I97431f491f60e2a6537502ef88042907723b7de6
2021-10-25 08:12:08 +02:00
Eric Wild 17bfa5273f fix bootloader led config crash
This led to occasional crashes for targets with leds since it was
introduced 3 years ago
The interesting thing is that most of the time it didn't crash...

Change-Id: Ia6a1b1fc0e44a301b4fb1d9c9fdbc27d61dcab97
2021-10-20 20:03:06 +02:00
Eric Wild a65fb1e319 clang build support
Supposed to be used with https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm
+ distro provided binutils-arm-none-eabi package, might provide better and more reliable
binary sizes, especially for the bootloader.

Just run USE_CLANG=1 make

Change-Id: I1a19f40d44797efad5c46121e73115ed738a095b
2021-10-20 20:03:06 +02:00
Eric Wild af6ae8b8dd drop unused exidx sections when linking
clang might emit those even though they are neither needed or wanted,
so just get rid of them.

Change-Id: I159b4405cebe72af4d98b27f876c48835ffd6e2d
2021-10-20 20:03:06 +02:00
Eric Wild 90784220a5 add the ngff cardem to default build targets
Change-Id: Icec4966fe419eee9f7ace67e46e3d88738812b38
2021-10-20 20:03:06 +02:00
Harald Welte 651050922a simtrace2-tool: Initialize logging to avoid error on first log output
This avoids
 ERROR: osmo_log_info == NULL! You must call log_init() before using logging in log_check_level()

Change-Id: Id355ef33e10164f8e8eb40c2fd0b606bc8e9b6f7
2021-10-06 21:10:44 +02:00
Harald Welte 5b7a608277 simtrace2-cardem-pcsc: Remove double libusb initialization
This code already calls osmo_libusb_init further above in the top
of the main() function, so there's no use of calling libusb_init()
directly in the same function lines below.

Change-Id: I2e0c7446aaa644c5aae1059ce91ff9f729903cbc
2021-10-06 21:06:21 +02:00
Harald Welte e304015b3c Use osmo_libusb_{init,exit}() instead of libusb_{init,exit}()
We use other osmo_libusb_* functions later in the code, so it is best
to initialize the library via libosmousb, and not directly.

Change-Id: I2fd981935e1420e529f5dd8a98edd347c317284c
2021-10-06 21:06:06 +02:00
Harald Welte 19ccc209c1 jenkins.sh: Build 'trace' firmware for ngff_cardem
Let's create and publish binary builds for 'trace' on BOARD=ngff_carde.

According to SYS#5525 this is verified working since two months ago, so
there's no reason to withhold the binary builds for it.

Change-Id: I8a98002ef5aa58e5a3d49627323fe11505508bc8
Related: SYS#5525
2021-10-06 21:01:14 +02:00
Eric Wild 5e82a2a1c6 Revert "firmware: data sections"
This reverts commit e6a76c7bf4.

Might or might not cause weird issues depending on gcc and binutils
versions, let's see if this helps.

Change-Id: I2f593fd5e0f1494aae6b9fcfb2160a6c9168f5b8
2021-10-04 18:05:45 +02:00
Eric Wild 301aec51f7 contrib/jenkins.sh: lower trace to make bl fit
We keep running out of rom space, so reduce tracing to nothing for alle
dfu targets, and let's hope newer gcc versions stop producing more
code...

Change-Id: I7d2947c84097035bed00ad489a175d614b4c388e
2021-10-04 15:07:44 +00:00
Eric Wild 1f75e3881c contrib: allow manually forcing bulk simtrace dissection
Change-Id: I5fcfe3c221b87b02e21c857ac51d0392c3b4de3c
2021-08-09 15:18:59 +02:00
Eric Wild 5beffa5d91 contrib/jenkins.sh: build ngff_Cardem dfu bootloader
It does fit with some compiler versions, while others overflow the bl region,
so just reduce the trace level a bit to make it fits all the time.

Change-Id: I168a847da8dfc585aaeef0030f95fc225a713147
2021-08-09 12:45:13 +02:00
Harald Welte 3092721729 contrib/jenkins.sh: Build APP=cardem for BOARD=ngff_cardem
This makes sure downloads.osmocom.org will get cardem images
for the new ngff_cardem board.

The dfu loader was not enabled as it currently overflows the ROM
region by 200 bytes, see OS#5210.

Change-Id: Id2b7925c823fb19f880e06a205764d2b19de4ad4
Related: OS#5210
2021-08-08 21:31:03 +02:00
Eric Wild 7ca68359f3 cardem: fix spurious NULL bytes during transfers
The "wait time extension timer" was apparently not being reset during
normal tx operations, which led to occasional NULL (0x60) bytes getting
injected into transfers, which in turn led to more tx bytes than what
the reader side expects...

The odd thing is that this was only noticeable with high baud rates,
probably due to the very long default WT of 9600 ETU, and even then only
because it led to weird ngff modem resets after benign transfers.

Change-Id: I15b0b83b7d93b8e5589f3640bd6eb2fc82f93394
Related: SYS#5553
2021-08-08 04:14:38 +02:00
Harald Welte a951c4ae02 simtrace2.spec: Add simtrace2-tool binary to package
This fixes RPM build issues reported as

[   59s] error: Installed (but unpackaged) file(s) found:
[   59s]    /usr/bin/simtrace2-tool

Change-Id: I1fd5980a686652afb47cd1c30e12919de626aec7
2021-08-03 09:02:34 +02:00