Skip to content
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,10 @@ jobs:
matrix:
os: ['macos', 'ubuntu', 'windows']
board: ['HACKRF_ONE', 'JAWBREAKER', 'RAD1O', 'PRALINE', 'UNIVERSAL']
cmake: ['3.10.0', 'latest']
cmake: ['3.12.0', 'latest']
exclude:
- os: 'windows'
cmake: '3.10.0'
cmake: '3.12.0'
# GitHub doesn't give us many macOS runners, so don't build for every board.
# We just need to know that building firmware works on macOS. Use PRALINE
# since that's the most complicated one due to FPGA bitstreams.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/includes-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
matrix:
board: ['HACKRF_ONE', 'JAWBREAKER', 'RAD1O', 'PRALINE', 'UNIVERSAL']
cmake: ['3.10.0', 'latest']
cmake: ['3.12.0', 'latest']

# Don't cancel all builds when one fails
fail-fast: false
Expand Down
2 changes: 1 addition & 1 deletion firmware/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
option(CHECK_INCLUDES
"Check firmware sources for unused includes and transitive dependencies. (Requires iwyu)" OFF)

cmake_minimum_required(VERSION 3.10.0)
cmake_minimum_required(VERSION 3.12.0)
set(CMAKE_TOOLCHAIN_FILE toolchain-arm-cortex-m.cmake)

