Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Darwin Support #43

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
18 changes: 11 additions & 7 deletions src/hackrf-sweep/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ CXX_WIN = x86_64-w64-mingw32-g++

ifeq ($(IS_RELEASE), y)
CFLAGS += -fdata-sections -ffunction-sections -O2
LDFLAGS += -Wl,--gc-sections #-s
# LDFLAGS += -Wl,--gc-sections #-s
LDFLAGS += -dynamiclib -Wl,-dead_strip #-s

else
CFLAGS += -O0 -g #-O2
LDFLAGS += -g
Expand All @@ -51,7 +53,7 @@ LDPATHS_STATIC = -L""

#paths
#path to build dlls
OUTPUT_DLL_DIR = $(OUTPUT_PATH)/lib/linux-x86-64
OUTPUT_DLL_DIR = $(OUTPUT_PATH)/lib/darwin
OUTPUT_DLL_DIR_WIN = $(OUTPUT_PATH)/lib/win32-x86-64

# Windows build setup
Expand All @@ -68,10 +70,10 @@ LDFLAGS_WIN += -Wl,--kill-at -static-libgcc -static-libstdc++ -shared
ANT_PATH = ""
#required installed libraries for linux: openjdk-8 or newer, libfftw3, libusb-1.0
JDK_EXECUTABLE = java #required to generate jna wrapper
DLL_LIB = $(OUTPUT_DLL_DIR)/libhackrf-sweep.so
DLL_LIB = $(OUTPUT_DLL_DIR)/libhackrf-sweep.dylib
LDLIBS = -lusb-1.0 -lfftw3 -lfftw3f
CFLAGS += -march=x86-64
LIB_DIR = linux-x86-64
LIB_DIR = darwin

JNAERATOR = $(CURDIR)/lib/jnaerator/jnaerator-0.13-20150328.111636-4-shaded.jar
ZIP_FILE = hackrf_spectrum_analyzer.zip
Expand All @@ -81,7 +83,7 @@ ZIP_FILE_PATH = $(OUTPUT_DLL_DIR)/../../$(ZIP_FILE)
.NOTPARALLEL: all
.PHONY: all

all: prepare $(MAIN_JAR) $(DLL_LIB) $(ZIP_FILE_PATH)
all: prepare jnabridge $(MAIN_JAR) $(DLL_LIB) $(ZIP_FILE_PATH)

.PHONY: dirs
dirs:
Expand All @@ -104,8 +106,10 @@ prepare: dirs $(OBJECTS) $(OBJECTS_WIN) $(DLL_LIB_FFTW)
mkdir -p $(OUTPUT_DLL_DIR) $(OUTPUT_DLL_DIR_WIN)
cp -f lib/program.ico lib/program.png $(OUTPUT_DLL_DIR)/../
cp lib/launchers/hackrf_sweep_spectrum_analyzer_linux.sh $(OUTPUT_PATH)
cp lib/launchers/hackrf_sweep_spectrum_analyzer_darwin.sh $(OUTPUT_PATH)
cp lib/launchers/hackrf_sweep_spectrum_analyzer_windows.cmd $(OUTPUT_PATH)
chmod +x $(OUTPUT_PATH)/hackrf_sweep_spectrum_analyzer_linux.sh #linux launcher
chmod +x $(OUTPUT_PATH)/hackrf_sweep_spectrum_analyzer_linux.sh
chmod +x $(OUTPUT_PATH)/hackrf_sweep_spectrum_analyzer_darwin.sh
cp -f $(DLL_LIB_FFTW) $(DLL_LIB_PTHREAD) $(DLL_LIB_USB) $(OUTPUT_DLL_DIR_WIN)
cp -f lib/zadig-2.5.exe $(OUTPUT_DLL_DIR_WIN)/../

Expand All @@ -127,7 +131,7 @@ $(DLL_LIB_WIN): $(OBJECTS_WIN)
$(DLL_LIB): $(OBJECTS)
echo "---- Building linux version [start] ----"
$(CXX) $(LDFLAGS) $(LDPATHS) $(OBJECTS) -o $(DLL_LIB) $(LDLIBS)
strip --strip-unneeded $(DLL_LIB)
# strip $(DLL_LIB)
echo "---- Building linux version [done ] ----"

$(BUILD_PATH)/%.c.$(OBJECT_SUFFIX): %.c
Expand Down
663 changes: 663 additions & 0 deletions src/hackrf-sweep/hs_err_pid19532.log

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/hackrf-sweep/lib/hackrf/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.brd linguist-language=KiCad
94 changes: 94 additions & 0 deletions src/hackrf-sweep/lib/hackrf/.github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Build

