Convert radio-rx

This commit is contained in:
Savanni D'Gerinel 2022-07-12 23:50:20 -04:00
parent c80db33d02
commit 762ba275b6
1 changed files with 10 additions and 9 deletions

View File

@ -221,8 +221,6 @@
name = "prime-tx"; name = "prime-tx";
src = ./.; src = ./.;
# includes = [ "base" "spi" "shift_register" "rfm69hcw" "display" ];
buildInputs = [ buildInputs = [
(packages."x86_64-linux"."base" { inherit mcu chip_select f_cpu; }) (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"."spi" { inherit mcu chip_select f_cpu; })
@ -257,18 +255,21 @@
name = "prime-tx"; name = "prime-tx";
src = ./.; 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; }; 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 = '' 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} ${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 $OBJCOPY -O ihex radio-rx.elf radio-rx.hex
''; '';
installPhase = '' installPhase = ''