roll: pigweed pw_multibuf: Allow iterating all v2 chunks

MBv2 allows iterating over all the contiguous chunks in the buffer. This
skips over boundaries between inserted chunks when the memory is
contiguous, and also skips zero-sized chunks.

For backwards compatibility with MBv1, allow also a "raw" unfiltered
iteration of the chunks, which enumerates all the entries in the
internal deque, even if empty.

The new iterators and chunk range types are only slightly different from
the previous types in a few key functions, so an added template argument
selects whether the iteration is filtered or not.

Original-Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/354257
Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>
Copybara-Verified: Copybara Prod <copybara-worker-blackhole@google.com>
Original-Revision: fa7e58742b79c39a109cb04473a218a9e62be8e8

Rolled-Repo: https://pigweed.googlesource.com/pigweed/pigweed
Rolled-Commits: 0cb639eb4ada75..fa7e58742b79c3
Roll-Count: 1
Roller-URL: https://cr-buildbucket.appspot.com/build/8693407705446896305
GitWatcher: ignore
CQ-Do-Not-Cancel-Tryjobs: true
Change-Id: I7061113bb3eaae9e832736449b643afb1e1afba4
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/showcase/sense/+/360754
Commit-Queue: Pigweed Roller <pigweed-roller@pigweed-service-accounts.iam.gserviceaccount.com>
Bot-Commit: Pigweed Roller <pigweed-roller@pigweed-service-accounts.iam.gserviceaccount.com>
1 file changed
tree: d387908480b4c411377e584d5d4bb624cfefa671
  1. .github/
  2. .vscode/
  3. apps/
  4. device/
  5. modules/
  6. system/
  7. targets/
  8. tools/
  9. web_app/
  10. .bazelignore
  11. .bazelrc
  12. .bazelversion
  13. .black.toml
  14. .buildifier.json
  15. .clang-format
  16. .clang-tidy
  17. .clangd.shared
  18. .gitignore
  19. .pw_console.yaml
  20. .pylintrc
  21. AUTHORS
  22. BUILD.bazel
  23. CONTRIBUTING.md
  24. LICENSE
  25. MODULE.bazel
  26. MODULE.bazel.lock
  27. mypy.ini
  28. OWNERS
  29. pigweed.json
  30. pw
  31. README.md
  32. REPO.bazel
  33. workflows.json
README.md

Sense

git clone https://pigweed.googlesource.com/pigweed/showcase/sense

Welcome to Pigweed Sense, a tour of key Pigweed components experienced through an imagined air quality product.

Please visit Sense: An interactive tour through Pigweed to get started.

Trying out changes to Pigweed with Pigweed Sense

If you'd like to test out changes to the main Pigweed code with Pigweed Sense, you will need to alter the your Pigweed Sense MODULE.bazel file to point to a local Pigweed checkout.

The typical workflow is to have the Pigweed and Pigweed Sense checkouts be subdirectories of the same parent directory.

/path/to/your/checkouts/
├── sense/
└── pigweed/

If you haven't yet cloned the Pigweed repository, you can do so with:

git clone https://pigweed.googlesource.com/pigweed/pigweed

Once that is done, you can modify the Sense MODULE.bazel to switch to using the local checkout.

  • First locate the existing “pigweed” module definition. It will look something like this:

    git_override(
        module_name = "pigweed",
        # ROLL: Warning: this entry is automatically updated.
        # ROLL: Last updated 2025-10-05.
        # ROLL: By https://cr-buildbucket.appspot.com/build/8701840885187145297.
        commit = "85ff7d8715ad7bcff4a1286f2d2d2139cbe11291",
        remote = "https://pigweed.googlesource.com/pigweed/pigweed",
    )
    
  • Change it instead:

    # Override for local Pigweed development.
    local_path_override(
        module_name = "pigweed",
        path = "../pigweed",
    )
    

Once you've landed changes to Pigweed, and our rollers have updated the Pigweed Sense dependencies, you can revert the MODULE.bazel changes.

Debugging Pigweed Sense issues

GDB with OpenOCD as a bridge

On Linux, MacOS, and Windows (with MSYS2) You can use OpenOCD to create a bridge for gdb.

However if you have a Pico2 (rp2350), you must build OpenOCD from source, as the latest official release build (0.12.0) does not include support.

The Raspberry Pi Foundation also maintains it's own pi-focused fork of the OpenCD sources at https://github.com/raspberrypi/openocd which supports the rp2350. You can download prebuilt binaries for it from https://github.com/raspberrypi/pico-sdk-tools.

If you are building OpenOCD from it source code, you can find some notes on this thread since the cmsis-dap.cfg driver support for the Raspberry Pi Debug Probe isn't necessarily included by default.

https://forums.raspberrypi.com/viewtopic.php?p=2322149#p2322149

Once you have a working OpenOCD installation supporting your target, you can launch it in a shell session to start it as a bridge server for gdb.

# Note: Use target/rp2040.cfg instead for the original Pico.
openocd -f interface/cmsis-dap.cfg -f target/rp2350.cfg -c "adapter speed 5000"

You can then launch gdb to connect to the bridge, and to reset the device to start with gdb at the initial entry point, and to trap on any ARM Cortex-M hardware events (such as a bus error or divide by zero).

arm-none-eabi-gdb -ex "target extended-remote :3333" \
        -ex "monitor reset init" \
        -ex "monitor cortex_m vector_catch all" \
        path/to/target.elf

For example:

# Note: Switch "rp23500" to "rp2040" below if you have the original Pico.
# Note: You will need to stop and later restart OpenOCD to flash the target.
# After: bazel run //apps/blinky:flash_rp2350
$ arm-none-eabi-gdb -ex "target extended-remote :3333" \
        -ex "monitor reset halt" \
        -ex "monitor cortex_m vector_catch all" \
        bazel-bin/apps/blinky/rp2350_blinky.elf
# [... gdb startup messages ... ]
Reading symbols from bazel-bin/apps/blinky/rp2350_blinky.elf...
Remote debugging using :3333
warning: multi-threaded target stopped without sending a thread-id, using first non-exited thread
0x00000088 in ?? ()
[rp2350.cm0] halted due to debug-request, current mode: Thread
xPSR: 0xf9000000 pc: 0x00000088 msp: 0xf0000000
[rp2350.cm1] halted due to debug-request, current mode: Thread
xPSR: 0xf9000000 pc: 0x00000088 msp: 0xf0000000
available
available
(gdb) b main
Breakpoint 1 at 0x100001ee: file apps/blinky/main.cc, line 25.
Note: automatically using hardware breakpoints for read-only addresses.
(gdb) c
Continuing.

Thread 1 "rp2350.cm0" hit Breakpoint 1, main () at apps/blinky/main.cc:25
25        sense::system::Init();
(gdb)

You can find more information in the “Getting started with Raspberry Pi Pico-series” documentation provided by the Raspberry Pi Foundation. In particular, “Appendix A: Debugprobe” covers OpenOCD and debugging.