2022-08-12 12:06:08 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, pkg-config
|
|
|
|
, pkgsCross
|
|
|
|
, bintools-unwrapped
|
|
|
|
, libffi
|
|
|
|
, libusb1
|
2023-03-24 00:07:29 +00:00
|
|
|
, wxGTK32
|
2022-08-12 12:06:08 +00:00
|
|
|
, python3
|
|
|
|
, gcc-arm-embedded
|
|
|
|
, klipper
|
|
|
|
, avrdude
|
|
|
|
, stm32flash
|
|
|
|
, mcu ? "mcu"
|
|
|
|
, firmwareConfig ? ./simulator.cfg
|
|
|
|
}: stdenv.mkDerivation rec {
|
|
|
|
name = "klipper-firmware-${mcu}-${version}";
|
|
|
|
version = klipper.version;
|
|
|
|
src = klipper.src;
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
python3
|
|
|
|
pkgsCross.avr.stdenv.cc
|
|
|
|
gcc-arm-embedded
|
|
|
|
bintools-unwrapped
|
|
|
|
libffi
|
|
|
|
libusb1
|
|
|
|
avrdude
|
|
|
|
stm32flash
|
|
|
|
pkg-config
|
2023-03-24 00:07:29 +00:00
|
|
|
wxGTK32 # Required for bossac
|
2022-08-12 12:06:08 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
preBuild = "cp ${firmwareConfig} ./.config";
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
patchShebangs .
|
|
|
|
'';
|
|
|
|
|
|
|
|
makeFlags = [
|
|
|
|
"V=1"
|
|
|
|
"KCONFIG_CONFIG=${firmwareConfig}"
|
2023-03-24 00:07:29 +00:00
|
|
|
"WXVERSION=3.2"
|
2022-08-12 12:06:08 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out
|
|
|
|
cp ./.config $out/config
|
2023-05-24 13:37:59 +00:00
|
|
|
cp out/klipper.bin $out/ || true
|
|
|
|
cp out/klipper.elf $out/ || true
|
2024-07-27 06:49:29 +00:00
|
|
|
cp out/klipper.uf2 $out/ || true
|
2022-08-12 12:06:08 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
dontFixup = true;
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
inherit (klipper.meta) homepage license;
|
|
|
|
description = "Firmware part of Klipper";
|
|
|
|
maintainers = with maintainers; [ vtuan10 ];
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|