Skip to content

Commit

Permalink
cn0534: automate build and code cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Trecia Agoylo <[email protected]>
  • Loading branch information
tagoylo committed Apr 15, 2021
1 parent f2da1b5 commit 7969679
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 17 deletions.
2 changes: 1 addition & 1 deletion cn0534/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The main script is based on the `power_check.c` script found on the [plutosdr_sc

Running first the build script is necessary. Prior to running, set the build environment first in the `./build_arm.sh`, change the CC_DIR to the path of the bin folder of the compiler.

For Linux, with the cross compiler set on the host pc and linked with the sysroot used by the pluto, run `./build_arm.sh`. The sysroot used should match to the firmware of pluto. As of this writing, pluto firmware v0.30 is used. The sysroot folder should be in the same directory as the `./build_arm.sh`. Also, updating Pluto to AD9364 frequency range is necessary to accommodate CN0534 frequency range.
For Linux, with the cross compiler set on the host pc and linked with the sysroot used by the pluto, run `./build_arm.sh`. The sysroot used should match to the firmware of pluto. As of this writing, pluto firmware v0.30 is used. The sysroot folder should be in the same directory as the `./build_arm.sh`. Also, [updating Pluto to AD9364 frequency range](https://wiki.analog.com/university/tools/pluto/users/customizing#updating_to_the_ad9364) is necessary to accommodate CN0534 frequency range.

![Build Folder Structure](images/build_folder_structure.png)

Expand Down
30 changes: 28 additions & 2 deletions cn0534/build_arm.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,30 @@
#!/bin/sh
ROOTFS=$(pwd)/pluto-0.30.sysroot
CC_DIR=/home/guest/linux_dev/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin
make CC=$CC_DIR/arm-linux-gnueabihf-gcc CFLAGS="-mfloat-abi=hard --sysroot=${ROOTFS} -I./include -L${ROOTFS}/lib"
CROSS_COMPILE="$3"
HOST=${HOST:-x86_64}
GCC_ARCH=arm-linux-gnueabihf

[ -n "$CROSS_COMPILE" ] || {
CROSS_COMPILE=${GCC_ARCH}-gcc
if type "${GCC_ARCH}-gcc" >/dev/null 2>&1 ; then
CROSS_COMPILE="${GCC_ARCH}-"
else
GCC_VERSION="8.3-2019.03"
GCC_DIR="gcc-arm-${GCC_VERSION}-${HOST}-${GCC_ARCH}"
GCC_TAR="$GCC_DIR.tar.xz"
GCC_URL="https://developer.arm.com/-/media/Files/downloads/gnu-a/${GCC_VERSION}/binrel/${GCC_TAR}"
if [ ! -d "$GCC_DIR" ] && [ ! -e "$GCC_TAR" ] ; then
wget "$GCC_URL"
fi
if [ ! -d "$GCC_DIR" ] ; then
tar -xvf $GCC_TAR || {
echo "'$GCC_TAR' seems invalid ; remove it and re-download it"
exit 1
}
fi
CROSS_COMPILE=$(pwd)/$GCC_DIR/bin/${GCC_ARCH}-gcc
fi
}


make CC=$CROSS_COMPILE CFLAGS="-mfloat-abi=hard --sysroot=${ROOTFS} -I./include -L${ROOTFS}/lib"
14 changes: 0 additions & 14 deletions cn0534/src/power_check.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,20 +407,6 @@ static int32_t iio_set_attribute(char *device, char *channel, bool in_out,
return EXIT_FAILURE;
}

ret = iio_channel_attr_read(chan, attribute, buf, sizeof(buf));
if (ret > 0)
{
/*if (log)
{
write_log[wl_index].device = strdup(device);
write_log[wl_index].channel = strdup(channel);
write_log[wl_index].in_out = in_out;
write_log[wl_index].attribute = strdup(attribute);
write_log[wl_index].value = strdup(buf);
wl_index++;
}*/
}

if (buffer)
{
ret = iio_channel_attr_write(chan, attribute, buffer);
Expand Down

0 comments on commit 7969679

Please sign in to comment.