diff --git a/.gitignore b/.gitignore index 3eb0b22f..c060d006 100644 --- a/.gitignore +++ b/.gitignore @@ -57,5 +57,8 @@ host/misc/windows/scripts/work env/ venv/ ENV/ +__pycache__/ +*.py[cod] +*$py.class .vscode/ diff --git a/debian/bladerf-firmware-fx3.postinst b/debian/bladerf-firmware-fx3.postinst index 26f2bf49..9a204660 100644 --- a/debian/bladerf-firmware-fx3.postinst +++ b/debian/bladerf-firmware-fx3.postinst @@ -1,7 +1,7 @@ #!/bin/sh -e -UPSTREAM='https://www.nuand.com/fx3/bladeRF_fw_v2.4.0.img' -CHECKSUM='337f570f2e3fdb26abde0f0765196d92' +UPSTREAM='https://www.nuand.com/fx3/bladeRF_fw_v2.6.0.img' +CHECKSUM='7cc51b4eedebf54dd01be83745d1c59f' DATAFILE='/usr/share/Nuand/bladeRF/bladeRF_fw.img' DESCRIPT='firmware' MYNAMEIS='bladerf-firmware-fx3' diff --git a/debian/bladerf-fpga-hostedx115.postinst b/debian/bladerf-fpga-hostedx115.postinst index 447c7e5f..9f473b9b 100644 --- a/debian/bladerf-fpga-hostedx115.postinst +++ b/debian/bladerf-fpga-hostedx115.postinst @@ -1,7 +1,7 @@ #!/bin/sh -e -UPSTREAM='https://www.nuand.com/fpga/v0.14.0/hostedx115.rbf' -CHECKSUM='94ee5c7f68abe5c3392202246789fedd' +UPSTREAM='https://www.nuand.com/fpga/v0.16.0/hostedx115.rbf' +CHECKSUM='a7f25be8abdab3835e734599eb846ea4' DATAFILE='/usr/share/Nuand/bladeRF/hostedx115.rbf' DESCRIPT='FPGA bitstream' MYNAMEIS='bladerf-fpga-hostedx115' diff --git a/debian/bladerf-fpga-hostedx40.postinst b/debian/bladerf-fpga-hostedx40.postinst index 1512dbda..d11baad6 100644 --- a/debian/bladerf-fpga-hostedx40.postinst +++ b/debian/bladerf-fpga-hostedx40.postinst @@ -1,7 +1,7 @@ #!/bin/sh -e -UPSTREAM='https://www.nuand.com/fpga/v0.14.0/hostedx40.rbf' -CHECKSUM='25f402b3734c9aa0d37db9531f93335c' +UPSTREAM='https://www.nuand.com/fpga/v0.16.0/hostedx40.rbf' +CHECKSUM='f3d0e55aa4cae485df6d3c20004b7742' DATAFILE='/usr/share/Nuand/bladeRF/hostedx40.rbf' DESCRIPT='FPGA bitstream' MYNAMEIS='bladerf-fpga-hostedx40' diff --git a/debian/bladerf-fpga-hostedxa4.postinst b/debian/bladerf-fpga-hostedxa4.postinst index 94a42bd2..46845c2f 100644 --- a/debian/bladerf-fpga-hostedxa4.postinst +++ b/debian/bladerf-fpga-hostedxa4.postinst @@ -1,7 +1,7 @@ #!/bin/sh -e -UPSTREAM='https://www.nuand.com/fpga/v0.14.0/hostedxA4.rbf' -CHECKSUM='c24af70cf56b13123295125a22d5e921' +UPSTREAM='https://www.nuand.com/fpga/v0.16.0/hostedxA4.rbf' +CHECKSUM='276a74b748d699a9fc348babd34af19c' DATAFILE='/usr/share/Nuand/bladeRF/hostedxA4.rbf' DESCRIPT='FPGA bitstream' MYNAMEIS='bladerf-fpga-hostedxa4' diff --git a/debian/bladerf-fpga-hostedxa5.postinst b/debian/bladerf-fpga-hostedxa5.postinst index 86e1b43b..1ad7a1cd 100644 --- a/debian/bladerf-fpga-hostedxa5.postinst +++ b/debian/bladerf-fpga-hostedxa5.postinst @@ -1,7 +1,7 @@ #!/bin/sh -e -UPSTREAM='https://www.nuand.com/fpga/v0.14.0/hostedxA5.rbf' -CHECKSUM='ae6391cc3fd467bbb07868450612ce17' +UPSTREAM='https://www.nuand.com/fpga/v0.16.0/hostedxA5.rbf' +CHECKSUM='be0909dc27b48a08c54db33675130f27' DATAFILE='/usr/share/Nuand/bladeRF/hostedxA5.rbf' DESCRIPT='FPGA bitstream' MYNAMEIS='bladerf-fpga-hostedxa5' diff --git a/debian/bladerf-fpga-hostedxa9.postinst b/debian/bladerf-fpga-hostedxa9.postinst index 25100b42..50938bb6 100644 --- a/debian/bladerf-fpga-hostedxa9.postinst +++ b/debian/bladerf-fpga-hostedxa9.postinst @@ -1,7 +1,7 @@ #!/bin/sh -e -UPSTREAM='https://www.nuand.com/fpga/v0.14.0/hostedxA9.rbf' -CHECKSUM='7dfe8c32f260d43a14b9583375a1a6eb' +UPSTREAM='https://www.nuand.com/fpga/v0.16.0/hostedxA9.rbf' +CHECKSUM='1ab3bc8bdcf16a5f0ddf3fcdbaa6556b' DATAFILE='/usr/share/Nuand/bladeRF/hostedxA9.rbf' DESCRIPT='FPGA bitstream' MYNAMEIS='bladerf-fpga-hostedxa9' diff --git a/debian/control b/debian/control index 75c93b81..fc13d01a 100644 --- a/debian/control +++ b/debian/control @@ -2,8 +2,8 @@ Source: bladerf Priority: optional Maintainer: Nuand LLC Build-Depends: debhelper (>=9), cmake (>= 2.8.5), pkg-config, doxygen, - libusb-1.0-0-dev (>= 1.0.12), libtecla-dev | libtecla1-dev, libncurses5-dev, - git, help2man, pandoc + libusb-1.0-0-dev (>= 1.0.12), libedit-dev, libncurses5-dev, + git, help2man, pandoc, libcurl4-openssl-dev Standards-Version: 4.1.4 Section: comm Homepage: https://www.nuand.com/bladeRF diff --git a/fpga_common/include/ad936x.h b/fpga_common/include/ad936x.h index 5fd43e73..38d0ea9a 100644 --- a/fpga_common/include/ad936x.h +++ b/fpga_common/include/ad936x.h @@ -29,6 +29,8 @@ #include #include +#include + /** * The purpose of this header file is to allow the use of libad9361 without * including all of the unnecessary defines, etc, used during compilation. @@ -46,15 +48,6 @@ * From common.h ******************************************************************************/ -struct clk_onecell_data { - struct clk **clks; - uint32_t clk_num; -}; - -/****************************************************************************** - * From ad9361.h - ******************************************************************************/ - #define AD936X_REG_TX1_OUT_1_PHASE_CORR 0x08E #define AD936X_REG_TX1_OUT_1_GAIN_CORR 0x08F #define AD936X_REG_TX2_OUT_1_PHASE_CORR 0x090 @@ -98,681 +91,6 @@ struct clk_onecell_data { #define AD936X_CNT(x) ((((x)-1) & 0x7) << 12) #define AD936X_ADDR(x) ((x)&0x3FF) -enum dev_id { ID_AD9361, ID_AD9364, ID_AD9363A }; - -enum ad9361_clocks { - BB_REFCLK, - RX_REFCLK, - TX_REFCLK, - BBPLL_CLK, - ADC_CLK, - R2_CLK, - R1_CLK, - CLKRF_CLK, - RX_SAMPL_CLK, - DAC_CLK, - T2_CLK, - T1_CLK, - CLKTF_CLK, - TX_SAMPL_CLK, - RX_RFPLL_INT, - TX_RFPLL_INT, - RX_RFPLL_DUMMY, - TX_RFPLL_DUMMY, - RX_RFPLL, - TX_RFPLL, - NUM_AD9361_CLKS, - EXT_REF_CLK, -}; - -enum rx_gain_table_name { - TBL_200_1300_MHZ, - TBL_1300_4000_MHZ, - TBL_4000_6000_MHZ, - RXGAIN_TBLS_END, -}; - -enum rx_gain_table_type { - RXGAIN_FULL_TBL, - RXGAIN_SPLIT_TBL, -}; - -struct rx_gain_info { - enum rx_gain_table_type tbl_type; - int32_t starting_gain_db; - int32_t max_gain_db; - int32_t gain_step_db; - int32_t max_idx; - int32_t idx_step_offset; -}; - -enum ad9361_pdata_rx_freq { - BBPLL_FREQ, - ADC_FREQ, - R2_FREQ, - R1_FREQ, - CLKRF_FREQ, - RX_SAMPL_FREQ, - NUM_RX_CLOCKS, -}; - -enum ad9361_pdata_tx_freq { - IGNORE_FREQ, - DAC_FREQ, - T2_FREQ, - T1_FREQ, - CLKTF_FREQ, - TX_SAMPL_FREQ, - NUM_TX_CLOCKS, -}; - -struct ad9361_fastlock_entry { - //#define FASTLOOK_INIT 1 - uint8_t flags; - uint8_t alc_orig; - uint8_t alc_written; -}; - -struct ad9361_fastlock { - uint8_t save_profile; - uint8_t current_profile[2]; - struct ad9361_fastlock_entry entry[2][8]; -}; - -enum ad9361_bist_mode { - BIST_DISABLE, - BIST_INJ_TX, - BIST_INJ_RX, -}; - -enum ad9361_clkout { - CLKOUT_DISABLE, - BUFFERED_XTALN_DCXO, - ADC_CLK_DIV_2, - ADC_CLK_DIV_3, - ADC_CLK_DIV_4, - ADC_CLK_DIV_8, - ADC_CLK_DIV_16, -}; - -enum rf_gain_ctrl_mode { - RF_GAIN_MGC, - RF_GAIN_FASTATTACK_AGC, - RF_GAIN_SLOWATTACK_AGC, - RF_GAIN_HYBRID_AGC -}; - -enum f_agc_target_gain_index_type { - MAX_GAIN, - SET_GAIN, - OPTIMIZED_GAIN, - NO_GAIN_CHANGE, -}; - -enum rssi_restart_mode { - AGC_IN_FAST_ATTACK_MODE_LOCKS_THE_GAIN, - EN_AGC_PIN_IS_PULLED_HIGH, - ENTERS_RX_MODE, - GAIN_CHANGE_OCCURS, - SPI_WRITE_TO_REGISTER, - GAIN_CHANGE_OCCURS_OR_EN_AGC_PIN_PULLED_HIGH, -}; - -struct rssi_control { - enum rssi_restart_mode restart_mode; - bool rssi_unit_is_rx_samples; - uint32_t rssi_delay; - uint32_t rssi_wait; - uint32_t rssi_duration; -}; - -struct port_control { - uint8_t pp_conf[3]; - uint8_t rx_clk_data_delay; - uint8_t tx_clk_data_delay; - uint8_t digital_io_ctrl; - uint8_t lvds_bias_ctrl; - uint8_t lvds_invert[2]; - uint8_t clk_out_drive; - uint8_t dataclk_drive; - uint8_t data_port_drive; - uint8_t clk_out_slew; - uint8_t dataclk_slew; - uint8_t data_port_slew; -}; - -struct ctrl_outs_control { - uint8_t index; - uint8_t en_mask; -}; - -struct elna_control { - uint16_t gain_mdB; - uint16_t bypass_loss_mdB; - uint32_t settling_delay_ns; - bool elna_1_control_en; - bool elna_2_control_en; - bool elna_in_gaintable_all_index_en; -}; - -struct auxadc_control { - int8_t offset; - uint32_t temp_time_inteval_ms; - uint32_t temp_sensor_decimation; - bool periodic_temp_measuremnt; - uint32_t auxadc_clock_rate; - uint32_t auxadc_decimation; -}; - -struct auxdac_control { - uint16_t dac1_default_value; - uint16_t dac2_default_value; - bool auxdac_manual_mode_en; - bool dac1_in_rx_en; - bool dac1_in_tx_en; - bool dac1_in_alert_en; - bool dac2_in_rx_en; - bool dac2_in_tx_en; - bool dac2_in_alert_en; - uint8_t dac1_rx_delay_us; - uint8_t dac1_tx_delay_us; - uint8_t dac2_rx_delay_us; - uint8_t dac2_tx_delay_us; -}; - -struct gpo_control { - bool gpo0_inactive_state_high_en; - bool gpo1_inactive_state_high_en; - bool gpo2_inactive_state_high_en; - bool gpo3_inactive_state_high_en; - bool gpo0_slave_rx_en; - bool gpo0_slave_tx_en; - bool gpo1_slave_rx_en; - bool gpo1_slave_tx_en; - bool gpo2_slave_rx_en; - bool gpo2_slave_tx_en; - bool gpo3_slave_rx_en; - bool gpo3_slave_tx_en; - uint8_t gpo0_rx_delay_us; - uint8_t gpo0_tx_delay_us; - uint8_t gpo1_rx_delay_us; - uint8_t gpo1_tx_delay_us; - uint8_t gpo2_rx_delay_us; - uint8_t gpo2_tx_delay_us; - uint8_t gpo3_rx_delay_us; - uint8_t gpo3_tx_delay_us; -}; - -struct tx_monitor_control { - bool tx_mon_track_en; - bool one_shot_mode_en; - uint32_t low_high_gain_threshold_mdB; - uint8_t low_gain_dB; - uint8_t high_gain_dB; - uint16_t tx_mon_delay; - uint16_t tx_mon_duration; - uint8_t tx1_mon_front_end_gain; - uint8_t tx2_mon_front_end_gain; - uint8_t tx1_mon_lo_cm; - uint8_t tx2_mon_lo_cm; -}; - -struct gain_control { - enum rf_gain_ctrl_mode rx1_mode; - enum rf_gain_ctrl_mode rx2_mode; - uint8_t adc_ovr_sample_size; - uint8_t adc_small_overload_thresh; - uint8_t adc_large_overload_thresh; - uint16_t lmt_overload_high_thresh; - uint16_t lmt_overload_low_thresh; - uint16_t dec_pow_measuremnt_duration; - uint8_t low_power_thresh; - bool dig_gain_en; - uint8_t max_dig_gain; - bool mgc_rx1_ctrl_inp_en; - bool mgc_rx2_ctrl_inp_en; - uint8_t mgc_inc_gain_step; - uint8_t mgc_dec_gain_step; - uint8_t mgc_split_table_ctrl_inp_gain_mode; - uint8_t agc_attack_delay_extra_margin_us; - uint8_t agc_outer_thresh_high; - uint8_t agc_outer_thresh_high_dec_steps; - uint8_t agc_inner_thresh_high; - uint8_t agc_inner_thresh_high_dec_steps; - uint8_t agc_inner_thresh_low; - uint8_t agc_inner_thresh_low_inc_steps; - uint8_t agc_outer_thresh_low; - uint8_t agc_outer_thresh_low_inc_steps; - uint8_t adc_small_overload_exceed_counter; - uint8_t adc_large_overload_exceed_counter; - uint8_t adc_large_overload_inc_steps; - bool adc_lmt_small_overload_prevent_gain_inc; - uint8_t lmt_overload_large_exceed_counter; - uint8_t lmt_overload_small_exceed_counter; - uint8_t lmt_overload_large_inc_steps; - uint8_t dig_saturation_exceed_counter; - uint8_t dig_gain_step_size; - bool sync_for_gain_counter_en; - uint32_t gain_update_interval_us; - bool immed_gain_change_if_large_adc_overload; - bool immed_gain_change_if_large_lmt_overload; - uint32_t f_agc_dec_pow_measuremnt_duration; - uint32_t f_agc_state_wait_time_ns; - bool f_agc_allow_agc_gain_increase; - uint8_t f_agc_lp_thresh_increment_time; - uint8_t f_agc_lp_thresh_increment_steps; - uint8_t f_agc_lock_level; - bool f_agc_lock_level_lmt_gain_increase_en; - uint8_t f_agc_lock_level_gain_increase_upper_limit; - uint8_t f_agc_lpf_final_settling_steps; - uint8_t f_agc_lmt_final_settling_steps; - uint8_t f_agc_final_overrange_count; - bool f_agc_gain_increase_after_gain_lock_en; - enum f_agc_target_gain_index_type f_agc_gain_index_type_after_exit_rx_mode; - bool f_agc_use_last_lock_level_for_set_gain_en; - uint8_t f_agc_optimized_gain_offset; - bool f_agc_rst_gla_stronger_sig_thresh_exceeded_en; - uint8_t f_agc_rst_gla_stronger_sig_thresh_above_ll; - bool f_agc_rst_gla_engergy_lost_sig_thresh_exceeded_en; - bool f_agc_rst_gla_engergy_lost_goto_optim_gain_en; - uint8_t f_agc_rst_gla_engergy_lost_sig_thresh_below_ll; - uint8_t f_agc_energy_lost_stronger_sig_gain_lock_exit_cnt; - bool f_agc_rst_gla_large_adc_overload_en; - bool f_agc_rst_gla_large_lmt_overload_en; - bool f_agc_rst_gla_en_agc_pulled_high_en; - enum f_agc_target_gain_index_type f_agc_rst_gla_if_en_agc_pulled_high_mode; - uint8_t f_agc_power_measurement_duration_in_state5; -}; - -struct ad9361_phy_platform_data { - bool rx2tx2; - bool fdd; - bool fdd_independent_mode; - bool split_gt; - bool use_extclk; - bool ensm_pin_pulse_mode; - bool ensm_pin_ctrl; - bool debug_mode; - bool tdd_use_dual_synth; - bool tdd_skip_vco_cal; - bool use_ext_rx_lo; - bool use_ext_tx_lo; - bool rx1rx2_phase_inversion_en; - bool qec_tracking_slow_mode_en; - uint8_t dc_offset_update_events; - uint8_t dc_offset_attenuation_high; - uint8_t dc_offset_attenuation_low; - uint8_t rf_dc_offset_count_high; - uint8_t rf_dc_offset_count_low; - uint8_t dig_interface_tune_skipmode; - uint8_t dig_interface_tune_fir_disable; - uint32_t dcxo_coarse; - uint32_t dcxo_fine; - uint32_t rf_rx_input_sel; - uint32_t rf_tx_output_sel; - uint32_t rx1tx1_mode_use_rx_num; - uint32_t rx1tx1_mode_use_tx_num; - uint32_t rx_path_clks[NUM_RX_CLOCKS]; - uint32_t tx_path_clks[NUM_TX_CLOCKS]; - uint32_t trx_synth_max_fref; - uint64_t rx_synth_freq; - uint64_t tx_synth_freq; - uint32_t rf_rx_bandwidth_Hz; - uint32_t rf_tx_bandwidth_Hz; - int32_t tx_atten; - bool update_tx_gain_via_alert; - uint32_t rx_fastlock_delay_ns; - uint32_t tx_fastlock_delay_ns; - bool trx_fastlock_pinctrl_en[2]; - enum ad9361_clkout ad9361_clkout_mode; - struct gain_control gain_ctrl; - struct rssi_control rssi_ctrl; - struct port_control port_ctrl; - struct ctrl_outs_control ctrl_outs_ctrl; - struct elna_control elna_ctrl; - struct auxadc_control auxadc_ctrl; - struct auxdac_control auxdac_ctrl; - struct gpo_control gpo_ctrl; - struct tx_monitor_control txmon_ctrl; - int32_t gpio_resetb; - int32_t gpio_sync; - int32_t gpio_cal_sw1; - int32_t gpio_cal_sw2; -}; - -struct ad9361_rf_phy { - enum dev_id dev_sel; - uint8_t id_no; - struct spi_device *spi; - struct gpio_device *gpio; - struct clk *clk_refin; - struct clk *clks[NUM_AD9361_CLKS]; - struct refclk_scale *ref_clk_scale[NUM_AD9361_CLKS]; - struct clk_onecell_data clk_data; - uint32_t (*ad9361_rfpll_ext_recalc_rate)(struct refclk_scale *clk_priv); - int32_t (*ad9361_rfpll_ext_round_rate)(struct refclk_scale *clk_priv, - uint32_t rate); - int32_t (*ad9361_rfpll_ext_set_rate)(struct refclk_scale *clk_priv, - uint32_t rate); - struct ad9361_phy_platform_data *pdata; - uint8_t prev_ensm_state; - uint8_t curr_ensm_state; - uint8_t cached_rx_rfpll_div; - uint8_t cached_tx_rfpll_div; - struct rx_gain_info rx_gain[RXGAIN_TBLS_END]; - enum rx_gain_table_name current_table; - bool ensm_pin_ctl_en; - bool auto_cal_en; - uint64_t last_tx_quad_cal_freq; - uint32_t last_tx_quad_cal_phase; - uint64_t current_tx_lo_freq; - uint64_t current_rx_lo_freq; - bool current_tx_use_tdd_table; - bool current_rx_use_tdd_table; - uint32_t flags; - uint32_t cal_threshold_freq; - uint32_t current_rx_bw_Hz; - uint32_t current_tx_bw_Hz; - uint32_t rxbbf_div; - uint32_t rate_governor; - bool bypass_rx_fir; - bool bypass_tx_fir; - bool rx_eq_2tx; - bool filt_valid; - uint32_t filt_rx_path_clks[NUM_RX_CLOCKS]; - uint32_t filt_tx_path_clks[NUM_TX_CLOCKS]; - uint32_t filt_rx_bw_Hz; - uint32_t filt_tx_bw_Hz; - uint8_t tx_fir_int; - uint8_t tx_fir_ntaps; - uint8_t rx_fir_dec; - uint8_t rx_fir_ntaps; - uint8_t agc_mode[2]; - bool rfdc_track_en; - bool bbdc_track_en; - bool quad_track_en; - bool txmon_tdd_en; - uint16_t auxdac1_value; - uint16_t auxdac2_value; - uint32_t tx1_atten_cached; - uint32_t tx2_atten_cached; - struct ad9361_fastlock fastlock; - struct axiadc_converter *adc_conv; - struct axiadc_state *adc_state; - int32_t bist_loopback_mode; - enum ad9361_bist_mode bist_prbs_mode; - enum ad9361_bist_mode bist_tone_mode; - uint32_t bist_tone_freq_Hz; - uint32_t bist_tone_level_dB; - uint32_t bist_tone_mask; - bool bbpll_initialized; -}; - -struct rf_rx_gain { - uint32_t ant; - int32_t gain_db; - uint32_t fgt_lmt_index; - uint32_t lmt_gain; - uint32_t lpf_gain; - uint32_t digital_gain; - uint32_t lna_index; - uint32_t tia_index; - uint32_t mixer_index; -}; - -struct rf_rssi { - uint32_t ant; - uint32_t symbol; - uint32_t preamble; - int32_t multiplier; - uint8_t duration; -}; - -int32_t ad9361_get_rx_gain(struct ad9361_rf_phy *phy, - uint32_t rx_id, - struct rf_rx_gain *rx_gain); -int32_t ad9361_spi_read(struct spi_device *spi, uint32_t reg); -int32_t ad9361_spi_write(struct spi_device *spi, uint32_t reg, uint32_t val); -void ad9361_get_bist_loopback(struct ad9361_rf_phy *phy, int32_t *mode); -int32_t ad9361_bist_loopback(struct ad9361_rf_phy *phy, int32_t mode); - -/****************************************************************************** - * From ad9361_api.h - ******************************************************************************/ - -typedef struct { - enum dev_id dev_sel; - uint8_t id_no; - uint32_t reference_clk_rate; - uint8_t two_rx_two_tx_mode_enable; - uint8_t one_rx_one_tx_mode_use_rx_num; - uint8_t one_rx_one_tx_mode_use_tx_num; - uint8_t frequency_division_duplex_mode_enable; - uint8_t frequency_division_duplex_independent_mode_enable; - uint8_t tdd_use_dual_synth_mode_enable; - uint8_t tdd_skip_vco_cal_enable; - uint32_t tx_fastlock_delay_ns; - uint32_t rx_fastlock_delay_ns; - uint8_t rx_fastlock_pincontrol_enable; - uint8_t tx_fastlock_pincontrol_enable; - uint8_t external_rx_lo_enable; - uint8_t external_tx_lo_enable; - uint8_t dc_offset_tracking_update_event_mask; - uint8_t dc_offset_attenuation_high_range; - uint8_t dc_offset_attenuation_low_range; - uint8_t dc_offset_count_high_range; - uint8_t dc_offset_count_low_range; - uint8_t split_gain_table_mode_enable; - uint32_t trx_synthesizer_target_fref_overwrite_hz; - uint8_t qec_tracking_slow_mode_enable; - uint8_t ensm_enable_pin_pulse_mode_enable; - uint8_t ensm_enable_txnrx_control_enable; - uint64_t rx_synthesizer_frequency_hz; - uint64_t tx_synthesizer_frequency_hz; - uint32_t rx_path_clock_frequencies[6]; - uint32_t tx_path_clock_frequencies[6]; - uint32_t rf_rx_bandwidth_hz; - uint32_t rf_tx_bandwidth_hz; - uint32_t rx_rf_port_input_select; - uint32_t tx_rf_port_input_select; - int32_t tx_attenuation_mdB; - uint8_t update_tx_gain_in_alert_enable; - uint8_t xo_disable_use_ext_refclk_enable; - uint32_t dcxo_coarse_and_fine_tune[2]; - uint32_t clk_output_mode_select; - uint8_t gc_rx1_mode; - uint8_t gc_rx2_mode; - uint8_t gc_adc_large_overload_thresh; - uint8_t gc_adc_ovr_sample_size; - uint8_t gc_adc_small_overload_thresh; - uint16_t gc_dec_pow_measurement_duration; - uint8_t gc_dig_gain_enable; - uint16_t gc_lmt_overload_high_thresh; - uint16_t gc_lmt_overload_low_thresh; - uint8_t gc_low_power_thresh; - uint8_t gc_max_dig_gain; - uint8_t mgc_dec_gain_step; - uint8_t mgc_inc_gain_step; - uint8_t mgc_rx1_ctrl_inp_enable; - uint8_t mgc_rx2_ctrl_inp_enable; - uint8_t mgc_split_table_ctrl_inp_gain_mode; - uint8_t agc_adc_large_overload_exceed_counter; - uint8_t agc_adc_large_overload_inc_steps; - uint8_t agc_adc_lmt_small_overload_prevent_gain_inc_enable; - uint8_t agc_adc_small_overload_exceed_counter; - uint8_t agc_dig_gain_step_size; - uint8_t agc_dig_saturation_exceed_counter; - uint32_t agc_gain_update_interval_us; - uint8_t agc_immed_gain_change_if_large_adc_overload_enable; - uint8_t agc_immed_gain_change_if_large_lmt_overload_enable; - uint8_t agc_inner_thresh_high; - uint8_t agc_inner_thresh_high_dec_steps; - uint8_t agc_inner_thresh_low; - uint8_t agc_inner_thresh_low_inc_steps; - uint8_t agc_lmt_overload_large_exceed_counter; - uint8_t agc_lmt_overload_large_inc_steps; - uint8_t agc_lmt_overload_small_exceed_counter; - uint8_t agc_outer_thresh_high; - uint8_t agc_outer_thresh_high_dec_steps; - uint8_t agc_outer_thresh_low; - uint8_t agc_outer_thresh_low_inc_steps; - uint32_t agc_attack_delay_extra_margin_us; - uint8_t agc_sync_for_gain_counter_enable; - uint32_t fagc_dec_pow_measuremnt_duration; - uint32_t fagc_state_wait_time_ns; - uint8_t fagc_allow_agc_gain_increase; - uint32_t fagc_lp_thresh_increment_time; - uint32_t fagc_lp_thresh_increment_steps; - uint8_t fagc_lock_level_lmt_gain_increase_en; - uint32_t fagc_lock_level_gain_increase_upper_limit; - uint32_t fagc_lpf_final_settling_steps; - uint32_t fagc_lmt_final_settling_steps; - uint32_t fagc_final_overrange_count; - uint8_t fagc_gain_increase_after_gain_lock_en; - uint32_t fagc_gain_index_type_after_exit_rx_mode; - uint8_t fagc_use_last_lock_level_for_set_gain_en; - uint8_t fagc_rst_gla_stronger_sig_thresh_exceeded_en; - uint32_t fagc_optimized_gain_offset; - uint32_t fagc_rst_gla_stronger_sig_thresh_above_ll; - uint8_t fagc_rst_gla_engergy_lost_sig_thresh_exceeded_en; - uint8_t fagc_rst_gla_engergy_lost_goto_optim_gain_en; - uint32_t fagc_rst_gla_engergy_lost_sig_thresh_below_ll; - uint32_t fagc_energy_lost_stronger_sig_gain_lock_exit_cnt; - uint8_t fagc_rst_gla_large_adc_overload_en; - uint8_t fagc_rst_gla_large_lmt_overload_en; - uint8_t fagc_rst_gla_en_agc_pulled_high_en; - uint32_t fagc_rst_gla_if_en_agc_pulled_high_mode; - uint32_t fagc_power_measurement_duration_in_state5; - uint32_t rssi_delay; - uint32_t rssi_duration; - uint8_t rssi_restart_mode; - uint8_t rssi_unit_is_rx_samples_enable; - uint32_t rssi_wait; - uint32_t aux_adc_decimation; - uint32_t aux_adc_rate; - uint8_t aux_dac_manual_mode_enable; - uint32_t aux_dac1_default_value_mV; - uint8_t aux_dac1_active_in_rx_enable; - uint8_t aux_dac1_active_in_tx_enable; - uint8_t aux_dac1_active_in_alert_enable; - uint32_t aux_dac1_rx_delay_us; - uint32_t aux_dac1_tx_delay_us; - uint32_t aux_dac2_default_value_mV; - uint8_t aux_dac2_active_in_rx_enable; - uint8_t aux_dac2_active_in_tx_enable; - uint8_t aux_dac2_active_in_alert_enable; - uint32_t aux_dac2_rx_delay_us; - uint32_t aux_dac2_tx_delay_us; - uint32_t temp_sense_decimation; - uint16_t temp_sense_measurement_interval_ms; - int8_t temp_sense_offset_signed; - uint8_t temp_sense_periodic_measurement_enable; - uint8_t ctrl_outs_enable_mask; - uint8_t ctrl_outs_index; - uint32_t elna_settling_delay_ns; - uint32_t elna_gain_mdB; - uint32_t elna_bypass_loss_mdB; - uint8_t elna_rx1_gpo0_control_enable; - uint8_t elna_rx2_gpo1_control_enable; - uint8_t elna_gaintable_all_index_enable; - uint8_t digital_interface_tune_skip_mode; - uint8_t digital_interface_tune_fir_disable; - uint8_t pp_tx_swap_enable; - uint8_t pp_rx_swap_enable; - uint8_t tx_channel_swap_enable; - uint8_t rx_channel_swap_enable; - uint8_t rx_frame_pulse_mode_enable; - uint8_t two_t_two_r_timing_enable; - uint8_t invert_data_bus_enable; - uint8_t invert_data_clk_enable; - uint8_t fdd_alt_word_order_enable; - uint8_t invert_rx_frame_enable; - uint8_t fdd_rx_rate_2tx_enable; - uint8_t swap_ports_enable; - uint8_t single_data_rate_enable; - uint8_t lvds_mode_enable; - uint8_t half_duplex_mode_enable; - uint8_t single_port_mode_enable; - uint8_t full_port_enable; - uint8_t full_duplex_swap_bits_enable; - uint32_t delay_rx_data; - uint32_t rx_data_clock_delay; - uint32_t rx_data_delay; - uint32_t tx_fb_clock_delay; - uint32_t tx_data_delay; - uint32_t lvds_bias_mV; - uint8_t lvds_rx_onchip_termination_enable; - uint8_t rx1rx2_phase_inversion_en; - uint8_t lvds_invert1_control; - uint8_t lvds_invert2_control; - uint8_t clk_out_drive; - uint8_t dataclk_drive; - uint8_t data_port_drive; - uint8_t clk_out_slew; - uint8_t dataclk_slew; - uint8_t data_port_slew; - uint8_t gpo0_inactive_state_high_enable; - uint8_t gpo1_inactive_state_high_enable; - uint8_t gpo2_inactive_state_high_enable; - uint8_t gpo3_inactive_state_high_enable; - uint8_t gpo0_slave_rx_enable; - uint8_t gpo0_slave_tx_enable; - uint8_t gpo1_slave_rx_enable; - uint8_t gpo1_slave_tx_enable; - uint8_t gpo2_slave_rx_enable; - uint8_t gpo2_slave_tx_enable; - uint8_t gpo3_slave_rx_enable; - uint8_t gpo3_slave_tx_enable; - uint8_t gpo0_rx_delay_us; - uint8_t gpo0_tx_delay_us; - uint8_t gpo1_rx_delay_us; - uint8_t gpo1_tx_delay_us; - uint8_t gpo2_rx_delay_us; - uint8_t gpo2_tx_delay_us; - uint8_t gpo3_rx_delay_us; - uint8_t gpo3_tx_delay_us; - uint32_t low_high_gain_threshold_mdB; - uint32_t low_gain_dB; - uint32_t high_gain_dB; - uint8_t tx_mon_track_en; - uint8_t one_shot_mode_en; - uint32_t tx_mon_delay; - uint32_t tx_mon_duration; - uint32_t tx1_mon_front_end_gain; - uint32_t tx2_mon_front_end_gain; - uint32_t tx1_mon_lo_cm; - uint32_t tx2_mon_lo_cm; - int32_t gpio_resetb; - int32_t gpio_sync; - int32_t gpio_cal_sw1; - int32_t gpio_cal_sw2; - uint32_t (*ad9361_rfpll_ext_recalc_rate)(struct refclk_scale *clk_priv); - int32_t (*ad9361_rfpll_ext_round_rate)(struct refclk_scale *clk_priv, - uint32_t rate); - int32_t (*ad9361_rfpll_ext_set_rate)(struct refclk_scale *clk_priv, - uint32_t rate); -} AD9361_InitParam; - -typedef struct { - uint32_t rx; /* 1, 2, 3(both) */ - int32_t rx_gain; /* -12, -6, 0, 6 */ - uint32_t rx_dec; /* 1, 2, 4 */ - int16_t rx_coef[128]; - uint8_t rx_coef_size; - uint32_t rx_path_clks[6]; - uint32_t rx_bandwidth; -} AD9361_RXFIRConfig; - -typedef struct { - uint32_t tx; /* 1, 2, 3(both) */ - int32_t tx_gain; /* -6, 0 */ - uint32_t tx_int; /* 1, 2, 4 */ - int16_t tx_coef[128]; - uint8_t tx_coef_size; - uint32_t tx_path_clks[6]; - uint32_t tx_bandwidth; -} AD9361_TXFIRConfig; - #define AD936X_A_BALANCED 0 #define AD936X_B_BALANCED 1 #define AD936X_C_BALANCED 2 @@ -789,70 +107,5 @@ typedef struct { #define AD936X_TXA 0 #define AD936X_TXB 1 -int32_t ad9361_init(struct ad9361_rf_phy **ad9361_phy, - AD9361_InitParam *init_param, - void *userdata); -int32_t ad9361_deinit(struct ad9361_rf_phy *phy); -int32_t ad9361_set_rx_rf_gain(struct ad9361_rf_phy *phy, - uint8_t ch, - int32_t gain_db); -int32_t ad9361_set_rx_rf_bandwidth(struct ad9361_rf_phy *phy, - uint32_t bandwidth_hz); -int32_t ad9361_get_rx_rf_bandwidth(struct ad9361_rf_phy *phy, - uint32_t *bandwidth_hz); -int32_t ad9361_set_rx_sampling_freq(struct ad9361_rf_phy *phy, - uint32_t sampling_freq_hz); -int32_t ad9361_get_rx_sampling_freq(struct ad9361_rf_phy *phy, - uint32_t *sampling_freq_hz); -int32_t ad9361_set_rx_lo_freq(struct ad9361_rf_phy *phy, uint64_t lo_freq_hz); -int32_t ad9361_get_rx_lo_freq(struct ad9361_rf_phy *phy, uint64_t *lo_freq_hz); -int32_t ad9361_get_rx_rssi(struct ad9361_rf_phy *phy, - uint8_t ch, - struct rf_rssi *rssi); -int32_t ad9361_set_rx_gain_control_mode(struct ad9361_rf_phy *phy, - uint8_t ch, - uint8_t gc_mode); -int32_t ad9361_get_rx_gain_control_mode(struct ad9361_rf_phy *phy, - uint8_t ch, - uint8_t *gc_mode); -int32_t ad9361_set_rx_fir_config(struct ad9361_rf_phy *phy, - AD9361_RXFIRConfig fir_cfg); -int32_t ad9361_set_rx_fir_en_dis(struct ad9361_rf_phy *phy, uint8_t en_dis); -int32_t ad9361_set_rx_rf_port_input(struct ad9361_rf_phy *phy, uint32_t mode); -int32_t ad9361_get_rx_rf_port_input(struct ad9361_rf_phy *phy, uint32_t *mode); -int32_t ad9361_set_tx_attenuation(struct ad9361_rf_phy *phy, - uint8_t ch, - uint32_t attenuation_mdb); -int32_t ad9361_get_tx_attenuation(struct ad9361_rf_phy *phy, - uint8_t ch, - uint32_t *attenuation_mdb); -int32_t ad9361_set_tx_rf_bandwidth(struct ad9361_rf_phy *phy, - uint32_t bandwidth_hz); -int32_t ad9361_get_tx_rf_bandwidth(struct ad9361_rf_phy *phy, - uint32_t *bandwidth_hz); -int32_t ad9361_set_tx_sampling_freq(struct ad9361_rf_phy *phy, - uint32_t sampling_freq_hz); -int32_t ad9361_get_tx_sampling_freq(struct ad9361_rf_phy *phy, - uint32_t *sampling_freq_hz); -int32_t ad9361_set_tx_lo_freq(struct ad9361_rf_phy *phy, uint64_t lo_freq_hz); -int32_t ad9361_get_tx_lo_freq(struct ad9361_rf_phy *phy, uint64_t *lo_freq_hz); -int32_t ad9361_set_tx_fir_config(struct ad9361_rf_phy *phy, - AD9361_TXFIRConfig fir_cfg); -int32_t ad9361_set_tx_fir_en_dis(struct ad9361_rf_phy *phy, uint8_t en_dis); -int32_t ad9361_get_tx_rssi(struct ad9361_rf_phy *phy, - uint8_t ch, - uint32_t *rssi_db_x_1000); -int32_t ad9361_set_tx_rf_port_output(struct ad9361_rf_phy *phy, uint32_t mode); -int32_t ad9361_get_tx_rf_port_output(struct ad9361_rf_phy *phy, uint32_t *mode); -int32_t ad9361_get_temp(struct ad9361_rf_phy *phy); -int32_t ad9361_rx_fastlock_store(struct ad9361_rf_phy *phy, uint32_t profile); -int32_t ad9361_rx_fastlock_save(struct ad9361_rf_phy *phy, - uint32_t profile, - uint8_t *values); -int32_t ad9361_tx_fastlock_store(struct ad9361_rf_phy *phy, uint32_t profile); -int32_t ad9361_tx_fastlock_save(struct ad9361_rf_phy *phy, - uint32_t profile, - uint8_t *values); -int32_t ad9361_set_no_ch_mode(struct ad9361_rf_phy *phy, uint8_t no_ch_mode); #endif // AD936X_H_ diff --git a/fx3_firmware/CHANGELOG b/fx3_firmware/CHANGELOG index e3185b3b..50699054 100644 --- a/fx3_firmware/CHANGELOG +++ b/fx3_firmware/CHANGELOG @@ -5,6 +5,12 @@ For more detailed information, please see the git change log and issue tracker hosted on GitHub: https://github.com/nuand/bladeRF ================================================================================ +v2.6.0 (2025-05-06) +-------------------------------- + * Increase GPIF buffer size for increase performance + * Fixed missing break in BLADE_USB_CMD_QUERY_FPGA_SOURCE command handling + * Improved FX3 SDK setup instructions in README + v2.5.0 (2024-07-30) -------------------------------- * Bumped GPIF DMA buffer size to 8192 bytes diff --git a/fx3_firmware/CMakeLists.txt b/fx3_firmware/CMakeLists.txt index fcd98074..278592d2 100644 --- a/fx3_firmware/CMakeLists.txt +++ b/fx3_firmware/CMakeLists.txt @@ -33,7 +33,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../host/cmake/modules) # Update these definitions when updating the firmware version set(VERSION_INFO_MAJOR 2) -set(VERSION_INFO_MINOR 5) +set(VERSION_INFO_MINOR 6) set(VERSION_INFO_PATCH 0) if(NOT DEFINED VERSION_INFO_EXTRA) diff --git a/hdl/CHANGELOG b/hdl/CHANGELOG index 013661d7..6ecc518d 100644 --- a/hdl/CHANGELOG +++ b/hdl/CHANGELOG @@ -5,6 +5,30 @@ For more detailed information, please see the git change log and issue tracker hosted on GitHub: https://github.com/nuand/bladeRF ================================================================================ +-------------------------------- +v0.16.0 (2025-05-06) +-------------------------------- + +This version brings significant FPGA improvements including sc16q11 packed mode +support and optimized USB throughput, along with important bug fixes for bladeRF +1.0 and 2.0 micro devices. + + Features: + * hdl: Added sc16q11 packed mode for improved sample efficiency + * hdl: Increased FX3 GPIF buffer sizes, boosting USB throughput (~356MB/s) + * hdl: Implemented dynamic Nios base address assignment based on RAM size + * hdl: Added parallel build support for hosted FPGA variants (40, 115, A4, A5, A9) + * nios: Enabled elf-gdb and gdb-server support for improved debugging capability + * hdl: Added git revision information to FPGA build outputs + + Fixes: + * hdl: Fixed delayed sample and off-by-one timestamp bugs on bladeRF 1.0 + * hdl: Corrected TX meta sample gap issue when timestamp set to META NOW + * hdl: Fixed corrupted UART buffer in command_uart component + * hdl: Resolved TX deadlock scenarios by refactoring RX/TX DMA prioritization + * hdl: Improved FPGA simulation accuracy for bladeRF 1 and 2 micro models + * hdl: Fixed false timing paths and resolved multiple timing violations + -------------------------------- v0.15.3 (2023-08-09) -------------------------------- diff --git a/hdl/fpga/platforms/bladerf-micro/software/bladeRF_nios/Makefile b/hdl/fpga/platforms/bladerf-micro/software/bladeRF_nios/Makefile index ac99213a..b25c273e 100644 --- a/hdl/fpga/platforms/bladerf-micro/software/bladeRF_nios/Makefile +++ b/hdl/fpga/platforms/bladerf-micro/software/bladeRF_nios/Makefile @@ -36,7 +36,9 @@ LIBAD936X_DIR := ../../../../fpga/ip/analogdevicesinc/no_OS INC_DIRS += $(LIBAD936X_BUILDDIR) \ ../$(LIBAD936X_DIR)/include \ - ../../../../../../host/common/include + ../../../../../../host/common/include \ + ../../../../../../host/build/common/thirdparty/ad936x/ \ + ../../../../../../thirdparty/analogdevicesinc/no-OS_local/platform_bladerf2/ LIB_DIRS += $(LIBAD936X_BUILDDIR) LDDEPS += $(LIBAD936X_BUILDDIR)/libad936x.a @@ -80,3 +82,6 @@ $(LIBAD936X_BUILDDIR)/Makefile: $(LIBAD936X_MAKE_DEP) $(LIBAD936X_BUILDDIR)/libad936x.a: $(LIBAD936X_BUILD_DEP) @$(ECHO) Info: Building libad936x @$(MAKE) --no-print-directory -C $(LIBAD936X_BUILDDIR) ad936x + +# Ensure libad936x is built before the application objects that depend on its headers +$(APP_OBJS): $(LIBAD936X_BUILDDIR)/libad936x.a diff --git a/hdl/fpga/platforms/bladerf-micro/software/foxhunt/Makefile b/hdl/fpga/platforms/bladerf-micro/software/foxhunt/Makefile index cb8a9e85..4b39a35f 100644 --- a/hdl/fpga/platforms/bladerf-micro/software/foxhunt/Makefile +++ b/hdl/fpga/platforms/bladerf-micro/software/foxhunt/Makefile @@ -38,7 +38,8 @@ LIBAD936X_DIR := ../../../../fpga/ip/analogdevicesinc/no_OS INC_DIRS += $(LIBAD936X_BUILDDIR) \ ../$(LIBAD936X_DIR)/include \ - ../../../../../../host/common/include + ../../../../../../host/common/include \ + ../../../../../../thirdparty/analogdevicesinc/no-OS_local/platform_bladerf2/ LIB_DIRS += $(LIBAD936X_BUILDDIR) LDDEPS += $(LIBAD936X_BUILDDIR)/libad936x.a diff --git a/hdl/quartus/build_bladerf.sh b/hdl/quartus/build_bladerf.sh index f6e7419e..09d52ff4 100755 --- a/hdl/quartus/build_bladerf.sh +++ b/hdl/quartus/build_bladerf.sh @@ -3,6 +3,41 @@ # Build a bladeRF fpga image ################################################################################ +# Ensure we're in the right directory and submodules are initialized +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" + +# Initialize and update submodules if needed +echo "Checking and initializing submodules..." +cd "$PROJECT_ROOT" +if [ -f .gitmodules ]; then + # Initialize submodules if not already initialized + git submodule init + + # Update submodules to ensure they're checked out + git submodule update + + echo "Submodules initialized and updated." +fi +cd "$SCRIPT_DIR" + +cleanup() { + # Prevent recursive cleanup calls + trap '' INT TERM HUP + + echo "Cleaning up and terminating builds..." + if [ -n "${build_pids[*]}" ]; then + for pid in "${build_pids[@]}"; do + pkill -P $pid 2>/dev/null || true + done + fi + + exit 1 +} + +# Set up trap to catch Ctrl+C and other termination signals +trap cleanup INT TERM HUP + function print_boards() { echo "Supported boards:" for i in ../fpga/platforms/*/build/platform.conf ; do @@ -45,6 +80,7 @@ function usage() echo " synth Synthesize the design" echo " full (default) Fit the design and create programming files" echo " -S Fitter seed setting (default: 1)" + echo " -D Output directory name won't contain the date" echo " -h Show this text" echo "" @@ -126,8 +162,9 @@ fi nios_rev="Tiny" flow="full" seed="1" +omit_date=false -while getopts ":cb:r:s:a:Hfn:l:S:h" opt; do +while getopts ":cb:r:s:a:fn:l:S:DhH" opt; do case $opt in c) clear_work_dir=1 @@ -171,6 +208,10 @@ while getopts ":cb:r:s:a:Hfn:l:S:h" opt; do seed=$OPTARG ;; + D) + omit_date=true + ;; + h) usage exit 0 @@ -192,22 +233,31 @@ if [ "$build_hosted" == "1" ]; then mkdir -p build_logs build_pids=() + echo "Starting parallel builds for all hosted configurations..." for config in "bladeRF 40" "bladeRF 115" "bladeRF-micro A4" "bladeRF-micro A5" "bladeRF-micro A9"; do read -r board size <<< "$config" - echo "Starting build for $board hosted $size..." - $0 -b "$board" -r hosted -s "$size" > "build_logs/$board-hosted-$size.log" 2>&1 & + log_file="build_logs/$board-hosted-$size.log" + $0 -b "$board" -r hosted -s "$size" > "$log_file" 2>&1 & build_pids+=($!) + echo " → $board $size (PID: ${build_pids[-1]})" done - echo "Waiting for ${#build_pids[@]} hosted builds to complete..." + echo "Waiting for ${#build_pids[@]} builds to complete..." + # Monitor build processes + failed=0 for pid in "${build_pids[@]}"; do if ! wait "$pid"; then - echo "Build failed. Check build_logs directory for details." - exit 1 + failed=1 fi done + if [ "$failed" -ne 0 ]; then + echo "One or more builds failed. Check build_logs directory for details." + cleanup + exit 1 + fi + echo "All hosted builds completed successfully!" exit 0 fi @@ -475,7 +525,11 @@ if [[ ${flow} == "full" ]]; then BUILD_TIME_DONE=$(date -d"$BUILD_TIME_DONE" '+%F_%H.%M.%S') BUILD_NAME="$rev"x"$size" - BUILD_OUTPUT_DIR="$BUILD_NAME"-"$BUILD_TIME_DONE" + if [ "$omit_date" = false ]; then + BUILD_OUTPUT_DIR="$BUILD_NAME"-"$BUILD_TIME_DONE" + else + BUILD_OUTPUT_DIR="$BUILD_NAME" + fi RBF=$BUILD_NAME.rbf mkdir -p "$BUILD_OUTPUT_DIR" diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt index f76cb32d..69aded1c 100644 --- a/host/CMakeLists.txt +++ b/host/CMakeLists.txt @@ -4,6 +4,7 @@ project(bladeRF C) ################################################################################ # Project configuration ################################################################################ +add_compile_definitions(NUAND_MODIFICATIONS=1) # All build output lands in this directory: set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/output) diff --git a/host/common/include/host_config.h.in b/host/common/include/host_config.h.in index 844946dd..fc94a777 100644 --- a/host/common/include/host_config.h.in +++ b/host/common/include/host_config.h.in @@ -316,7 +316,9 @@ /******************************************************************************* * Miscellaneous utility macros ******************************************************************************/ +#ifndef ARRAY_SIZE #define ARRAY_SIZE(n) (sizeof(n) / sizeof(n[0])) +#endif /** * GCC 7+ warns on implicit fallthroughs in switch statements diff --git a/host/common/include/osx/clock_gettime.h b/host/common/include/osx/clock_gettime.h index f2ee0cea..db4a0094 100644 --- a/host/common/include/osx/clock_gettime.h +++ b/host/common/include/osx/clock_gettime.h @@ -39,7 +39,9 @@ extern "C" { #endif // __MACH__ typedef int clockid_t; +#ifndef CLOCK_REALTIME #define CLOCK_REALTIME 0 +#endif int clock_gettime(clockid_t clk_id, struct timespec *tp); diff --git a/host/common/include/thread.h b/host/common/include/thread.h index bc6f7d26..9f68ba6f 100644 --- a/host/common/include/thread.h +++ b/host/common/include/thread.h @@ -51,7 +51,9 @@ #include #include #include +#ifndef CLOCK_REALTIME #define CLOCK_REALTIME 0 +#endif #define THREAD pthread_t #define MUTEX pthread_mutex_t diff --git a/host/common/include/windows/clock_gettime.h b/host/common/include/windows/clock_gettime.h index f720a4db..d9ccd932 100644 --- a/host/common/include/windows/clock_gettime.h +++ b/host/common/include/windows/clock_gettime.h @@ -36,7 +36,9 @@ extern "C" { #endif typedef int clockid_t; +#ifndef CLOCK_REALTIME #define CLOCK_REALTIME 0 +#endif int clock_gettime(clockid_t clk_id, struct timespec *tp); diff --git a/host/libraries/libbladeRF/CHANGELOG b/host/libraries/libbladeRF/CHANGELOG index 6b841dee..13cec6ad 100644 --- a/host/libraries/libbladeRF/CHANGELOG +++ b/host/libraries/libbladeRF/CHANGELOG @@ -5,6 +5,56 @@ For more detailed information, please see the git change log and issue tracker hosted on GitHub: https://github.com/Nuand/bladeRF ================================================================================ +v2.6.0 (2025-05-06) +-------------------------------- + +This version of libbladeRF is intended for use with: + + FX3 Firmware v2.6.0 + FPGA v0.16.0 + +New Features: + * Added SC16_Q11 packed sample format support, improving sample efficiency + * Increased FX3 GPIF buffer sizes, significantly boosting USB throughput (~356MB/s) + * Implemented dynamic Nios base address assignment based on RAM size + * Added parallel build support for hosted FPGA variants (40, 115, A4, A5, A9) + * Enabled elf-gdb and gdb-server support for improved FPGA debugging capability + * Added git revision information to FPGA build outputs + * bladeRF 2.0: Added support for gain calibration loading, enabling, and management + * bladeRF 2.0: Introduced bladeRF-power CLI tool for managing gain calibration + * bladeRF 2.0: Added bladerf_get_gain_target function for gain management + * bladeRF 2.0: Added bladerf_format_to_string API call + * bladeRF 2.0: Added bladerf_image_print_metadata API to display image metadata + * bladeRF 2.0: Improved compatibility checking between FPGA and FX3 firmware GPIF buffers + +Improvements: + * libbladeRF now compiles and runs under MinGW and MSVC on Windows platforms + * Replaced libpthreadswin32 dependency with native libbladeRF threading macros + * Improved error handling and reporting for out-of-range frequency and sample rate settings + * Added detailed logging for USB transfer and Nios access timeouts + * Updated Doxygen to v1.9.8, adding support for light/dark modes and modernized configuration + * Improved GPIF buffer alignment handling for larger FX3 buffer sizes + * Added CMake find_package() support for easier integration into external projects + * Streamlined internal error checking macros, simplifying codebase + * Enhanced sync_rx_meta example with additional argument parsing and MIMO support + * Improved FPGA simulations for bladeRF 1.0 and bladeRF 2.0 micro + +Bug Fixes: + * Fixed delayed sample and off-by-one timestamp issues on bladeRF 1.0 + * Corrected TX meta sample gap issue when timestamp set to META_NOW + * Resolved corrupted UART buffer in command_uart component + * Fixed TX deadlock scenarios by refactoring RX/TX DMA prioritization + * Addressed SC16_Q11 packed RX discontinuity issue on overflow condition + * Fixed false timing paths and resolved multiple timing violations + * Fixed calibration load check in bladerf_get_gain_calibration + * Corrected RX meta packet timestamp and flags assignment + * Fixed sync TX initialization bug + +Miscellaneous: + * Updated API documentation to reflect larger GPIF buffer sizes + * Improved FX3 SDK setup instructions in README + * Minor typo and documentation corrections throughout the codebase + v2.5.0 (2023-02-13) -------------------------------- diff --git a/host/libraries/libbladeRF/doc/examples/freq_range_sweep.c b/host/libraries/libbladeRF/doc/examples/freq_range_sweep.c index f969ce6f..5f4675d5 100644 --- a/host/libraries/libbladeRF/doc/examples/freq_range_sweep.c +++ b/host/libraries/libbladeRF/doc/examples/freq_range_sweep.c @@ -2,6 +2,7 @@ #include #include #include +#include #define FREQ_HOP_SPACING (bladerf_frequency)40e6 #define ITERATIONS 10000 @@ -78,16 +79,16 @@ int main(int argc, char *argv[]) for (i = 0; i < num_frequencies; i++) { status = bladerf_set_frequency(dev, ch, frequencies[i]); if (status != 0) { - fprintf(stderr, "Failed to set frequency to %lu Hz: %s\n", + fprintf(stderr, "Failed to set frequency to %" PRIu64 " Hz: %s\n", frequencies[i], bladerf_strerror(status)); return status; } bladerf_log_set_verbosity(BLADERF_LOG_LEVEL_VERBOSE); - printf("Frequency: %lu Hz\n", frequencies[i]); + printf("Frequency: %" PRIu64 " Hz\n", frequencies[i]); status = bladerf_get_quick_tune(dev, ch, &quick_tunes[i]); if (status != 0) { - fprintf(stderr, "Failed to get quick tune for %lu Hz: %s\n", + fprintf(stderr, "Failed to get quick tune for %" PRIu64 " Hz: %s\n", frequencies[i], bladerf_strerror(status)); return status; } diff --git a/host/libraries/libbladeRF/src/bladerf.c b/host/libraries/libbladeRF/src/bladerf.c index 02df2b58..d68595f4 100644 --- a/host/libraries/libbladeRF/src/bladerf.c +++ b/host/libraries/libbladeRF/src/bladerf.c @@ -2165,7 +2165,7 @@ int bladerf_set_oversample_register_config(struct bladerf *dev) { return BLADERF_ERR_UNSUPPORTED; } - bladerf_set_rfic_register(dev,0x003,0x54); // OC Register + bladerf_set_rfic_register(dev,0x003,0xD4); // OC Register /* TX Register Assignments */ bladerf_set_rfic_register(dev,0x02,0xc0); // TX Enable and Filter Control diff --git a/host/libraries/libbladeRF/src/board/bladerf1/bladerf1.c b/host/libraries/libbladeRF/src/board/bladerf1/bladerf1.c index 8a30f767..8d885676 100644 --- a/host/libraries/libbladeRF/src/board/bladerf1/bladerf1.c +++ b/host/libraries/libbladeRF/src/board/bladerf1/bladerf1.c @@ -1369,6 +1369,18 @@ static int bladerf1_enable_module(struct bladerf *dev, } lms_enable_rffe(dev, ch, enable); + + if (enable && !BLADERF_CHANNEL_IS_TX(ch)) { + struct bladerf_sync *sync = &board_data->sync[ch]; + + if (sync->initialized) { + status = sync_prime_stream(sync, 0); + if (status != 0) { + return status; + } + } + } + status = dev->backend->enable_module( dev, BLADERF_CHANNEL_IS_TX(ch) ? BLADERF_TX : BLADERF_RX, enable); diff --git a/host/libraries/libbladeRF/src/board/bladerf1/compatibility.c b/host/libraries/libbladeRF/src/board/bladerf1/compatibility.c index a5276fb8..25e58a4b 100644 --- a/host/libraries/libbladeRF/src/board/bladerf1/compatibility.c +++ b/host/libraries/libbladeRF/src/board/bladerf1/compatibility.c @@ -13,6 +13,7 @@ static const struct compat fw_compat[] = { /* Firmware requires >= FPGA */ + { VERSION(2, 6, 0), VERSION(0, 16, 0) }, { VERSION(2, 5, 0), VERSION(0, 16, 0) }, { VERSION(2, 4, 0), VERSION(0, 6, 0) }, { VERSION(2, 3, 2), VERSION(0, 0, 2) }, @@ -36,6 +37,7 @@ const struct version_compat_table bladerf1_fw_compat_table = {fw_compat, ARRAY_S static const struct compat fpga_compat[] = { /* FPGA requires >= Firmware */ + { VERSION(0, 16, 0), VERSION(2, 6, 0) }, { VERSION(0, 16, 0), VERSION(2, 5, 0) }, { VERSION(0, 15, 3), VERSION(2, 4, 0) }, { VERSION(0, 15, 1), VERSION(2, 4, 0) }, diff --git a/host/libraries/libbladeRF/src/board/bladerf2/bladerf2.c b/host/libraries/libbladeRF/src/board/bladerf2/bladerf2.c index 9fd7ee55..5a77ff83 100644 --- a/host/libraries/libbladeRF/src/board/bladerf2/bladerf2.c +++ b/host/libraries/libbladeRF/src/board/bladerf2/bladerf2.c @@ -2471,8 +2471,9 @@ static int bladerf2_set_loopback(struct bladerf *dev, bladerf_loopback mode) IF_COMMAND_MODE(dev, RFIC_COMMAND_FPGA, { if (BLADERF_LB_RFIC_BIST == mode) { - log_debug( - "%s: BLADERF_LB_RFIC_BIST not supported in FPGA command mode\n", + log_error( + "%s: RFIC BIST requires HOST tuning mode (currently FPGA). " + "Check BLADERF_DEFAULT_TUNING_MODE env var.\n", __FUNCTION__); return BLADERF_ERR_UNSUPPORTED; } diff --git a/host/libraries/libbladeRF/src/board/bladerf2/common.c b/host/libraries/libbladeRF/src/board/bladerf2/common.c index 60a02699..37bd86ba 100644 --- a/host/libraries/libbladeRF/src/board/bladerf2/common.c +++ b/host/libraries/libbladeRF/src/board/bladerf2/common.c @@ -312,7 +312,8 @@ bool check_total_sample_rate(struct bladerf *dev) bladerf_sample_rate rate_accum = 0; size_t active_channels = 0; - const bladerf_sample_rate MAX_SAMPLE_THROUGHPUT = 80000000; + const bladerf_sample_rate MAX_SAMPLE_THROUGHPUT = + (dev->feature == BLADERF_FEATURE_OVERSAMPLE) ? 160000000 : 80000000; /* Read RFFE control register */ status = dev->backend->rffe_control_read(dev, ®); diff --git a/host/libraries/libbladeRF/src/board/bladerf2/compatibility.c b/host/libraries/libbladeRF/src/board/bladerf2/compatibility.c index 8801d174..e67d5b67 100644 --- a/host/libraries/libbladeRF/src/board/bladerf2/compatibility.c +++ b/host/libraries/libbladeRF/src/board/bladerf2/compatibility.c @@ -13,6 +13,7 @@ static const struct compat fw_compat[] = { /* Firmware requires >= FPGA */ + { VERSION(2, 6, 0), VERSION(0, 16, 0) }, { VERSION(2, 5, 0), VERSION(0, 16, 0) }, { VERSION(2, 4, 0), VERSION(0, 6, 0) }, { VERSION(2, 3, 2), VERSION(0, 6, 0) }, @@ -28,6 +29,7 @@ const struct version_compat_table bladerf2_fw_compat_table = {fw_compat, ARRAY_S static const struct compat fpga_compat[] = { /* FPGA requires >= Firmware */ + { VERSION(0, 16, 0), VERSION(2, 6, 0) }, { VERSION(0, 16, 0), VERSION(2, 5, 0) }, { VERSION(0, 15, 3), VERSION(2, 4, 0) }, { VERSION(0, 15, 2), VERSION(2, 4, 0) }, diff --git a/host/libraries/libbladeRF/src/board/bladerf2/rfic_fpga.c b/host/libraries/libbladeRF/src/board/bladerf2/rfic_fpga.c index 089a8cb1..f7590d90 100644 --- a/host/libraries/libbladeRF/src/board/bladerf2/rfic_fpga.c +++ b/host/libraries/libbladeRF/src/board/bladerf2/rfic_fpga.c @@ -319,6 +319,14 @@ static int _rfic_fpga_enable_module(struct bladerf *dev, /* Perform backend setup */ if (be_setup) { + if (dir == BLADERF_RX) { + struct bladerf_sync *sync = &board_data->sync[BLADERF_RX]; + + if (sync->initialized) { + CHECK_STATUS(sync_prime_stream(sync, 0)); + } + } + CHECK_STATUS(dev->backend->enable_module(dev, dir, true)); } diff --git a/host/libraries/libbladeRF/src/board/bladerf2/rfic_host.c b/host/libraries/libbladeRF/src/board/bladerf2/rfic_host.c index 202f3a33..56ed4dd1 100644 --- a/host/libraries/libbladeRF/src/board/bladerf2/rfic_host.c +++ b/host/libraries/libbladeRF/src/board/bladerf2/rfic_host.c @@ -337,6 +337,14 @@ static int _rfic_host_enable_module(struct bladerf *dev, } if (dir_enable || backend_clear) { + if (dir == BLADERF_RX) { + struct bladerf_sync *sync = &board_data->sync[BLADERF_RX]; + + if (sync->initialized) { + CHECK_STATUS(sync_prime_stream(sync, 0)); + } + } + CHECK_STATUS(dev->backend->enable_module(dev, dir, true)); } } diff --git a/host/libraries/libbladeRF/src/streaming/sync.c b/host/libraries/libbladeRF/src/streaming/sync.c index 2162b227..6af3ff08 100644 --- a/host/libraries/libbladeRF/src/streaming/sync.c +++ b/host/libraries/libbladeRF/src/streaming/sync.c @@ -271,6 +271,22 @@ int sync_init(struct bladerf_sync *sync, goto error; } + if ((layout & BLADERF_DIRECTION_MASK) == BLADERF_RX) { + sync->buf_mgmt.buffer_seq = + (uint32_t *)malloc(num_buffers * sizeof(uint32_t)); + if (sync->buf_mgmt.buffer_seq == NULL) { + status = BLADERF_ERR_MEM; + goto error; + } + } else { + sync->buf_mgmt.buffer_seq = NULL; + } + + sync->buf_mgmt.expected_seq = 0; + sync->buf_mgmt.next_seq = 0; + sync->buf_mgmt.reorder_len = 0; + sync->buf_mgmt.reorder_limit = 0; + switch (layout & BLADERF_DIRECTION_MASK) { case BLADERF_RX: /* When starting up an RX stream, the first 'num_transfers' @@ -290,6 +306,8 @@ int sync_init(struct bladerf_sync *sync, sync->meta.msg_timestamp = 0; sync->meta.msg_flags = 0; + sync_reset_sequence_tracking(&sync->buf_mgmt, num_transfers); + break; case BLADERF_TX: @@ -332,13 +350,21 @@ void sync_deinit(struct bladerf_sync *sync) sync_worker_deinit(sync->worker, &sync->buf_mgmt.lock, &sync->buf_mgmt.buf_ready); - if (sync->buf_mgmt.actual_lengths) { - free(sync->buf_mgmt.actual_lengths); - } /* De-allocate our buffer management resources */ if (sync->buf_mgmt.status) { MUTEX_DESTROY(&sync->buf_mgmt.lock); free(sync->buf_mgmt.status); + sync->buf_mgmt.status = NULL; + } + + if (sync->buf_mgmt.actual_lengths) { + free(sync->buf_mgmt.actual_lengths); + sync->buf_mgmt.actual_lengths = NULL; + } + + if (sync->buf_mgmt.buffer_seq) { + free(sync->buf_mgmt.buffer_seq); + sync->buf_mgmt.buffer_seq = NULL; } MUTEX_DESTROY(&sync->lock); @@ -379,6 +405,43 @@ static int wait_for_buffer(struct buffer_mgmt *b, # define SYNC_WORKER_START_TIMEOUT_MS 250 #endif +int sync_prime_stream(struct bladerf_sync *sync, unsigned int timeout_ms) +{ + int status; + unsigned int wait_ms = timeout_ms ? timeout_ms : SYNC_WORKER_START_TIMEOUT_MS; + + if (sync == NULL || !sync->initialized) { + return 0; + } + + if ((sync->stream_config.layout & BLADERF_DIRECTION_MASK) != BLADERF_RX) { + return 0; + } + + if (sync->worker == NULL) { + return BLADERF_ERR_INVAL; + } + + switch (sync_worker_get_state(sync->worker, NULL)) { + case SYNC_WORKER_STATE_RUNNING: + return 0; + + case SYNC_WORKER_STATE_IDLE: + break; + + default: + return BLADERF_ERR_UNEXPECTED; + } + + sync_worker_submit_request(sync->worker, SYNC_WORKER_START); + + status = sync_worker_wait_for_state(sync->worker, + SYNC_WORKER_STATE_RUNNING, + wait_ms); + + return status; +} + /* Returns # of timestamps (or time steps) left in a message */ static inline unsigned int ts_remaining(struct bladerf_sync *s) { diff --git a/host/libraries/libbladeRF/src/streaming/sync.h b/host/libraries/libbladeRF/src/streaming/sync.h index e28d0938..99e10f0f 100644 --- a/host/libraries/libbladeRF/src/streaming/sync.h +++ b/host/libraries/libbladeRF/src/streaming/sync.h @@ -23,6 +23,7 @@ #define STREAMING_SYNC_H_ #include +#include #include @@ -47,6 +48,16 @@ typedef enum { SYNC_BUFFER_IN_FLIGHT, /**< Currently being transferred */ } sync_buffer_status; +#ifndef SYNC_RX_MAX_REORDER +#define SYNC_RX_MAX_REORDER 256 +#endif + +struct rx_reorder_entry { + uint32_t seq; + unsigned int buf_idx; + size_t num_samples; +}; + typedef enum { SYNC_META_STATE_HEADER, /**< Extract the metadata header */ SYNC_META_STATE_SAMPLES, /**< Process samples */ @@ -85,12 +96,68 @@ struct buffer_mgmt { * submitting full buffers to the underlying async system */ sync_tx_submitter submitter; + /* RX-specific tracking for out-of-order completions */ + uint32_t *buffer_seq; + uint32_t expected_seq; + uint32_t next_seq; + struct rx_reorder_entry reorder[SYNC_RX_MAX_REORDER]; + size_t reorder_len; + unsigned int reorder_limit; + MUTEX lock; COND buf_ready; /**< Buffer produced by RX callback, or * buffer emptied by TX callback */ }; +static inline void sync_reset_sequence_tracking(struct buffer_mgmt *b, + unsigned int num_in_flight) +{ + if (b == NULL) { + return; + } + + if (!b->buffer_seq) { + b->expected_seq = 0; + b->next_seq = 0; + b->reorder_len = 0; + return; + } + + for (size_t i = 0; i < SYNC_RX_MAX_REORDER; ++i) { + b->reorder[i].seq = 0; + b->reorder[i].buf_idx = 0; + b->reorder[i].num_samples = 0; + } + + for (unsigned int i = 0; i < b->num_buffers; ++i) { + b->buffer_seq[i] = UINT32_MAX; + } + + unsigned int limit = num_in_flight; + if (limit > b->num_buffers) { + limit = b->num_buffers; + } + + for (unsigned int i = 0; i < limit; ++i) { + b->buffer_seq[i] = i; + } + + b->expected_seq = 0; + b->next_seq = limit; + b->reorder_len = 0; + /* Allow a larger reorder window independent of instantaneous slack. */ + if (b->num_buffers > 1) { + unsigned int capacity = b->num_buffers - 1; + if (capacity > SYNC_RX_MAX_REORDER) { + capacity = SYNC_RX_MAX_REORDER; + } + b->reorder_limit = capacity; + } else { + b->reorder_limit = 0; + } +} + /* State of API-side sync interface */ typedef enum { SYNC_STATE_CHECK_WORKER, @@ -189,4 +256,6 @@ unsigned int sync_buf2idx(struct buffer_mgmt *b, void *addr); void *sync_idx2buf(struct buffer_mgmt *b, unsigned int idx); +int sync_prime_stream(struct bladerf_sync *sync, unsigned int timeout_ms); + #endif diff --git a/host/libraries/libbladeRF/src/streaming/sync_worker.c b/host/libraries/libbladeRF/src/streaming/sync_worker.c index cb7911a7..ede1ec23 100644 --- a/host/libraries/libbladeRF/src/streaming/sync_worker.c +++ b/host/libraries/libbladeRF/src/streaming/sync_worker.c @@ -17,6 +17,7 @@ */ #include +#include #include #include @@ -43,6 +44,75 @@ void *sync_worker_task(void *arg); +static void mark_buffer_ready(struct buffer_mgmt *b, + unsigned int idx, + size_t num_samples) +{ + b->status[idx] = SYNC_BUFFER_FULL; + b->actual_lengths[idx] = num_samples; + COND_SIGNAL(&b->buf_ready); +} + +static void flush_reorder_entries(struct buffer_mgmt *b) +{ + bool progressed = true; + + while (progressed && b->reorder_len > 0) { + progressed = false; + + for (size_t i = 0; i < b->reorder_len; ++i) { + if (b->reorder[i].seq == b->expected_seq) { + mark_buffer_ready(b, b->reorder[i].buf_idx, + b->reorder[i].num_samples); + b->expected_seq++; + + for (size_t j = i; j + 1 < b->reorder_len; ++j) { + b->reorder[j] = b->reorder[j + 1]; + } + + b->reorder_len--; + progressed = true; + break; + } + } + } +} + +static bool hold_out_of_order_buffer(struct buffer_mgmt *b, + uint32_t seq, + unsigned int idx, + size_t num_samples) +{ + if (b->reorder_limit == 0 || b->reorder_len >= b->reorder_limit) { + return false; + } + + const uint32_t new_distance = seq - b->expected_seq; + size_t insert_pos = 0; + + while (insert_pos < b->reorder_len) { + const uint32_t existing_distance = + b->reorder[insert_pos].seq - b->expected_seq; + + if (existing_distance > new_distance) { + break; + } + + insert_pos++; + } + + for (size_t i = b->reorder_len; i > insert_pos; --i) { + b->reorder[i] = b->reorder[i - 1]; + } + + b->reorder[insert_pos].seq = seq; + b->reorder[insert_pos].buf_idx = idx; + b->reorder[insert_pos].num_samples = num_samples; + b->reorder_len++; + + return true; +} + static void *rx_callback(struct bladerf *dev, struct bladerf_stream *stream, struct bladerf_metadata *meta, @@ -80,28 +150,81 @@ static void *rx_callback(struct bladerf *dev, if (b->resubmit_count == 0) { if (b->status[b->prod_i] == SYNC_BUFFER_EMPTY) { - /* This buffer is now ready for the consumer */ - b->status[samples_idx] = SYNC_BUFFER_FULL; - b->actual_lengths[samples_idx] = num_samples; - COND_SIGNAL(&b->buf_ready); + bool release_now = true; + uint32_t seq = 0; + + if (b->buffer_seq) { + seq = b->buffer_seq[samples_idx]; + + if (seq != b->expected_seq) { + const uint32_t distance = seq - b->expected_seq; + + if (distance != 0 && distance <= b->reorder_limit) { + if (hold_out_of_order_buffer(b, seq, samples_idx, + num_samples)) { + release_now = false; + log_verbose("%s worker: buf[%u] held for reorder " + "(seq=%u expect=%u)\n", + worker2str(s), samples_idx, seq, + b->expected_seq); + } else { + log_warning("%s worker: RX reorder window full " + "(limit=%u). Forwarding buf[%u] " + "(seq=%u, expect=%u).\n", + worker2str(s), b->reorder_limit, + samples_idx, seq, b->expected_seq); + } + } else if (distance != 0) { + log_warning("%s worker: RX reorder distance %u exceeds " + "window %u. Forwarding buf[%u].\n", + worker2str(s), distance, b->reorder_limit, + samples_idx); + } + } + } + + if (release_now) { + mark_buffer_ready(b, samples_idx, num_samples); + + if (b->buffer_seq && seq == b->expected_seq) { + b->expected_seq++; + flush_reorder_entries(b); + } + + log_verbose("%s worker: buf[%u] = full\n", + worker2str(s), samples_idx); + } /* Update the state of the buffer being submitted next */ next_idx = b->prod_i; b->status[next_idx] = SYNC_BUFFER_IN_FLIGHT; + if (b->buffer_seq) { + b->buffer_seq[next_idx] = b->next_seq++; + } next_buf = b->buffers[next_idx]; /* Advance to the next buffer for the next callback */ b->prod_i = (next_idx + 1) % b->num_buffers; - log_verbose("%s worker: buf[%u] = full, buf[%u] = in_flight\n", - worker2str(s), samples_idx, next_idx); + if (release_now) { + log_verbose("%s worker: buf[%u] now in_flight\n", + worker2str(s), next_idx); + } } else { - /* TODO propagate back the RX Overrun to the sync_rx() caller */ - log_debug("RX overrun @ buffer %u\r\n", samples_idx); + if (b->reorder_len > 0) { + /* We're holding buffers to restore order. Skip submitting a + * new transfer this time to avoid overwriting held data. */ + next_buf = BLADERF_STREAM_NO_DATA; + log_verbose("%s worker: delaying submission while reorder " + "queue drains\n", worker2str(s)); + } else { + /* TODO propagate back the RX Overrun to the sync_rx() caller */ + log_debug("RX overrun @ buffer %u\r\n", samples_idx); - next_buf = samples; - b->resubmit_count = s->stream_config.num_xfers - 1; + next_buf = samples; + b->resubmit_count = s->stream_config.num_xfers - 1; + } } } else { /* We're still recovering from an overrun at this point. Just @@ -428,6 +551,9 @@ static sync_worker_state exec_idle_state(struct bladerf_sync *s) s->buf_mgmt.status[i] = SYNC_BUFFER_EMPTY; } } + + sync_reset_sequence_tracking(&s->buf_mgmt, + s->stream_config.num_xfers); } MUTEX_UNLOCK(&s->buf_mgmt.lock); diff --git a/host/libraries/libbladeRF_test/CMakeLists.txt b/host/libraries/libbladeRF_test/CMakeLists.txt index fc3d90e1..0121c424 100644 --- a/host/libraries/libbladeRF_test/CMakeLists.txt +++ b/host/libraries/libbladeRF_test/CMakeLists.txt @@ -10,6 +10,7 @@ add_subdirectory(test_ctrl) add_subdirectory(test_freq_hop) add_subdirectory(test_fw_check) add_subdirectory(test_open) +add_subdirectory(test_oversample) add_subdirectory(test_packet) add_subdirectory(test_parse) add_subdirectory(test_peripheral_timing) diff --git a/host/libraries/libbladeRF_test/requirements.txt b/host/libraries/libbladeRF_test/requirements.txt index 875171b7..7f5123fa 100644 --- a/host/libraries/libbladeRF_test/requirements.txt +++ b/host/libraries/libbladeRF_test/requirements.txt @@ -1,14 +1,15 @@ -contourpy==1.3.1 +contourpy>=1.1.1 cycler==0.12.1 fonttools==4.56.0 -kiwisolver==1.4.8 -matplotlib==3.10.0 -numpy==2.2.3 +kiwisolver>=1.4.7 +matplotlib>=3.7.5 +numpy>=1.24.4 packaging==24.2 -pandas==2.2.3 -pillow==11.1.0 -pyparsing==3.2.1 +pandas>=2.0.3 +pillow>=10.4.0 +pyparsing>=3.1.4 python-dateutil==2.9.0.post0 pytz==2025.1 +scipy>=1.8.0 six==1.17.0 tzdata==2025.1 diff --git a/host/libraries/libbladeRF_test/test_gain_compare/requirements.txt b/host/libraries/libbladeRF_test/test_gain_compare/requirements.txt index 2cc080d4..1c587673 100644 --- a/host/libraries/libbladeRF_test/test_gain_compare/requirements.txt +++ b/host/libraries/libbladeRF_test/test_gain_compare/requirements.txt @@ -5,7 +5,7 @@ kiwisolver==1.4.5 matplotlib==3.8.0 numpy==1.26.0 packaging==23.2 -Pillow==10.0.1 +Pillow==11.3.0 pyparsing==3.1.1 python-dateutil==2.8.2 six==1.16.0 diff --git a/host/libraries/libbladeRF_test/test_oversample/CMakeLists.txt b/host/libraries/libbladeRF_test/test_oversample/CMakeLists.txt new file mode 100644 index 00000000..8b9cf347 --- /dev/null +++ b/host/libraries/libbladeRF_test/test_oversample/CMakeLists.txt @@ -0,0 +1,37 @@ +cmake_minimum_required(VERSION 3.10...3.27) +project(libbladeRF_test_oversample C) + +set(INCLUDES + ${libbladeRF_SOURCE_DIR}/include + ${CMAKE_CURRENT_SOURCE_DIR}/../common/include + ${CMAKE_CURRENT_SOURCE_DIR}/../../../common/include + ${CMAKE_CURRENT_SOURCE_DIR}/../../../common/include/windows +) +if(MSVC) + set(INCLUDES ${INCLUDES} ${MSVC_C99_INCLUDES}) +endif() + +set(SRC + src/main.c + ../common/src/test_common.c +) + +if(MSVC OR WIN32) + set(SRC ${SRC} + ${CMAKE_CURRENT_SOURCE_DIR}/../../../common/src/windows/getopt_long.c + ${CMAKE_CURRENT_SOURCE_DIR}/../../../common/src/windows/clock_gettime.c + ) +endif() + +include_directories(${INCLUDES}) +add_executable(${PROJECT_NAME} ${SRC}) +target_link_libraries(${PROJECT_NAME} + libbladerf_shared +) + +# Only link with the math library on non-Windows platforms +if(NOT WIN32 AND NOT MSVC) + target_link_libraries(${PROJECT_NAME} m) +endif() + +add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME}) diff --git a/host/libraries/libbladeRF_test/test_oversample/src/main.c b/host/libraries/libbladeRF_test/test_oversample/src/main.c new file mode 100644 index 00000000..19a94d4f --- /dev/null +++ b/host/libraries/libbladeRF_test/test_oversample/src/main.c @@ -0,0 +1,167 @@ +#include +#include +#include +#include +#include +#if !defined(_WIN32) +#include // for getopt +#else +#include +#include +#endif +#include +#include +#include "log.h" +#include "test_common.h" +#include "libbladeRF.h" + +#define ANSI_COLOR_RED "\x1b[31m" +#define ANSI_COLOR_GREEN "\x1b[32m" +#define ANSI_COLOR_YELLOW "\x1b[33m" +#define ANSI_COLOR_BLUE "\x1b[34m" +#define ANSI_COLOR_MAGENTA "\x1b[35m" +#define ANSI_COLOR_RESET "\x1b[0m" + +/* Use CLOCK_MONOTONIC as a portable alternative that works on FreeBSD and Linux */ +#if defined(_WIN32) +/* On Windows, only CLOCK_REALTIME is supported by our implementation */ +#define TIMING_CLOCK CLOCK_REALTIME +#else +#ifndef CLOCK_MONOTONIC_PRECISE +#ifdef __FreeBSD__ +/* FreeBSD defines CLOCK_MONOTONIC_PRECISE for higher precision */ +#define TIMING_CLOCK CLOCK_MONOTONIC_PRECISE +#elif defined(CLOCK_MONOTONIC_RAW) && defined(__linux__) +/* Linux has CLOCK_MONOTONIC_RAW which is not affected by NTP adjustments */ +#define TIMING_CLOCK CLOCK_MONOTONIC_RAW +#else +/* Fallback to CLOCK_MONOTONIC which is POSIX standard */ +#define TIMING_CLOCK CLOCK_MONOTONIC +#endif +#else +#define TIMING_CLOCK CLOCK_MONOTONIC_PRECISE +#endif +#endif + +void print_usage(const char *prog_name) +{ + printf("Usage: %s [-h] [-v] [-c channel]\n", prog_name); + printf(" -h Show this help message\n"); + printf(" -v Enable verbose logging\n"); + printf(" -c Channel to test (1 or 2, default: 1)\n"); +} + +int main(int argc, char *argv[]) +{ + int status = 0; + struct bladerf *dev = NULL; + int opt; + int opt_ind = 0; + bladerf_log_set_verbosity(BLADERF_LOG_LEVEL_INFO); + + bladerf_frequency freq = 915e6; + bladerf_sample_rate samp_rate = 122.88e6; + bladerf_channel channel = BLADERF_CHANNEL_RX(0); + + const unsigned int num_buffers = 64; + const unsigned int buffer_size = 16384; + const unsigned int num_transfers = 16; + const unsigned int timeout_ms = 1000; + + struct timespec start, end; + + struct option longopts[] = { + {"help", no_argument, 0, 'h'}, + {"verbose", no_argument, 0, 'v'}, + {"channel", required_argument, 0, 'c'}, + {0, 0, 0, 0} + }; + + while ((opt = getopt_long(argc, argv, "hvc:", longopts, &opt_ind)) != -1) { + switch (opt) { + case 'h': + print_usage(argv[0]); + return EXIT_SUCCESS; + case 'v': + bladerf_log_set_verbosity(BLADERF_LOG_LEVEL_VERBOSE); + break; + case 'c': { + int ch_selected= atoi(optarg); + if (ch_selected != 1 && ch_selected != 2) { + fprintf(stderr, "Error: Channel must be 1 or 2\n"); + print_usage(argv[0]); + return EXIT_FAILURE; + } + channel = BLADERF_CHANNEL_RX(ch_selected - 1); + break; + } + default: + print_usage(argv[0]); + return EXIT_FAILURE; + } + } + + const unsigned int num_samples = 1*samp_rate; // 1s of samples + int8_t *samples = (int8_t *)malloc(num_samples * sizeof(int16_t)); + double power = 0; + + CHECK_STATUS(bladerf_open(&dev, NULL)); + CHECK_STATUS(bladerf_set_frequency(dev, channel, freq)); + printf("Channel: %d\n", (channel == BLADERF_CHANNEL_RX(0)) ? 1 : 2); + printf("Frequency: %.2f MHz\n", freq / 1e6); + CHECK_STATUS(bladerf_enable_feature(dev, BLADERF_FEATURE_OVERSAMPLE, true)); + CHECK_STATUS(bladerf_sync_config(dev, BLADERF_RX_X1, BLADERF_FORMAT_SC8_Q7, + num_buffers, buffer_size, num_transfers, timeout_ms)); + + // Not only sets the sample rate, but also applies the oversample register configuration + CHECK_STATUS(bladerf_set_sample_rate(dev, channel, samp_rate, NULL)); + printf("Sample Rate: %.2f MHz\n", samp_rate / 1e6); + + // Collect samples + CHECK_STATUS(bladerf_enable_module(dev, channel, true)); + CHECK_STATUS(clock_gettime(TIMING_CLOCK, &start)); + CHECK_STATUS(bladerf_sync_rx(dev, samples, num_samples, NULL, 0)); + CHECK_STATUS(clock_gettime(TIMING_CLOCK, &end)); + CHECK_STATUS(bladerf_enable_module(dev, channel, false)); + + const double expected_sync_time = (double)num_samples / samp_rate; + double time_taken = (end.tv_sec - start.tv_sec) + (end.tv_nsec - start.tv_nsec) * 1e-9; + printf("Time taken: %f seconds\n", time_taken); + printf("Expected sync time: %f seconds\n", expected_sync_time); + printf("%% error: %f\n", (time_taken - expected_sync_time) / expected_sync_time * 100); + + // Throw error if sync time is outside 5% error margin + double error_percent = (time_taken - expected_sync_time) / expected_sync_time * 100; + double tolerance = 1.0; // 1% tolerance + if (error_percent > tolerance || error_percent < -tolerance) { + printf(ANSI_COLOR_RED "Sync time error: %f%%" ANSI_COLOR_RESET "\n", error_percent); + status = 1; + } + + // Calculate power + for (size_t i = 0; i < num_samples/2; i++) { + double i_sample = (double)samples[2*i]; + double q_sample = (double)samples[2*i+1]; + power += i_sample * i_sample + q_sample * q_sample; + } + double avg_power = power / num_samples; + const double MAX_POWER = (INT8_MAX * INT8_MAX) + (INT8_MAX * INT8_MAX); + double dBFS = 20 * log10(avg_power/MAX_POWER); + printf(ANSI_COLOR_GREEN "Avg Power: %fdBFS" ANSI_COLOR_RESET "\n" , dBFS); + + size_t num_zero_samples = 0; + for (size_t i = 0; i < num_samples; i++) { + if (samples[i] == 0 && samples[i+1] == 0) { + num_zero_samples++; + } + } + + if (num_zero_samples > num_samples * 0.40) { + printf(ANSI_COLOR_RED "%0.2f%% of samples are stuck at 0\n" ANSI_COLOR_RESET, num_zero_samples * 100.0 / num_samples); + status = 1; + } + +error: + if (dev) bladerf_close(dev); + return (status == 0) ? EXIT_SUCCESS : EXIT_FAILURE; +} diff --git a/host/libraries/libbladeRF_test/test_regression/CMakeLists.txt b/host/libraries/libbladeRF_test/test_regression/CMakeLists.txt index 78f09b88..5747d519 100644 --- a/host/libraries/libbladeRF_test/test_regression/CMakeLists.txt +++ b/host/libraries/libbladeRF_test/test_regression/CMakeLists.txt @@ -72,6 +72,16 @@ add_custom_target(test_synthesis DEPENDS ${PROJECT_NAME} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) +add_custom_target(prep_ci + COMMAND ${PROJECT_NAME} --gtest_filter="dump_tests.disk" --gtest_output="json" + DEPENDS ${PROJECT_NAME} + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) + +add_custom_target(bitfile_ci + COMMAND ${PROJECT_NAME} --gtest_filter="bitfile_ci/synth_ci*" --gtest_output="json":bitfile_ci.json + DEPENDS ${PROJECT_NAME} + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) + target_link_libraries( ${PROJECT_NAME} libbladerf_shared diff --git a/host/libraries/libbladeRF_test/test_regression/src/main.cxx b/host/libraries/libbladeRF_test/test_regression/src/main.cxx index 3d95ba07..5813c603 100644 --- a/host/libraries/libbladeRF_test/test_regression/src/main.cxx +++ b/host/libraries/libbladeRF_test/test_regression/src/main.cxx @@ -36,9 +36,11 @@ #include #include #include +#include #define TEST_LIBBLADERF libbladeRF #define TEST_XB200 xb200 +#define BLADERF_QUARTUS_CI_DIR "bladeRF/hdl/quartus/" #define BLADERF_QUARTUS_DIR "../../hdl/quartus/" #define BLADERF_MODELSIM_DIR "../../hdl/fpga/platforms/bladerf-micro/modelsim/" #define NIOS2SHELL "~/intelFPGA_lite/20.1/nios2eds/nios2_command_shell.sh" @@ -474,6 +476,20 @@ const std::vector> fpga_images {"bladeRF-micro", "wlan", "A9"} }; +const std::vector> fpga_images_ci = { + {"bladeRF", "hosted", "40"}, + {"bladeRF", "hosted", "115"}, + {"bladeRF", "fsk_bridge", "40"}, + {"bladeRF", "fsk_bridge", "115"}, + {"bladeRF", "qpsk_tx", "40"}, + {"bladeRF", "qpsk_tx", "115"}, + {"bladeRF-micro", "hosted", "A4"}, + {"bladeRF-micro", "hosted", "A9"}, + {"bladeRF-micro", "foxhunt", "A4"}, + {"bladeRF-micro", "foxhunt", "A9"}, + {"bladeRF-micro", "wlan", "A9"} +}; + class synth: public ::testing::TestWithParam> { char build_dir[PATH_MAX]; void SetUp() override { @@ -506,6 +522,8 @@ class synth: public ::testing::TestWithParam(GetParam()); std::string revision = std::get<1>(GetParam()); @@ -521,27 +539,130 @@ TEST_P(synth, synthesis) { EXPECT_EQ(status, 0); } +TEST_P(synth_ci, synthesis) { + std::string board = std::get<0>(GetParam()); + std::string revision = std::get<1>(GetParam()); + std::string size = std::get<2>(GetParam()); + + std::string command = NIOS2SHELL; + command += " ./build_bladerf.sh "; + command += " -b " + board; + command += " -r " + revision; + command += " -s " + size; + command += " -D "; + + status = std::system(command.c_str()); + EXPECT_EQ(status, 0); +} + + +/** + * @brief Convert a tuple into a build output folder used by build_bladerf.sh + * This is only valid when -o is passed to build_bladerf.sh + * + * @param[in] row The tuple + * + * @return The output folder name + */ +std::string build_folder_name(const std::tuple& row) { + std::string name = absl::StrCat( + std::get<1>(row), "x", + std::get<2>(row)); + absl::c_replace_if(name, [](char c) { return !std::isalnum(c); }, '_'); + return name; +} + +/** + * @brief Convert a tuple into a test name. + * + * @param[in] row The tuple + * + * @return The name of the test + */ +std::string test_name(const std::tuple& row) { + std::string name = absl::StrCat( + std::get<0>(row), "_", + std::get<1>(row), "_", + std::get<2>(row)); + absl::c_replace_if(name, [](char c) { return !std::isalnum(c); }, '_'); + return name; +} + +/** + * @brief Convert a TestParamInfo into a test name. + * + * @param[in] row The TestParamInfo + * + * @return The name of the test + */ +std::string info_test_name(const testing::TestParamInfo& info) { + return test_name(info.param); +} + INSTANTIATE_TEST_SUITE_P(synthesize_defaults, synth, ::testing::ValuesIn(fpga_images_defaults), - [](const testing::TestParamInfo& info) { - std::string name = absl::StrCat( - std::get<0>(info.param), "_", - std::get<1>(info.param), "_", - std::get<2>(info.param)); - absl::c_replace_if(name, [](char c) { return !std::isalnum(c); }, '_'); - return name; - }); + info_test_name); INSTANTIATE_TEST_SUITE_P(DISABLED_synthesize_all, synth, ::testing::ValuesIn(fpga_images_all), - [](const testing::TestParamInfo& info) { - std::string name = absl::StrCat( - std::get<0>(info.param), "_", - std::get<1>(info.param), "_", - std::get<2>(info.param)); - absl::c_replace_if(name, [](char c) { return !std::isalnum(c); }, '_'); - return name; - }); + info_test_name); + +INSTANTIATE_TEST_SUITE_P(bitfile_ci, synth_ci, + ::testing::ValuesIn(fpga_images_ci), + info_test_name); + +/** + * @brief Not a test, writes out an artifacts file to disk so CI can pick it up. + * + */ +TEST(dump_tests, disk) { + std::vector out; + for(const auto& row : fpga_images_ci) { + out.push_back(test_name(row)); + out.push_back(std::string(BLADERF_QUARTUS_CI_DIR) + build_folder_name(row)); + } + + std::ofstream file("ci_artifacts.txt"); // Create an ofstream object and open "ci_artifacts.txt" for writing + + if (!file.is_open()) { + std::cerr << "Failed to open file." << std::endl; + FAIL(); + } + + file << "["; + + for(size_t i = 0; i < out.size(); ++i) { + file << "\"" << out[i] << "\""; + if (i < out.size() - 1) { + file << ", "; + } + } + + file << "]" << std::endl; + file.close(); +} + +/** + * @brief Convert argc/argv into a vector, and filter out gtest_ args + * + * @param[in] argc The number of arguments + * @param[in] argv The arguments + * + * @return A vector of arguments + */ +std::vector filter_gtest_args(int argc, char** argv) { + std::vector args; + for (int i = 0; i < argc; ++i) { + std::string arg(argv[i]); + + // skip all arguments that are for gtest + if (i == 0 || arg.find("--gtest_") != 0) { + std::cout << "adding " << arg << "\n"; + args.push_back(arg); + } + } + return args; +} #define OPTARG "v:h" static struct option long_options[] = { @@ -556,8 +677,17 @@ int main(int argc, char** argv) { int opt_ind = 0; bladerf_log_level log_level; + auto filtered = filter_gtest_args(argc, argv); + const int argc_filt = filtered.size(); + const char* argv_filt[argc_filt]; + + // copy back into a c-style array for getopt_long + for (size_t i = 0; i < filtered.size(); ++i) { + argv_filt[i] = filtered[i].c_str(); + } + while (opt != -1) { - opt = getopt_long(argc, argv, OPTARG, long_options, &opt_ind); + opt = getopt_long(argc_filt, const_cast(argv_filt), OPTARG, long_options, &opt_ind); switch (opt) { case 'v': @@ -579,6 +709,7 @@ int main(int argc, char** argv) { printf(" Example filters: \"libbladeRF*\", \"hdl*\", \"synthesis*\"\n"); printf(" --gtest_also_run_disabled_tests Run only the tests matching the filter.\n"); printf(" --gtest_output=\"json\" Generates JSON report of test run.\n"); + printf(" --gtest_help View gtest specific help menu.\n"); printf("\n"); return EXIT_SUCCESS; diff --git a/host/libraries/libbladeRF_test/test_timestamps/CMakeLists.txt b/host/libraries/libbladeRF_test/test_timestamps/CMakeLists.txt index 34b40751..455aba83 100644 --- a/host/libraries/libbladeRF_test/test_timestamps/CMakeLists.txt +++ b/host/libraries/libbladeRF_test/test_timestamps/CMakeLists.txt @@ -81,7 +81,7 @@ add_executable(libbladeRF_test_txrx_hwloop ${SRC}) target_link_libraries(libbladeRF_test_txrx_hwloop ${LIBS}) configure_file(scripts/test_txrx_hwloop.py - ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${BIN_NAME}.py + ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libbladeRF_test_txrx_hwloop.py FILE_PERMISSIONS OWNER_EXECUTE OWNER_READ COPYONLY) diff --git a/host/libraries/libbladeRF_test/test_timestamps/scripts/test_txrx_hwloop.py b/host/libraries/libbladeRF_test/test_timestamps/scripts/test_txrx_hwloop.py index 9a832d82..bf9e00f3 100644 --- a/host/libraries/libbladeRF_test/test_timestamps/scripts/test_txrx_hwloop.py +++ b/host/libraries/libbladeRF_test/test_timestamps/scripts/test_txrx_hwloop.py @@ -26,8 +26,10 @@ import matplotlib.pyplot as plt import numpy as np import scipy.stats as st import os +import sys import argparse import subprocess +import json def close_figure(event): if event.key == 'escape': @@ -71,6 +73,8 @@ devarg_tx = "" devarg_rx = "" samp_rate_arg = "" devarg_verbosity = "" +devarg_tx_gain = "" +devarg_rx_gain = "" print_stats = False parser = argparse.ArgumentParser( @@ -84,11 +88,21 @@ parser.add_argument('-sr', '--samprate', type=int, help='Sample Rate (Hz)', defa parser.add_argument('-p', '--period', type=int, help='period length (in samples)') parser.add_argument('-i', '--iterations', type=int, help='number of pulses') parser.add_argument('-t', '--threshold', type=int, help='edge count power threshold') +parser.add_argument('-ts', '--threshold-spread', type=int, help='threshold spread (rising = threshold + spread, falling = threshold - spread)', default=int(1e6)) parser.add_argument('-tx', '--txdev', type=str, help='TX device string') parser.add_argument('-rx', '--rxdev', type=str, help='RX device string') +parser.add_argument('-g', '--tx-gain', type=int, help='TX gain (unified gain mode)') +parser.add_argument('-G', '--rx-gain', type=int, help='RX gain (unified gain mode, MGC)') parser.add_argument('-v', '--verbosity', type=str, help='bladeRF log level', default="info") parser.add_argument('-c', '--compare', help='RF loopback compare', action="store_true", default=False) +parser.add_argument('-l', '--loop', help='Enable RX device', action="store_false", default=True, dest="just_tx") parser.add_argument('-s', '--stats', help='print edge statistics', action="store_true", default=False) +parser.add_argument('-o', '--output', type=str, help='output stats to the specified filename, in JSON format') +parser.add_argument('-ng', '--no-gui', help='No GUI', action="store_false", default=True, dest="gui") +parser.add_argument('-e', '--enforce', type=float, help='enforce results and exit code appropriately (in samples, lower is more strict, less than or equal)', default=False) +parser.add_argument('--save-png', type=str, help='Path to save the plot output as a PNG file. When set the gui will not be shown. Use --png-width and --png-height to control size.') +parser.add_argument('--png-width', type=int, help='Width of saved PNG in pixels (default: 800 for single plot, 1600 for dual plot)', default=None) +parser.add_argument('--png-height', type=int, help='Height of saved PNG in pixels (default: 600)', default=None) args = parser.parse_args() @@ -114,8 +128,20 @@ if args.stats: print_stats = True if args.samprate: samp_rate_arg = f"-s {args.samprate}" +if args.tx_gain: + devarg_tx_gain = f"-g {args.tx_gain}" +if args.rx_gain: + devarg_rx_gain = f"-G {args.rx_gain}" -threshold_spread = 1e6 +plot_count = 2 if not args.just_tx and args.compare else 1 +first_label = "TX" if args.just_tx else "RX" +first_file = "compare.csv" if args.just_tx else "samples.csv" +jout = {} +jout["settings"] = {} +jout["settings"]["python_args"] = " ".join(sys.argv[1:]) +test_pass = True + +threshold_spread = args.threshold_spread rising_threshold = threshold + threshold_spread falling_threshold = threshold - threshold_spread @@ -126,39 +152,68 @@ binary_file = 'libbladeRF_test_txrx_hwloop' output_dir = os.path.dirname(os.path.abspath(__file__)) os.chdir(output_dir) proc = subprocess.run(f"./{binary_file} --fill {fill} --burst {burst} --period {period} " - f"--iterations {iterations} -l {devarg_tx} {devarg_rx} {args.compare * '-c'} " - f"{devarg_verbosity} {samp_rate_arg}", shell=True) + f"--iterations {iterations} {devarg_tx} {devarg_rx} {args.compare * '-c'} {(not args.just_tx) * '-l'} " + f"{devarg_verbosity} {samp_rate_arg} {devarg_tx_gain} {devarg_rx_gain}", shell=True) if proc.returncode != 0: print("Failed to run hwloop binary") exit(1) +if not args.compare and args.just_tx: + print("No output written for python to analyze. Please use a combination of -c and -l to display something useful.") + exit(1) + ################################################################ -# RX Data Analysis +# TX or RX Data Analysis ################################################################ -data = pd.read_csv('samples.csv') +data = pd.read_csv(first_file) + I = data['I'].to_numpy() Q = data['Q'].to_numpy() power = I**2 + Q**2 num_samples = range(len(I)) -if args.compare == True: - fig, ((ax1, ax3), - (ax2, ax4), - (ax5, ax6)) = plt.subplots(nrows=3, ncols=2, figsize=(16, 6)) +# Calculate figure size for custom PNG dimensions or GUI display +if args.save_png: + # For PNG output, calculate figsize based on desired pixel dimensions + default_width = 1600 if plot_count == 2 else 800 + default_height = 600 + + png_width = args.png_width if args.png_width else default_width + png_height = args.png_height if args.png_height else default_height + + # Use DPI of 100 to make calculations simple (pixels = inches * 100) + dpi = 100 + figsize = (png_width/dpi, png_height/dpi) else: - fig, (ax1, ax2, ax5) = plt.subplots(nrows=3, ncols=1, figsize=(8, 6)) + # For GUI display, use the original sizes + figsize = (16, 6) if plot_count == 2 else (8, 6) + dpi = 100 -ax1.set_title('RX Board IQ') -ax1.plot(I, label='I') -ax1.plot(Q, label='Q') -ax2.set_title('RX Board Power') -ax2.plot(power, label='Power', color='red') +if args.gui or args.save_png: + if plot_count == 2: + fig, ((ax1, ax3), + (ax2, ax4), + (ax5, ax6)) = plt.subplots(nrows=3, ncols=2, figsize=figsize, dpi=dpi) + else: + fig, (ax1, ax2, ax5) = plt.subplots(nrows=3, ncols=1, figsize=figsize, dpi=dpi) + + ax1.set_title('%s Board IQ' % first_label) + ax1.plot(I, label='I') + ax1.plot(Q, label='Q') + ax2.set_title('%s Board Power' % first_label) + ax2.plot(power, label='Power', color='red') + + # Add threshold lines + ax2.axhline(y=rising_threshold, color='green', linestyle='--', alpha=0.7, label=f'Rising Threshold ({rising_threshold:.0f})') + ax2.axhline(y=falling_threshold, color='orange', linestyle='--', alpha=0.7, label=f'Falling Threshold ({falling_threshold:.0f})') positive_edge, negative_edge = edge_detector(power, rising_threshold, falling_threshold, cycles_to_debounce) pos_edge_indexes = np.argwhere(positive_edge).flatten() -for i in pos_edge_indexes: - ax2.plot(i, rising_threshold, 'g^', markersize=6) + +if args.gui or args.save_png: + for i in pos_edge_indexes: + ax2.plot(i, rising_threshold, 'g^', markersize=6) time_delta_pos_edges = np.diff(pos_edge_indexes) avg = np.average(time_delta_pos_edges) @@ -172,8 +227,10 @@ if print_stats: print(f" Edge Count: {len(pos_edge_indexes)}") neg_edge_indexes = np.argwhere(negative_edge).flatten() -for i in neg_edge_indexes: - ax2.plot(i, falling_threshold, 'yv', markersize=6) + +if args.gui or args.save_png: + for i in neg_edge_indexes: + ax2.plot(i, falling_threshold, 'yv', markersize=6) time_delta_neg_edges = np.diff(neg_edge_indexes) avg = np.average(time_delta_neg_edges) @@ -186,8 +243,8 @@ if print_stats: print(f" Std.Dev: {dev:.2f}") print(f" Edge Count: {len(neg_edge_indexes)}") -print("\nRX Board") -print(f" Predicted Timestamp: {(avg):.3f} samples, Error: {(avg-period):.3f} samples") +print("\n%s Board" % first_label) +print(f" Measured Timestamp: {(avg):.3f} samples, Error: {(avg-period):.3f} samples") try: fill_expected = int(burst*fill/100) @@ -197,38 +254,59 @@ try: dev = np.std(fill) fill_vs_burst = 100 * avg/burst except ValueError as err: - print(f"[Error] RX Board: Edge count imbalanced.\n{err}") + print(f"[Error] %s Board: Edge count imbalanced.\n{err}" % first_label) print(err) fill = None fill_vs_burst = -1 -ax5.set_title("Fill Error") -ax5.set_xlabel("Error (samples)") -fill_error = fill - fill_expected -ax5.hist(fill_error, alpha=0.7, bins=30, color=('skyblue')) -print(f" Predicted Fill: {fill_vs_burst:.2f}%, Error: {(avg-fill_expected):.2f} samples") +if args.gui or args.save_png: + ax5.set_title("Fill Error") + ax5.set_xlabel("Error (samples)") + fill_error = fill - fill_expected + ax5.hist(fill_error, alpha=0.7, bins=30, color=('skyblue')) + +error_samples=(avg-fill_expected) + +jout[first_label] = { + "measured_fill_percent": fill_vs_burst, + "error_samples": error_samples} + +print(f" Measured Fill: {fill_vs_burst:.2f}%, Error: {error_samples:.2f} samples") + +if args.enforce: + local_pass = abs(error_samples) <= args.enforce + test_pass = False if not local_pass else test_pass + print(f" Test threshold: {args.enforce}, Result: %s" % ("PASS" if local_pass else "FAIL")) + ################################################################ # TX Loopback Compare ################################################################ -if args.compare == True: +if plot_count == 2: data = pd.read_csv('compare.csv') I = data['I'].to_numpy() Q = data['Q'].to_numpy() power = I**2 + Q**2 num_samples = range(len(I)) - ax3.set_title('TX Loopback Compare IQ') - ax3.plot(I, label='I') - ax3.plot(Q, label='Q') - ax4.set_title('TX Loopback Compare Power') - ax4.plot(power, label='Power', color='red') + if args.gui or args.save_png: + ax3.set_title('TX Loopback Compare IQ') + ax3.plot(I, label='I') + ax3.plot(Q, label='Q') + ax4.set_title('TX Loopback Compare Power') + ax4.plot(power, label='Power', color='red') + + # Add threshold lines + ax4.axhline(y=rising_threshold, color='green', linestyle='--', alpha=0.7, label=f'Rising Threshold ({rising_threshold:.0f})') + ax4.axhline(y=falling_threshold, color='orange', linestyle='--', alpha=0.7, label=f'Falling Threshold ({falling_threshold:.0f})') positive_edge, negative_edge = edge_detector(power, rising_threshold, falling_threshold, cycles_to_debounce) pos_edge_indexes = np.argwhere(positive_edge).flatten() - for i in pos_edge_indexes: - ax4.plot(i, rising_threshold, 'g^', markersize=6) + + if args.gui or args.save_png: + for i in pos_edge_indexes: + ax4.plot(i, rising_threshold, 'g^', markersize=6) time_delta_pos_edges = np.diff(pos_edge_indexes) avg = np.average(time_delta_pos_edges) @@ -242,8 +320,10 @@ if args.compare == True: print(f" Edge Count: {len(pos_edge_indexes)}") neg_edge_indexes = np.argwhere(negative_edge).flatten() - for i in neg_edge_indexes: - ax4.plot(i, falling_threshold, 'yv', markersize=6) + + if args.gui or args.save_png: + for i in neg_edge_indexes: + ax4.plot(i, falling_threshold, 'yv', markersize=6) time_delta_neg_edges = np.diff(neg_edge_indexes) avg = np.average(time_delta_neg_edges) @@ -256,8 +336,10 @@ if args.compare == True: print(f" Std.Dev: {dev:.2f}") print(f" Edge Count: {len(neg_edge_indexes)}") + + jout["TX"] = {"measured_timestamp": avg} print("\nTX Board: loopback compare") - print(f" Predicted Timestamp: {(avg):.3f} samples") + print(f" Measured Timestamp: {(avg):.3f} samples") try: fill_compare = neg_edge_indexes - pos_edge_indexes @@ -271,20 +353,41 @@ if args.compare == True: fill_compare = None fill_vs_burst_compare = -1 - print(f" Predicted Fill: {fill_vs_burst_compare:.2f}%, Error: {(avg-fill_expected):.2f} samples") + error_samples=(avg-fill_expected) + jout["TX"]["measured_fill_percent"] = fill_vs_burst_compare + jout["TX"]["error_samples"] = error_samples + print(f" Measured Fill: {fill_vs_burst_compare:.2f}%, Error: {error_samples:.2f} samples") + + if args.enforce: + local_pass = error_samples <= args.enforce + test_pass = False if not local_pass else test_pass + print(f" Test threshold: {args.enforce}, Result: %s" % ("PASS" if local_pass else "FAIL")) print("") print(f"Fill Delta:") fill_delta_avg = 100*(np.average(fill_compare) - np.average(fill))/burst + jout["TX"]["fill_delta_average"] = fill_delta_avg print(f" Average: {fill_delta_avg:.2f}%") - ax6.set_title("Fill Error") - ax6.set_xlabel("Error (samples)") - fill_error = fill_compare - fill_expected - ax6.hist(fill_error, alpha=0.7, bins=30, color=('skyblue')) + if args.gui or args.save_png: + ax6.set_title("Fill Error") + ax6.set_xlabel("Error (samples)") + fill_error = fill_compare - fill_expected + ax6.hist(fill_error, alpha=0.7, bins=30, color=('skyblue')) + +# File Ops +if args.enforce: + jout["exit"] = 1 if not test_pass else 0 +if args.output: + with open(args.output, 'w') as json_file: + json.dump(jout, json_file, indent=4) + +# early exit, as the rest of the script is GUI stuff +if not args.gui and not args.save_png: + exit(1 if not test_pass else 0) # General plot assignments -if args.compare == True: +if plot_count == 2: axis = (ax1, ax2, ax3, ax4) axis_iq = (ax1, ax3) axis_power = (ax2, ax4) @@ -303,6 +406,13 @@ for ax in axis_iq: ax.set_ylim(bottom=-2500, top=2500) fig.subplots_adjust(hspace=1) -print(f"\nPress [Escape] to close figure") -fig.canvas.mpl_connect('key_press_event', close_figure) -plt.show() + +if args.save_png: + plt.savefig(args.save_png, dpi=dpi) + print(f"Plot saved to {args.save_png} ({png_width}x{png_height} pixels)") +elif args.gui: + print(f"\nPress [Escape] to close figure") + fig.canvas.mpl_connect('key_press_event', close_figure) + plt.show() + +exit(1 if not test_pass else 0) diff --git a/host/libraries/libbladeRF_test/test_timestamps/src/test_txrx_hwloop.c b/host/libraries/libbladeRF_test/test_timestamps/src/test_txrx_hwloop.c index f37b9116..0a1eb41d 100644 --- a/host/libraries/libbladeRF_test/test_timestamps/src/test_txrx_hwloop.c +++ b/host/libraries/libbladeRF_test/test_timestamps/src/test_txrx_hwloop.c @@ -63,6 +63,12 @@ static void init_app_params(struct app_params *p, struct test_case *tc) { tc->fill = 50; //percent tc->init_ts_delay = 200000; tc->gain = 30; + + // Initialize gain parameters + tc->tx_gain_set = false; + tc->rx_gain_set = false; + tc->tx_gain = 0; + tc->rx_gain = 0; memset(p, 0, sizeof(p[0])); p->samplerate = 1e6; @@ -164,6 +170,24 @@ int main(int argc, char *argv[]) { } break; + case 'g': + test.tx_gain = str2uint(optarg, 0, UINT_MAX, &ok); + if (!ok) { + fprintf(stderr, "Invalid TX gain: %s\n", optarg); + return -1; + } + test.tx_gain_set = true; + break; + + case 'G': + test.rx_gain = str2uint(optarg, 0, UINT_MAX, &ok); + if (!ok) { + fprintf(stderr, "Invalid RX gain: %s\n", optarg); + return -1; + } + test.rx_gain_set = true; + break; + case 'v': log_level = str2loglevel(optarg, &ok); if (!ok) { @@ -269,6 +293,18 @@ int main(int argc, char *argv[]) { buf += 2 * to_send; } + // Wait for this burst to complete before scheduling the next one + if (status == 0 && i < (test.iterations - 1)) { + uint64_t burst_end_timestamp = meta.timestamp + test.burst_len; + int wait_status = wait_for_timestamp(dev_tx, BLADERF_MODULE_TX, + burst_end_timestamp, 1000); + if (wait_status != 0) { + fprintf(stderr, "Failed to wait for burst %u to complete: %s\n", + (unsigned int)i, bladerf_strerror(wait_status)); + status = first_error(status, wait_status); + } + } + meta.timestamp += test.period; } diff --git a/host/libraries/libbladeRF_test/test_timestamps/src/test_txrx_hwloop.h b/host/libraries/libbladeRF_test/test_timestamps/src/test_txrx_hwloop.h index f30de91f..add16f7c 100644 --- a/host/libraries/libbladeRF_test/test_timestamps/src/test_txrx_hwloop.h +++ b/host/libraries/libbladeRF_test/test_timestamps/src/test_txrx_hwloop.h @@ -34,7 +34,14 @@ struct test_case { unsigned int fill; unsigned int init_ts_delay; bladerf_frequency frequency; - bladerf_gain gain; + bladerf_gain gain; /* Legacy gain field - kept for compatibility */ + + /* Separate TX and RX gain support */ + bool tx_gain_set; + bool rx_gain_set; + bladerf_gain tx_gain; + bladerf_gain rx_gain; + char* dev_tx_str; char* dev_rx_str; bool just_tx; @@ -51,6 +58,8 @@ static struct option const long_options[] = { { "fill", required_argument, NULL, 'f' }, { "loop", no_argument, NULL, 'l' }, { "iterations", required_argument, NULL, 'i' }, + { "tx-gain", required_argument, NULL, 'g' }, + { "rx-gain", required_argument, NULL, 'G' }, { "verbosity", required_argument, NULL, 'v' }, { "help", no_argument, NULL, 'h' }, { NULL, 0, NULL, 0 }, @@ -95,6 +104,8 @@ static void usage() printf(" -p, --period Length between timestamps in samples\n"); printf(" -f, --fill %% of burst to fill with [2000,2000]\n"); printf(" others set to [0,0]\n"); + printf(" -g, --tx-gain Set TX gain (unified gain mode)\n"); + printf(" -G, --rx-gain Set RX gain (unified gain mode, MGC)\n"); printf(" -l, --loop Enables RX device for TX capture\n"); printf(" -c, --compare Outputs CSV RX capture from TX device\n"); printf(" for multi-device fill comparison\n"); @@ -108,7 +119,7 @@ static void usage() printf("\n"); printf("Loop setup:\n"); - printf(" A bladeRF device will TX into the other bladeRF device’s\n" + printf(" A bladeRF device will TX into the other bladeRF device's\n" " RX port over SMA and a 20dB attenuator. See the following\n" " tested config.\n\n"); printf(" bladeRF micro 2.0 TX -> 20dB att. -> SMA -> RX bladeRF x115\n"); @@ -155,6 +166,27 @@ int module_config_enable(struct bladerf *dev, bladerf_channel ch, return status; } + // Set gain if specified + if (BLADERF_CHANNEL_IS_TX(ch) && test->tx_gain_set) { + status = bladerf_set_gain(dev, ch, test->tx_gain); + if (status != 0) { + fprintf(stderr, "Failed to set TX gain: %s\n", bladerf_strerror(status)); + return status; + } + } else if (!BLADERF_CHANNEL_IS_TX(ch) && test->rx_gain_set) { + status = bladerf_set_gain_mode(dev, ch, BLADERF_GAIN_MGC); + if (status != 0) { + fprintf(stderr, "Failed to set RX gain mode: %s\n", bladerf_strerror(status)); + return status; + } + + status = bladerf_set_gain(dev, ch, test->rx_gain); + if (status != 0) { + fprintf(stderr, "Failed to set RX gain: %s\n", bladerf_strerror(status)); + return status; + } + } + status = bladerf_sync_config(dev, ch, sample_format, params->num_buffers, params->buf_size, params->num_xfers, params->timeout_ms); @@ -194,6 +226,7 @@ int init_devices(struct bladerf** dev_tx, struct bladerf** dev_rx, struct app_pa /** RX init */ if (tc->just_tx == false && tc->compare == true) { + // -l -c printf("Mode: TX -> RX (+RF loopback)\n"); printf(" +---------------+ +---------------+\n"); printf(" | TX Device TX|---┬-->|RX RX Device |\n"); @@ -201,6 +234,7 @@ int init_devices(struct bladerf** dev_tx, struct bladerf** dev_rx, struct app_pa printf(" | RX|<--┘ | |\n"); printf(" +---------------+ +---------------+\n"); } else if (tc->just_tx == true && tc->compare == true) { + // -c printf("Mode: TX -> TX\n"); printf(" +---------------+ +---------------+\n"); printf(" | TX Device TX|---┬ |RX RX Device |\n"); @@ -208,13 +242,15 @@ int init_devices(struct bladerf** dev_tx, struct bladerf** dev_rx, struct app_pa printf(" | RX|<--┘ | |\n"); printf(" +---------------+ +---------------+\n"); } else if (tc->just_tx == false && tc->compare == false) { + // -l printf("Mode: TX -> RX\n"); printf(" +---------------+ +---------------+\n"); printf(" | TX Device TX|------>|RX RX Device |\n"); printf(" | | | |\n"); printf(" | RX| | |\n"); printf(" +---------------+ +---------------+\n"); - } else { + } else {// tc->just_tx == true && tc->compare == false + // defaults, no args printf("Mode: TX Only\n"); printf(" +---------------+ v +---------------+\n"); printf(" | TX Device TX|---┘ |RX RX Device |\n"); @@ -248,7 +284,9 @@ int init_devices(struct bladerf** dev_tx, struct bladerf** dev_rx, struct app_pa return -1; } - status = bladerf_set_gain(*dev_tx, BLADERF_MODULE_RX, tc->gain); + // Use new RX gain CLI argument if set + bladerf_gain compare_gain = tc->rx_gain_set ? tc->rx_gain : tc->gain; + status = bladerf_set_gain(*dev_tx, BLADERF_MODULE_RX, compare_gain); if (status != 0) { fprintf(stderr, "Failed to set gain loopback compare RX gain: %s\n", bladerf_strerror(status)); return -1; diff --git a/host/misc/docker/_base.Dockerfile b/host/misc/docker/_base.Dockerfile index c1b91f93..f6544118 100644 --- a/host/misc/docker/_base.Dockerfile +++ b/host/misc/docker/_base.Dockerfile @@ -23,14 +23,11 @@ # This image is a cleaned version of the current working directory. # It is used to speed up the copy/clean process for later builds. -FROM ubuntu AS first +FROM alpine AS first LABEL maintainer="Nuand LLC " -RUN apt-get update \ - && apt-get install -y \ - git \ - && apt-get clean +RUN apk add --no-cache git COPY . /root/bladeRF ENV work="/root/bladeRF/hdl/quartus/work" diff --git a/host/misc/docker/archlinux.Dockerfile b/host/misc/docker/archlinux.Dockerfile index c769763f..89651bf3 100644 --- a/host/misc/docker/archlinux.Dockerfile +++ b/host/misc/docker/archlinux.Dockerfile @@ -1,7 +1,7 @@ # This file is part of the bladeRF project: # http://www.github.com/nuand/bladeRF # -# Copyright (c) 2018 Nuand LLC. +# Copyright (c) 2025 Nuand LLC. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,7 +21,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -FROM archlinux/base +FROM archlinux:latest LABEL maintainer="Nuand LLC " LABEL version="0.0.2" diff --git a/host/misc/docker/build.bash b/host/misc/docker/build.bash old mode 100644 new mode 100755 index 056152eb..6c7fb545 --- a/host/misc/docker/build.bash +++ b/host/misc/docker/build.bash @@ -38,8 +38,12 @@ make_jobs_clangscan=4 # assuming the script is 3 levels down (host/misc/docker) dfdir=$(dirname "${0}") +dfdir=$(cd "${dfdir}" && pwd) # Convert to absolute path basedir=${dfdir}/../../.. +# Always cd to the root. This script is a lot more reliable when we do this +cd $basedir + # globals success="" failure="" @@ -171,18 +175,28 @@ main () { echo "RESULT:SUCCESS:${success}" echo "RESULT:FAILED:${failure}" - [ -n "${failure}" ] && exit 1 + # this if structure is important, script was exiting 1 when it should be passing. bad version: [ -n "${failure}" ] && exit 1 + if [ -n "${failure}" ]; then + exit 1 + fi } if [ $# -gt 0 ]; then # We have an argument, so just build those images... + base_only=true for rootname in "$*"; do if [ "${rootname}" == "_base" ]; then do_base continue fi rels="${rels} ${rootname}" + base_only=false done + + # If we only processed _base targets, exit successfully + if [ "$base_only" = true ] && [ -z "${rels}" ]; then + exit 0 + fi else # No argument, so build everything cd ${basedir} diff --git a/host/misc/docker/centos-7.Dockerfile b/host/misc/docker/centos-7.Dockerfile deleted file mode 100644 index 578bcd13..00000000 --- a/host/misc/docker/centos-7.Dockerfile +++ /dev/null @@ -1,75 +0,0 @@ -# This file is part of the bladeRF project: -# http://www.github.com/nuand/bladeRF -# -# Copyright (c) 2018 Nuand LLC. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -FROM centos:7 - -LABEL maintainer="Nuand LLC " -LABEL version="0.0.3" -LABEL description="CI build environment for the bladeRF project" -LABEL com.nuand.ci.distribution.name="CentOS" -LABEL com.nuand.ci.distribution.version="7" - -# Install things -RUN yum groupinstall -y "Development Tools" \ - && yum install -y \ - clang \ - cmake \ - doxygen \ - help2man \ - libedit \ - libedit-devel \ - libusbx \ - libusbx-devel \ - pandoc \ - wget \ - && yum clean all \ - && rm -rf /var/cache/yum \ - && echo "/usr/local/lib" > /etc/ld.so.conf.d/locallib.conf \ - && echo "/usr/local/lib64" >> /etc/ld.so.conf.d/locallib.conf - -# Copy in our build context -COPY --from=nuand/bladerf-buildenv:base /root/bladeRF /root/bladeRF -COPY --from=nuand/bladerf-buildenv:base /root/.config /root/.config -WORKDIR /root/bladeRF - -# Build arguments -ARG compiler=gcc -ARG buildtype=Release -ARG taggedrelease=NO -ARG parallel=1 - -# Do the build! -RUN cd /root/bladeRF/ \ - && mkdir -p build \ - && cd build \ - && cmake \ - -DBUILD_DOCUMENTATION=ON \ - -DCMAKE_C_COMPILER=${compiler} \ - -DCMAKE_BUILD_TYPE=${buildtype} \ - -DENABLE_FX3_BUILD=OFF \ - -DENABLE_HOST_BUILD=ON \ - -DTAGGED_RELEASE=${taggedrelease} \ - ../ \ - && make -j${parallel} \ - && make install \ - && ldconfig diff --git a/host/misc/docker/clang-scan.Dockerfile b/host/misc/docker/clang-scan.Dockerfile index d9dfd083..2fbb554f 100644 --- a/host/misc/docker/clang-scan.Dockerfile +++ b/host/misc/docker/clang-scan.Dockerfile @@ -1,7 +1,7 @@ # This file is part of the bladeRF project: # http://www.github.com/nuand/bladeRF # -# Copyright (c) 2018 Nuand LLC. +# Copyright (c) 2025 Nuand LLC. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,14 +21,14 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -FROM ubuntu:bionic +FROM ubuntu:noble LABEL maintainer="Nuand LLC " LABEL version="0.0.2" LABEL description="CI build environment for the bladeRF project" LABEL com.nuand.ci.distribution.name="Ubuntu" -LABEL com.nuand.ci.distribution.codename="bionic" -LABEL com.nuand.ci.distribution.version="18.04" +LABEL com.nuand.ci.distribution.codename="noble" +LABEL com.nuand.ci.distribution.version="24.04" # Install things RUN apt-get update \ @@ -39,7 +39,9 @@ RUN apt-get update \ doxygen \ git \ help2man \ - libtecla-dev \ + libcurl4-openssl-dev \ + libedit-dev \ + libncurses5-dev \ libusb-1.0-0-dev \ pandoc \ pkg-config \ @@ -58,5 +60,5 @@ ARG parallel=1 RUN cd /root/bladeRF/host \ && mkdir -p build \ && cd build \ - && cmake -DBUILD_DOCUMENTATION=ON -DCMAKE_C_COMPILER=/usr/share/clang/scan-build-6.0/libexec/ccc-analyzer ../ \ - && /usr/share/clang/scan-build-6.0/bin/scan-build -analyze-headers -maxloop 100 -o ./report make -j${parallel} + && scan-build cmake -DBUILD_DOCUMENTATION=ON ../ \ + && scan-build -analyze-headers -maxloop 100 -o ./report make -j${parallel} diff --git a/host/misc/docker/debian-stretch-i386.Dockerfile b/host/misc/docker/debian-stretch-i386.Dockerfile deleted file mode 100644 index 389220c7..00000000 --- a/host/misc/docker/debian-stretch-i386.Dockerfile +++ /dev/null @@ -1,74 +0,0 @@ -# This file is part of the bladeRF project: -# http://www.github.com/nuand/bladeRF -# -# Copyright (c) 2018 Nuand LLC. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -FROM i386/debian:stretch - -LABEL maintainer="Nuand LLC " -LABEL version="0.0.2" -LABEL description="CI build environment for the bladeRF project" -LABEL com.nuand.ci.distribution.name="Debian" -LABEL com.nuand.ci.distribution.codename="stretch-i386" -LABEL com.nuand.ci.distribution.version="9" - -# Install things -RUN apt-get update \ - && apt-get install -y \ - build-essential \ - clang \ - cmake \ - doxygen \ - git \ - help2man \ - libtecla-dev \ - libusb-1.0-0-dev \ - pandoc \ - pkg-config \ - usbutils \ - && apt-get clean - -# Copy in our build context -COPY --from=nuand/bladerf-buildenv:base /root/bladeRF /root/bladeRF -COPY --from=nuand/bladerf-buildenv:base /root/.config /root/.config -WORKDIR /root/bladeRF - -# Build arguments -ARG compiler=gcc -ARG buildtype=Release -ARG taggedrelease=NO -ARG parallel=1 - -# Do the build! -RUN cd /root/bladeRF/ \ - && mkdir -p build \ - && cd build \ - && cmake \ - -DBUILD_DOCUMENTATION=ON \ - -DCMAKE_C_COMPILER=${compiler} \ - -DCMAKE_BUILD_TYPE=${buildtype} \ - -DENABLE_FX3_BUILD=OFF \ - -DENABLE_HOST_BUILD=ON \ - -DTAGGED_RELEASE=${taggedrelease} \ - ../ \ - && make -j${parallel} \ - && make install \ - && ldconfig diff --git a/host/misc/docker/fedora-latest.Dockerfile b/host/misc/docker/fedora-latest.Dockerfile index 9b00c988..35af359e 100644 --- a/host/misc/docker/fedora-latest.Dockerfile +++ b/host/misc/docker/fedora-latest.Dockerfile @@ -24,14 +24,14 @@ FROM fedora:latest LABEL maintainer="Nuand LLC " -LABEL version="0.0.3" +LABEL version="0.0.4" LABEL description="CI build environment for the bladeRF project" LABEL com.nuand.ci.distribution.name="Fedora" LABEL com.nuand.ci.distribution.version="latest" # Install things -RUN yum groupinstall -y "Development Tools" \ - && yum install -y \ +RUN dnf install -y @development-tools \ + && dnf install -y \ clang \ cmake \ doxygen \ @@ -41,10 +41,13 @@ RUN yum groupinstall -y "Development Tools" \ libedit-devel \ libusbx \ libusbx-devel \ + ncurses-devel \ + curl-devel \ + awk \ pandoc \ wget \ - && yum clean all \ - && rm -rf /var/cache/yum \ + && dnf clean all \ + && rm -rf /var/cache/dnf \ && echo "/usr/local/lib" > /etc/ld.so.conf.d/locallib.conf \ && echo "/usr/local/lib64" >> /etc/ld.so.conf.d/locallib.conf @@ -69,8 +72,8 @@ RUN cd /root/bladeRF/ \ -DCMAKE_BUILD_TYPE=${buildtype} \ -DENABLE_FX3_BUILD=OFF \ -DENABLE_HOST_BUILD=ON \ - -DTAGGED_RELEASE=${taggedrelease} \ - ../ \ + -DTEST_REGRESSION=ON \ + -DTAGGED_RELEASE=${taggedrelease} ../ \ && make -j${parallel} \ && make install \ && ldconfig diff --git a/host/misc/docker/freshen.bash b/host/misc/docker/freshen.bash old mode 100644 new mode 100755 diff --git a/host/misc/docker/debian-jessie.Dockerfile b/host/misc/docker/mageia-latest.Dockerfile similarity index 74% rename from host/misc/docker/debian-jessie.Dockerfile rename to host/misc/docker/mageia-latest.Dockerfile index d31914d1..c9d1e81e 100644 --- a/host/misc/docker/debian-jessie.Dockerfile +++ b/host/misc/docker/mageia-latest.Dockerfile @@ -1,7 +1,7 @@ # This file is part of the bladeRF project: # http://www.github.com/nuand/bladeRF # -# Copyright (c) 2018 Nuand LLC. +# Copyright (c) 2025 Nuand LLC. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,30 +21,32 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -FROM debian:jessie +FROM mageia:latest LABEL maintainer="Nuand LLC " LABEL version="0.0.2" LABEL description="CI build environment for the bladeRF project" -LABEL com.nuand.ci.distribution.name="Debian" -LABEL com.nuand.ci.distribution.codename="jessie" -LABEL com.nuand.ci.distribution.version="8" +LABEL com.nuand.ci.distribution.name="Mageia Linux" -# Install things -RUN apt-get update \ - && apt-get install -y \ - build-essential \ +# Install development tools and required packages using urpmi (Mageia's package manager) +RUN urpmi.update -a \ + && urpmi --auto \ + task-c-devel \ + task-c++-devel \ clang \ cmake \ doxygen \ git \ help2man \ - libtecla-dev \ - libusb-1.0-0-dev \ - pandoc \ - pkg-config \ + lib64curl-devel \ + lib64edit-devel \ + lib64ncurses-devel \ + lib64usb1.0-devel \ usbutils \ - && apt-get clean + make \ + gcc \ + gcc-c++ \ + && urpme --auto-orphans # Copy in our build context COPY --from=nuand/bladerf-buildenv:base /root/bladeRF /root/bladeRF @@ -67,8 +69,13 @@ RUN cd /root/bladeRF/ \ -DCMAKE_BUILD_TYPE=${buildtype} \ -DENABLE_FX3_BUILD=OFF \ -DENABLE_HOST_BUILD=ON \ + -DTEST_REGRESSION=ON \ -DTAGGED_RELEASE=${taggedrelease} \ + -DCURSES_INCLUDE_PATH=/usr/include \ + -DCURSES_CURSES_LIBRARY=/usr/lib64/libcurses.so \ + -DCURSES_NCURSES_LIBRARY=/usr/lib64/libncurses.so \ ../ \ && make -j${parallel} \ && make install \ + && echo "/usr/local/lib64" > /etc/ld.so.conf.d/bladerf.conf \ && ldconfig diff --git a/host/misc/docker/opensuse-latest.Dockerfile b/host/misc/docker/opensuse-latest.Dockerfile index dfdacf35..c0c67436 100644 --- a/host/misc/docker/opensuse-latest.Dockerfile +++ b/host/misc/docker/opensuse-latest.Dockerfile @@ -1,7 +1,7 @@ # This file is part of the bladeRF project: # http://www.github.com/nuand/bladeRF # -# Copyright (c) 2018 Nuand LLC. +# Copyright (c) 2025 Nuand LLC. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -35,12 +35,15 @@ RUN zypper --non-interactive install \ cmake \ doxygen \ gcc \ + gcc-c++ \ git \ help2man \ + libcurl-devel \ libedit \ libedit-devel \ libusb \ libusb-devel \ + ncurses-devel \ pandoc \ wget diff --git a/host/misc/docker/parallel.bash b/host/misc/docker/parallel.bash old mode 100644 new mode 100755 diff --git a/host/misc/docker/debian-jessie-i386.Dockerfile b/host/misc/docker/rocky-8.Dockerfile similarity index 80% rename from host/misc/docker/debian-jessie-i386.Dockerfile rename to host/misc/docker/rocky-8.Dockerfile index 39030a2b..b599605d 100644 --- a/host/misc/docker/debian-jessie-i386.Dockerfile +++ b/host/misc/docker/rocky-8.Dockerfile @@ -1,7 +1,7 @@ # This file is part of the bladeRF project: # http://www.github.com/nuand/bladeRF # -# Copyright (c) 2018 Nuand LLC. +# Copyright (c) 2025 Nuand LLC. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,30 +21,34 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -FROM i386/debian:jessie +FROM rockylinux:8-minimal LABEL maintainer="Nuand LLC " LABEL version="0.0.2" LABEL description="CI build environment for the bladeRF project" -LABEL com.nuand.ci.distribution.name="Debian" -LABEL com.nuand.ci.distribution.codename="jessie-i386" +LABEL com.nuand.ci.distribution.name="Rocky Linux" +LABEL com.nuand.ci.distribution.codename="8" LABEL com.nuand.ci.distribution.version="8" -# Install things -RUN apt-get update \ - && apt-get install -y \ - build-essential \ +# Install dnf first, then everything else +RUN microdnf install -y dnf \ + && dnf update -y \ + && dnf install -y epel-release \ + && dnf config-manager --set-enabled powertools \ + && dnf groupinstall -y "Development Tools" \ + && dnf install -y \ clang \ cmake \ doxygen \ git \ help2man \ - libtecla-dev \ - libusb-1.0-0-dev \ + libcurl-devel \ + libedit-devel \ + ncurses-devel \ + libusb1-devel \ pandoc \ - pkg-config \ usbutils \ - && apt-get clean + && dnf clean all # Copy in our build context COPY --from=nuand/bladerf-buildenv:base /root/bladeRF /root/bladeRF @@ -71,4 +75,4 @@ RUN cd /root/bladeRF/ \ ../ \ && make -j${parallel} \ && make install \ - && ldconfig + && ldconfig \ No newline at end of file diff --git a/host/misc/docker/debian-stretch.Dockerfile b/host/misc/docker/rocky-9.Dockerfile similarity index 77% rename from host/misc/docker/debian-stretch.Dockerfile rename to host/misc/docker/rocky-9.Dockerfile index 97007161..a5042502 100644 --- a/host/misc/docker/debian-stretch.Dockerfile +++ b/host/misc/docker/rocky-9.Dockerfile @@ -1,7 +1,7 @@ # This file is part of the bladeRF project: # http://www.github.com/nuand/bladeRF # -# Copyright (c) 2018 Nuand LLC. +# Copyright (c) 2025 Nuand LLC. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,30 +21,34 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -FROM debian:stretch +FROM rockylinux:9-minimal LABEL maintainer="Nuand LLC " LABEL version="0.0.2" LABEL description="CI build environment for the bladeRF project" -LABEL com.nuand.ci.distribution.name="Debian" -LABEL com.nuand.ci.distribution.codename="stretch" +LABEL com.nuand.ci.distribution.name="Rocky Linux" +LABEL com.nuand.ci.distribution.codename="9" LABEL com.nuand.ci.distribution.version="9" -# Install things -RUN apt-get update \ - && apt-get install -y \ - build-essential \ +# Install dnf first, then everything else +RUN microdnf install -y dnf \ + && dnf update -y \ + && dnf install -y epel-release \ + && dnf groupinstall -y "Development Tools" \ + && dnf config-manager --set-enabled crb \ + && dnf install -y \ clang \ cmake \ doxygen \ git \ help2man \ - libtecla-dev \ - libusb-1.0-0-dev \ + libcurl-devel \ + libedit-devel \ + ncurses-devel \ + libusb1-devel \ pandoc \ - pkg-config \ usbutils \ - && apt-get clean + && dnf clean all # Copy in our build context COPY --from=nuand/bladerf-buildenv:base /root/bladeRF /root/bladeRF @@ -67,8 +71,10 @@ RUN cd /root/bladeRF/ \ -DCMAKE_BUILD_TYPE=${buildtype} \ -DENABLE_FX3_BUILD=OFF \ -DENABLE_HOST_BUILD=ON \ + -DTEST_REGRESSION=ON \ -DTAGGED_RELEASE=${taggedrelease} \ ../ \ && make -j${parallel} \ && make install \ - && ldconfig + && echo "/usr/local/lib64" > /etc/ld.so.conf.d/bladerf.conf \ + && ldconfig \ No newline at end of file diff --git a/host/misc/docker/test.bash b/host/misc/docker/test.bash old mode 100644 new mode 100755 diff --git a/host/misc/docker/ubuntu-disco-i386.Dockerfile b/host/misc/docker/ubuntu-disco-i386.Dockerfile deleted file mode 100644 index c7aa8511..00000000 --- a/host/misc/docker/ubuntu-disco-i386.Dockerfile +++ /dev/null @@ -1,74 +0,0 @@ -# This file is part of the bladeRF project: -# http://www.github.com/nuand/bladeRF -# -# Copyright (c) 2019 Nuand LLC. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -FROM i386/ubuntu:disco - -LABEL maintainer="Nuand LLC " -LABEL version="0.0.2" -LABEL description="CI build environment for the bladeRF project" -LABEL com.nuand.ci.distribution.name="Ubuntu" -LABEL com.nuand.ci.distribution.codename="disco-i386" -LABEL com.nuand.ci.distribution.version="19.04" - -# Install things -RUN apt-get update \ - && apt-get install -y \ - build-essential \ - clang \ - cmake \ - doxygen \ - git \ - help2man \ - libtecla-dev \ - libusb-1.0-0-dev \ - pandoc \ - pkg-config \ - usbutils \ - && apt-get clean - -# Copy in our build context -COPY --from=nuand/bladerf-buildenv:base /root/bladeRF /root/bladeRF -COPY --from=nuand/bladerf-buildenv:base /root/.config /root/.config -WORKDIR /root/bladeRF - -# Build arguments -ARG compiler=gcc -ARG buildtype=Release -ARG taggedrelease=NO -ARG parallel=1 - -# Do the build! -RUN cd /root/bladeRF/ \ - && mkdir -p build \ - && cd build \ - && cmake \ - -DBUILD_DOCUMENTATION=ON \ - -DCMAKE_C_COMPILER=${compiler} \ - -DCMAKE_BUILD_TYPE=${buildtype} \ - -DENABLE_FX3_BUILD=OFF \ - -DENABLE_HOST_BUILD=ON \ - -DTAGGED_RELEASE=${taggedrelease} \ - ../ \ - && make -j${parallel} \ - && make install \ - && ldconfig diff --git a/host/misc/docker/ubuntu-disco.Dockerfile b/host/misc/docker/ubuntu-disco.Dockerfile deleted file mode 100644 index c2507084..00000000 --- a/host/misc/docker/ubuntu-disco.Dockerfile +++ /dev/null @@ -1,74 +0,0 @@ -# This file is part of the bladeRF project: -# http://www.github.com/nuand/bladeRF -# -# Copyright (c) 2019 Nuand LLC. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -FROM ubuntu:disco - -LABEL maintainer="Nuand LLC " -LABEL version="0.0.2" -LABEL description="CI build environment for the bladeRF project" -LABEL com.nuand.ci.distribution.name="Ubuntu" -LABEL com.nuand.ci.distribution.codename="disco" -LABEL com.nuand.ci.distribution.version="19.04" - -# Install things -RUN apt-get update \ - && apt-get install -y \ - build-essential \ - clang \ - cmake \ - doxygen \ - git \ - help2man \ - libtecla-dev \ - libusb-1.0-0-dev \ - pandoc \ - pkg-config \ - usbutils \ - && apt-get clean - -# Copy in our build context -COPY --from=nuand/bladerf-buildenv:base /root/bladeRF /root/bladeRF -COPY --from=nuand/bladerf-buildenv:base /root/.config /root/.config -WORKDIR /root/bladeRF - -# Build arguments -ARG compiler=gcc -ARG buildtype=Release -ARG taggedrelease=NO -ARG parallel=1 - -# Do the build! -RUN cd /root/bladeRF/ \ - && mkdir -p build \ - && cd build \ - && cmake \ - -DBUILD_DOCUMENTATION=ON \ - -DCMAKE_C_COMPILER=${compiler} \ - -DCMAKE_BUILD_TYPE=${buildtype} \ - -DENABLE_FX3_BUILD=OFF \ - -DENABLE_HOST_BUILD=ON \ - -DTAGGED_RELEASE=${taggedrelease} \ - ../ \ - && make -j${parallel} \ - && make install \ - && ldconfig diff --git a/host/misc/docker/ubuntu-eoan-i386.Dockerfile b/host/misc/docker/ubuntu-eoan-i386.Dockerfile deleted file mode 100644 index fdbd0489..00000000 --- a/host/misc/docker/ubuntu-eoan-i386.Dockerfile +++ /dev/null @@ -1,74 +0,0 @@ -# This file is part of the bladeRF project: -# http://www.github.com/nuand/bladeRF -# -# Copyright (c) 2018 Nuand LLC. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -FROM i386/ubuntu:eoan - -LABEL maintainer="Nuand LLC " -LABEL version="0.0.2" -LABEL description="CI build environment for the bladeRF project" -LABEL com.nuand.ci.distribution.name="Ubuntu" -LABEL com.nuand.ci.distribution.codename="eoan" -LABEL com.nuand.ci.distribution.version="19.10-i386" - -# Install things -RUN apt-get update \ - && apt-get install -y \ - build-essential \ - clang \ - cmake \ - doxygen \ - git \ - help2man \ - libtecla-dev \ - libusb-1.0-0-dev \ - pandoc \ - pkg-config \ - usbutils \ - && apt-get clean - -# Copy in our build context -COPY --from=nuand/bladerf-buildenv:base /root/bladeRF /root/bladeRF -COPY --from=nuand/bladerf-buildenv:base /root/.config /root/.config -WORKDIR /root/bladeRF - -# Build arguments -ARG compiler=gcc -ARG buildtype=Release -ARG taggedrelease=NO -ARG parallel=1 - -# Do the build! -RUN cd /root/bladeRF/ \ - && mkdir -p build \ - && cd build \ - && cmake \ - -DBUILD_DOCUMENTATION=ON \ - -DCMAKE_C_COMPILER=${compiler} \ - -DCMAKE_BUILD_TYPE=${buildtype} \ - -DENABLE_FX3_BUILD=OFF \ - -DENABLE_HOST_BUILD=ON \ - -DTAGGED_RELEASE=${taggedrelease} \ - ../ \ - && make -j${parallel} \ - && make install \ - && ldconfig diff --git a/host/misc/docker/ubuntu-eoan.Dockerfile b/host/misc/docker/ubuntu-eoan.Dockerfile deleted file mode 100644 index eeb8ea85..00000000 --- a/host/misc/docker/ubuntu-eoan.Dockerfile +++ /dev/null @@ -1,74 +0,0 @@ -# This file is part of the bladeRF project: -# http://www.github.com/nuand/bladeRF -# -# Copyright (c) 2018 Nuand LLC. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -FROM ubuntu:eoan - -LABEL maintainer="Nuand LLC " -LABEL version="0.0.2" -LABEL description="CI build environment for the bladeRF project" -LABEL com.nuand.ci.distribution.name="Ubuntu" -LABEL com.nuand.ci.distribution.codename="eoan" -LABEL com.nuand.ci.distribution.version="19.10" - -# Install things -RUN apt-get update \ - && apt-get install -y \ - build-essential \ - clang \ - cmake \ - doxygen \ - git \ - help2man \ - libtecla-dev \ - libusb-1.0-0-dev \ - pandoc \ - pkg-config \ - usbutils \ - && apt-get clean - -# Copy in our build context -COPY --from=nuand/bladerf-buildenv:base /root/bladeRF /root/bladeRF -COPY --from=nuand/bladerf-buildenv:base /root/.config /root/.config -WORKDIR /root/bladeRF - -# Build arguments -ARG compiler=gcc -ARG buildtype=Release -ARG taggedrelease=NO -ARG parallel=1 - -# Do the build! -RUN cd /root/bladeRF/ \ - && mkdir -p build \ - && cd build \ - && cmake \ - -DBUILD_DOCUMENTATION=ON \ - -DCMAKE_C_COMPILER=${compiler} \ - -DCMAKE_BUILD_TYPE=${buildtype} \ - -DENABLE_FX3_BUILD=OFF \ - -DENABLE_HOST_BUILD=ON \ - -DTAGGED_RELEASE=${taggedrelease} \ - ../ \ - && make -j${parallel} \ - && make install \ - && ldconfig diff --git a/host/misc/docker/ubuntu-focal-i386.Dockerfile b/host/misc/docker/ubuntu-focal-i386.Dockerfile deleted file mode 100644 index ee00b17d..00000000 --- a/host/misc/docker/ubuntu-focal-i386.Dockerfile +++ /dev/null @@ -1,74 +0,0 @@ -# This file is part of the bladeRF project: -# http://www.github.com/nuand/bladeRF -# -# Copyright (c) 2018 Nuand LLC. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -FROM i386/ubuntu:focal - -LABEL maintainer="Nuand LLC " -LABEL version="0.0.2" -LABEL description="CI build environment for the bladeRF project" -LABEL com.nuand.ci.distribution.name="Ubuntu" -LABEL com.nuand.ci.distribution.codename="focal" -LABEL com.nuand.ci.distribution.version="20.10-i386" - -# Install things -RUN apt-get update \ - && apt-get install -y \ - build-essential \ - clang \ - cmake \ - doxygen \ - git \ - help2man \ - libtecla-dev \ - libusb-1.0-0-dev \ - pandoc \ - pkg-config \ - usbutils \ - && apt-get clean - -# Copy in our build context -COPY --from=nuand/bladerf-buildenv:base /root/bladeRF /root/bladeRF -COPY --from=nuand/bladerf-buildenv:base /root/.config /root/.config -WORKDIR /root/bladeRF - -# Build arguments -ARG compiler=gcc -ARG buildtype=Release -ARG taggedrelease=NO -ARG parallel=1 - -# Do the build! -RUN cd /root/bladeRF/ \ - && mkdir -p build \ - && cd build \ - && cmake \ - -DBUILD_DOCUMENTATION=ON \ - -DCMAKE_C_COMPILER=${compiler} \ - -DCMAKE_BUILD_TYPE=${buildtype} \ - -DENABLE_FX3_BUILD=OFF \ - -DENABLE_HOST_BUILD=ON \ - -DTAGGED_RELEASE=${taggedrelease} \ - ../ \ - && make -j${parallel} \ - && make install \ - && ldconfig diff --git a/host/misc/docker/ubuntu-focal.Dockerfile b/host/misc/docker/ubuntu-focal.Dockerfile index fba4d52f..9c98409b 100644 --- a/host/misc/docker/ubuntu-focal.Dockerfile +++ b/host/misc/docker/ubuntu-focal.Dockerfile @@ -30,6 +30,8 @@ LABEL com.nuand.ci.distribution.name="Ubuntu" LABEL com.nuand.ci.distribution.codename="focal" LABEL com.nuand.ci.distribution.version="20.10" +ENV DEBIAN_FRONTEND=noninteractive + # Install things RUN apt-get update \ && apt-get install -y \ @@ -39,7 +41,9 @@ RUN apt-get update \ doxygen \ git \ help2man \ - libtecla-dev \ + libcurl4-openssl-dev \ + libedit-dev \ + libncurses5-dev \ libusb-1.0-0-dev \ pandoc \ pkg-config \ diff --git a/host/misc/docker/ubuntu-bionic.Dockerfile b/host/misc/docker/ubuntu-jammy.Dockerfile similarity index 87% rename from host/misc/docker/ubuntu-bionic.Dockerfile rename to host/misc/docker/ubuntu-jammy.Dockerfile index 98959c31..883668d4 100644 --- a/host/misc/docker/ubuntu-bionic.Dockerfile +++ b/host/misc/docker/ubuntu-jammy.Dockerfile @@ -1,7 +1,7 @@ # This file is part of the bladeRF project: # http://www.github.com/nuand/bladeRF # -# Copyright (c) 2018 Nuand LLC. +# Copyright (c) 2018-2025 Nuand LLC. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,14 +21,16 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -FROM ubuntu:bionic +FROM ubuntu:jammy LABEL maintainer="Nuand LLC " LABEL version="0.0.2" LABEL description="CI build environment for the bladeRF project" LABEL com.nuand.ci.distribution.name="Ubuntu" -LABEL com.nuand.ci.distribution.codename="bionic" -LABEL com.nuand.ci.distribution.version="18.04" +LABEL com.nuand.ci.distribution.codename="jammy" +LABEL com.nuand.ci.distribution.version="22.04" + +ENV DEBIAN_FRONTEND=noninteractive # Install things RUN apt-get update \ @@ -39,7 +41,9 @@ RUN apt-get update \ doxygen \ git \ help2man \ - libtecla-dev \ + libcurl4-openssl-dev \ + libedit-dev \ + libncurses5-dev \ libusb-1.0-0-dev \ pandoc \ pkg-config \ @@ -67,8 +71,9 @@ RUN cd /root/bladeRF/ \ -DCMAKE_BUILD_TYPE=${buildtype} \ -DENABLE_FX3_BUILD=OFF \ -DENABLE_HOST_BUILD=ON \ + -DTEST_REGRESSION=ON \ -DTAGGED_RELEASE=${taggedrelease} \ ../ \ && make -j${parallel} \ && make install \ - && ldconfig + && ldconfig \ No newline at end of file diff --git a/host/misc/docker/ubuntu-cosmic.Dockerfile b/host/misc/docker/ubuntu-latest-i386.Dockerfile similarity index 63% rename from host/misc/docker/ubuntu-cosmic.Dockerfile rename to host/misc/docker/ubuntu-latest-i386.Dockerfile index 9f4f3974..38bac0ea 100644 --- a/host/misc/docker/ubuntu-cosmic.Dockerfile +++ b/host/misc/docker/ubuntu-latest-i386.Dockerfile @@ -1,7 +1,7 @@ # This file is part of the bladeRF project: # http://www.github.com/nuand/bladeRF # -# Copyright (c) 2018 Nuand LLC. +# Copyright (c) 2025 Nuand LLC. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,31 +21,48 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -FROM ubuntu:cosmic +FROM i386/ubuntu:latest LABEL maintainer="Nuand LLC " LABEL version="0.0.2" LABEL description="CI build environment for the bladeRF project" LABEL com.nuand.ci.distribution.name="Ubuntu" -LABEL com.nuand.ci.distribution.codename="cosmic" -LABEL com.nuand.ci.distribution.version="18.10" +LABEL com.nuand.ci.distribution.codename="latest" +LABEL com.nuand.ci.distribution.version="latest-i386" # Install things RUN apt-get update \ && apt-get install -y \ build-essential \ clang \ - cmake \ doxygen \ git \ help2man \ - libtecla-dev \ + libcurl4-openssl-dev \ + libedit-dev \ + libncurses5-dev \ + libncurses-dev \ + libncursesw5-dev \ + libssl-dev \ libusb-1.0-0-dev \ pandoc \ pkg-config \ usbutils \ + wget \ && apt-get clean +# Custom compile cmake because the version provided in the i386 repos is too old for our cmake scripts +RUN version=3.28 \ + && build=1 \ + && mkdir ~/temp \ + && cd ~/temp \ + && wget -nv https://cmake.org/files/v$version/cmake-$version.$build.tar.gz \ + && tar -xzf cmake-$version.$build.tar.gz \ + && cd cmake-$version.$build/ \ + && ./bootstrap --parallel=$(nproc) --no-debugger \ + && make -j$(nproc) \ + && make install + # Copy in our build context COPY --from=nuand/bladerf-buildenv:base /root/bladeRF /root/bladeRF COPY --from=nuand/bladerf-buildenv:base /root/.config /root/.config @@ -57,6 +74,8 @@ ARG buildtype=Release ARG taggedrelease=NO ARG parallel=1 +RUN ${compiler} --version + # Do the build! RUN cd /root/bladeRF/ \ && mkdir -p build \ @@ -72,3 +91,22 @@ RUN cd /root/bladeRF/ \ && make -j${parallel} \ && make install \ && ldconfig + +# Do an i686 build +RUN cd /root/bladeRF/ \ + && rm -rf build \ + && mkdir -p build \ + && cd build \ + && cmake \ + -DBUILD_DOCUMENTATION=ON \ + -DCMAKE_C_COMPILER=${compiler} \ + -DCMAKE_BUILD_TYPE=${buildtype} \ + -DCMAKE_C_FLAGS="-march=i686 -mtune=i686" \ + -DCMAKE_CXX_FLAGS="-march=i686 -mtune=i686" \ + -DENABLE_FX3_BUILD=OFF \ + -DENABLE_HOST_BUILD=ON \ + -DTAGGED_RELEASE=${taggedrelease} \ + ../ \ + && make -j${parallel} \ + && make install \ + && ldconfig \ No newline at end of file diff --git a/host/misc/docker/ubuntu-cosmic-i386.Dockerfile b/host/misc/docker/ubuntu-latest.Dockerfile similarity index 87% rename from host/misc/docker/ubuntu-cosmic-i386.Dockerfile rename to host/misc/docker/ubuntu-latest.Dockerfile index a9ba599f..1a191cbf 100644 --- a/host/misc/docker/ubuntu-cosmic-i386.Dockerfile +++ b/host/misc/docker/ubuntu-latest.Dockerfile @@ -1,7 +1,7 @@ # This file is part of the bladeRF project: # http://www.github.com/nuand/bladeRF # -# Copyright (c) 2018 Nuand LLC. +# Copyright (c) 2018-2025 Nuand LLC. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,14 +21,16 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -FROM i386/ubuntu:cosmic +FROM ubuntu:latest LABEL maintainer="Nuand LLC " LABEL version="0.0.2" LABEL description="CI build environment for the bladeRF project" LABEL com.nuand.ci.distribution.name="Ubuntu" -LABEL com.nuand.ci.distribution.codename="cosmic-i386" -LABEL com.nuand.ci.distribution.version="18.10" +LABEL com.nuand.ci.distribution.codename="latest" +LABEL com.nuand.ci.distribution.version="latest" + +ENV DEBIAN_FRONTEND=noninteractive # Install things RUN apt-get update \ @@ -39,7 +41,9 @@ RUN apt-get update \ doxygen \ git \ help2man \ - libtecla-dev \ + libcurl4-openssl-dev \ + libedit-dev \ + libncurses5-dev \ libusb-1.0-0-dev \ pandoc \ pkg-config \ @@ -67,8 +71,9 @@ RUN cd /root/bladeRF/ \ -DCMAKE_BUILD_TYPE=${buildtype} \ -DENABLE_FX3_BUILD=OFF \ -DENABLE_HOST_BUILD=ON \ + -DTEST_REGRESSION=ON \ -DTAGGED_RELEASE=${taggedrelease} \ ../ \ && make -j${parallel} \ && make install \ - && ldconfig + && ldconfig \ No newline at end of file diff --git a/host/misc/docker/ubuntu-bionic-i386.Dockerfile b/host/misc/docker/ubuntu-noble.Dockerfile similarity index 88% rename from host/misc/docker/ubuntu-bionic-i386.Dockerfile rename to host/misc/docker/ubuntu-noble.Dockerfile index bd9cef91..8887d05e 100644 --- a/host/misc/docker/ubuntu-bionic-i386.Dockerfile +++ b/host/misc/docker/ubuntu-noble.Dockerfile @@ -1,7 +1,7 @@ # This file is part of the bladeRF project: # http://www.github.com/nuand/bladeRF # -# Copyright (c) 2018 Nuand LLC. +# Copyright (c) 2018-2025 Nuand LLC. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,14 +21,16 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -FROM i386/ubuntu:bionic +FROM ubuntu:noble LABEL maintainer="Nuand LLC " LABEL version="0.0.2" LABEL description="CI build environment for the bladeRF project" LABEL com.nuand.ci.distribution.name="Ubuntu" -LABEL com.nuand.ci.distribution.codename="bionic-i386" -LABEL com.nuand.ci.distribution.version="18.04" +LABEL com.nuand.ci.distribution.codename="noble" +LABEL com.nuand.ci.distribution.version="24.04" + +ENV DEBIAN_FRONTEND=noninteractive # Install things RUN apt-get update \ @@ -39,7 +41,9 @@ RUN apt-get update \ doxygen \ git \ help2man \ - libtecla-dev \ + libcurl4-openssl-dev \ + libedit-dev \ + libncurses5-dev \ libusb-1.0-0-dev \ pandoc \ pkg-config \ @@ -67,6 +71,7 @@ RUN cd /root/bladeRF/ \ -DCMAKE_BUILD_TYPE=${buildtype} \ -DENABLE_FX3_BUILD=OFF \ -DENABLE_HOST_BUILD=ON \ + -DTEST_REGRESSION=ON \ -DTAGGED_RELEASE=${taggedrelease} \ ../ \ && make -j${parallel} \ diff --git a/host/misc/docker/ubuntu-trusty-i386.Dockerfile b/host/misc/docker/ubuntu-trusty-i386.Dockerfile deleted file mode 100644 index c739630a..00000000 --- a/host/misc/docker/ubuntu-trusty-i386.Dockerfile +++ /dev/null @@ -1,74 +0,0 @@ -# This file is part of the bladeRF project: -# http://www.github.com/nuand/bladeRF -# -# Copyright (c) 2018 Nuand LLC. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -FROM i386/ubuntu:trusty - -LABEL maintainer="Nuand LLC " -LABEL version="0.0.2" -LABEL description="CI build environment for the bladeRF project" -LABEL com.nuand.ci.distribution.name="Ubuntu" -LABEL com.nuand.ci.distribution.codename="trusty-i386" -LABEL com.nuand.ci.distribution.version="14.04" - -# Install things -RUN apt-get update \ - && apt-get install -y \ - build-essential \ - clang \ - cmake \ - doxygen \ - git \ - help2man \ - libtecla-dev \ - libusb-1.0-0-dev \ - pandoc \ - pkg-config \ - usbutils \ - && apt-get clean - -# Copy in our build context -COPY --from=nuand/bladerf-buildenv:base /root/bladeRF /root/bladeRF -COPY --from=nuand/bladerf-buildenv:base /root/.config /root/.config -WORKDIR /root/bladeRF - -# Build arguments -ARG compiler=gcc -ARG buildtype=Release -ARG taggedrelease=NO -ARG parallel=1 - -# Do the build! -RUN cd /root/bladeRF/ \ - && mkdir -p build \ - && cd build \ - && cmake \ - -DBUILD_DOCUMENTATION=ON \ - -DCMAKE_C_COMPILER=${compiler} \ - -DCMAKE_BUILD_TYPE=${buildtype} \ - -DENABLE_FX3_BUILD=OFF \ - -DENABLE_HOST_BUILD=ON \ - -DTAGGED_RELEASE=${taggedrelease} \ - ../ \ - && make -j${parallel} \ - && make install \ - && ldconfig diff --git a/host/misc/docker/ubuntu-trusty.Dockerfile b/host/misc/docker/ubuntu-trusty.Dockerfile deleted file mode 100644 index ac0d4d2f..00000000 --- a/host/misc/docker/ubuntu-trusty.Dockerfile +++ /dev/null @@ -1,74 +0,0 @@ -# This file is part of the bladeRF project: -# http://www.github.com/nuand/bladeRF -# -# Copyright (c) 2018 Nuand LLC. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -FROM ubuntu:trusty - -LABEL maintainer="Nuand LLC " -LABEL version="0.0.2" -LABEL description="CI build environment for the bladeRF project" -LABEL com.nuand.ci.distribution.name="Ubuntu" -LABEL com.nuand.ci.distribution.codename="trusty" -LABEL com.nuand.ci.distribution.version="14.04" - -# Install things -RUN apt-get update \ - && apt-get install -y \ - build-essential \ - clang \ - cmake \ - doxygen \ - git \ - help2man \ - libtecla-dev \ - libusb-1.0-0-dev \ - pandoc \ - pkg-config \ - usbutils \ - && apt-get clean - -# Copy in our build context -COPY --from=nuand/bladerf-buildenv:base /root/bladeRF /root/bladeRF -COPY --from=nuand/bladerf-buildenv:base /root/.config /root/.config -WORKDIR /root/bladeRF - -# Build arguments -ARG compiler=gcc -ARG buildtype=Release -ARG taggedrelease=NO -ARG parallel=1 - -# Do the build! -RUN cd /root/bladeRF/ \ - && mkdir -p build \ - && cd build \ - && cmake \ - -DBUILD_DOCUMENTATION=ON \ - -DCMAKE_C_COMPILER=${compiler} \ - -DCMAKE_BUILD_TYPE=${buildtype} \ - -DENABLE_FX3_BUILD=OFF \ - -DENABLE_HOST_BUILD=ON \ - -DTAGGED_RELEASE=${taggedrelease} \ - ../ \ - && make -j${parallel} \ - && make install \ - && ldconfig diff --git a/host/misc/docker/ubuntu-xenial-i386.Dockerfile b/host/misc/docker/ubuntu-xenial-i386.Dockerfile deleted file mode 100644 index 60d2d940..00000000 --- a/host/misc/docker/ubuntu-xenial-i386.Dockerfile +++ /dev/null @@ -1,74 +0,0 @@ -# This file is part of the bladeRF project: -# http://www.github.com/nuand/bladeRF -# -# Copyright (c) 2018 Nuand LLC. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -FROM i386/ubuntu:xenial - -LABEL maintainer="Nuand LLC " -LABEL version="0.0.2" -LABEL description="CI build environment for the bladeRF project" -LABEL com.nuand.ci.distribution.name="Ubuntu" -LABEL com.nuand.ci.distribution.codename="xenial-i386" -LABEL com.nuand.ci.distribution.version="16.04" - -# Install things -RUN apt-get update \ - && apt-get install -y \ - build-essential \ - clang \ - cmake \ - doxygen \ - git \ - help2man \ - libtecla-dev \ - libusb-1.0-0-dev \ - pandoc \ - pkg-config \ - usbutils \ - && apt-get clean - -# Copy in our build context -COPY --from=nuand/bladerf-buildenv:base /root/bladeRF /root/bladeRF -COPY --from=nuand/bladerf-buildenv:base /root/.config /root/.config -WORKDIR /root/bladeRF - -# Build arguments -ARG compiler=gcc -ARG buildtype=Release -ARG taggedrelease=NO -ARG parallel=1 - -# Do the build! -RUN cd /root/bladeRF/ \ - && mkdir -p build \ - && cd build \ - && cmake \ - -DBUILD_DOCUMENTATION=ON \ - -DCMAKE_C_COMPILER=${compiler} \ - -DCMAKE_BUILD_TYPE=${buildtype} \ - -DENABLE_FX3_BUILD=OFF \ - -DENABLE_HOST_BUILD=ON \ - -DTAGGED_RELEASE=${taggedrelease} \ - ../ \ - && make -j${parallel} \ - && make install \ - && ldconfig diff --git a/host/misc/docker/ubuntu-xenial.Dockerfile b/host/misc/docker/ubuntu-xenial.Dockerfile index c0953b10..75f2844e 100644 --- a/host/misc/docker/ubuntu-xenial.Dockerfile +++ b/host/misc/docker/ubuntu-xenial.Dockerfile @@ -1,7 +1,7 @@ # This file is part of the bladeRF project: # http://www.github.com/nuand/bladeRF # -# Copyright (c) 2018 Nuand LLC. +# Copyright (c) 2025 Nuand LLC. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -39,13 +39,31 @@ RUN apt-get update \ doxygen \ git \ help2man \ - libtecla-dev \ + libcurl4-openssl-dev \ + libedit-dev \ + libncurses5-dev \ + libncurses-dev \ + libncursesw5-dev \ + libssl-dev \ libusb-1.0-0-dev \ pandoc \ pkg-config \ usbutils \ + wget \ && apt-get clean +# Custom compile cmake because the version provided in the xenial repos is too old for our cmake scripts +RUN version=3.28 \ +&& build=1 \ +&& mkdir ~/temp \ +&& cd ~/temp \ +&& wget -nv https://cmake.org/files/v$version/cmake-$version.$build.tar.gz \ +&& tar -xzf cmake-$version.$build.tar.gz \ +&& cd cmake-$version.$build/ \ +&& ./bootstrap --parallel=$(nproc) --no-debugger \ +&& make -j$(nproc) \ +&& make install + # Copy in our build context COPY --from=nuand/bladerf-buildenv:base /root/bladeRF /root/bladeRF COPY --from=nuand/bladerf-buildenv:base /root/.config /root/.config @@ -57,6 +75,8 @@ ARG buildtype=Release ARG taggedrelease=NO ARG parallel=1 +RUN ${compiler} --version + # Do the build! RUN cd /root/bladeRF/ \ && mkdir -p build \ @@ -68,7 +88,8 @@ RUN cd /root/bladeRF/ \ -DENABLE_FX3_BUILD=OFF \ -DENABLE_HOST_BUILD=ON \ -DTAGGED_RELEASE=${taggedrelease} \ - ../ \ + ../ \ && make -j${parallel} \ && make install \ && ldconfig + \ No newline at end of file diff --git a/host/utilities/CMakeLists.txt b/host/utilities/CMakeLists.txt index dec80c68..00abd4c6 100644 --- a/host/utilities/CMakeLists.txt +++ b/host/utilities/CMakeLists.txt @@ -1,8 +1,36 @@ cmake_minimum_required(VERSION 3.10...3.27) +option(BUILD_BLADERF_FSK "Build bladeRF FSK" ON) + +if(NOT IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bladeRF-fsk/c) + message(STATUS "bladeRF-fsk: Attempting to initialize missing submodule") + + find_package(Git QUIET) + + if(Git_FOUND) + execute_process( + COMMAND ${Git_EXECUTABLE} submodule init + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + ) + execute_process( + COMMAND ${Git_EXECUTABLE} submodule update + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + ) + endif() +endif() + +if(NOT IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bladeRF-fsk/c) + message(FATAL_ERROR "Directory ${CMAKE_CURRENT_SOURCE_DIR}/bladeRF-fsk was not found. " + "It appears that this submodule has not been properly " + "initialized. Please run 'git submodule init' and " + "'git submodule update', and then re-run cmake.") +endif() + add_subdirectory(bladeRF-cli) add_subdirectory(bladeRF-update) if(NOT MSVC) add_subdirectory(bladeRF-power) - add_subdirectory(bladeRF-fsk/c) + if(BUILD_BLADERF_FSK) + add_subdirectory(bladeRF-fsk/c) + endif() endif() diff --git a/host/utilities/bladeRF-cli/CHANGELOG b/host/utilities/bladeRF-cli/CHANGELOG index 79444a95..3687d321 100644 --- a/host/utilities/bladeRF-cli/CHANGELOG +++ b/host/utilities/bladeRF-cli/CHANGELOG @@ -5,6 +5,17 @@ For more detailed information, please see the git change log and issue tracker hosted on GitHub: https://github.com/Nuand/bladeRF ================================================================================ +v1.10.0 (2025-05-06) +-------------------------------- + * Added sc16q11 packed format support + * Improved sample format tracking and replaced legacy bit_mode handling + * Migrated threading to unified libbladeRF thread macros + * Updated CMake minimum requirement to modernized syntax + * Fixed RX sample count overflow (issue #941) + * Return error code when no available devices detected (issue #844) + * Clarified K/M/G prefixes as powers of 1024 in documentation (issue #840) + * Updated documentation to reflect sample limit changes + v1.9.0 (2023-02-13) -------------------------------- * Added 8-bit sample support for RX/TX, CSV and binary formats diff --git a/host/utilities/bladeRF-cli/CMakeLists.txt b/host/utilities/bladeRF-cli/CMakeLists.txt index 378d2faa..79cd1822 100644 --- a/host/utilities/bladeRF-cli/CMakeLists.txt +++ b/host/utilities/bladeRF-cli/CMakeLists.txt @@ -6,7 +6,7 @@ project(bladeRF-cli C) ################################################################################ set(VERSION_INFO_MAJOR 1) -set(VERSION_INFO_MINOR 9) +set(VERSION_INFO_MINOR 10) set(VERSION_INFO_PATCH 0) if(NOT DEFINED VERSION_INFO_EXTRA) diff --git a/host/utilities/bladeRF-cli/src/input/editline.c b/host/utilities/bladeRF-cli/src/input/editline.c index a832c45b..893bd83d 100644 --- a/host/utilities/bladeRF-cli/src/input/editline.c +++ b/host/utilities/bladeRF-cli/src/input/editline.c @@ -20,7 +20,11 @@ #include #include #include +#ifdef __FreeBSD__ +#include +#else #include +#endif #include #include #include "input_impl.h" diff --git a/host/utilities/bladeRF-fsk b/host/utilities/bladeRF-fsk index b60b1213..fb903684 160000 --- a/host/utilities/bladeRF-fsk +++ b/host/utilities/bladeRF-fsk @@ -1 +1 @@ -Subproject commit b60b121377a5632cd48a03647028a0a45cff7d45 +Subproject commit fb903684036217b9db9dcd6be8007548e12a377e diff --git a/host/utilities/bladeRF-power/CMakeLists.txt b/host/utilities/bladeRF-power/CMakeLists.txt index f2b25c58..0a6ba1cf 100644 --- a/host/utilities/bladeRF-power/CMakeLists.txt +++ b/host/utilities/bladeRF-power/CMakeLists.txt @@ -3,6 +3,17 @@ project(bladeRF-power LANGUAGES C) set (CURSES_NEED_NCURSES TRUE) set (CURSES_NEED_WIDE TRUE) + +if(APPLE) + if(EXISTS "/opt/homebrew/opt/ncurses") + list(APPEND CMAKE_PREFIX_PATH "/opt/homebrew/opt/ncurses") + elseif(EXISTS "/usr/local/opt/ncurses") + list(APPEND CMAKE_PREFIX_PATH "/usr/local/opt/ncurses") + else() + message(WARNING "Homebrew ncurses not found. Install it if the build is failing: brew install ncurses") + endif() +endif() + find_package(Curses REQUIRED) include_directories( diff --git a/host/utilities/bladeRF-power/src/main.c b/host/utilities/bladeRF-power/src/main.c index 58baba3f..086ee14c 100644 --- a/host/utilities/bladeRF-power/src/main.c +++ b/host/utilities/bladeRF-power/src/main.c @@ -94,7 +94,7 @@ int main(int argc, char *argv[]) case 't': case 'r': - if (test.direction != DIRECTION_UNSET) { + if ((int)test.direction != DIRECTION_UNSET) { fprintf(stderr, "Only one direction may be specified.\n"); test.direction = ask_direction(); break; @@ -145,7 +145,7 @@ int main(int argc, char *argv[]) CHECK(bladerf_get_devinfo(dev, &devinfo)); printf("Device: %s\n", devinfo.serial); - if (test.direction == DIRECTION_UNSET) { + if ((int)test.direction == DIRECTION_UNSET) { test.direction = ask_direction(); } diff --git a/host/utilities/bladeRF-update/bladeRF-update.c b/host/utilities/bladeRF-update/bladeRF-update.c index efe77288..6d20a4e6 100644 --- a/host/utilities/bladeRF-update/bladeRF-update.c +++ b/host/utilities/bladeRF-update/bladeRF-update.c @@ -1130,7 +1130,12 @@ void update_rbf_files(const UpdateInfo* update_info) { if (file_exists(filepath)) { if (verify_file(filepath, latest_version->files[j].md5, latest_version->files[j].sha256, update_info)) { rbf_up_to_date = true; - strncpy(existing_rbf_path, filepath, MAX_PATH_LENGTH - 1); + size_t copy_len = strlen(filepath); + if (copy_len >= MAX_PATH_LENGTH) { + copy_len = MAX_PATH_LENGTH - 1; + } + memcpy(existing_rbf_path, filepath, copy_len); + existing_rbf_path[copy_len] = '\0'; printf("[+] Found up-to-date RBF at %s, skipping download\n", filepath); break; } @@ -1184,7 +1189,12 @@ void update_fw_files(const UpdateInfo* update_info) { if (file_exists(filepath)) { if (verify_file(filepath, update_info->firmware.md5, update_info->firmware.sha256, update_info)) { fw_up_to_date = true; - strncpy(existing_fw_path, filepath, MAX_PATH_LENGTH - 1); + size_t copy_len = strlen(filepath); + if (copy_len >= MAX_PATH_LENGTH) { + copy_len = MAX_PATH_LENGTH - 1; + } + memcpy(existing_fw_path, filepath, copy_len); + existing_fw_path[copy_len] = '\0'; printf("[+] Found up-to-date firmware at %s, skipping download\n", filepath); break; } diff --git a/thirdparty/analogdevicesinc/no-OS_local/patches/0001-0bba46e-nuand-modifications.patch b/thirdparty/analogdevicesinc/no-OS_local/patches/0001-0bba46e-nuand-modifications.patch index 78ef06ee..bd81e2f5 100644 --- a/thirdparty/analogdevicesinc/no-OS_local/patches/0001-0bba46e-nuand-modifications.patch +++ b/thirdparty/analogdevicesinc/no-OS_local/patches/0001-0bba46e-nuand-modifications.patch @@ -492,6 +492,15 @@ index 77ffa44..ff5d7c5 100644 /* Set the Enable State Machine (ENSM) mode. */ int32_t ad9361_set_en_state_machine_mode (struct ad9361_rf_phy *phy, uint32_t mode); /* Get the Enable State Machine (ENSM) mode. */ +@@ -365,6 +381,8 @@ + int32_t ad9361_set_rx_rf_gain (struct ad9361_rf_phy *phy, uint8_t ch, int32_t gain_db); + /* Get current receive RF gain for the selected channel. */ + int32_t ad9361_get_rx_rf_gain (struct ad9361_rf_phy *phy, uint8_t ch, int32_t *gain_db); ++/* Get RFIC temperature */ ++int32_t ad9361_get_temp(struct ad9361_rf_phy *phy); + /* Set the RX RF bandwidth. */ + int32_t ad9361_set_rx_rf_bandwidth (struct ad9361_rf_phy *phy, uint32_t bandwidth_hz); + /* Get the RX RF bandwidth. */ diff --git a/ad9361/sw/ad9361_conv.c b/ad9361/sw/ad9361_conv.c index b20cb71..0491f91 100644 --- a/ad9361/sw/ad9361_conv.c