Skip to content

Instantly share code, notes, and snippets.

View coralmw's full-sized avatar

Coral coralmw

View GitHub Profile
@coralmw
coralmw / Build env
Last active September 2, 2015 10:04
Combining the red-pitaya-notes and the stock red pitaya FPGA bit file to create a suitable package to put on the red pitaya.
pretty much red-pitaya-notes (for the ubuntu os) + the FPGA from the stock os.
http://fpga.org/2013/05/28/how-to-design-and-access-a-memory-mapped-device-part-one/
CMA: https://lwn.net/Articles/486301/
@coralmw
coralmw / gist:67ebefa5c2756e4ae066
Last active September 5, 2015 10:05
Using zynq OCM with red pitaya with pavel-demin notes
OCM: 256kb of on-chip memory
?I think? it's called ps7_ram_1_S_AXI_BASEADDR in the linker scripts, but that does not work.
on boot, dmesg has zynq-ocm f800c000.ocmc: ZYNQ OCM pool: 256 KiB @ 0x5e880000
This address works. un-segmented.
#define COMM_BASE 0x5e880000
app_cpu1:
no malloc, so no heap?
def. stack size: 0x2000 == 0.008 mb
sizeof(actionTable_t) == 20bytes
400ish entries if the stack was otherwise empty? a 1mb stack would allow for < 50000 entries
10mb stack space perhaps?
#### Monday
Expanded stack in the linkerscript to 0xA00000
typedef struct actionTable {
uint64_t nanos; // ulong max 4.9secs, ull max = 584 years
XTime clocks;
uint32_t pins;
uint32_t a1;
uint32_t a2;
} actionTable_t;
(XTime = u64)
niave assumption: that this is of size 8 + 8 + 4 + 4 + 4 = 28
@coralmw
coralmw / panic.txt
Created September 9, 2015 09:17
RP panic - after using low OCM?
Unable to handle kernel paging request at virtual address 6528d77c
pgd = 5bbc0000
[6528d77c] *pgd=00000000
Internal error: Oops - BUG: 5 [#1] PREEMPT SMP ARM
Modules linked in: zynq_remoteproc remoteproc virtio virtio_ring
CPU: 0 PID: 1637 Comm: modprobe Not tainted 3.19.0-xilinx #1
Hardware name: Xilinx Zynq Platform
task: 5d65c580 ti: 5bb0a000 task.ti: 5bb0a000
PC is at put_pid+0x10/0x54
LR is at __fput+0x11c/0x1a8
# curvefit .py Problem Sheet 5 example
import numpy as np
from scipy.optimize import curve_fit
import matplotlib.pyplot as plt
def func(x, a, b, c):
return a*np.exp(-b*x) + c # function to generate data for curve fit
# The first part of this program generates a set of data that follows a particular functional form that allows us to test the curvefit routine
x = np.linspace(0, 4, 50)
y = func(x, 3.0, 1.3, 5)
yn = y + 0.2*np.random.normal(size=len(x)) # adding some noise to the data points
@coralmw
coralmw / dvol.py
Created October 13, 2015 19:38
Changes the volume of a denon network-attached receiver.
"""Trivial app to change the volume of my denon reciever from my laptop.
"""
import telnetlib
import sys
if __name__ == "__main__":
if len(sys.argv) < 2:
print("""USAGE: dvol [0-100]""")
(lambda __builtin__: (lambda __print, __y, __d: [[[[[[[[[[(lambda __after: (lambda __after: (lambda ___: __after(__d))(__print('Usage: python main.py inputfilename [outputfilename]')) if __d.len(__d.sys.argv)<=1 else [(lambda __after: [__after(__d) for __d.outfilename in [(__d.sys.argv[2])]][0] if __d.len(__d.sys.argv)>=3 else (lambda __after: [__after(__d) for __d.outfilename in [('.ol.py'.join(__d.infilename.rsplit('.py',1)))]][0] if '.py' in __d.infilename else [__after(__d) for __d.outfilename in [((__d.infilename+'.ol.py'))]][0])(lambda __d: (lambda ___: __after(__d))(__print(('Writing to %s'%__d.outfilename)))))(lambda __d: [[[[(lambda ___: (lambda __after: (lambda ___: (lambda ___: (lambda ___: (lambda ___: __after(__d))(__print(__d.onelined)))(__print('--- ONELINED ---------------------------------')))(__print(__d.original)))(__print('--- ORIGINAL ---------------------------------')) if __d.VERBOSE else __after(__d))(lambda __d: __after(__d)))(__d.outfi.write((__d.onelined+'\n'))) for __d.onelined in
import pylab
from Tkinter import *
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
from matplotlib.figure import Figure
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
import numpy as np
class ParticleMotion:
def __init__(self, master):