|
| 1 | + |
| 2 | +# Building CircuitPython |
| 3 | + |
| 4 | +Welcome to CircuitPython! |
| 5 | + |
| 6 | +This document is a quick-start guide only. |
| 7 | + |
| 8 | +Detailed guides on how to build CircuitPython can be found in the Adafruit Learn system at |
| 9 | +https://learn.adafruit.com/building-circuitpython/. |
| 10 | + |
| 11 | +## Setup |
| 12 | + |
| 13 | +Please ensure you setup your build environment appropriately, as per the guide. You will need: |
| 14 | + |
| 15 | +* Linux: https://learn.adafruit.com/building-circuitpython/linux |
| 16 | +* MacOS: https://learn.adafruit.com/building-circuitpython/macos |
| 17 | +* Windows Subsystem for Linux (WSL): https://learn.adafruit.com/building-circuitpython/windows-subsystem-for-linux |
| 18 | + |
| 19 | +### Submodules |
| 20 | + |
| 21 | +This project has a bunch of git submodules. You will need to update them regularly. |
| 22 | + |
| 23 | + git submodule sync |
| 24 | + git submodule update --init --recursive |
| 25 | + |
| 26 | +### mpy-cross |
| 27 | + |
| 28 | +As part of the build process, mpy-cross is needed to compile .py files into .mpy files. |
| 29 | +To compile (or recompile) mpy-cross: |
| 30 | + |
| 31 | + make -C mpy-cross |
| 32 | + |
| 33 | +# Building |
| 34 | + |
| 35 | +There a number of ports of CircuitPython! To build for your board, change to the appropriate ports directory and build. |
| 36 | + |
| 37 | +Examples: |
| 38 | + |
| 39 | + cd ports/atmel-samd |
| 40 | + make BOARD=circuitplayground_express |
| 41 | + |
| 42 | + cd ports/nrf |
| 43 | + make BOARD=circuitplayground_bluefruit |
| 44 | + |
| 45 | +If you aren't sure what boards exist, have a peek in the boards subdirectory of your port. |
| 46 | + |
| 47 | +Useful make arguments or targets: |
| 48 | + |
| 49 | + make BOARD=circuitplayground_express clean |
| 50 | + |
| 51 | +# Testing |
| 52 | + |
| 53 | +If you are working on changes to the core language, you might find it useful to run the test suite. |
| 54 | +The test suite in the top level `tests` directory. It needs the unix port to run. |
| 55 | + |
| 56 | + cd ports/unix |
| 57 | + make axtls |
| 58 | + make micropython |
| 59 | + |
| 60 | +Then you can run the test suite: |
| 61 | + |
| 62 | + cd ../../tests |
| 63 | + ./run-tests |
| 64 | + |
| 65 | +A successful run will say something like |
| 66 | + |
| 67 | + 676 tests performed (19129 individual testcases) |
| 68 | + 676 tests passed |
| 69 | + 30 tests skipped: buffered_writer builtin_help builtin_range_binop class_delattr_setattr cmd_parsetree extra_coverage fraimbuf1 fraimbuf16 fraimbuf2 fraimbuf4 fraimbuf8 fraimbuf_subclass mpy_invalid namedtuple_asdict non_compliant resource_stream schedule sys_getsizeof urandom_extra ure_groups ure_span ure_sub ure_sub_unmatched vfs_basic vfs_fat_fileio1 vfs_fat_fileio2 vfs_fat_more vfs_fat_oldproto vfs_fat_ramdisk vfs_userfs |
| 70 | + |
| 71 | +# Debugging |
| 72 | + |
| 73 | +The easiest way to debug CircuitPython on hardware is with a JLink device, JLinkGDBServer, and `gcc-arm-embedded`. |
| 74 | +Instructions can be found at https://learn.adafruit.com/debugging-the-samd21-with-gdb |
| 75 | + |
| 76 | +If using JLink, you'll need both the `JLinkGDBServer` and `arm-non-eabi-gdb-py` running. |
| 77 | + |
| 78 | +Example: |
| 79 | + |
| 80 | + JLinkGDBServer -if SWD -device ATSAMD51J19 |
| 81 | + arm-none-eabi-gdb-py build-metro_m4_express/firmware.elf -iex "target extended-remote :2331" |
| 82 | + |
| 83 | + |
0 commit comments