on:
push:
pull_request:

# Run automatically every monday
schedule:
- cron: 1 12 * * 1

env:
BUILD_TYPE: Release

jobs:
host:
strategy:
matrix:
os: ['macos-latest', 'ubuntu-latest']

# Don't cancel all builds when one fails
fail-fast: false
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2

- name: Install dependencies (macOS)
run: brew install fftw
if: matrix.os == 'macos-latest'

- name: Install dependencies (Ubuntu)
run: |
sudo apt update
sudo apt install libfftw3-dev libusb-1.0-0-dev
if: matrix.os == 'ubuntu-latest'

- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/host/build

- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/host/build
run: cmake $GITHUB_WORKSPACE/host/ -DCMAKE_BUILD_TYPE=$BUILD_TYPE

- name: Build
working-directory: ${{runner.workspace}}/host/build
shell: bash
run: cmake --build . --config $BUILD_TYPE

firmware:
strategy:
matrix:
os: ['macos-latest', 'ubuntu-latest']
board: ['HACKRF_ONE', 'JAWBREAKER', 'RAD1O']

# Don't cancel all builds when one fails
fail-fast: false
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
with:
submodules: true

- name: Install dependencies (macOS)
run: |
brew tap armmbed/formulae
brew install arm-none-eabi-gcc dfu-util
pip install PyYAML
if: matrix.os == 'macos-latest'

- name: Install dependencies (Ubuntu)
run: |
sudo apt install dfu-util gcc-arm-none-eabi
if: matrix.os == 'ubuntu-latest'

- name: Build libopencm3
shell: bash
working-directory: ${{github.workspace}}/firmware/libopencm3/
run: make

- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/firmware/build

- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/firmware/build
run: cmake $GITHUB_WORKSPACE/firmware/ -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBOARD=${{ matrix.board }}

- name: Build
working-directory: ${{runner.workspace}}/firmware/build
shell: bash
run: cmake --build . --config $BUILD_TYPE

6 changes: 6 additions & 0 deletions src/hackrf-sweep/lib/hackrf/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ Thumbs.db
*.sublime-workspace
.vscode*

CMakefiles/
Makefile


# Xilinx tools create an enormous amount of poop:
firmware/cpld/**/isim/
firmware/cpld/**/_ngo/
Expand Down Expand Up @@ -68,3 +72,5 @@ firmware/cpld/**/*.xst
firmware/cpld/**/*.xwbt

firmware/**/build

*.pyc
6 changes: 6 additions & 0 deletions src/hackrf-sweep/lib/hackrf/.gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "firmware/libopencm3"]
path = firmware/libopencm3
url = https://github.com/mossmann/libopencm3.git
[submodule "hardware/gsg-kicad-lib"]
path = hardware/gsg-kicad-lib
url = https://github.com/greatscottgadgets/gsg-kicad-lib.git
62 changes: 0 additions & 62 deletions src/hackrf-sweep/lib/hackrf/.travis.yml

This file was deleted.