project (hackrf_firmware_all C)
Expand Down
2 changes: 0 additions & 2 deletions firmware/common/clock_gen.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
extern "C" {
#endif

#include "platform_detect.h" // IWYU pragma: keep

#include <stdbool.h>

#include "fixed_point.h"
Expand Down
1 change: 1 addition & 0 deletions firmware/common/clock_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

#include "gpdma.h"
#include "gpio.h"
#include "platform_detect.h"
#ifdef IS_NOT_PRALINE
#include "sgpio.h"
#endif
Expand Down
2 changes: 0 additions & 2 deletions firmware/common/clock_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
#include <stdbool.h>
#include <stdint.h>

#include "platform_detect.h" // IWYU pragma: keep

void clkin_detect_init(void);
uint32_t clkin_frequency(void);

Expand Down
1 change: 0 additions & 1 deletion firmware/common/cpld_jtag.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "cpld_jtag.h"

#include "platform_detect.h"

#ifdef IS_NOT_PRALINE
#include <stdint.h>
#include "xapp058/micro.h"
Expand Down
1 change: 0 additions & 1 deletion firmware/common/cpld_jtag.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include <stdint.h>

#include "gpio.h"
#include "platform_detect.h"

typedef struct {
gpio_t gpio_tck;
Expand Down
3 changes: 0 additions & 3 deletions firmware/common/cpu_clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@
#include "delay.h"
#include "i2c_bus.h"
#include "si5351c.h"
#ifdef IS_NOT_RAD1O
#include "platform_detect.h"
#endif

/*
Configure PLL1 (Main MCU Clock) to max speed (204MHz).
Expand Down
2 changes: 0 additions & 2 deletions firmware/common/cpu_clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
extern "C" {
#endif

#include "platform_detect.h" // IWYU pragma: keep

void cpu_clock_init(void);

#ifdef __cplusplus
Expand Down
1 change: 0 additions & 1 deletion firmware/common/hackrf_ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <stddef.h>

#include "hackrf_ui.h"
#include "platform_detect.h" // IWYU pragma: keep
#include "transceiver_mode.h"
#ifdef IS_EXPANSION_COMPATIBLE
#include "ui_portapack.h"
Expand Down
1 change: 0 additions & 1 deletion firmware/common/max283x.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include <stdint.h>

#include "fixed_point.h"
#include "platform_detect.h"
#include "spi_ssp.h"

#ifdef IS_PRALINE
Expand Down
2 changes: 0 additions & 2 deletions firmware/common/mixer.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
#include <stdint.h>

#include "fixed_point.h"
#include "platform_detect.h"

#ifdef IS_RAD1O
#include "max2871.h"
#endif
Expand Down
5 changes: 4 additions & 1 deletion firmware/common/operacake_sctimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,15 @@
#include "platform_detect.h"
#include "platform_scu.h"
#include "sct.h"

#ifdef IS_NOT_PRALINE
#include <libopencm3/cm3/common.h>
#include <libopencm3/lpc43xx/sgpio.h>
#endif

#include "delay.h"
#include "platform_detect.h"
#include "sct.h"

#define U1CTRL_SET SCT_OUT14_SET
#define U1CTRL_CLR SCT_OUT14_CLR
#define U2CTRL0_SET SCT_OUT13_SET
Expand Down
2 changes: 1 addition & 1 deletion firmware/common/pins.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include "rf_path.h"
#include "sgpio.h"
#include "w25q80bv.h"
#if defined(IS_PRALINE)
#ifdef IS_PRALINE
#include "clock_io.h"
#include "ice40_spi.h"
#endif
Expand Down
2 changes: 0 additions & 2 deletions firmware/common/pins.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
extern "C" {
#endif

#include "platform_detect.h" // IWYU pragma: keep

void pins_shutdown(void);
void pins_setup(void);

Expand Down
62 changes: 0 additions & 62 deletions firmware/common/platform_detect.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

#pragma once

#include <stdbool.h>
#include <stdint.h>

#define BOARD_REV_GSG (0x80)
Expand All @@ -32,67 +31,6 @@
#define PLATFORM_HACKRF1_R9 (1 << 3)
#define PLATFORM_PRALINE (1 << 4)

/* clang-format off */

/* Helper macros for platform-specific code. */
#if defined(UNIVERSAL)
#define IS_PRALINE (detected_platform() == BOARD_ID_PRALINE)
#define IS_NOT_PRALINE (!IS_PRALINE)
#define IS_HACKRF_ONE ( \
detected_platform() == BOARD_ID_HACKRF1_OG || \
detected_platform() == BOARD_ID_HACKRF1_R9 \
)
#define IS_NOT_HACKRF_ONE (!IS_HACKRF_ONE)
#define IS_H1_R9 (detected_platform() == BOARD_ID_HACKRF1_R9)
#define IS_NOT_H1_R9 (!IS_H1_R9)
#define IS_NOT_RAD1O true
#define IS_NOT_JAWBREAKER true
#define IS_H1_OR_PRALINE true
#define IS_H1_OR_RAD1O IS_HACKRF_ONE
#define IS_H1_OR_JAWBREAKER IS_HACKRF_ONE
#define IS_FOUR_LEDS IS_PRALINE
#define IS_EXPANSION_COMPATIBLE true
#elif defined(HACKRF_ONE)
#define IS_NOT_PRALINE true
#define IS_HACKRF_ONE true
#define IS_H1_R9 (detected_platform() == BOARD_ID_HACKRF1_R9)
#define IS_NOT_H1_R9 (!IS_H1_R9)
#define IS_NOT_RAD1O true
#define IS_NOT_JAWBREAKER true
#define IS_H1_OR_PRALINE true
#define IS_H1_OR_RAD1O true
#define IS_H1_OR_JAWBREAKER true
#define IS_EXPANSION_COMPATIBLE true
#elif defined(PRALINE)
#define IS_PRALINE true
#define IS_NOT_HACKRF_ONE true
#define IS_NOT_H1_R9 true
#define IS_NOT_RAD1O true
#define IS_NOT_JAWBREAKER true
#define IS_H1_OR_PRALINE true
#define IS_FOUR_LEDS true
#define IS_EXPANSION_COMPATIBLE true
#elif defined(RAD1O)
#define IS_NOT_PRALINE true
#define IS_NOT_HACKRF_ONE true
#define IS_NOT_H1_R9 true
#define IS_RAD1O true
#define IS_NOT_JAWBREAKER true
#define IS_H1_OR_RAD1O true
#define IS_FOUR_LEDS true
#elif defined(JAWBREAKER)
#define IS_NOT_PRALINE true
#define IS_NOT_HACKRF_ONE true
#define IS_NOT_H1_R9 true
#define IS_NOT_RAD1O true
#define IS_JAWBREAKER true
#define IS_H1_OR_JAWBREAKER true
#else
#error "No recognised platform defined"
#endif

/* clang-format on */

typedef enum {
BOARD_ID_JELLYBEAN = 0,
BOARD_ID_JAWBREAKER = 1,
Expand Down
1 change: 0 additions & 1 deletion firmware/common/platform_gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ extern "C" {

#include "gpio.h"
#include "gpio_lpc.h"
#include "platform_detect.h"

typedef struct {
/* LEDs */
Expand Down
2 changes: 0 additions & 2 deletions firmware/common/platform_scu.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ extern "C" {

#include <libopencm3/lpc43xx/scu.h>

#include "platform_detect.h"

/*
* SCU PinMux
*/
Expand Down
10 changes: 4 additions & 6 deletions firmware/common/power.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,13 @@
#if defined(IS_HACKRF_ONE)
#include <stdint.h>
#endif
#if defined(IS_HACKRF_ONE) || defined(IS_RAD1O) || defined(IS_JAWBREAKER)
#include "platform_detect.h"
#endif
#if defined(IS_PRALINE) || defined(IS_RAD1O)
#include "delay.h"
#endif

#include "gpio.h"
#include "platform_detect.h"
#include "platform_gpio.h"
#if defined(IS_PRALINE) || defined(IS_RAD1O)
#include "delay.h"
#endif

#ifdef IS_PRALINE
void enable_1v2_power(void)
Expand Down
2 changes: 0 additions & 2 deletions firmware/common/power.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
extern "C" {
#endif

#include "platform_detect.h" // IWYU pragma: keep

#ifdef IS_PRALINE
void enable_1v2_power(void);
void disable_1v2_power(void);
Expand Down
2 changes: 0 additions & 2 deletions firmware/common/rf_path.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@

#include <stdint.h>

#include "platform_detect.h" // IWYU pragma: keep

#ifdef IS_NOT_JAWBREAKER
#include "gpio.h"
#endif
Expand Down
1 change: 0 additions & 1 deletion firmware/common/rffc5071.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

#include "fixed_point.h"
#include "gpio.h"
#include "platform_detect.h" // IWYU pragma: keep
#include "spi_bus.h"

/* 31 registers, each containing 16 bits of data. */
Expand Down
2 changes: 0 additions & 2 deletions firmware/common/selftest.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
#include <stdbool.h>
#include <stdint.h>

#include "platform_detect.h" // IWYU pragma: keep

#define NUM_LOCK_ATTEMPTS 3

enum {
Expand Down
1 change: 0 additions & 1 deletion firmware/common/sgpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <stdint.h>

#include "gpio.h"
#include "platform_detect.h" // IWYU pragma: keep

typedef enum {
SGPIO_DIRECTION_RX,
Expand Down
2 changes: 2 additions & 0 deletions firmware/hackrf-common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ if(NOT DEFINED BOARD)
set(BOARD HACKRF_ONE)
endif()

include(${PATH_HACKRF_FIRMWARE}/platform-detect.cmake)

if(BOARD STREQUAL "HACKRF_ONE" OR BOARD STREQUAL "PRALINE" OR BOARD STREQUAL "UNIVERSAL")
set(MCU_PARTNO LPC4320)
else()
Expand Down
1 change: 1 addition & 0 deletions firmware/hackrf_usb/usb_api_register.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/

#include "usb_api_register.h"

#include <stdbool.h>
Expand Down
2 changes: 0 additions & 2 deletions firmware/hackrf_usb/usb_api_register.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@

#pragma once

#include "platform_detect.h" // IWYU pragma: keep

#include <usb_request.h>
#include <usb_type.h>

Expand Down
7 changes: 3 additions & 4 deletions firmware/hackrf_usb/usb_api_selftest.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@

#include <stddef.h>
#include <stdint.h>
#ifdef IS_NOT_RAD1O
#include <stdbool.h>
#endif

#include <libopencm3/lpc43xx/cgu.h>
#include <libopencm3/lpc43xx/creg.h>
Expand All @@ -33,10 +36,6 @@
#include <usb_request.h>
#include <usb_type.h>

#ifdef IS_NOT_RAD1O
#include <stdbool.h>
#endif

static char* itoa(int val, int base)
{
static char buf[32] = {0};
Expand Down
2 changes: 0 additions & 2 deletions firmware/hackrf_usb/usb_descriptor.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@

#include <usb_type.h>

#include "platform_detect.h"

#define USB_VENDOR_ID (0x1D50)

#define USB_API_VERSION (0x0112)
Expand Down
2 changes: 0 additions & 2 deletions firmware/hackrf_usb/usb_descriptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@

#include <stdint.h>

#include "platform_detect.h"

#if defined(IS_HACKRF_ONE) || defined(IS_PRALINE)
extern uint8_t usb_descriptor_device_hackrf[];
#endif
Expand Down
1 change: 0 additions & 1 deletion firmware/hackrf_usb/usb_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

#include <usb_type.h>

#include "platform_detect.h"
#include "usb_descriptor.h"

usb_configuration_t usb_configuration_high_speed = {
Expand Down
2 changes: 0 additions & 2 deletions firmware/hackrf_usb/usb_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@

#include <usb_type.h>

#include "platform_detect.h"

extern usb_device_t usb_device;

#ifdef IS_HACKRF_ONE
Expand Down
Loading
Loading