blob: cd04e7a9534112f977bd448b40279ce09de3a243 [file] [log] [blame]
Kévin Redon0828b912018-05-21 19:35:56 +02001This is the source code for SIMtrace 2 firmwares.
Harald Welted8a003d2017-02-27 20:31:09 +01002
Kévin Redon0828b912018-05-21 19:35:56 +02003= Hardware
Harald Welted8a003d2017-02-27 20:31:09 +01004
Kévin Redon0828b912018-05-21 19:35:56 +02005== Micro-Controller
Harald Welted8a003d2017-02-27 20:31:09 +01006
Kévin Redon0828b912018-05-21 19:35:56 +02007The firmware is for Microchip (formerly Atmel) ATSAM3S4B micro-controllers (MCU).
8Product page: https://www.microchip.com/wwwproducts/en/ATSAM3S4B
9Datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-6500-32-bit-Cortex-M3-Microcontroller-SAM3S4-SAM3S2-SAM3S1_Datasheet.pdf
10
11Note: The SAM3S is now not recommended for new designs.
12It can be replaced by the pin-compatible SAM4S.
13The MCU can be specified using the environment variable `CHIP` (set to `sam3s4` per default) for future MCU support.
14
15== Boards
16
17The SIMtrace 2 firmware supports multiple boards.
18A board defines a given circuit board.
19While compiling the firmware, set the target board using the `BOARD` environment variable (set to `qmod` per default).
20The supported boards correspond to sub-folders under `libboard`.
Harald Welted8a003d2017-02-27 20:31:09 +010021
22Current boards supported are:
Harald Welted8a003d2017-02-27 20:31:09 +010023
Kévin Redon0828b912018-05-21 19:35:56 +020024* `simtrace`: The good old Osmocom SIMtrace PCB with SAM3 instead of SAM7, open hardware.
25* `qmod`: A sysmocom-proprietary quad mPCIe carrier board, publicly available
26* `owhw`: An undisclosed sysmocom-internal board, not publicly available
Joachim Steigerb1a81c12019-07-26 22:13:51 +020027* `octsimtest`: A sysmocom-proprietary production testing board, not publicly available
Harald Welted8a003d2017-02-27 20:31:09 +010028
Kévin Redon0828b912018-05-21 19:35:56 +020029= Firmware
Harald Welted8a003d2017-02-27 20:31:09 +010030
Kévin Redon0828b912018-05-21 19:35:56 +020031== Library
Harald Welted8a003d2017-02-27 20:31:09 +010032
Kévin Redon0828b912018-05-21 19:35:56 +020033The firmware uses the manufacturer provided Software Package (SoftPack) micro-controller library.
34The original library is available at https://www.microchip.com/design-centers/32-bit/softpacks/legacy-softpacks .
35Version 2.1 from 2001 is used: http://ww1.microchip.com/downloads/en/DeviceDoc/SAM3S_softpack_2.1_for_CodeSourcery_2010q1.zip
36The SIMtrace 2 project uses the `libboard_sam3s-ek`, `libchip_sam3s`, and `usb` sub-libraries, saved in `atmel_softpack_libraries` (with local modifications).
37
38Note: SoftPack is the legacy micro-controller library.
39This library is now replaced by the Advanced Software Framework (ASF): https://www.microchip.com/avr-support/advanced-software-framework-(asf) .
40The SAM3S ASF documentation is available at http://asf.atmel.com/docs/latest/sam3s/html/index.html .
41
42== Applications
43
44An application is a specific piece of software with given functionality.
45While compiling the firmware, set the target application using the `APP` environment variable (set to `dfu` per default).
46The supported applications correspond to sub-folder under `apps`.
47
48Current applications supported are:
49
50* `dfu`: The USB DFU bootloader to flash further main appliction firmwares.
51* `ccid`: To use SIMtrace 2 as USB CCID smartcard reader.
52* `cardem`: To provide remote SIM operation capabilities.
53* `trace`: To monitor the communication between a SIM card and a phone (corresponds to the functionality provide by the first SIMtrace)
54* `triple_play`: To support the three previous functionalities, using USB configurations.
Joachim Steigerb1a81c12019-07-26 22:13:51 +020055* `gpio_test`: internal test code
Kévin Redon0828b912018-05-21 19:35:56 +020056
57== Memories
58
59Firmwares can be run from several memory locations:
60
Harald Welted8a003d2017-02-27 20:31:09 +010061* flash: Run natively from start of flash memory
Kévin Redon0828b912018-05-21 19:35:56 +020062* dfu: Run after a DFU bootloader from an offset after the first 16k of flash (the first 16k are reserved for the bootloader)
Harald Welted8a003d2017-02-27 20:31:09 +010063* ram: Run from within the RAM of the chip, downloaded via JTAG/SWD
64
Harald Welted8a003d2017-02-27 20:31:09 +010065== Building
66
Kévin Redon0828b912018-05-21 19:35:56 +020067A given firmware build is made for a specific combination of an application `APP` running in a certain memory `MEM` on a given board `BOARD`.
68When building using `make`, set the target application using the `APP` environment variable and target board using the `BOARD` environment variable, e.g.:
Harald Welte601e0d32017-03-08 15:33:33 +010069
Harald Welte601e0d32017-03-08 15:33:33 +010070* make APP=cardem BOARD=qmod
71* make APP=dfu BOARD=qmod
72
Kévin Redon0828b912018-05-21 19:35:56 +020073The Makefile will create output files in the format: `bin/$(BOARD)-$(APP)-$(MEM).{elf,bin}`
74
Harald Welte601e0d32017-03-08 15:33:33 +010075The level of debug messages can be altered at compile time:
76```
77$ make TRACE_LEVEL=4
78```
79Accepted values: 0 (NO_TRACE) to 5 (DEBUG)
80
Kévin Redon6228d182019-05-23 17:33:45 +020081The qmod specific option `ALLOW_PEER_ERASE` controls if the UART debug command to assert the peer SAM3S ERASE line is present in the code.
82Per default this is set to 0 to prevent accidentally erasing all firmware, including the DFU bootloader, which would then need to be flashed using SAM-BA or JTAG/SWD.
83Setting `ALLOW_PEER_ERASE` to 1 enables back the debug command and should be used only for debugging or development purposes.
84
Kévin Redon0828b912018-05-21 19:35:56 +020085= Flashing
Harald Welte601e0d32017-03-08 15:33:33 +010086
Kévin Redon0828b912018-05-21 19:35:56 +020087To flash a firmware image follow the instructions provided in the [wiki](https://projects.osmocom.org/projects/simtrace2/wiki/).