From 0f2bf7bf709f417e0ef5a0860e18b190f740fd1b Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 17 Aug 2010 18:40:17 -0700 Subject: usrp1: added firmware to images makefile and prebuilt fpga images --- images/Makefile | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'images') diff --git a/images/Makefile b/images/Makefile index 6ab54e6ac..0a829a296 100644 --- a/images/Makefile +++ b/images/Makefile @@ -30,6 +30,30 @@ CMAKE_BUILD_DIR = $(TOP_DIR)/build ##filled in below IMAGES_LIST = +######################################################################## +# USRP1 firmware +######################################################################## +_usrp1_fw_dir = $(TOP_FW_DIR)/fx2 +_usrp1_fw_ihx = $(BUILT_IMAGES_DIR)/usrp1_fw.ihx +IMAGES_LIST += $(_usrp1_fw_ihx) + +$(_usrp1_fw_ihx): + cd $(_usrp1_fw_dir) && ./bootstrap + cd $(_usrp1_fw_dir) && ./configure + make -C $(_usrp1_fw_dir) clean + make -C $(_usrp1_fw_dir) all + cp $(_usrp1_fw_dir)/src/usrp1/std.ihx $@ + +######################################################################## +# USRP1 fpga +######################################################################## +_usrp1_fpga_dir = $(TOP_FPGA_DIR)/usrp1/rbf/rev4 +_usrp1_fpga_rbf = $(BUILT_IMAGES_DIR)/usrp1_fpga.rbf +IMAGES_LIST += $(_usrp1_fpga_rbf) + +$(_usrp1_fpga_rbf): + cp $(_usrp1_fpga_dir)/std_2rxhb_2tx.rbf $@ + ######################################################################## # USRP2 firmware ######################################################################## -- cgit v1.2.3 From 2f3269f359043290fcaa7659e90292919306a8bc Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 19 Aug 2010 18:23:19 -0700 Subject: usrp1: images for usrp1, makefile checks for image generation dependencies --- firmware/fx2/.gitignore | 5 +++++ host/AUTHORS | 10 +++++++++- host/lib/usrp/usrp1/usrp1_impl.cpp | 34 ++++++++++++++++++++++------------ host/lib/usrp/usrp1/usrp1_impl.hpp | 6 +----- images/Makefile | 27 +++++++++++++++++++++++++++ 5 files changed, 64 insertions(+), 18 deletions(-) (limited to 'images') diff --git a/firmware/fx2/.gitignore b/firmware/fx2/.gitignore index 75bb241c8..affc0b779 100644 --- a/firmware/fx2/.gitignore +++ b/firmware/fx2/.gitignore @@ -23,3 +23,8 @@ /missing /make.log /usrp.pc +/INSTALL +/config.guess +/config.sub +/install-sh +/ltmain.sh diff --git a/host/AUTHORS b/host/AUTHORS index 137eba0e6..7292da8f9 100644 --- a/host/AUTHORS +++ b/host/AUTHORS @@ -1,5 +1,6 @@ Matt Ettus - matt@ettus.com - USRP1/USRP2 FPGA code + USRP1 FPGA code + USRP2 FPGA code Josh Blum - josh@ettus.com driver framework @@ -14,4 +15,11 @@ Jason Abele - jason@ettus.com WBX host code Eric Blossom - eb@comsec.com + USRP1 firmware USRP2 firmware + +Tom Tsou - ttsou@vt.edu + UHD-USB framework + LIBUSB host code + USRP1 host code + USRP1 firmware diff --git a/host/lib/usrp/usrp1/usrp1_impl.cpp b/host/lib/usrp/usrp1/usrp1_impl.cpp index ece5f1dea..33a069bc6 100644 --- a/host/lib/usrp/usrp1/usrp1_impl.cpp +++ b/host/lib/usrp/usrp1/usrp1_impl.cpp @@ -23,9 +23,11 @@ #include #include #include +#include #include #include #include +#include #include using namespace uhd; @@ -42,11 +44,16 @@ const std::vector usrp1_impl::_dboard_slots = boost:: static device_addrs_t usrp1_find(const device_addr_t &hint) { device_addrs_t usrp1_addrs; - std::string filename = "/usr/local/share/usrp/rev4/std.ihx"; //return an empty list of addresses when type is set to non-usrp1 if (hint.has_key("type") and hint["type"] != "usrp1") return usrp1_addrs; + //extract the firmware path for the USRP1 + std::string usrp1_fw_image = find_image_path( + hint.has_key("fw")? hint["fw"] : "usrp1_fw.ihx" + ); + std::cout << "USRP1 firmware image: " << usrp1_fw_image << std::endl; + //see what we got on the USB bus usb_descriptors_t usb_descriptors; usb_descriptors = usb_control::get_device_list(); @@ -56,12 +63,12 @@ static device_addrs_t usrp1_find(const device_addr_t &hint) if (desc.vendor_id == 0xfffe && desc.product_id == 0x0002) { usb_control::sptr ctrl_transport = usb_control::make(desc); usrp_ctrl::sptr usrp_ctrl = usrp_ctrl::make(ctrl_transport); - usrp_ctrl->usrp_load_firmware(filename); + usrp_ctrl->usrp_load_firmware(usrp1_fw_image); } } //wait for things to settle - sleep(1); + boost::this_thread::sleep(boost::posix_time::milliseconds(500)); //get descriptors again with serial number usb_descriptors = usb_control::get_device_list(); @@ -83,14 +90,11 @@ static device_addrs_t usrp1_find(const device_addr_t &hint) **********************************************************************/ static device::sptr usrp1_make(const device_addr_t &device_addr) { - std::string filename; - - if (device_addr.has_key("fpga")) - filename = device_addr["fpga"]; - else - filename = "/usr/local/share/usrp/rev4/std_2rxhb_2tx.rbf"; - - std::cout << "Make usrp1 with " << filename << std::endl; + //extract the FPGA path for the USRP1 + std::string usrp1_fpga_image = find_image_path( + device_addr.has_key("fpga")? device_addr["fpga"] : "usrp1_fpga.rbf" + ); + std::cout << "USRP1 FPGA image: " << usrp1_fpga_image << std::endl; //try to match the given device address with something on the USB bus usb_descriptors_t usb_descriptors; @@ -106,7 +110,7 @@ static device::sptr usrp1_make(const device_addr_t &device_addr) usb_control::sptr ctrl_transport = usb_control::make(desc); usrp_ctrl = usrp_ctrl::make(ctrl_transport); - usrp_ctrl->usrp_load_fpga(filename); + usrp_ctrl->usrp_load_fpga(usrp1_fpga_image); data_transport = usb_zero_copy::make(desc, // identifier 6, // IN endpoint @@ -167,6 +171,12 @@ usrp1_impl::~usrp1_impl(void){ /* NOP */ } +bool usrp1_impl::recv_async_msg(uhd::async_metadata_t &, size_t timeout_ms){ + //dummy fill-in for the recv_async_msg + boost::this_thread::sleep(boost::posix_time::milliseconds(timeout_ms)); + return false; +} + /*********************************************************************** * Device Get **********************************************************************/ diff --git a/host/lib/usrp/usrp1/usrp1_impl.hpp b/host/lib/usrp/usrp1/usrp1_impl.hpp index f57f9a09a..cbd3d5315 100644 --- a/host/lib/usrp/usrp1/usrp1_impl.hpp +++ b/host/lib/usrp/usrp1/usrp1_impl.hpp @@ -93,11 +93,7 @@ public: size_t get_max_send_samps_per_packet(void) const { return 0; } size_t get_max_recv_samps_per_packet(void) const { return 0; } - - bool recv_async_msg(uhd::async_metadata_t &, size_t) { - //TODO sleep the number of ms supplied (dont want to hog CPU) - return false; - } + bool recv_async_msg(uhd::async_metadata_t &, size_t); private: /*! diff --git a/images/Makefile b/images/Makefile index 0a829a296..0e58fbb18 100644 --- a/images/Makefile +++ b/images/Makefile @@ -30,9 +30,26 @@ CMAKE_BUILD_DIR = $(TOP_DIR)/build ##filled in below IMAGES_LIST = +######################################################################## +# Utility Checks +######################################################################## +ifeq ($(shell sdcc --help > /dev/null 2>&1 && echo $$?),0) + HAS_SDCC=1 +endif + +ifeq ($(shell mb-gcc --help > /dev/null 2>&1 && echo $$?),0) + HAS_MB_GCC=1 +endif + +ifeq ($(shell xtclsh -h > /dev/null 2>&1 && echo $$?),0) + HAS_XTCLSH=1 +endif + ######################################################################## # USRP1 firmware ######################################################################## +ifdef HAS_SDCC + _usrp1_fw_dir = $(TOP_FW_DIR)/fx2 _usrp1_fw_ihx = $(BUILT_IMAGES_DIR)/usrp1_fw.ihx IMAGES_LIST += $(_usrp1_fw_ihx) @@ -44,6 +61,8 @@ $(_usrp1_fw_ihx): make -C $(_usrp1_fw_dir) all cp $(_usrp1_fw_dir)/src/usrp1/std.ihx $@ +endif + ######################################################################## # USRP1 fpga ######################################################################## @@ -57,6 +76,8 @@ $(_usrp1_fpga_rbf): ######################################################################## # USRP2 firmware ######################################################################## +ifdef HAS_MB_GCC + _usrp2_fw_dir = $(TOP_FW_DIR)/microblaze _usrp2_fw_bin = $(BUILT_IMAGES_DIR)/usrp2_fw.bin IMAGES_LIST += $(_usrp2_fw_bin) @@ -68,9 +89,13 @@ $(_usrp2_fw_bin): make -C $(_usrp2_fw_dir) all cp $(_usrp2_fw_dir)/usrp2/usrp2_txrx_uhd.bin $@ +endif + ######################################################################## # USRP2 fpga ######################################################################## +ifdef HAS_XTCLSH + _usrp2_fpga_dir = $(TOP_FPGA_DIR)/usrp2/top/u2_rev3 _usrp2_fpga_bin = $(BUILT_IMAGES_DIR)/usrp2_fpga.bin IMAGES_LIST += $(_usrp2_fpga_bin) @@ -80,6 +105,8 @@ $(_usrp2_fpga_bin): cd $(_usrp2_fpga_dir) && make -f Makefile.udp bin cp $(_usrp2_fpga_dir)/build-udp/u2_rev3.bin $@ +endif + ######################################################################## # Build rules ######################################################################## -- cgit v1.2.3 From aa2ef7d246e93f4e6c0cb8b9b985a487cd2ea548 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 27 Aug 2010 16:59:13 -0700 Subject: usrp1: add the 4rx image to the installed usrp1 fpga images --- images/Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'images') diff --git a/images/Makefile b/images/Makefile index 0e58fbb18..57277e787 100644 --- a/images/Makefile +++ b/images/Makefile @@ -68,11 +68,15 @@ endif ######################################################################## _usrp1_fpga_dir = $(TOP_FPGA_DIR)/usrp1/rbf/rev4 _usrp1_fpga_rbf = $(BUILT_IMAGES_DIR)/usrp1_fpga.rbf -IMAGES_LIST += $(_usrp1_fpga_rbf) +_usrp1_fpga_4rx_rbf = $(BUILT_IMAGES_DIR)/usrp1_fpga_4rx.rbf +IMAGES_LIST += $(_usrp1_fpga_rbf) $(_usrp1_fpga_4rx_rbf) $(_usrp1_fpga_rbf): cp $(_usrp1_fpga_dir)/std_2rxhb_2tx.rbf $@ +$(_usrp1_fpga_4rx_rbf): + cp $(_usrp1_fpga_dir)/std_4rx_0tx.rbf $@ + ######################################################################## # USRP2 firmware ######################################################################## -- cgit v1.2.3 From 80fe3189afd52d1aab95ee95e71d5d50bddbba55 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 31 Aug 2010 13:08:50 -0700 Subject: usrp1: Fedora sdcc note and change fw error to warning (find should not error) --- host/lib/usrp/usrp1/usrp1_impl.cpp | 17 ++++++++++++++--- images/README | 5 +++++ 2 files changed, 19 insertions(+), 3 deletions(-) (limited to 'images') diff --git a/host/lib/usrp/usrp1/usrp1_impl.cpp b/host/lib/usrp/usrp1/usrp1_impl.cpp index ccb41a09d..9f824045d 100644 --- a/host/lib/usrp/usrp1/usrp1_impl.cpp +++ b/host/lib/usrp/usrp1/usrp1_impl.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -50,9 +51,19 @@ static device_addrs_t usrp1_find(const device_addr_t &hint) if (hint.has_key("type") and hint["type"] != "usrp1") return usrp1_addrs; //extract the firmware path for the USRP1 - std::string usrp1_fw_image = find_image_path( - hint.has_key("fw")? hint["fw"] : "usrp1_fw.ihx" - ); + std::string usrp1_fw_image; + try{ + usrp1_fw_image = find_image_path( + hint.has_key("fw")? hint["fw"] : "usrp1_fw.ihx" + ); + } + catch(const std::exception &e){ + uhd::print_warning( + "Could not locate USRP1 firmware.\n" + "Please install the images package.\n" + ); + return usrp1_addrs; + } std::cout << "USRP1 firmware image: " << usrp1_fw_image << std::endl; //see what we got on the USB bus diff --git a/images/README b/images/README index ec8391826..2f9c6a95e 100644 --- a/images/README +++ b/images/README @@ -18,3 +18,8 @@ To build the package (unix): The package generator types are described here: http://www.cmake.org/Wiki/CMake:CPackPackageGenerators + +Fedora note: + The sdcc binaries are prefixed with "sdcc-" which breaks the build. + However, /usr/libexec/sdcc contains properly named sdcc binaries. + export PATH=${PATH}:/usr/libexec/sdcc -- cgit v1.2.3