Skip to content

Berry on Propeller 2 v0.9.6

Latest

Choose a tag to compare

@speccy88 speccy88 released this 10 Jun 01:45

Berry on Propeller 2 v0.9.6

This release is the first Propeller 2-first binary set for the current native
module and XMM work. It focuses on making the release page useful to someone who
has a board on the bench: choose the right Edge profile, flash the right binary,
and get to berry>.

Release Artifacts

This release ships these P2 binaries:

Artifact Board Profile Use
berry-p2-v0.9.6-p2edge-minimal-app.binary P2 Edge without PSRAM minimal / COMPACT RAM-load app image
berry-p2-v0.9.6-p2edge-minimal-flash-loader.binary P2 Edge without PSRAM minimal / COMPACT Flash install image
berry-p2-v0.9.6-p2edge32-xmm-app.binary P2 Edge 32 MB PSRAM xmm / LARGE XMM app payload
berry-p2-v0.9.6-p2edge32-xmm-flash-image.binary P2 Edge 32 MB PSRAM xmm / LARGE Standalone sparse flash image
SHA256SUMS.txt all all release checksums

The no-PSRAM full COMPACT profile and the PSRAM edge32 COMPACT profile are
not shipped as v0.9.6 binaries because the current native module set exceeds the
512 KiB Hub RAM image guard. The release keeps that guard intact instead of
publishing oversized images. Use minimal on no-PSRAM Edge boards, and use
xmm on the PSRAM Edge32 board.

Flash It To The Propeller 2

Set your serial port first. On the current macOS bench setup this is:

PORT=/dev/cu.usbserial-P97cvdxp
BAUD=230400
LOADP2=.third_party_cache/flexprop/bin/loadp2

For P2 Edge dev boot-from-flash, use boot switches:

FLASH=ON, triangle=OFF, inverted-triangle=OFF

For fast flash-only boot, use:

FLASH=ON, triangle=OFF, inverted-triangle=ON

Flash P2 Edge Without PSRAM

Use the p2edge-minimal-flash-loader artifact:

python3 tools/p2/loader/catalina_flash_program.py \
  --loadp2 "$LOADP2" \
  --port "$PORT" \
  --baud "$BAUD" \
  --image berry-p2-v0.9.6-p2edge-minimal-flash-loader.binary

Then attach to the REPL:

tio -b "$BAUD" "$PORT"

You should see a normal Berry banner and then:

berry>

Flash P2 Edge 32 MB PSRAM / XMM

Use the raw sparse XMM flash image artifact:

$LOADP2 -p "$PORT" -b "$BAUD" -FLASHRAW \
  berry-p2-v0.9.6-p2edge32-xmm-flash-image.binary

If your loadp2 does not support -FLASHRAW, use the equivalent high-memory
flash form:

$LOADP2 -p "$PORT" -b "$BAUD" -HIMEM=flash \
  @80000000=berry-p2-v0.9.6-p2edge32-xmm-flash-image.binary

Power-cycle or reset the board, then attach:

tio -b "$BAUD" "$PORT"

Expected startup shape:

Initializing PSRAM ... done
Berry 1.1.0 ... [xmm profile]
Starting Berry VM ... done
berry>

The XMM flash image uses the sparse startup loader, so it does not write long
runs of zeroes into PSRAM during boot.

Build The Same Profiles From Source

No-PSRAM P2 Edge minimal:

make p2-minimal TOOLCHAIN=catalina CATALINA_DIR=/Users/fred/Documents/Code/catalina-speccy88
make p2-flash TOOLCHAIN=catalina PORT="$PORT" P2_PROFILE=minimal P2_BOARD=p2edge \
  CATALINA_MODEL=COMPACT CATALINA_CLIB=-lcx CATALINA_SERIAL_LIB= \
  CATALINA_DIR=/Users/fred/Documents/Code/catalina-speccy88

P2 Edge 32 MB PSRAM XMM:

make p2-xmm TOOLCHAIN=catalina CATALINA_DIR=/Users/fred/Documents/Code/catalina-speccy88
make p2-xmm-flash TOOLCHAIN=catalina PORT="$PORT" \
  CATALINA_DIR=/Users/fred/Documents/Code/catalina-speccy88

What Is New In This Release

Native math, string, and task

math, string, and task are firmware-native modules on the active P2 path.
math no longer needs /modules/math.be on SD, and uses P2 CORDIC-backed
helpers where appropriate.

import math
import string
import task

print(math.sqrt(81))
print(string.toupper("propeller"))
print(task.info())

Friendly Cooperative Tasks

The native task scheduler provides cooperative tasks, sleep, wait/signal,
status, and RTOS-inspired primitives inside one Berry VM.

import p2
import task

def blink(pin, ms)
    p2.toggle(pin)
    return task.sleep(ms)
end

h = task.start(blink, 38, 250)
task.run(20)
task.stop(h)

Native Cog Handles

p2.cog supports native handle-backed work for supported task descriptors, such
as LED blinkers on another cog.

import p2

def blinker(pin, ms)
    return p2.cog.blinker(pin, ms)
end

h = p2.cog.spawn(blinker, 38, 250)
print(p2.cog.info(h))
p2.cog.stop(h)

Faster XMM Boot Feedback

The XMM flash path now has visible startup progress:

Initializing PSRAM ... done
Starting Berry VM ... done

The sparse flash image reports populated records and skips long zero-filled
regions during the PSRAM copy.

Known Limits

  • p2-full for no-PSRAM Edge currently exceeds the 512 KiB Hub RAM image guard.
  • p2-edge32 COMPACT currently exceeds the same Hub RAM image guard.
  • Use XMM for the full PSRAM Edge experience in this release.
  • This release build was compiled with Catalina 8.8.9 from the native Catalina
    checkout. The local .third_party_cache/catalina-v8.8.9-build executable was
    not usable on this Mac because it had the wrong executable format.