A minimal reference design showing Quilla QBOOT booting a Zephyr RTOS appliance on a GD32F502VE (Cortex-M33) instead of Quilla's own Contiki-based APP.
This is the Zephyr counterpart of Quilla.FR. The point of the demo is the
boundary between the two images: they share no header and no source file, only
a binary flash contract.
| Path | Contents |
|---|---|
quilla/ |
Independent clone of github.com/JiChiRen/Quilla (branch develop). Not tracked here; pull/merge upstream at any time. |
appliance/ |
Independent clone of github.com/GD32-MCU-IOT/gd32_zephyr (branch main), a Zephyr 4.4 downstream tree with GD32 support. Its directory structure is kept intact so upstream can be merged. Not tracked here. |
app/ |
The out-of-tree Zephyr application owned by this repository. Every Quilla-side capability is added through Zephyr's own registration mechanisms; no upstream Zephyr file is modified. |
doc/ |
Architecture, registration points, QBOOT adaptation, and build/upgrade guides (EN / zh-CN). |
tools/ |
check_contract.py (binary-contract checker) and qboot_image.py (factory image packer). |
Both upstream clones are deliberately excluded by .gitignore. Recreate them
with the commands in doc/build-and-upgrade.md.
GitHub language statistics: tools/*.py is excluded via .gitattributes
because those files are host-side helpers, not firmware. The repository is
classified by its C product code; most of that C lives in the untracked
upstream clones above and does not appear in the language bar.
| Item | Value |
|---|---|
| QBOOT | 0x08000000, 24 KiB |
| META | 0x08006000, 4 KiB (two 2 KiB slots, 256 B records) |
| APP | 0x08007000 .. 0x0807FFFF (484 KiB) |
| QAV1 record | 0x08007400 (APP start + 0x400), 8 bytes, inside the signed image |
| Console | USART0 / PB6 TX / PB7 RX / AF0 / 115200 8N1, DMA0 CH4 in QBOOT |
| Core clock | 160 MHz (8 MHz HXTAL + PLL), set by QBOOT and declared in the board DTS |
QBOOT sets SCB->VTOR = APP_START, loads MSP and the reset handler from the
first two words of the APP image, and jumps. The Zephyr image must therefore
start with its vector table at 0x08007000 with no image header.
All appliance-side behaviour is registered with Zephyr, never pasted into an unrelated Zephyr file:
| Capability | Zephyr mechanism | File |
|---|---|---|
part / version / swqboot commands |
SHELL_CMD_REGISTER |
app/src/quilla_shell.c |
[QAPP] boot banner |
SYS_INIT |
app/src/quilla_shell.c |
| LED heart-beat | K_THREAD_DEFINE + led0 devicetree alias |
app/src/led.c |
| META flag commit | Zephyr flash driver API, DT_CHOSEN(zephyr_flash_controller) |
app/src/quilla_meta.c |
| QAV1 record | section attribute + zephyr_linker_sources(ROM_START ...) |
app/src/quilla_secver.c, app/linker/quilla-secver.ld |
| Console and flash layout | out-of-tree board (BOARD_ROOT) + devicetree chosen/overlay |
app/boards/gd/gd32f502ve_quilla/, app/app.overlay |
| Version, geometry, partition | Kconfig | app/Kconfig, app/prj.conf |
See doc/zephyr-integration.md for the rationale of each choice.
Compiles: verified. On-target: full QIAP upgrade passed on hardware
(2026-11-09). A full clean west build -b gd32f502ve_quilla was executed
on native Windows with Zephyr 4.4 (ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb, GNU
Arm Embedded 13.2) and completes with zero warnings:
- FLASH 42 004 B / 484 KB (8.48 %), RAM 9 112 B / 64 KB (13.9 %)
- the
quilla_secver(QAV1) section lands exactly at0x08007400, verified inzephyr.bin(QAV1+ security version at offset 0x400) CONFIG_FLASH_LOAD_OFFSET=0x7000,CONFIG_FLASH_LOAD_SIZE=0x79000
Verified on real hardware (GD32F502VE, QBOOT V0.11.0002 in SEC mode):
- upgrade from the previous APP via
swqboot-> QBOOT -> QIAP: 42 004 B written in 5.2 s, SIGN verified (ACK_SIGN 0x84), anti-rollback accepted secver=1 - after the jump the banner
[QAPP] Quilla.ZP V1.0.0001arrives as one clean line (160 MHz clock handover and baud rate derivation correct); repeated cold boots behave identically - the Zephyr shell works;
helplistspart/version/swqbootetc. - the appliance's own
swqboot(META flag write through the Zephyr flash driver under XIP + cold reboot) returns to the[BOOT]banner without a META commit failure - a second full QIAP upgrade initiated from the ZP APP (same image, secver=1) passes with ACK_SIGN 0x84 again; META dual-slot records and anti-rollback behave correctly across repeated upgrades
Windows notes: a workspace path containing a space breaks both CMake/Ninja
and GCC (__FILE__ ends up inside unquoted assembler section names). Place
the project under a space-free path and none of this applies; if the path
cannot be changed, one workaround is to use 8.3 short paths everywhere after
configuration.
python tools/check_contract.py passes 22/22 checks against the two clones.
It compares partition geometry, META record layout, flag values, secver magic,
console wiring and the CRC reference vector. Run it after every upstream pull.
For porting to another MCU, tools/qboot_image.py hard-codes the GD32F502VE
geometry (512 KiB Flash / 64 KiB SRAM). See
doc/mcu-porting.md for the constant table and the
synchronisation checklist.
The appliance-owned files are BSD-3 (see LICENSE). The two upstream clones
keep their own licenses (Quilla BSD-3, Zephyr Apache-2.0) and are not
redistributed by this repository.