forked from M-Labs/nix-servo
Compare commits
No commits in common. "fc71fe0ab358ef3513d6e88ae92d8b3d190737c9" and "3d98549fd1c6b539820e434bf4707317c6c37eff" have entirely different histories.
fc71fe0ab3
...
3d98549fd1
|
@ -21,7 +21,7 @@ import mmap
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import spidev
|
import spidev
|
||||||
from pyfastservo.common import (
|
from common import (
|
||||||
ADC_AFE_CTRL_ADDR,
|
ADC_AFE_CTRL_ADDR,
|
||||||
ADC_BITSLIP_ADDR,
|
ADC_BITSLIP_ADDR,
|
||||||
ADC_CH0_HIGH_ADDR,
|
ADC_CH0_HIGH_ADDR,
|
||||||
|
|
|
@ -22,8 +22,8 @@ MAP_SIZE = 0x1000
|
||||||
MAP_MASK = 0xFFF
|
MAP_MASK = 0xFFF
|
||||||
PAGESIZE = 0x1000
|
PAGESIZE = 0x1000
|
||||||
|
|
||||||
# LINIEN_OFFSET = 0x0
|
LINIEN_OFFSET = 0x0
|
||||||
LINIEN_OFFSET = 0x300000
|
# LINIEN_OFFSET = 0x300000
|
||||||
|
|
||||||
# ----------------------------------------------------------------
|
# ----------------------------------------------------------------
|
||||||
# FRONT PANEL LEDS REGISTER ADDRESSES
|
# FRONT PANEL LEDS REGISTER ADDRESSES
|
||||||
|
|
|
@ -21,7 +21,7 @@ import mmap
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import spidev
|
import spidev
|
||||||
from pyfastservo.common import (
|
from common import (
|
||||||
CH0_HIGH_WORD_ADDR,
|
CH0_HIGH_WORD_ADDR,
|
||||||
CH0_LOW_WORD_ADDR,
|
CH0_LOW_WORD_ADDR,
|
||||||
CH1_HIGH_WORD_ADDR,
|
CH1_HIGH_WORD_ADDR,
|
||||||
|
|
|
@ -21,7 +21,7 @@ import mmap
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from pyfastservo.common import (
|
from common import (
|
||||||
LED0_BASE_ADDR,
|
LED0_BASE_ADDR,
|
||||||
LED1_BASE_ADDR,
|
LED1_BASE_ADDR,
|
||||||
LED2_BASE_ADDR,
|
LED2_BASE_ADDR,
|
||||||
|
|
|
@ -17,7 +17,9 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from pyfastservo import adc, si5340, dac
|
import adc
|
||||||
|
import si5340
|
||||||
|
import dac
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
si5340.configure_si5340()
|
si5340.configure_si5340()
|
||||||
|
|
44
flake.nix
44
flake.nix
|
@ -180,27 +180,6 @@
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
pyfastservo = pkgs-armv7l.python3Packages.buildPythonPackage rec {
|
|
||||||
name = "pyfastservo";
|
|
||||||
src = ./fast-servo;
|
|
||||||
preBuild = ''
|
|
||||||
cat > setup.py << EOF
|
|
||||||
from setuptools import setup
|
|
||||||
|
|
||||||
setup(
|
|
||||||
name="pyfastservo",
|
|
||||||
packages=["pyfastservo"],
|
|
||||||
install_requires=["spidev", "smbus2"],
|
|
||||||
entry_points = {"console_scripts": ["fp_leds=pyfastservo.fp_leds:main"]},
|
|
||||||
)
|
|
||||||
EOF
|
|
||||||
'';
|
|
||||||
propagatedBuildInputs = with pkgs-armv7l.python3Packages; [
|
|
||||||
spidev
|
|
||||||
smbus2
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
mkbootimage = pkgs.stdenv.mkDerivation {
|
mkbootimage = pkgs.stdenv.mkDerivation {
|
||||||
pname = "mkbootimage";
|
pname = "mkbootimage";
|
||||||
version = "2.3dev";
|
version = "2.3dev";
|
||||||
|
@ -230,25 +209,8 @@
|
||||||
extraModules = [
|
extraModules = [
|
||||||
"${patched-not-os}/zynq_image.nix"
|
"${patched-not-os}/zynq_image.nix"
|
||||||
] ++ pkgs.lib.optionals (board == "fast-servo") [
|
] ++ pkgs.lib.optionals (board == "fast-servo") [
|
||||||
({ config, pkgs, lib, ... }: {
|
({ config, pkgs, ... }: {
|
||||||
environment.systemPackages = [
|
environment.systemPackages = [ linien-server ];
|
||||||
linien-server
|
|
||||||
(pkgs.python3.withPackages(ps: [ pyfastservo ]))
|
|
||||||
];
|
|
||||||
boot.postBootCommands = lib.mkAfter ''
|
|
||||||
|
|
||||||
# Program the FPGA
|
|
||||||
set +x
|
|
||||||
echo "Loading bitstream into SRAM..."
|
|
||||||
echo 0 > /sys/class/fpga_manager/fpga0/flags
|
|
||||||
mkdir -p /lib/firmware
|
|
||||||
cp ${fast-servo-gateware}/gateware.bin /lib/firmware/
|
|
||||||
echo gateware.bin > /sys/class/fpga_manager/fpga0/firmware
|
|
||||||
|
|
||||||
# Run device init scripts
|
|
||||||
echo "Initializing clock generator, ADC, and DAC..."
|
|
||||||
python3 -m pyfastservo.initialize
|
|
||||||
'';
|
|
||||||
})];
|
})];
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
inherit crossSystem;
|
inherit crossSystem;
|
||||||
|
@ -426,7 +388,7 @@
|
||||||
BASE=$(realpath $(dirname $0))
|
BASE=$(realpath $(dirname $0))
|
||||||
|
|
||||||
qemu-img convert -O qcow2 -f raw -o preallocation=metadata $BASE/sd-image.img $IMGDIR/sd-sparse.qcow2
|
qemu-img convert -O qcow2 -f raw -o preallocation=metadata $BASE/sd-image.img $IMGDIR/sd-sparse.qcow2
|
||||||
qemu-img create -F qcow2 -f qcow2 -b $IMGDIR/sd-sparse.qcow2 $IMGDIR/sd-overlay.qcow2 2G
|
qemu-img create -F qcow2 -f qcow2 -b $IMGDIR/sd-sparse.qcow2 $IMGDIR/sd-overlay.qcow2 1G
|
||||||
|
|
||||||
# Some command arguments are based from samples in Xilinx QEMU User Documentation
|
# Some command arguments are based from samples in Xilinx QEMU User Documentation
|
||||||
# See: https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/821854273/Running+Bare+Metal+Applications+on+QEMU
|
# See: https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/821854273/Running+Bare+Metal+Applications+on+QEMU
|
||||||
|
|
Loading…
Reference in New Issue