initial commit
This commit is contained in:
parent
30563655d7
commit
0f3695d0f4
|
@ -0,0 +1,31 @@
|
|||
Build CircuitPython in a Github-Devcontainer
|
||||
============================================
|
||||
|
||||
To build CircuitPython within a Github-Devcontainer, you need to perform
|
||||
the following steps.
|
||||
|
||||
1. checkout the code to a devcontainer
|
||||
|
||||
- click on the green "<> Code"-button
|
||||
- select the Codespaces-tab
|
||||
- choose "+ new with options..." from the "..."-menu
|
||||
- in the following screen select the branch and then
|
||||
- select ".devcontainer/cortex-m/devcontainer.json" instead
|
||||
of "Default Codespaces configuration"
|
||||
- update region as necessary
|
||||
- finally, click on the green "Create codespace" button
|
||||
|
||||
2. Your codespace is created. Cloning the images is quite fast, but
|
||||
preparing it for CircuitPython-development takes about 10 minutes.
|
||||
Note that this is a one-time task.
|
||||
|
||||
3. During creation, you can run the command
|
||||
`tail -f /workspaces/.codespaces/.persistedshare/creation.log`
|
||||
to see what is going on.
|
||||
|
||||
4. To actually build CircuitPython, run
|
||||
|
||||
cd ports/raspberrypi
|
||||
make -j $(nproc) BOARD=whatever TRANSLATION=xx_XX
|
||||
|
||||
This takes about 2m40s.
|
|
@ -0,0 +1,23 @@
|
|||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
||||
// README at: https://github.com/devcontainers/templates/tree/main/src/universal
|
||||
{
|
||||
"name": "CircuitPython Cortex-M Build-Environment (base: Default Linux Universal)",
|
||||
"image": "mcr.microsoft.com/devcontainers/universal:2-linux",
|
||||
"postCreateCommand": ".devcontainer/cortex-mq/on-create.sh",
|
||||
"remoteEnv": { "PATH": "/workspaces/gcc-arm-none-eabi/bin:${containerEnv:PATH}" }
|
||||
|
||||
// Features to add to the dev container. More info: https://containers.dev/features.
|
||||
// "features": {},
|
||||
|
||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||
// "forwardPorts": [],
|
||||
|
||||
// Use 'postCreateCommand' to run commands after the container is created.
|
||||
// "postCreateCommand": "uname -a",
|
||||
|
||||
// Configure tool-specific properties.
|
||||
// "customizations": {},
|
||||
|
||||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
||||
// "remoteUser": "root"
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
#!/bin/bash
|
||||
# -----------------------------------------------------------------------------
|
||||
# on-create.sh: postCreateCommand-hook for devcontainer.json (Cortex-M build)
|
||||
#
|
||||
# Author: Bernhard Bablok
|
||||
#
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
echo -e "[on-create.sh] downloading and installing gcc-arm-non-eabi toolchain"
|
||||
cd /workspaces
|
||||
wget -qO gcc-arm-none-eabi.tar.bz2 https://adafru.it/Pid
|
||||
tar -xjf gcc-arm-none-eabi.tar.bz2
|
||||
ln -s gcc-arm-none-eabi-10-2020-q4-major gcc-arm-none-eabi
|
||||
rm -f /workspaces/gcc-arm-none-eabi.tar.bz2
|
||||
export PATH=/workspaces/gcc-arm-none-eabi/bin:$PATH
|
||||
|
||||
# add repository and install tools
|
||||
echo -e "[on-create.sh] adding pybricks/ppa"
|
||||
sudo add-apt-repository -y ppa:pybricks/ppa
|
||||
echo -e "[on-create.sh] installing uncrustify and mtools"
|
||||
sudo apt-get -y install uncrustify mtools
|
||||
|
||||
# dosfstools >= 4.2 needed, standard repo only has 4.1
|
||||
echo -e "[on-create.sh] downloading and installing dosfstools"
|
||||
wget https://github.com/dosfstools/dosfstools/releases/download/v4.2/dosfstools-4.2.tar.gz
|
||||
tar -xzf dosfstools-4.2.tar.gz
|
||||
cd dosfstools-4.2/
|
||||
./configure
|
||||
make -j $(nproc)
|
||||
sudo make install
|
||||
cd /workspaces
|
||||
rm -fr /workspaces/dosfstools-4.2 /workspaces/dosfstools-4.2.tar.gz
|
||||
|
||||
# prepare source-code tree
|
||||
cd /workspaces/circuitpython/
|
||||
echo -e "[on-create.sh] fetching submodules"
|
||||
make fetch-submodules
|
||||
echo -e "[on-create.sh] fetching tags"
|
||||
git fetch --tags --recurse-submodules=no --shallow-since="2021-07-01" https://github.com/adafruit/circuitpython HEAD
|
||||
|
||||
# additional python requirements
|
||||
echo -e "[on-create.sh] pip-installing requirements"
|
||||
pip install --upgrade -r requirements-dev.txt
|
||||
pip install --upgrade -r requirements-doc.txt
|
||||
|
||||
# add pre-commit
|
||||
echo -e "[on-create.sh] installing pre-commit"
|
||||
pre-commit install
|
||||
|
||||
# create cross-compiler
|
||||
echo -e "[on-create.sh] building mpy-cross"
|
||||
make -j $(nproc) -C mpy-cross # time: about 36 sec
|
||||
|
||||
# that's it!
|
||||
echo -e "[on-create.sh] setup complete"
|
||||
|
||||
#commands to actually build CP:
|
||||
#cd ports/raspberrypi
|
||||
#time make -j $(nproc) BOARD=pimoroni_tufty2040 TRANSLATION=de_DE
|
Loading…
Reference in New Issue