All Projects → Nitrokey → nitrokey-storage-firmware

Nitrokey / nitrokey-storage-firmware

Licence: GPL-3.0 license
Firmware for the Nitrokey Storage device

Programming Languages

c
50402 projects - #5 most used programming language
Logos
282 projects
CMake
9771 projects
Makefile
30231 projects
HTML
75241 projects
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to nitrokey-storage-firmware

libnitrokey
Communicate with Nitrokey devices in a clean and easy manner
Stars: ✭ 61 (+15.09%)
Mutual labels:  otp, nitrokey-stick-devices
nitrocli
A command line tool for interacting with Nitrokey devices.
Stars: ✭ 23 (-56.6%)
Mutual labels:  nitrokey-stick-devices, nitrokey-storage
akvo-flow-mobile
Akvo Flow app
Stars: ✭ 18 (-66.04%)
Mutual labels:  gplv3
adb-cheatsheet
Your journey to master Android™ Shell begins here
Stars: ✭ 44 (-16.98%)
Mutual labels:  firmware
Mirage
Reimplementation of the Nintendo Switch firmware
Stars: ✭ 40 (-24.53%)
Mutual labels:  firmware
otp-authenticator-webapp
A 'Google Authenticator' like Single Page Application
Stars: ✭ 69 (+30.19%)
Mutual labels:  otp
supervisorring
otp/supervisor-like interface to supervise distributed processes
Stars: ✭ 15 (-71.7%)
Mutual labels:  otp
otp-view
OTP View
Stars: ✭ 32 (-39.62%)
Mutual labels:  otp
Phicomm-K2P-K3-OpenWrt-Firmware
Phicomm K3 OpenWrt firmware Compile by Github Actions,(K2P firmware update,see my mood)
Stars: ✭ 42 (-20.75%)
Mutual labels:  firmware
e-voting-with-django
The Voting System web application using Django is a project that serves as the automated voting system of an organization or school. This system works like the common manual system of election voting system whereas this system must be populated by the list of the positions, candidates, and voters. This system can help a certain organization or s…
Stars: ✭ 54 (+1.89%)
Mutual labels:  otp
Port-Able-Suite
🌐 Manager for portable applications
Stars: ✭ 35 (-33.96%)
Mutual labels:  device
angular-code-input
Code (number/chars/otp/password) input component for angular 7, 8, 9, 10, 11, 12+ projects including Ionic 4, 5 +
Stars: ✭ 112 (+111.32%)
Mutual labels:  otp
lumazoid
Firmware for the Lumazoid realtime music visualizer board
Stars: ✭ 85 (+60.38%)
Mutual labels:  firmware
rabbit
Build Elixir applications with RabbitMQ
Stars: ✭ 36 (-32.08%)
Mutual labels:  otp
polargraph server polarshield
Firmware for PolargraphSD based on Arduino MEGA 2560, current until 2018.
Stars: ✭ 21 (-60.38%)
Mutual labels:  firmware
elixir-fire-brigade-workshop
Workshop "Join the Elixir Fire Brigade - Level-up Your Elixir Debugging Skills" (ElixirConf US 2017)
Stars: ✭ 14 (-73.58%)
Mutual labels:  otp
smram parse
System Management RAM analysis tool
Stars: ✭ 50 (-5.66%)
Mutual labels:  firmware
MinaOTP
TOTP authenticator implement as a wechat mini program
Stars: ✭ 30 (-43.4%)
Mutual labels:  otp
firmware
Alternative IP Camera firmware from an open community
Stars: ✭ 236 (+345.28%)
Mutual labels:  firmware
yubico-rs
Yubikey client API library, Challenge-Response & Configuration
Stars: ✭ 39 (-26.42%)
Mutual labels:  otp

Nitrokey Storage Firmware

Firmware verification

To verify firmware flashed on device, please use the Nitrokey Storage Firmware Checksum Tool from the tools directory.

Building

Windows

Note: Tested with Windows 7

Install the following tools in this order:

  1. avr32-gnu-toolchain-2.4.2-setup.exe
  2. avr32studio-ide-installer-2.5.0.35-win32.win32.x86.exe
  3. AvrStudio4Setup.exe
  4. AVRStudio4.18SP2.exe

Linux

GUI

