Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/actions/deps/ports/zephyr-cp/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ name: Fetch Zephyr port deps
runs:
using: composite
steps:
- name: Get libusb
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libusb-1.0-0-dev libudev-dev
shell: bash
- name: Setup Zephyr project
uses: zephyrproject-rtos/action-zephyr-setup@v1
with:
Expand Down
4 changes: 2 additions & 2 deletions ports/zephyr-cp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ pip install west
west init -l zephyr-config
west update
west zephyr-export
pip install -r lib/zephyr/scripts/requirements.txt
pip install -r zephyr/scripts/requirements.txt
west sdk install
```

Now to build from the top level:
Now to build from `ports/zephyr-cp`:

```sh
make BOARD=nordic_nrf7002dk
Expand Down
2 changes: 1 addition & 1 deletion ports/zephyr-cp/boards/nrf7002dk_nrf5340_cpuapp.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CONFIG_NETWORKING=y
CONFIG_WIFI=y

CONFIG_MBEDTLS_TLS_VERSION_1_2=y
CONFIG_MBEDTLS_SSL_PROTO_TLS1_2=y
CONFIG_MBEDTLS_USE_PSA_CRYPTO=n

CONFIG_BT=y
Expand Down
21 changes: 9 additions & 12 deletions ports/zephyr-cp/cptools/build_circuitpython.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import asyncio
import colorlog
import sys
import logging
import os
import pathlib
import tomllib
import tomlkit
import yaml
import pickle
import sys

import cpbuild
import board_tools
import colorlog
import cpbuild
import tomlkit
import tomllib
import yaml

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -219,13 +219,13 @@ async def build_circuitpython():
circuitpython_flags.append(f"-DCIRCUITPY_ENABLE_MPY_NATIVE={1 if enable_mpy_native else 0}")
circuitpython_flags.append(f"-DCIRCUITPY_FULL_BUILD={1 if full_build else 0}")
circuitpython_flags.append(f"-DCIRCUITPY_USB_HOST={1 if usb_host else 0}")
circuitpython_flags.append(f'-DCIRCUITPY_BOARD_ID=\\"{board}\\"')
circuitpython_flags.append(f"-DCIRCUITPY_BOARD_ID='\"{board}\"'")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. I am just curious. Why doesn't

    circuitpython_flags.append(f"-DCIRCUITPY_BOARD_ID={board}")

work here, since we know the board has no spaces? Does the context in which this is used require a double-quoted argument?

Similarly elsewhere below, where there are filenames in quotes, etc.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The filenames are used in #include lines and need the quotes. This needs them to be a c-string:

static const MP_DEFINE_STR_OBJ(board_module_id_obj, CIRCUITPY_BOARD_ID);

I changed it to wrapped in single quotes because the response file will escape the backspace formerly used to escape the double quote.

circuitpython_flags.append(f"-DCIRCUITPY_TUSB_MEM_ALIGN={tusb_mem_align}")
circuitpython_flags.append(f"-DCIRCUITPY_TRANSLATE_OBJECT={1 if lto else 0}")
circuitpython_flags.append("-DINTERNAL_FLASH_FILESYSTEM")
circuitpython_flags.append("-DLONGINT_IMPL_MPZ")
circuitpython_flags.append("-DCIRCUITPY_SSL_MBEDTLS")
circuitpython_flags.append('-DFFCONF_H=\\"lib/oofatfs/ffconf.h\\"')
circuitpython_flags.append("-DFFCONF_H='\"lib/oofatfs/ffconf.h\"'")
circuitpython_flags.extend(("-I", srcdir))
circuitpython_flags.extend(("-I", srcdir / "lib/tinyusb/src"))
circuitpython_flags.extend(("-I", srcdir / "supervisor/shared/usb"))
Expand Down Expand Up @@ -448,10 +448,7 @@ async def build_circuitpython():

if "ssl" in enabled_modules:
# TODO: Figure out how to get these paths from zephyr
circuitpython_flags.append('-DMBEDTLS_CONFIG_FILE=\\"config-tls-generic.h\\"')
circuitpython_flags.extend(
("-isystem", portdir / "modules" / "crypto" / "tinycrypt" / "lib" / "include")
)
circuitpython_flags.append("-DMBEDTLS_CONFIG_FILE='\"config-mbedtls.h\"'")
circuitpython_flags.extend(
("-isystem", portdir / "modules" / "crypto" / "mbedtls" / "include")
)
Expand Down
Loading