Convert radio-rx
This commit is contained in:
parent
c80db33d02
commit
762ba275b6
19
flake.nix
19
flake.nix
|
@ -221,8 +221,6 @@
|
|||
name = "prime-tx";
|
||||
src = ./.;
|
||||
|
||||
# includes = [ "base" "spi" "shift_register" "rfm69hcw" "display" ];
|
||||
|
||||
buildInputs = [
|
||||
(packages."x86_64-linux"."base" { inherit mcu chip_select f_cpu; })
|
||||
(packages."x86_64-linux"."spi" { inherit mcu chip_select f_cpu; })
|
||||
|
@ -257,18 +255,21 @@
|
|||
name = "prime-tx";
|
||||
src = ./.;
|
||||
|
||||
includes = [ "base" "spi" "shift_register" "rfm69hcw" "display" ];
|
||||
buildInputs = [
|
||||
(packages."x86_64-linux"."base" { inherit mcu chip_select f_cpu; })
|
||||
(packages."x86_64-linux"."spi" { inherit mcu chip_select f_cpu; })
|
||||
(packages."x86_64-linux"."shift-register" { inherit mcu chip_select f_cpu; })
|
||||
(packages."x86_64-linux"."rfm" { inherit mcu chip_select f_cpu; })
|
||||
(packages."x86_64-linux"."display" { inherit mcu chip_select f_cpu; })
|
||||
];
|
||||
|
||||
CFLAGS = cflags { inherit mcu chip_select f_cpu; };
|
||||
INCLUDE_DIRS = lib.concatStringsSep " " (map (dir: "-I${src}/${dir}") includes);
|
||||
INCLUDE_DIRS = pkgs.lib.concatStringsSep " " (map (dir: "-I${dir}") buildInputs);
|
||||
OBJECT_FILES = pkgs.lib.concatStringsSep " " (map (dir: "${dir}/*.o") buildInputs);
|
||||
|
||||
buildPhase = ''
|
||||
${avr.gcc}/bin/avr-gcc ${CFLAGS} ${INCLUDE_DIRS} -o rfm.o -c ${src}/rfm69hcw/rfm.c
|
||||
${avr.gcc}/bin/avr-gcc ${CFLAGS} ${INCLUDE_DIRS} -o spi.o -c ${src}/spi/spi.c
|
||||
${avr.gcc}/bin/avr-gcc ${CFLAGS} ${INCLUDE_DIRS} -o reg.o -c ${src}/shift_register/shift_register.c
|
||||
${avr.gcc}/bin/avr-gcc ${CFLAGS} ${INCLUDE_DIRS} -o display.o -c ${src}/display/display.c
|
||||
${avr.gcc}/bin/avr-gcc ${CFLAGS} ${INCLUDE_DIRS} -o main.o -c ${src}/radio-rx/main.c
|
||||
${avr.gcc}/bin/avr-gcc ${CFLAGS} -o radio-rx.elf main.o display.o spi.o rfm.o reg.o
|
||||
${avr.gcc}/bin/avr-gcc ${CFLAGS} -o radio-rx.elf main.o ${OBJECT_FILES}
|
||||
$OBJCOPY -O ihex radio-rx.elf radio-rx.hex
|
||||
'';
|
||||
installPhase = ''
|
||||
|
|
Loading…
Reference in New Issue