The compile procedure is as follows (tested on ArchLinux but should work on any other GNU/Linux OS):

  1. Clone this git project (git clone https://github.com/Nitrokey/nitrokey-storage-firmware.git)
  2. Download and extract AVR32 Studio. Example archive filename: avr32studio-ide-2.6.0.753-linux.gtk.x86_64.zip. At the moment no newer version seems to be available for Linux.
  3. Start AVR32 Studio by executing avr32studio in the extracted folder.
  4. Import project into AVR32 Studio: File | Import... | General | Existing Projects into Workspace | Choose the folder of downloaded git project.
  5. Rename pm_240.h in the git project folder to pm_231.h. Make a backup of as4e-ide/plugins/com.atmel.avr.toolchains.linux.x86_64_3.0.0.201009140852/os/linux/x86_64/avr32/include/avr32/pm_231.h. Replace that pm_231.h with the renamed pm_240.h.
  6. In AVR32 Studio select Project | Build All.
  7. The builded file is now in the folder Debug of the git project folder.

Command Line

# setup
TOOLCHAIN_PATH=as4e-ide
T_SUBPATH=plugins/com.atmel.avr.toolchains.linux.x86_64_3.0.0.201009140852/os/linux/x86_64/avr32/include/avr32
mv $(TOOLCHAIN_PATH)/$(T_SUBPATH)/pm_231.h{,~} -v
cp pm_240.h $(TOOLCHAIN_PATH)/$(T_SUBPATH)/pm_231.h
# firmware build
cd src && make CC=path/to/avr32-gcc

Converting to .HEX file

Before flashing there may be a need to convert binary file to .hex. If it was not done automatically execute the following in Debug or Release directory:

avr-objcopy -R .eeprom -O ihex USB_MASS.elf firmware.hex

or, while in ./Debug directory:

make firmware.hex

Flashing the Firmware to Device

Debugging

Note: To connect an external debugger as described here, you will need a development version of the Nitrokey Storage that makes the JTAG pins available (pictured below). This version is currently not for sale. The PCB layout for the developer version can be found in the Nitrokey Storage Hardware repository, inside the dev folders.

NK Storage Development Version

Compatible Debuggers

This has been tested with the AVR JTAGICE XPII, however the more recent Atmel ICE and any other AVR UC3 compatible debugger should work as well.

Prepare connections

The JTAG connections on the PCB have a pitch of 1.27mm. To ease connecting and disconnecting, it is easiest to solder a pin header to the PCB and use a pin socket to quickly attach the device to the debugger. It is recommended to use the following parts for that (however any connector with a 1.27mm pitch will work):

Part Digikey Part Number
7-pin THT Pin header, 1.27mm Pitch S9014E-07-ND
7-pin THT Pin header, 2.54mm Pitch S1012EC-07-ND
7-pin Socket, 1.27mm Pitch S9008E-07-ND
1.27mm Ribbon Cable, ca. 15cm
Heatshrink
  • Solder the 1.27mm Pin header to the board
  • Solder the 1.27mm socket and 2.54mm header to the cable and isolate individual contacts with heatshrink

Connect Debugger interface to the Nitrokey

Use jumper wires to connect the cable from the Nitrokey to the Debugger interface connector as pictured below:

NK Storage Debugger Connection

Nitrokey Side AVR JTAG Connector Side
RST nSRST
TCK TCK
TDI TDI
TDO TDO
TMS TMS
GND GND
VDD VTref

The device still needs to be powered via USB during debugging. For an initial function test, you can issue the following commands from the AVR32Studio home directory:

cd /plugins/com.atmel.avr.utilities.linux.x86_64_3.0.0.201009140848/os/linux/x86_64/bin
./avr32program --part UC3A3256S cpuinfo

if the device is connected correctly, this should yield an output similar to this:

Connected to JTAGICE mkII version 6.6, 6.6 at USB.

Device information:
Device Name                                   UC3A3256S 
Device Revision                               H
JTAG ID                                       0x7202003f
SRAM size                                     128 kB
Flash size                                    256 kB

Using the debugger in AVR32Studio

To enable the debugger, follow these steps inside the IDE:

  • Enable the "AVR Targets" dialog under Window -> Show View -> AVR Targets
  • Right click inside the "AVR Targets" window and select Scan Targets. Your debugger should now be shown as a target.
  • Right click on the debugger entry and select Properties
  • Select the "Details" tab. Under "Device", select AVR UC3A Series -> AT32UC3A3256S

The debugger should now be available. Configure the debugging environment by following these steps:

  • Open Run -> Debug Configurations
  • If there is no entry under AVR Application, create one by double clicking on it. Otherwise select the existing entry.
  • Under "File", select Debug/USB_MASS.elf
  • Under "Target" select JTAGICE mkII (or your correspondig JTAG debugger)
  • Under "Erase Options" select Erase sectors
  • Under "Run Options" select Reset MCU
  • Apply Settings and close the dialog window

Congratulations, your IDE should now be ready for debugging. Set breakpoints as needed and start a JTAG debugging session by pressing F11.

Defaulting to USB DFU

If you accidentally erased the DFU bootloader from the chip or run into any trouble, the stick can always be reprogrammed like this:

  • In the "AVR Targets" dialog, right click on your JTAG debugger and select Program Bootloader
  • Leave all the entries in their default state and reprogram the bootloader by clicking Finish

The device will now start in DFU mode and can be programmed as described above in the Firmware Upgrade Instructions

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].