Skip to content

Instantly share code, notes, and snippets.

@trabucayre
trabucayre / luna.py
Last active February 4, 2026 10:29
luna wrapper in LiteX
#
# Copyright (c) 2025 Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
#
# SPDX-License-Identifier: BSD-2-Clause
import os
import migen
from litex.gen import *
#!/usr/bin/env python3
"""
Device Tree Overlay Generator - Generates DTS overlays with fragments.
Creates overlay files that can be dynamically loaded to modify existing device trees
"""
import argparse
import sys
import os
import json
# Build
```
make ARCH=arm CROSS_COMPILE=arm-linux- DEVICE_TREE=zynq-zed xilinx_zynq_virt_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux- DEVICE_TREE=zynq-zed
make ARCH=arm CROSS_COMPILE=arm-linux- DEVICE_TREE=zynq-zed spl/boot.bin
make ARCH=arm CROSS_COMPILE=arm-linux- DEVICE_TREE=zynq-zed u-boot.img
```
# uboot config
@trabucayre
trabucayre / gpiodjtag.cpp
Last active July 15, 2022 06:58
libgpiod wrapper for JTAG
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <gpiod.h>
#include <cstring>
#include <stdexcept>
/*!
* \brief LibGPIOD driver
@trabucayre
trabucayre / gen_pm_cfg.tcl
Created January 22, 2022 06:35
Zynq Ultrascale+ MPSoC: pm_cfg_obj.c generation script
# xsct -nodisp -sdx gen_pm_cfg.tcl project.xsa
# open the hardware design and produces:
# - bsp files
# - fsbl structure
#
# According to
# https://lucaceresoli.net/zynqmp-uboot-spl-pmufw-cfg-load/
# pm_cfg_obj.c is required by pmufw (Platform Management Unit) at boot time
# used with https://github.com/lucaceresoli/zynqmp-pmufw-builder
# in uboot context allows to build a fully functional uboot ready