30 changes: 24 additions & 6 deletions src/hackrf-sweep/lib/hackrf/Readme.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,33 @@
Modified hackrf_sweep to support building it as a library for use in [HackRF Spectrum analyzer](https://github.com/pavsa/hackrf-spectrum-analyzer)



# HackRF

This repository contains hardware designs and software for HackRF,
a low cost, open source Software Defined Radio platform.

![HackRF One](https://raw.github.com/mossmann/hackrf/master/doc/HackRF-One-fd0-0009.jpeg)
![HackRF One](https://raw.github.com/mossmann/hackrf/master/docs/images/HackRF-One-fd0-0009.jpeg)

(photo by fd0 from https://github.com/fd0/hackrf-one-pictures)

principal author: Michael Ossmann <[email protected]>

http://greatscottgadgets.com/hackrf/
Information on HackRF and purchasing HackRF: https://greatscottgadgets.com/hackrf/

--------------------

# Documentation

Documentation for HackRF can be viewed on [Read the Docs](https://hackrf.readthedocs.io/en/latest/). The raw documenation files for HackRF are in the [docs folder](https://github.com/mossmann/hackrf/tree/master/docs) in this repository and can be built locally by installing [Sphinx Docs](https://www.sphinx-doc.org/en/master/usage/installation.html) and running `make html`. Documentation changes can be submitted through pull request and suggestions can be made as GitHub issues.

--------------------

# Getting Help


Before asking for help with HackRF, check to see if your question is listed in the [FAQ](https://hackrf.readthedocs.io/en/latest/faq.html).

For assistance with HackRF general use or development, please look at the [issues on the GitHub project](https://github.com/greatscottgadgets/hackrf/issues). This is the preferred place to ask questions so that others may locate the answer to your question in the future.

We invite you to join our community discussions on [Discord](https://discord.gg/rsfMw3rsU8). Note that while technical support requests are welcome here, we do not have support staff on duty at all times. Be sure to also submit an issue on GitHub if you've found a bug or if you want to ensure that your request will be tracked and not overlooked.

If you wish to see past discussions and questions about HackRF, you may also view the [mailing list archives](https://pairlist9.pair.net/pipermail/hackrf-dev/).

GitHub issues on this repository that are labelled "technical support" by Great Scott Gadgets employees can expect a response time of two weeks. We currently do not have expected response times for other GitHub issues or pull requests for this repository.
23 changes: 21 additions & 2 deletions src/hackrf-sweep/lib/hackrf/appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
os: Visual Studio 2015
os: Visual Studio 2017
clone_depth: 1

configuration:
Expand All @@ -7,18 +7,25 @@ configuration:
init:
- C:\"Program Files (x86)"\"Microsoft Visual Studio 14.0"\VC\vcvarsall.bat %PLATFORM%
install:
- appveyor DownloadFile "https://downloads.sourceforge.net/project/libusb/libusb-1.0/libusb-1.0.21/libusb-1.0.21.7z?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Flibusb%2Ffiles%2Flibusb-1.0%2Flibusb-1.0.21%2F&ts=1485478643&use_mirror=cytranet" -FileName "C:\libusb.7z"
# Dependencies for libHackRF
- appveyor DownloadFile "https://github.com/libusb/libusb/releases/download/v1.0.22/libusb-1.0.22.7z" -FileName "C:\libusb.7z"
- 7z x -y "C:\libusb.7z" -o"C:\libusb"
- appveyor DownloadFile "http://mirrors.kernel.org/sourceware/pthreads-win32/pthreads-w32-2-9-1-release.zip" -FileName "C:\pthreads-w32-release.zip"
- 7z x -y "C:\pthreads-w32-release.zip" -o"C:\pthreads"
- appveyor DownloadFile "http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/pkg-config_0.26-1_win32.zip" -FileName "C:\pkg-config_win32.zip"
- 7z x -y "C:\pkg-config_win32.zip" -o"C:\pkg-config"
# FFTW for hackrf_sweep
- curl -fsS -o "C:\fftw-3.3.5.zip" "ftp://ftp.fftw.org/pub/fftw/fftw-3.3.5-dll64.zip"
- 7z x -y "C:\fftw-3.3.5.zip" -o"C:\fftw"
- cd c:\fftw
- ps: lib /machine:x64 /def:libfftw3f-3.def
# ARM GCC for firmware builds
# - appveyor DownloadFile "https://developer.arm.com/-/media/Files/downloads/gnu-rm/6-2017q2/gcc-arm-none-eabi-6-2017-q2-update-win32.zip" -FileName "C:\gcc-arm-none-eabi-win32.zip"
# - 7z x -y "C:\gcc-arm-none-eabi-win32.zip" -o"C:\gcc-arm-none-eabi"
# - set PATH=%PATH%;c:\gcc-arm-none-eabi\bin

build_script:
# Host library and tools
- mkdir c:\projects\hackrf\host\build
- cd c:\projects\hackrf\host\build
- cmake -G "Visual Studio 14 2015 Win64" \
Expand All @@ -31,3 +38,15 @@ build_script:
-DFFTW_LIBRARIES=C:\fftw\libfftw3f-3.lib \
..
- msbuild HackRF.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
# Firmware
# - cd c:\projects\hackrf\
# - git submodule init
# - git submodule update
# - '%CYG_BASH% -lc "cd $APPVEYOR_BUILD_FOLDER && firmware/appveyor.sh"'

after_build:
- 7z a %APPVEYOR_BUILD_FOLDER%\HackRF-Windows-%APPVEYOR_REPO_COMMIT%.zip %APPVEYOR_BUILD_FOLDER%\host\build\libhackrf\src\Release\* %APPVEYOR_BUILD_FOLDER%\host\build\hackrf-tools\src\Release\*

artifacts:
- path: HackRF-Windows-%APPVEYOR_REPO_COMMIT%.zip
name: HackRF-Windows-%APPVEYOR_REPO_COMMIT%
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
7 changes: 0 additions & 7 deletions src/hackrf-sweep/lib/hackrf/doc/Readme.md

This file was deleted.

Binary file not shown.
Loading