diff options
author | Alyssa Ross <hi@alyssa.is> | 2021-09-08 17:57:14 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2021-09-13 11:31:47 +0000 |
commit | ee7984efa14902a2ddd820c937457667a4f40c6a (patch) | |
tree | c9c1d046733cefe5e21fdd8a52104175d47b2443 /nixpkgs/pkgs/development/embedded/stm32 | |
parent | ffc9d4ba381da62fd08b361bacd1e71e2a3d934d (diff) | |
parent | b3c692172e5b5241b028a98e1977f9fb12eeaf42 (diff) | |
download | nixlib-ee7984efa14902a2ddd820c937457667a4f40c6a.tar nixlib-ee7984efa14902a2ddd820c937457667a4f40c6a.tar.gz nixlib-ee7984efa14902a2ddd820c937457667a4f40c6a.tar.bz2 nixlib-ee7984efa14902a2ddd820c937457667a4f40c6a.tar.lz nixlib-ee7984efa14902a2ddd820c937457667a4f40c6a.tar.xz nixlib-ee7984efa14902a2ddd820c937457667a4f40c6a.tar.zst nixlib-ee7984efa14902a2ddd820c937457667a4f40c6a.zip |
Merge commit 'b3c692172e5b5241b028a98e1977f9fb12eeaf42'
Diffstat (limited to 'nixpkgs/pkgs/development/embedded/stm32')
4 files changed, 218 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/embedded/stm32/betaflight/default.nix b/nixpkgs/pkgs/development/embedded/stm32/betaflight/default.nix new file mode 100644 index 000000000000..1ecf9be5d8d0 --- /dev/null +++ b/nixpkgs/pkgs/development/embedded/stm32/betaflight/default.nix @@ -0,0 +1,64 @@ +{ lib, stdenv, fetchFromGitHub +, gcc-arm-embedded, binutils-arm-embedded, python2 +, skipTargets ? [ + # These targets do not build, for the reasons listed, along with the last version checked. + # Probably all of the issues with these targets need to be addressed upstream. + "AG3X" # 3.4.0-rc4: has not specified a valid STM group, must be one of F1, F3, F405, F411 or F7x5. Have you prepared a valid target.mk? + "ALIENWHOOP" # 3.4.0-rc4: has not specified a valid STM group, must be one of F1, F3, F405, F411 or F7x5. Have you prepared a valid target.mk? + "FURYF3" # 3.4.0-rc4: flash region overflow + "OMNINXT" # 3.4.0-rc4: has not specified a valid STM group, must be one of F1, F3, F405, F411 or F7x5. Have you prepared a valid target.mk? +]}: + +stdenv.mkDerivation rec { + + pname = "betaflight"; + version = "3.4.0-rc4"; + + src = fetchFromGitHub { + owner = "betaflight"; + repo = "betaflight"; + rev = "8e9e7574481b1abba9354b24f41eb31054943785"; # Always use a commit id here! + sha256 = "1wyp23p876xbfi9z6gm4xn1nwss3myvrjjjq9pd3s0vf5gkclkg5"; + }; + + nativeBuildInputs = [ + gcc-arm-embedded binutils-arm-embedded + python2 + ]; + + postPatch = '' + sed -ri "s/REVISION.*=.*git log.*/REVISION = ${builtins.substring 0 10 src.rev}/" Makefile # Simulate abbrev'd rev. + sed -ri "s/binary hex/hex/" Makefile # No need for anything besides .hex + + substituteInPlace Makefile \ + --replace "--specs=nano.specs" "" + ''; + + enableParallelBuilding = true; + + preBuild = '' + buildFlagsArray=( + "NOBUILD_TARGETS=${toString skipTargets}" + "GCC_REQUIRED_VERSION=$(arm-none-eabi-gcc -dumpversion)" + all + ) + ''; + + installPhase = '' + runHook preInstall + + mkdir -p $out + cp obj/*.hex $out + + runHook postInstall + ''; + + meta = with lib; { + description = "Flight controller software (firmware) used to fly multi-rotor craft and fixed wing craft"; + homepage = "https://github.com/betaflight/betaflight"; + license = licenses.gpl3; + maintainers = with maintainers; [ elitak ]; + broken = true; + }; + +} diff --git a/nixpkgs/pkgs/development/embedded/stm32/inav/default.nix b/nixpkgs/pkgs/development/embedded/stm32/inav/default.nix new file mode 100644 index 000000000000..c1f762e47d86 --- /dev/null +++ b/nixpkgs/pkgs/development/embedded/stm32/inav/default.nix @@ -0,0 +1,56 @@ +{ lib, stdenv, fetchFromGitHub +, gcc-arm-embedded, binutils-arm-embedded, ruby +}: + +stdenv.mkDerivation rec { + + pname = "inav"; + version = "2.0.0-rc2"; + + src = fetchFromGitHub { + owner = "iNavFlight"; + repo = "inav"; + rev = "a8415e89c2956d133d8175827c079bcf3bc3766c"; # Always use a commit id here! + sha256 = "15zai8qf43b06fmws1sbkmdgip51zp7gkfj7pp9b6gi8giarzq3y"; + }; + + nativeBuildInputs = [ + gcc-arm-embedded binutils-arm-embedded + ruby + ]; + + postPatch = '' + sed -ri "s/REVISION.*=.*shell git.*/REVISION = ${builtins.substring 0 10 src.rev}/" Makefile # Simulate abbrev'd rev. + sed -ri "s/-j *[0-9]+//" Makefile # Eliminate parallel build args in submakes + sed -ri "s/binary hex/hex/" Makefile # No need for anything besides .hex + + substituteInPlace Makefile \ + --replace "--specs=nano.specs" "" + ''; + + enableParallelBuilding = true; + + preBuild = '' + buildFlagsArray=( + all + ) + ''; + + installPhase = '' + runHook preInstall + + mkdir -p $out + cp obj/*.hex $out + + runHook postInstall + ''; + + meta = with lib; { + description = "Navigation-enabled flight control software"; + homepage = "https://inavflight.github.io"; + license = licenses.gpl3; + maintainers = with maintainers; [ elitak ]; + broken = true; + }; + +} diff --git a/nixpkgs/pkgs/development/embedded/stm32/stm32cubemx/default.nix b/nixpkgs/pkgs/development/embedded/stm32/stm32cubemx/default.nix new file mode 100644 index 000000000000..bca4f87f9a55 --- /dev/null +++ b/nixpkgs/pkgs/development/embedded/stm32/stm32cubemx/default.nix @@ -0,0 +1,71 @@ +{ lib, stdenv, makeDesktopItem, copyDesktopItems, icoutils, fdupes, imagemagick, jdk11, fetchzip }: +# TODO: JDK16 causes STM32CubeMX to crash right now, so we fixed the version to JDK11 +# This may be fixed in a future version of STM32CubeMX. This issue has been reported to ST: +# https://community.st.com/s/question/0D53W00000jnOzPSAU/stm32cubemx-crashes-on-launch-with-openjdk16 +# If you're updating this derivation, check the link above to see if it's been fixed upstream +# and try replacing all occurrences of jdk11 with jre and test whether it works. +let + iconame = "STM32CubeMX"; +in +stdenv.mkDerivation rec { + pname = "stm32cubemx"; + version = "6.2.1"; + + src = fetchzip { + url = "https://sw-center.st.com/packs/resource/library/stm32cube_mx_v${builtins.replaceStrings ["."] [""] version}-lin.zip"; + sha256 = "0m5h01iq0mgrr9svj4gmykfi9lsyjpqzrkvlizff26c8dqad59c5"; + stripRoot = false; + }; + + nativeBuildInputs = [ icoutils fdupes imagemagick copyDesktopItems]; + desktopItems = [ + (makeDesktopItem { + name = "stm32CubeMX"; + exec = "stm32cubemx"; + desktopName = "STM32CubeMX"; + categories = "Development;"; + comment = "STM32Cube initialization code generator"; + icon = "stm32cubemx"; + }) + ]; + + buildCommand = '' + mkdir -p $out/{bin,opt/STM32CubeMX} + cp -r $src/MX/. $out/opt/STM32CubeMX/ + chmod +rx $out/opt/STM32CubeMX/STM32CubeMX + cat << EOF > $out/bin/${pname} + #!${stdenv.shell} + ${jdk11}/bin/java -jar $out/opt/STM32CubeMX/STM32CubeMX + EOF + chmod +x $out/bin/${pname} + + icotool --extract $out/opt/STM32CubeMX/help/${iconame}.ico + fdupes -dN . > /dev/null + ls + for size in 16 24 32 48 64 128 256; do + mkdir -pv $out/share/icons/hicolor/"$size"x"$size"/apps + if [ $size -eq 256 ]; then + mv ${iconame}_*_"$size"x"$size"x32.png \ + $out/share/icons/hicolor/"$size"x"$size"/apps/${pname}.png + else + convert -resize "$size"x"$size" ${iconame}_*_256x256x32.png \ + $out/share/icons/hicolor/"$size"x"$size"/apps/${pname}.png + fi + done; + ''; + + meta = with lib; { + description = "A graphical tool for configuring STM32 microcontrollers and microprocessors"; + longDescription = '' + A graphical tool that allows a very easy configuration of STM32 + microcontrollers and microprocessors, as well as the generation of the + corresponding initialization C code for the Arm® Cortex®-M core or a + partial Linux® Device Tree for Arm® Cortex®-A core), through a + step-by-step process. + ''; + homepage = "https://www.st.com/en/development-tools/stm32cubemx.html"; + license = licenses.unfree; + maintainers = with maintainers; [ wucke13 ]; + platforms = platforms.all; + }; +} diff --git a/nixpkgs/pkgs/development/embedded/stm32/stm32flash/default.nix b/nixpkgs/pkgs/development/embedded/stm32/stm32flash/default.nix new file mode 100644 index 000000000000..52b301154993 --- /dev/null +++ b/nixpkgs/pkgs/development/embedded/stm32/stm32flash/default.nix @@ -0,0 +1,27 @@ +{ lib, stdenv, fetchurl }: + +stdenv.mkDerivation rec { + pname = "stm32flash"; + version = "0.6"; + + src = fetchurl { + url = "mirror://sourceforge/${pname}/${pname}-${version}.tar.gz"; + sha256 = "sha256-7ptA1NPlzSi5k+CK4qLDxVm2vqhzDNfh1Acn3tsd2gk="; + }; + + buildFlags = [ "CC=${stdenv.cc.targetPrefix}cc" ]; + + installPhase = '' + # Manually copy, make install copies to /usr/local/bin + mkdir -pv $out/bin/ + cp stm32flash $out/bin/ + ''; + + meta = with lib; { + description = "Open source flash program for the STM32 ARM processors using the ST bootloader"; + homepage = "https://sourceforge.net/projects/stm32flash/"; + license = lib.licenses.gpl2; + platforms = platforms.all; # Should work on all platforms + maintainers = with maintainers; [ elitak ]; + }; +} |