Clone this repo:
  1. c529a41 dagwood: use the Dagwood commit in DW_VERSION by Abe Levkoy · 2 days ago main
  2. 4557da0 dagwood: measure Intel MTL AP power sequence timings by Keith Short · 10 days ago firmware-R159-16883.2.B release-R159-16883.B
  3. 51e3fa3 main: print STM32 ROM bootloader version on startup by Fabio Baltieri · 12 days ago
  4. 0ac9ac3 dagwood: support software-triggered DFU entry and auto-reset on leave by Keith Short · 12 days ago
  5. d63f30c build_from_chroot: check running version before flashing by Keith Short · 2 weeks ago

Dagwood

Firmware build, flash and debug

The firmware can be built and flashed both with or without the chroot, though it's recommended reusing the checkout that is part of a ChromiumOS SDK as that includes the necessary configuration to upload changes to Gerrit.

Chroot / Docker build and flash

Build the firmware:

./build_from_chroot.py

Flash the firmware using an attached ST-Link debugger via OpenOCD:

# Build and flash (checks running version and skips if already matching):
./build_from_chroot.py -f

# Force flashing even if the running version matches:
./build_from_chroot.py -f --force

# Or flash an existing build without rebuilding:
./build_from_chroot.py --flash-only

To flash using USB DFU instead:

./build_from_chroot.py -f --flasher dfu

You can also run this inside the EC Docker container or directly from the host:

./src/platform/ec/docker/run_docker.sh bash -c "cd /workspace/src/platform/dagwood && ./build_from_chroot.py -f"

Or flash directly with OpenOCD outside the chroot / container:

openocd -f firmware/boards/google/dagwood/support/openocd-stlink.cfg \
  -c "program build/dagwood/build-singleimage/zephyr/zephyr.elf verify reset exit"

Out of chroot build

This setup reuses the upstream Zephyr repository and modules directly, requires an install of the zephyr-sdk but all the debugging tools are available.

Venv setup (only needed once)

sudo apt install python3-venv
python3 -m venv ~/chromiumos/src/platform/dagwood/.venv

Enter the venv (once before either setting up or building):

source ~/chromiumos/src/platform/dagwood/.venv/bin/activate

Initialize the project modules and install dependencies (only needed once):

cd ~/chromiumos/src/platform/dagwood
pip install west
unset ZEPHYR_BASE # only needed if there's other Zephyr checkouts in the system
west init -l firmware
west update -o=--depth=1 -n
pip install -U -r zephyr/scripts/requirements.txt
west sdk install -t arm-zephyr-eabi
sudo apt install cmake ninja-build ccache dfu-util

Build and flash:

cd ~/chromiumos/src/platform/dagwood
west update # only needed if there was a breaking change in the modules
west build firmware
west flash

Build without a ChromiumOS SDK

It's possible to build, flash and debug the firmware without the whole chromiumos checkout, in that case just pick an arbitrary directory as a workspace instead of ~/chromiumos/src/platform/dagwood and initialize it with west init --mf firmware/west.yml -m https://chromium.googlesource.com/chromiumos/platform/dagwood, the rest of the process it the same.

This setup takes less disk space, but results in a checkout with no tools to upload changelists.

Build with a standalone full Zephyr checkout

The firmware can be built against an existing Zephyr project checkout, in that case follow the project Getting Started Guide, make sure that the ZEPHYR_BASE variable is set and run west build from the project firwmare directory.

Available runners

There‘s multiple options for flashing and debugging the board firmware, depending on what’s hardware is available.

USB-DFU

Just for flashing, uses the embedded USB DFU bootloader and requires no additional debugging hardware.

When flashing via build_from_chroot.py, a running Dagwood board is automatically switched into DFU mode over USB and automatically resets back into the programmed firmware image once flashing completes:

./build_from_chroot.py -f --flasher dfu

You can also manually place a running Dagwood board into DFU mode from the host (./flash.py --dfu), from the Dagwood UART shell (dfu), or using the hardware buttons (press NRST while holding the BOOT0 button), and then run:

west flash -r dfu-util

JLink

JLink can be used for both flahing and debugging, requires the J-Link Software installed.

Flash with:

west flash -r jlink

or start a debugging session with

west debug -r jlink

ST-LINK

ST-LINK can be used for flashing and debugging with OpenOCD or STM32CubeProgrammer.

Flash directly using OpenOCD:

openocd -f firmware/boards/google/dagwood/support/openocd-stlink.cfg \
  -c "program build/dagwood/build-singleimage/zephyr/zephyr.elf verify reset exit"

Or using build_from_chroot.py:

./build_from_chroot.py -f

Or using west:

west flash -r openocd --config firmware/boards/google/dagwood/support/openocd-stlink.cfg

Or with STM32CubeProgrammer (requires host tools):

west flash -r stm32cubeprogrammer

Start a debugging session with:

west debug -r openocd

or

west debug -r stm32cubeprogrammer

CMSIS-DAP

CMSIS-DAP can be used for both flashing and debugging with openocd and is part of Zephyr SDK.

Flash with:

west flash -r openocd

or start a debugging session with

west debug -r openocd

Persistent serial port path

The project uses a pair of standard USB CDC-ACM interfaces for the main board and AIC board shell. These can be mapped to a persistent path using the following udev rules (add them on a file in /etc/udev/rules.d/):

SUBSYSTEM=="tty", ACTION=="add", ATTRS{interface}=="Dagwood shell", SYMLINK+="tty-dw-shell"
SUBSYSTEM=="tty", ACTION=="add", ATTRS{interface}=="EC shell", SYMLINK+="tty-ec-shell"

Signal and Pin Mapping Documentation

Reference pinouts and signal mappings between the 200-pin Intel MECC connector and the Dagwood fixture MCU as well as supported EC Add-In Cards (AICs):