Skip to content

Instantly share code, notes, and snippets.

@mithro
mithro / HDMI-Signals.txt
Created August 23, 2016 01:38
HDMI Signals to various buffers.
---- High speed speed signals
HDMI_CLK_N - LVDS
HDMI_CLK_P - LVDS
HDMI_D0_N - LVDS
HDMI_D0_P - LVDS
HDMI_D1_N - LVDS
HDMI_D1_P - LVDS
diff -u -r an0042_efm32_usb_uart_bootloader/src/main.c an0042_efm32_usb_uart_bootloader_hg/src/main.c
--- an0042_efm32_usb_uart_bootloader/src/main.c 2015-11-05 14:45:54.000000000 +1100
+++ an0042_efm32_usb_uart_bootloader_hg/src/main.c 2016-02-18 20:00:18.000000000 +1100
@@ -46,6 +46,7 @@
#include "retargetdebug.h"
/*** Typedef's and defines. ***/
+#define BOOTLOADER_VERSION_STRING "EFM32HG bootloader v1.0"
/** Version string, used when the user connects */
@mithro
mithro / codecs_utf8_replace.py
Created September 14, 2016 03:54
Python codec/encoding which uses errors='replace' by default rather than errors='strict'
import codecs
def find_utf8_replace(encoding):
"""Return the codec for 'utf8-replace'."""
utf8_codecinfo = codecs.lookup('utf-8')
def wrap(f):
return lambda data, errors='replace', **kw: f(data, errors, **kw)
if encoding == 'utf8-replace':
#!/bin/bash
sed -i -e's/_D1+/_CLK+/' -e's/_D1-/_CLK-/' $(grep -R -l '_D1+' . | grep '.sch')
git commit -a -m "HDMI signal fixes (1) - s/_D1/_CLK/"
sed -i -e's/_D2+/_D0+/' -e's/_D2-/_D0-/' $(grep -R -l '_D2+' . | grep '.sch')
git commit -a -m "HDMI signal fixes (2) - s/_D2/_D0/"
sed -i -e's/_D3+/_D1+/' -e's/_D3-/_D1-/' $(grep -R -l '_D3+' . | grep '.sch')
git commit -a -m "HDMI signal fixes (3) - s/_D3/_D1/"
sed -i -e's/_D4+/_D2+/' -e's/_D4-/_D2-/' $(grep -R -l '_D4+' . | grep '.sch')
git commit -a -m "HDMI signal fixes (4) - s/_D4/_D2/"
#!/bin/bash
PREFIX=/opt/lm32
MAKE_ARGS=-j128
TARGET=lm32-elf
set -x
set -e
# Build binutils + gcc
@mithro
mithro / check_csrs.py
Created January 12, 2017 02:14
Hacky script to check the csrs don't violate constraints in litex
#!/usr/bin/env python3
import sys
import csv
import pprint
print(sys.argv[1])
data = list(csv.reader(open(sys.argv[1],'r')))
bases = [x for x in data if x[0] == 'csr_base']
@mithro
mithro / or1klitex-opsis.dts
Created April 5, 2017 05:45
Linux DeviceTree Stub for Litex with mor1k running on Numato Opsis
/dts-v1/;
/ {
compatible = "opencores,or1ksim";
#address-cells = <1>;
#size-cells = <1>;
interrupt-parent = <&pic>;
chosen {
bootargs = "console=uart,mmio,0x90000000,115200";
};
@mithro
mithro / or1k-j-ops.c
Last active April 11, 2017 03:07
Code for dynamically patching or1k l.j functions....
/*
* l.j instruction is opcode 0 and does a
* PC ← exts(Immediate << 2) + JumpInsnAddr
*/
// Top 6 bits is the op code
#define OPENRISC_OPCODE_MASK 0xfc000000 // Top 6 bits
#define OPENRISC_OPCODE_J 0x0 << 26
#define OPENRISC_OPCODE_BNF 0x3 << 26
#define OPENRISC_OPCODE_BF 0x4 << 26
@mithro
mithro / symposium-review-extra.js
Last active August 2, 2018 10:57
GreaseMonkey / TamperMonkey script to make Linux.conf.au (Symposium) reviews a bit nicer
// ==UserScript==
// @name symposium-review-extra
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Show all the tabs in the review pane at once.
// @author You
// @match https://rego.linux.conf.au/reviews/review/.*
// @match https://rego.linux.conf.au/reviews/review/*
// @downloadURL https://gist.github.com/mithro/e60a3f8b62696d1cff12dbb7e1377c47.js
// @updateURL https://gist.github.com/mithro/e60a3f8b62696d1cff12dbb7e1377c47.js
@mithro
mithro / README.md
Last active October 5, 2017 10:48
MimasV2 mor1kx tuning patches

Patches for the configs used to look at the resource usage.

  • Base mor1kx - v5.0
  • Base HDMI2USB-litex-firmware rev - or1k-fixing
  • 9949934e2804238be9ccda9e17e60e34c233cfab - git+ssh://[email protected]/mithro/HDMI2USB-litex-firmware.git
  • Base LiteX rev - or1k-mimasv2
  • 1b7fa415b6c51faf1f616bbc36f06679e5fb6568 - git+ssh://github.com/mithro/litex.git