Skip to content
Snippets Groups Projects
Forked from card10 / firmware
765 commits behind the upstream repository.
Rahix's avatar
rahix authored
In the current firmware, different locking mechanisms a littered around
the code-base.  Among them are bare FreeRTOS mutexes and the hw-locks.
The callers for these often specify timeouts but don't make much effort
in A) picking robust values for the timeout and B) recovering gracefully
from a timeout happening.  Most of the time, we return -EBUSY to _Python
code_.  This is really really bad API design.  The firmware needs to
have enough integrity to ensure these situations can't ever occur.

To combat this, add a new locking primitive: The `struct mutex`.  The
intention is to replace all other locking and synchronization APIs with
this one.  This will provide one central place to debug any sort of
locking issues.

The `struct mutex` API is based on a few assumptions about locking.
Those are detailed in `Documentation/epicardium/mutex.rst`, which is
part of this commit.  The most important one is:

    Locking can **never** fail.

By requiring this to be true, we eliminate the need for drivers to
contain (often incorrect) logic for dealing with locking fails.  This
should drastically improve the stability of the firmware in regards to
lock-related bugs.

This commit does not introduce any functional changes yet.

Signed-off-by: default avatarRahix <rahix@rahix.de>
9a5a46cd
History

card10 Firmware Readme

Firmware for the card10 badge for the Chaos Communication Camp 2019.

We keep documentation in the Documentation/ subdirectory. You can find a rendered version over at https://firmware.card10.badge.events.ccc.de/.

How To Help

If you want to help us ensure the card10 will have been exactly as we reconstructed from the audio-logs we recovered, please head over to our wiki, or directly to the issue tracker.

How To Build

A full guide for building is available in the docs as How To Build.

Last Artifacts from Gitlab-CI: pipeline status

How To Flash

Flasing with or without a debugger is described in detail in How To Flash.

Debugger

If you have a debugger, head over to our Debugger page to learn how to use it.

License

Unless otherwise noted in a file, the contents of this repository are licensed under the MIT license. See COPYING for more details.


Old README Contents:

TODO: Move over into new docs

Serial Console

Learn more about card10's Serial Console.

Bootloader

The bootloader is used to flash card10 without an external debugger. It exposes the file system via USB and accepts a card10.bin file as firmware image.

To flash the bootloader, go to the bootloader directory and follow the steps above.

To execute the bootloader, turn off card10, press the lower right button and turn on. Connect card10 via a USB cable to a computer and mount the file system. You can now copy your card10.bin file to the file system. Eject the drive (IMPORTANT!) via your operating system (umount and sync is not enough). Turn card10 off and back on again. It will try to boot the image.

IMPORTANT: The prototypes have the USB data lines reversed. Use the provided USB adapter to connect card10.

Building card10.bin

Run ./build_image. TODO: Add to meson

The tool uses Python to generate a CRC. Make sure to have python-crc16 installed.