No description
  • C++ 40.9%
  • CMake 32%
  • Shell 11.6%
  • C 10.8%
  • Dockerfile 4.7%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Avinal Kumar 1519640583 slight update to readme
Signed-off-by: Avinal Kumar <avinal.xlvii@gmail.com>
2022-10-05 01:09:03 +05:30
.devcontainer Initial commit 2022-09-22 20:23:09 +05:30
otpgen add totp generator code 2022-10-05 01:01:33 +05:30
pico-extras@18de33966e Initial commit 2022-09-22 20:23:09 +05:30
pico-sdk@426e46126b Initial commit 2022-09-22 20:23:09 +05:30
pimoroni-pico@b41631bc14 Initial commit 2022-09-22 20:23:09 +05:30
.gitignore Initial commit 2022-09-22 20:23:09 +05:30
.gitmodules Initial commit 2022-09-22 20:23:09 +05:30
bootstrap Initial commit 2022-09-22 20:23:09 +05:30
CMakeLists.txt update cmake build config 2022-10-05 01:01:08 +05:30
LICENSE Initial commit 2022-09-22 20:23:09 +05:30
pico_extras_import.cmake Initial commit 2022-09-22 20:23:09 +05:30
pico_sdk_import.cmake Initial commit 2022-09-22 20:23:09 +05:30
pimoroni_pico_import.cmake Initial commit 2022-09-22 20:23:09 +05:30
README.md slight update to readme 2022-10-05 01:09:03 +05:30
send.sh add script to send data to badger 2022-10-05 01:07:00 +05:30

Badger 2040 2 Factor Authanticator TOTP/HOTP

TOTP/HOTP implementation for Badger 2040.

Prerequisite

I have gathered all the required dependencies for developing C++ programs for Badger 2040 and created a bootstrap script to do the heavy lifting. However, the prerequisites are as listed below.

  • Common dependencies
    • git
    • cmake
    • make
    • ninja-build
  • Build dependencies for Fedora
    • gcc-arm-linux-gnu
    • arm-none-eabi-gcc-cs-c++
    • arm-none-eabi-gcc-cs
    • arm-none-eabi-binutils
    • arm-none-eabi-newlib
  • Build dependencies for Ubuntu
    • gcc-arm-none-eabi
    • build-essential
    • gcc-arm-none-eabi
  • Project dependencies

How to create a new Badger 2040 program?

This part explains how to properly arrange source code for a Badger 2040 program for easy compiling and maintenance.

  1. Clone the unmodified programexample directory and rename it (let it be example-too).

  2. Add your source code files to the directory.

  3. Modify the CMakeLists.txt in the new program directory to add source files and required options.

  4. Add the following line at the end of this project's CMakeLists.txt

    add_subdirectory(example-too)
    

How to build the program?

If you have used the supplied bootstrap script, you should be able to see the build folder, please follow from steps in that case.

  1. Install all the build dependencies for your distro and initialize all the submodules. Run the following command in the project root and then inside all three submodules pico-sdk, pico-extras, pimoroni-pico.

    git submodule update --init
    
  2. Create a build directory.

    mkdir build && cd build
    
  3. Generate CMake project. (Note: using Ninja for speedy compilation.)

    cmake .. -DPICO_BOARD=pimoroni_badger2040 -GNinja
    
  4. Compile your project. Do not compile the whole project, only compile the project you need by specifying the name.

    ninja <program-name>
    

How to flash the programs to Badger 2040?

The Badger 2040 uses .ef2 files to flash any program. You can upload MicroPython, CircuitPython or custom-built images. Follow these steps to use your custom build images. You can add only one file at a time.

  1. Hold boot/usr button on your badger and connect to your system. It will get mounted as RPI-RP2. There will be two files already, do not touch them.
  2. Go to the build directory and find the corresponding <project-name>.ef2 file for your project.
  3. Copy this file to the mounted RPI-RP2.
  4. Your badger screen will flash and the program will load.
  5. You can now test your program.

References

Where to buy Badger 2040?

Important Repositories

Acknowledgments

License

I've added the BSD 3-Clause License to match the license used in the project dependencies. You should review this and check it's appropriate for your project before publishing your code.