Compare commits
1 commit
master
...
ryan/build
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e53a0516d6 |
6 changed files with 131 additions and 11 deletions
|
|
@ -43,13 +43,6 @@ include(Version)
|
|||
|
||||
set(VERSION "${VERSION_INFO}")
|
||||
|
||||
# Generate firmware version header file
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/version.h.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/include/version.h
|
||||
@ONLY
|
||||
)
|
||||
|
||||
################################################################################
|
||||
# Configuration options
|
||||
################################################################################
|
||||
|
|
@ -59,6 +52,51 @@ option(ENABLE_BLADERF_FIRMWARE
|
|||
ON
|
||||
)
|
||||
|
||||
option(LOW_LATENCY_GPIF_BUFFERS
|
||||
"Use smaller GPIF buffer sizes for lower latency (original pre-2.5.0 behavior)"
|
||||
OFF
|
||||
)
|
||||
|
||||
# GPIF DMA buffer configuration
|
||||
# Low-latency mode: 2x multiplier, 22 buffers (original pre-2.5.0)
|
||||
# High-throughput mode: 8x multiplier, 11 buffers (2.5.0+)
|
||||
if(LOW_LATENCY_GPIF_BUFFERS)
|
||||
set(GPIF_DMA_SIZE_MULTIPLIER 2)
|
||||
set(GPIF_DMA_BUFFER_COUNT 22)
|
||||
# Report firmware version 2.4.0 for libbladeRF legacy buffer detection
|
||||
# (libbladeRF checks FW_LARGER_BUFFER_VERSION: major=2, minor=5, patch=0)
|
||||
set(VERSION_INFO_MINOR 4)
|
||||
message(STATUS "GPIF buffers: LOW LATENCY mode (size*2, count=22)")
|
||||
message(STATUS "Firmware version set to ${VERSION_INFO_MAJOR}.${VERSION_INFO_MINOR}.${VERSION_INFO_PATCH} for legacy detection")
|
||||
else()
|
||||
set(GPIF_DMA_SIZE_MULTIPLIER 8)
|
||||
set(GPIF_DMA_BUFFER_COUNT 11)
|
||||
message(STATUS "GPIF buffers: HIGH THROUGHPUT mode (size*8, count=11)")
|
||||
endif()
|
||||
|
||||
# Regenerate VERSION string for low-latency mode
|
||||
# Manually construct VERSION string with correct 2.4.0 version number
|
||||
if(LOW_LATENCY_GPIF_BUFFERS)
|
||||
# Extract git info from the original VERSION string
|
||||
string(REGEX MATCH "git-[^-]+" GIT_COMMIT_HASH "${VERSION}")
|
||||
# Check if working directory is dirty
|
||||
if(VERSION MATCHES "dirty")
|
||||
set(VERSION "${VERSION_INFO_MAJOR}.${VERSION_INFO_MINOR}.${VERSION_INFO_PATCH}-${GIT_COMMIT_HASH}-dirty")
|
||||
else()
|
||||
set(VERSION "${VERSION_INFO_MAJOR}.${VERSION_INFO_MINOR}.${VERSION_INFO_PATCH}-${GIT_COMMIT_HASH}")
|
||||
endif()
|
||||
message(STATUS "Firmware VERSION string: ${VERSION}")
|
||||
# Update VERSION_INFO_BASE for output filename
|
||||
set(VERSION_INFO_BASE "${VERSION_INFO_MAJOR}.${VERSION_INFO_MINOR}.${VERSION_INFO_PATCH}")
|
||||
endif()
|
||||
|
||||
# Generate firmware version header file (must be after GPIF buffer config)
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/version.h.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/include/version.h
|
||||
@ONLY
|
||||
)
|
||||
|
||||
################################################################################
|
||||
# Build Configuration
|
||||
################################################################################
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include <cyu3uart.h>
|
||||
#include "gpif.h"
|
||||
#include "rf.h"
|
||||
#include "version.h"
|
||||
|
||||
#define THIS_FILE LOGGER_ID_RF_C
|
||||
|
||||
|
|
@ -290,8 +291,8 @@ static void NuandRFLinkStart(void)
|
|||
}
|
||||
|
||||
CyU3PMemSet((uint8_t *)&dmaCfg, 0, sizeof(dmaCfg));
|
||||
dmaCfg.size = size * 8;
|
||||
dmaCfg.count = 11;
|
||||
dmaCfg.size = size * GPIF_DMA_SIZE_MULTIPLIER;
|
||||
dmaCfg.count = GPIF_DMA_BUFFER_COUNT;
|
||||
dmaCfg.prodSckId = BLADE_RF_SAMPLE_EP_PRODUCER_USB_SOCKET;
|
||||
dmaCfg.consSckId = CY_U3P_PIB_SOCKET_3;
|
||||
dmaCfg.dmaMode = CY_U3P_DMA_MODE_BYTE;
|
||||
|
|
|
|||
|
|
@ -6,5 +6,12 @@
|
|||
#define FIRMWARE_VERSION_MINOR @VERSION_INFO_MINOR@
|
||||
#define FIRMWARE_VERSION_PATCH @VERSION_INFO_PATCH@
|
||||
|
||||
/* GPIF DMA buffer configuration
|
||||
* Low-latency mode: multiplier=2, count=22 (pre-2.5.0 behavior)
|
||||
* High-throughput mode: multiplier=8, count=11 (2.5.0+ behavior)
|
||||
*/
|
||||
#define GPIF_DMA_SIZE_MULTIPLIER @GPIF_DMA_SIZE_MULTIPLIER@
|
||||
#define GPIF_DMA_BUFFER_COUNT @GPIF_DMA_BUFFER_COUNT@
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
-- 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
|
||||
-- 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.
|
||||
|
||||
-- Low-latency GPIF buffer configuration (pre-0.16.0/2.5.0 behavior)
|
||||
-- Use this for latency-sensitive applications where minimum delay
|
||||
-- is more important than maximum throughput.
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
|
||||
package fx3_gpif_p is
|
||||
-- GPIF buffer sizes for USB high-speed and super-speed
|
||||
-- Low-latency mode: smaller buffers for reduced latency
|
||||
constant GPIF_BUF_SIZE_HS : natural := 256;
|
||||
constant GPIF_BUF_SIZE_SS : natural := 512;
|
||||
end package fx3_gpif_p;
|
||||
|
|
@ -10,6 +10,7 @@ set options { \
|
|||
{ "stp.arg" "" "SignalTap II file to use" } \
|
||||
{ "force.arg" "" "Force enable TalkBack to use SignalTapII" } \
|
||||
{ "seed.arg" "" "Specify fitter seed" } \
|
||||
{ "lowlatency" "" "Use smaller GPIF buffers for lower latency (pre-2.5.0 behavior)" } \
|
||||
}
|
||||
|
||||
# Parse the command arguments, store them into 'opts'
|
||||
|
|
@ -69,6 +70,16 @@ if { $opts(flow) != "gen" &&
|
|||
# Open the project with the specific revision
|
||||
project_open -revision $opts(rev) $opts(projname)
|
||||
|
||||
# Configure GPIF buffer sizes via package file selection
|
||||
# Low-latency mode: HS=256, SS=512 (pre-0.16.0/2.5.0 behavior)
|
||||
# High-throughput mode: HS=1024, SS=2048 (default, 0.16.0/2.5.0+ behavior)
|
||||
# Note: build_bladerf.sh swaps the package files before running Quartus
|
||||
if { $opts(lowlatency) } {
|
||||
puts "Configuring LOW LATENCY GPIF buffers (HS=256, SS=512)"
|
||||
} else {
|
||||
puts "Configuring HIGH THROUGHPUT GPIF buffers (HS=1024, SS=2048)"
|
||||
}
|
||||
|
||||
# Add signaltap file
|
||||
set forced_talkback 0
|
||||
set enable_stp 0
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@ function usage()
|
|||
echo " full (default) Fit the design and create programming files"
|
||||
echo " -S <seed> Fitter seed setting (default: 1)"
|
||||
echo " -D Output directory name won't contain the date"
|
||||
echo " -L Build with low-latency GPIF buffer sizes (pre-0.16.0 behavior)"
|
||||
echo " -h Show this text"
|
||||
echo ""
|
||||
|
||||
|
|
@ -164,7 +165,7 @@ flow="full"
|
|||
seed="1"
|
||||
omit_date=false
|
||||
|
||||
while getopts ":cb:r:s:a:fn:l:S:DhH" opt; do
|
||||
while getopts ":cb:r:s:a:fn:l:S:DLhH" opt; do
|
||||
case $opt in
|
||||
c)
|
||||
clear_work_dir=1
|
||||
|
|
@ -212,6 +213,10 @@ while getopts ":cb:r:s:a:fn:l:S:DhH" opt; do
|
|||
omit_date=true
|
||||
;;
|
||||
|
||||
L)
|
||||
lowlatency=1
|
||||
;;
|
||||
|
||||
h)
|
||||
usage
|
||||
exit 0
|
||||
|
|
@ -442,6 +447,18 @@ echo " Building BSP and ${board} application..."
|
|||
echo "##########################################################################"
|
||||
echo ""
|
||||
|
||||
# Configure FPGA version for low-latency mode
|
||||
# When -L is set, report version 0.15.3 so libbladeRF uses legacy buffer sizes
|
||||
# Version 0.15.3 includes important HDL bug fixes for metadata and timestamp handling
|
||||
if [ "$lowlatency" == "1" ]; then
|
||||
echo "Low-latency mode: Setting FPGA version to 0.15.3 for legacy buffer detection"
|
||||
fpga_version_file="${build_dir}/../software/bladeRF_nios/src/fpga_version.h"
|
||||
if [ -f "$fpga_version_file" ]; then
|
||||
sed -i 's/#define FPGA_VERSION_MINOR.*16/#define FPGA_VERSION_MINOR 15/' "$fpga_version_file"
|
||||
sed -i 's/#define FPGA_VERSION_PATCH.*0/#define FPGA_VERSION_PATCH 3/' "$fpga_version_file"
|
||||
fi
|
||||
fi
|
||||
|
||||
mkdir -p bladeRF_nios_bsp
|
||||
if [ -f settings.bsp ]; then
|
||||
echo "Skipping creating Nios BSP, settings.bsp already exists"
|
||||
|
|
@ -508,7 +525,19 @@ quartus_sh --64bit \
|
|||
-part "${DEVICE}" \
|
||||
-platdir "${build_dir}/.."
|
||||
|
||||
# Swap GPIF package file for low-latency mode
|
||||
if [ "$lowlatency" == "1" ]; then
|
||||
echo "Low-latency mode: Swapping GPIF package file"
|
||||
gpif_pkg_dir="${PROJECT_ROOT}/hdl/fpga/platforms/common/bladerf/vhdl"
|
||||
cp "${gpif_pkg_dir}/fx3_gpif_p_lowlatency.vhd" "${gpif_pkg_dir}/fx3_gpif_p.vhd"
|
||||
fi
|
||||
|
||||
# Run Quartus flow
|
||||
lowlatency_flag=""
|
||||
if [ "$lowlatency" == "1" ]; then
|
||||
lowlatency_flag="-lowlatency"
|
||||
fi
|
||||
|
||||
quartus_sh --64bit \
|
||||
-t "../../build.tcl" \
|
||||
-projname "${PROJECT_NAME}" \
|
||||
|
|
@ -516,7 +545,8 @@ quartus_sh --64bit \
|
|||
-flow "${flow}" \
|
||||
-stp "${stp}" \
|
||||
-force "${force}" \
|
||||
-seed "${seed}"
|
||||
-seed "${seed}" \
|
||||
${lowlatency_flag}
|
||||
|
||||
popd
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue