Repository navigation
Xteink X4: PebbleOS on Simantic (boot + BLE) - #7
Draft
ShahriarAhnaf wants to merge 449 commits into
Draft
ShahriarAhnaf wants to merge 449 commits into
ShahriarAhnaf wants to merge 449 commits into
Conversation
Assisted-by: LLM Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
A toolchain file for Espressif's riscv32-esp-elf GCC. The prefix comes from CROSS_COMPILE, given to CMake or in the environment, else from PATH, else from where PlatformIO or ESP-IDF install the toolchain, and is then derived from the compiler found. RISC-V CPUs are built with -march and -mabi from their Kconfig, with no -mcpu. The libc build takes -mabi= along with the other arch flags, and meson's cpu_family is riscv32 or arm. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
GCC puts small objects in .sdata, .sbss, .scommon and .srodata on RISC-V: they go with the kernel's data, bss and read-only data. The patterns match nothing on ARM. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
mcu_state_is_isr() was a stub returning false on anything but ARM. The console, the UART log backend and the libc locks rely on it, so RISC-V reads the arch's interrupt nesting count. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
…vices
A prop of a *.regs.yaml may name a cell of a property with several, as
a GPIO specifier: {label: power_latch, prop: gpios, cell: 1} is the pin,
for early init code that drives it before there are devices.
Assisted-by: LLM
Signed-off-by: Eric Migicovsky <eric@repebble.com>
Some SoCs fetch instructions from their RAM through another address window than they read and write it. With RAMFUNC_ALIAS_OFFSET set, .ramfunc is linked at the start of RAM plus the offset, where the CPU fetches it, and copied to the start of RAM, which .ramfunc_copy reserves. The offset defaults to 0, which keeps the layout of every existing board: __ramfunc_copy_start is then __ramfunc_start. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
A machine-mode only port for RV32 cores, such as the ESP32-C3's. Context switches happen on trap exit: the tick and other interrupts save the frame on the thread's stack and run on the ISR stack, and a thread yields with a synchronous ecall. A trap taken on the ISR stack before the first thread runs stays below the frame it saved. Faults dump mcause, mepc, mtval and the registers through the fatal path. A fault while handling one resets the SoC straight away, since recording or logging it is what faulted. Atomics are done with interrupts masked, as the cores have no A extension. There is no MPU, userspace, coredump or stack guard yet. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
The ESP32-C3 boots straight from the flash through its ROM: the image starts with the header the ROM looks for, the code runs in place at 0x42000000 and the read-only data is read through 0x3c000000. The early init turns off the watchdogs the ROM may leave armed and keeps the clocks as the ROM leaves them. The interrupt matrix routes every source to one CPU line, whose handler dispatches the pending and enabled sources. A source disabled by an earlier handler in the same pass keeps its software request pending, for its enable to raise again. Picolibc is built from source: the toolchain's has TLS and a 64-bit time_t. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
The SoC's memory, CPU, APB clock, UARTs, timer groups, SYSTIMER, RTC controller, SYSTEM registers and interrupt matrix, with their bindings and that of the boot flash. Bindings use the upstream esp vendor prefix. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
Unit 0 of the SYSTIMER, a 52-bit counter at a fixed 16 MHz, is the clock source, and its comparator 0 the one-shot clock event device. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
Polled transmission and interrupt-driven reception. The APB clock it divides is a fixed-clock, so no new clock driver is needed. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
The qemu-esp32 runner pads the firmware into a flash image and boots it through the emulated ROM of the machine the board's yml names with the new qemu.machine key, from PEBBLE_QEMU_ESP32_BIN or PATH. The Pebble QEMU runner is untouched: it keys on CONFIG_QEMU, which these boards do not set. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
The esp32c3 machine of Espressif's QEMU, with UART0 for the console. The machine counts cycles at 160 MHz whatever the clocks. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
…topped On silicon, a target loaded while its comparator works only matches the counter reaching it: one the counter has already passed never raises the event, and the clock stops. QEMU fires it at once, which hid this. The comparator is stopped while the target is loaded and started again after, as ESP-IDF does: a target already passed then raises the event at once. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
The ROM leaves the CPU on the crystal halved, 20 MHz, and the PLL running for the USB PHY. The early init now sets the clock cpu0 gives: 160 or 80 MHz switch the CPU to the PLL, 40 MHz and its divisions take the crystal. A build-time check keeps clk_apb, the CPU clock up to 80 MHz, in step with it. cpu0 defaults to 160 MHz and clk_apb to 80 MHz. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
The serial port of the chip's USB-Serial-JTAG controller, a console that needs no UART pins. Only the FIFO, its packet handover and the reception interrupt are touched, never the USB side, so the host keeps its port and esptool its reset path whatever the firmware does. When no host takes the bytes within a timeout, transmission drops bytes without waiting until the host reads again. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
Pin levels, directions and level and edge interrupts through the GPIO matrix, the pads configured through the IO_MUX. The USB pins, GPIO18 and GPIO19, are refused: reconfiguring them drops the console and esptool's reset. The SoC nodes come with the pin controller's, which refers to this one. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
Pin states set the pads' function, pulls, input enable and drive strength in the IO_MUX, and route peripheral signals to and from pins through the GPIO matrix. The SoC gets its gpio and io_mux nodes, which refer to each other. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
An always-on rail had its enable pin configured off before being switched on, a glitch low on the pin. When the rail is a latch that keeps the board powered, that glitch can switch the board off. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
A board that powers itself from the battery through a latch pin, its power_latch node, has the early init drive the pin high before anything else, before there are devices: the board then stays on once the power button is released. The level is set before the pin is routed and enabled, so it never goes low, and a pad hold from before the reset is released. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
The esptool runner writes the image at the start of the flash, with the flash settings kept as they are, over the port given with --tty, ESPTOOL_PORT or a lab file. Its console flashes, resets the chip through the USB-Serial-JTAG and reads the port from the reset on, which is what pbl samples needs. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
The Xteink X4 e-reader, an ESP32-C3 with 16 MiB of flash, an e-paper panel, keys on ADC ladders and a power latch. The console is the USB-Serial-JTAG port: UART0's pins are the panel's chip select and the USB detect input. The latch is held from reset. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
The registers of GPSPI2, the general purpose SPI controller, and its clock and reset bits in SYSTEM. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
GPSPI2 as a master, moving data through its 64-byte buffer, chip selects on GPIOs. A transfer that times out resets the controller before the generic layer releases the chip select and the bus, so the block never keeps running past an error. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
Disabled, as every SoC node a board has to wire up. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
A header for display drivers that show a logical display on a panel at a whole-number scale, centred, with the panel mounted turned by a quarter turn or more: each panel pixel maps back to a logical one. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
The virtual RGB framebuffer of Espressif's QEMU machines, described as the panel it stands in for: a logical size and a whole-number scale shown centred on a panel, which may be mounted turned. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
A display class driver for the RGB framebuffer of Espressif's QEMU. It presents a 1-bit display, white as 1, and expands it into the framebuffer, scaled and turned as the devicetree gives. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
The machine's framebuffer, as the X4's 800x480 panel mounted in portrait: PebbleOS sees 480x800, and the window, which the machine limits to 600 rows, shows it sideways as the panel's controller scans it. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
pbl run opens an SDL window when the build has a display, with the monitor socket the Pebble QEMU runner uses for screendumps. The console command pbl samples runs stays headless. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
Add the ESP32-S3 devicetree include and bindings for the Xtensa LX7 CPU, interrupt matrix, RTC controller, system controller, and SPI flash. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
Update the qemu-esp32 runner to launch qemu-system-xtensa for esp32s3 boards without -icount throttling, add the qemu_esp32s3 board with UART0 console, SPI flash and QEMU RGB display, and enable it in the 21 integration samples. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
When a function using a VLA or alloca executes movsp while its caller window is spilled to [sp - 16], Xtensa raises EXCCAUSE_ALLOCA (5) so the caller can be underflowed back into registers before sp moves. Add the architectural alloca fast path in trap.S that sets PS.OWB to the current window, rotates back by a0[31:30], and enters the matching WindowUnderflow vector. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
Wire ESP32-S3 into firmware metadata, flash-backed mfg, resource bank sizing, and native SDK shim generation (skipping the foreign ABI shim lib when running ARM apps via Samsa on Xtensa), and add the 16 MiB partition map and qemu_esp32s3 xteinkx4 configuration. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
Extend the shared ESP32-C3 GPIO, pinctrl, and SPI2 drivers for ESP32-S3: - Support bank 1 registers (GPIOs 32..48) and PCPU_INT1 interrupts - Parameterize USB-Serial-JTAG pins (GPIO19/20), matrix signal bitfields, and SYSTEM SPI2 clock/reset offsets for CONFIG_SOC_ESP32S3 - Add ESP32-S3 pinctrl DT bindings, early power-latch hold, and expand sram0 to the full 412 KiB ROM-free SRAM1 window (0x3fc88000..0x3fcef000) Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
Add board definitions and PebbleOS firmware configurations for two ESP32-S3 e-reader targets using 800x480 SSD1677 panels on SPI2, 16 MiB flash, USB-Serial-JTAG console, fixed power-latch regulators, and digital gpio-keys: - xteink_x4_pro: SSD1677 (SCLK=12, MOSI=11, CS=13, DC=18, RST=14, BUSY=6), power latch GPIO1 HIGH, touch rail GPIO2 active-LOW, digital buttons (Up=GPIO0, Down=GPIO7, Power=GPIO3) - boox_picco: SSD1677 (SCLK=48, MOSI=47, CS=18, DC=17, RST=16, BUSY=15), power latch GPIO4 HIGH, peripheral rail GPIO0 active-LOW, digital buttons (Up=GPIO21, Down=GPIO9, Confirm=GPIO5, Power=GPIO2) Hardware pinouts referenced from CrossPoint / FreeInk (MIT). Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
A project could only use a Pebble package on the platforms the package
was built for. @rebble/clay, which most configurable apps depend on,
is JavaScript only but ships an empty archive for each platform it
knew, so a project targeting xteinkx4 was refused ("doesn't support
the 'xteinkx4' platform"). A package whose archives are all empty and
that has no resources is the same on every platform: a build of the
project now takes whichever build such a package has. A package with
code or resources still has to have been built for the platform.
Unit tests cover the three cases; a calculator app built against an
unmodified @rebble/clay for flint and xteinkx4.
Assisted-by: LLM
Signed-off-by: Eric Migicovsky <eric@repebble.com>
Bring up the ESP32-S3 reader, its peripherals and its display. Retain Flint compatibility alongside native app builds and package selection. Qualify rendering, framebuffer ownership and partial panel updates with host tests, emulator boots and physical X4 and X4 Pro runs. Picco board support has been built and still requires validation on the hardware. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
Keep app and resource payloads intact when preparing a native X4 PBW for a phone that selects Flint. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
Use word writes on independent storage. Preserve pixel order when source and destination alias. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
Keep visible rows stationary and drive changed cursor pixels before idle text refinement. Repair the old selection when input settles. Trim neutral holds from the local grayscale waveform. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
Store native-resolution edges in gap order and map coverage to the panel tones at load time. Keep the v3 glyph ABI and the original one- and two-bit font formats. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
Apply the SDK dispatch hook in the build directory, keeping the default interpreter intact. Offer the optimized dispatcher and 64-entry decode cache as a Pro build option. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
Retain the base and cumulative mask at opposite ends of an 8 KiB arena. Stage changes in the display transfer tile and fall back when a frame does not fit. This gives the Bluetooth controller enough contiguous memory to calibrate at startup. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
Display settings can draw rows without subtitles. Return the absent message directly instead of stripping a context prefix from a null pointer. Make the buffer form return an empty string and cover both paths in the catalog tests. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
Keep the task and hardware watchdogs active in ordinary firmware. Only register the shell commands that deliberately halt the system when a developer selects the diagnostic option. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
Build both readers from the same revision and export the native and Flint app SDK together. Publish the board-specific flash images, resource packs and watchfaces with checksums on the Xteink fork. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
Start system UI and notifications at the same size as the Smaller choice in Settings. Preserve the platform reference size for app layouts, existing system and notification preferences, and legacy notification text migrations. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
Include the 34 Pro watchfaces with their original identities, companion scripts, upstream attribution and reproducible SDK inputs. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
Verify the matched firmware and resource pair against release checksums. Install batches over USB or through the selected CoreApp developer link. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
Publish the bundled SDK tool directories on PATH before configuring the readers. Native shim generation and the Flint export invoke ARM tools directly even when CMake has located the SDK. Assisted-by: LLM Signed-off-by: Eric Migicovsky <eric@repebble.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| if (!s_base_size || buf->pitch != PITCH) { | ||
| return false; | ||
| } | ||
| struct reader prev = {.data = s_arena}, mask = {.data = s_arena + sizeof(s_arena) - s_mask_size}; |
| return false; | ||
| } | ||
| } | ||
| memcpy(s_arena + sizeof(s_arena) - next.size, next.data, next.size); |
|
|
||
| int uc8279_cursor_seed(const struct pbl_display_ssd1677 *epd, | ||
| const struct pbl_display_buffer *buf) { | ||
| struct reader prev = {.data = s_arena}, mask = {.data = s_arena + sizeof(s_arena) - s_mask_size}; |
| memcpy(font, s_edge_font, sizeof(font)); | ||
| font[9] &= ~FEATURE_EDGES4; | ||
| const uint8_t edges[] = {0, 0, 0xe4, 2, 1, 0x4e}; | ||
| memcpy(font + sizeof(font) - sizeof(edges), edges, sizeof(edges)); |
| memcpy(font, s_edge_font, sizeof(font)); | ||
| font[9] &= ~FEATURE_EDGES4; | ||
| const uint8_t edges[] = {0, 0, 0xe4, 2, 1, 0x4e}; | ||
| memcpy(font + sizeof(font) - sizeof(edges), edges, sizeof(edges)); |
| uint8_t font[sizeof(s_edge_font)]; | ||
| memcpy(font, s_edge_font, sizeof(font)); | ||
| const uint8_t edges[] = {0, 0x22, 0x22, 3, 0x22, 0x22}; | ||
| memcpy(font + sizeof(font) - sizeof(edges), edges, sizeof(edges)); |
| uint8_t font[sizeof(s_edge_font)]; | ||
| memcpy(font, s_edge_font, sizeof(font)); | ||
| const uint8_t edges[] = {0, 0x22, 0x22, 3, 0x22, 0x22}; | ||
| memcpy(font + sizeof(font) - sizeof(edges), edges, sizeof(edges)); |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tion) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
sim/on top of ericmigi/PebbleOScodex/xteink-combined@ 49be5ee:sim/run.sh ble|live, the X4 board/peers shared with the CrossPoint demo, and a BLE scanner peer.pebble>at real time; needs simantic-dev/pyrite#5055.Pebble 09CBseen by a second simulated C3.Base is our
main(coredevices upstream), so the diff includes ericmigi's X4 branch; this PR is a home for the demo, not for merging upstream.🤖 Generated with Claude Code