Compare commits
2 Commits
1c500e015c
...
97cb513fd5
Author | SHA1 | Date | |
---|---|---|---|
97cb513fd5 | |||
ea12d87356 |
18
flake.lock
generated
18
flake.lock
generated
@ -41,11 +41,11 @@
|
|||||||
"pre-commit-hooks": "pre-commit-hooks"
|
"pre-commit-hooks": "pre-commit-hooks"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1722605649,
|
"lastModified": 1724763216,
|
||||||
"narHash": "sha256-T5dzUFRb2ocZ+LB2qBZufewdUFQs0pB4fnLKIWBLd9Y=",
|
"narHash": "sha256-oW2bwCrJpIzibCNK6zfIDaIQw765yMAuMSG2gyZfGv0=",
|
||||||
"owner": "cachix",
|
"owner": "cachix",
|
||||||
"repo": "devenv",
|
"repo": "devenv",
|
||||||
"rev": "a07842582c030fdf2ccf07d3b1402b2a46908856",
|
"rev": "1e4ef61205b9aa20fe04bf1c468b6a316281c4f1",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -122,11 +122,11 @@
|
|||||||
"nixpkgs-lib": "nixpkgs-lib"
|
"nixpkgs-lib": "nixpkgs-lib"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1722555600,
|
"lastModified": 1725024810,
|
||||||
"narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=",
|
"narHash": "sha256-ODYRm8zHfLTH3soTFWE452ydPYz2iTvr9T8ftDMUQ3E=",
|
||||||
"owner": "hercules-ci",
|
"owner": "hercules-ci",
|
||||||
"repo": "flake-parts",
|
"repo": "flake-parts",
|
||||||
"rev": "8471fe90ad337a8074e957b69ca4d0089218391d",
|
"rev": "af510d4a62d071ea13925ce41c95e3dec816c01d",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -348,11 +348,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs_2": {
|
"nixpkgs_2": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1722640603,
|
"lastModified": 1725067332,
|
||||||
"narHash": "sha256-TcXjLVNd3VeH1qKPH335Tc4RbFDbZQX+d7rqnDUoRaY=",
|
"narHash": "sha256-bMi5zhDwR6jdmN5mBHEu9gQQf9CibIEasA/6mc34Iek=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "81610abc161d4021b29199aa464d6a1a521e0cc9",
|
"rev": "192e7407cc66e2eccc3a6c5ad3834dd62fae3800",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
13
flake.nix
13
flake.nix
@ -14,6 +14,8 @@
|
|||||||
flake-parts.lib.mkFlake { inherit inputs; } {
|
flake-parts.lib.mkFlake { inherit inputs; } {
|
||||||
imports = [
|
imports = [
|
||||||
devenv.flakeModule
|
devenv.flakeModule
|
||||||
|
|
||||||
|
./mcu
|
||||||
];
|
];
|
||||||
systems = [ "x86_64-linux" ];
|
systems = [ "x86_64-linux" ];
|
||||||
|
|
||||||
@ -26,14 +28,13 @@
|
|||||||
rootFileContent = builtins.readFile rootdir.outPath;
|
rootFileContent = builtins.readFile rootdir.outPath;
|
||||||
in
|
in
|
||||||
pkgs.lib.mkIf (rootFileContent != "") rootFileContent;
|
pkgs.lib.mkIf (rootFileContent != "") rootFileContent;
|
||||||
withRootdir = f: mkMerge [
|
|
||||||
(import f)
|
|
||||||
{ devenv.root = rootdirOpt; }
|
|
||||||
];
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
devenv.shells = {
|
_module.args.libMy = {
|
||||||
mcu = withRootdir mcu/devenv.nix;
|
withRootdir = c: mkMerge [
|
||||||
|
c
|
||||||
|
{ devenv.root = rootdirOpt; }
|
||||||
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
40
mcu/default.nix
Normal file
40
mcu/default.nix
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
{
|
||||||
|
perSystem = { libMy, pkgs, ... }: {
|
||||||
|
devenv.shells.mcu = libMy.withRootdir {
|
||||||
|
packages = with pkgs; [
|
||||||
|
gnumake
|
||||||
|
cmake
|
||||||
|
pkgsCross.arm-embedded.buildPackages.gdb # ARM one is broken
|
||||||
|
gcc-arm-embedded
|
||||||
|
python3
|
||||||
|
picotool
|
||||||
|
openocd-rp2040
|
||||||
|
];
|
||||||
|
|
||||||
|
env = {
|
||||||
|
PICO_SDK_PATH = "${pkgs.pico-sdk}/lib/pico-sdk";
|
||||||
|
};
|
||||||
|
|
||||||
|
scripts = {
|
||||||
|
build.exec = ''
|
||||||
|
cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug -D PICO_STDIO_SEMIHOSTING=1
|
||||||
|
cmake --build build --parallel
|
||||||
|
'';
|
||||||
|
build-rel.exec = ''
|
||||||
|
cmake -S . -B build-release -D CMAKE_BUILD_TYPE=Release
|
||||||
|
cmake --build build-release --parallel
|
||||||
|
'';
|
||||||
|
clean.exec = ''
|
||||||
|
rm -rf build/ build-release/
|
||||||
|
'';
|
||||||
|
|
||||||
|
ocd.exec = ''
|
||||||
|
openocd -f ${./tigard-swd.cfg} -f target/rp2040.cfg
|
||||||
|
'';
|
||||||
|
gdb.exec = ''
|
||||||
|
arm-none-eabi-gdb -x .gdbinit build/qclk.elf
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
@ -1,36 +0,0 @@
|
|||||||
{ pkgs, ... }: {
|
|
||||||
packages = with pkgs; [
|
|
||||||
gnumake
|
|
||||||
cmake
|
|
||||||
pkgsCross.arm-embedded.buildPackages.gdb # ARM one is broken
|
|
||||||
gcc-arm-embedded
|
|
||||||
python3
|
|
||||||
picotool
|
|
||||||
openocd-rp2040
|
|
||||||
];
|
|
||||||
|
|
||||||
env = {
|
|
||||||
PICO_SDK_PATH = "${pkgs.pico-sdk}/lib/pico-sdk";
|
|
||||||
};
|
|
||||||
|
|
||||||
scripts = {
|
|
||||||
build.exec = ''
|
|
||||||
cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug -D PICO_STDIO_SEMIHOSTING=1
|
|
||||||
cmake --build build --parallel
|
|
||||||
'';
|
|
||||||
build-rel.exec = ''
|
|
||||||
cmake -S . -B build-release -D CMAKE_BUILD_TYPE=Release
|
|
||||||
cmake --build build-release --parallel
|
|
||||||
'';
|
|
||||||
clean.exec = ''
|
|
||||||
rm -rf build/ build-release/
|
|
||||||
'';
|
|
||||||
|
|
||||||
ocd.exec = ''
|
|
||||||
openocd -f ${./tigard-swd.cfg} -f target/rp2040.cfg
|
|
||||||
'';
|
|
||||||
gdb.exec = ''
|
|
||||||
arm-none-eabi-gdb -x .gdbinit build/qclk.elf
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user