The value of x was being returned as 0 when the FPGA was either not
loaded or when the LMS was still in reset. Catch this condition and
return back an invalid parameter.
Another pass or two will definitely be required. So far, cleanup
includes:
- Adding checks of libbladeRF return codes
- Unifying the way errors are printed
- Reorganizing command order (as they're searched linearly), by
what's most time-sensitive.
- Removed "specialized help" stubs. These can be re-added if/when
this functionality is added
- Removed some noisy warnings and replaced some with errors.
- Script execution stops at first error encountered in script
Added:
- "clear" command to clear terminal
Remaining issues:
- We're still lacking a "run" command
- Valgrind indicates we have some remaining issues in cli_err()
that we should address.
Added support to run scripts from the command line. A 'run' command
still needs to be added. This will required a script stack and
detection of recursive loops.
Interactive console's argc wasn't being checked, resulting in
a bogus "Unexpected command:" and often segfaults.
In other news, I failed to note in the previus changeset that at
least half the cli changes were authored by Brian Padalino...so
doing that here - ec54e4e409
The CLI now supports flashing the FX3 and loading the FPGA from the
command line and through the interactive console.
To flash the firmware from the command line:
./bin/bladerf -b -f ./path/to/img -d /dev/bladerf1
To load the firmware from the command line:
./bin/bladerf -b -l ./path/to/rbf -d /dev/bladerf1
To flash/load interactively either run with -d /dev/bladerf1, or
use the open command to attach to a device:
bladeRF> open /dev/bladerf1
To flash the firmware interactively:
bladeRF> load fx3 ./path/to/img
To load the FPGA interactively:
bladeRF> load fpga ./path/to/rbf
Note that a power-on-reset is currently required in between
flashing firmware and loading the FPGA.
Various commands have been stubbed out for the time being. A TODO
list has been created to keep track of desired functionality.
The simple_load and upgrade_firmware programs have been removed,
as they are no longer needed.
This is the first commit in a set of upcoming changes that will
move functionality from simple_load and upgrade_firmware into the
libbladeRF library and provide access to these routines through a
bladeRF cli.
Don't merge from jon-dev until I get this straightened out, or
you'll be left with something possibly unusable...
This should include everything needed to build the FSK bridge example from scratch.
1) Open existing hdl/quartus/bladerf.qsf project in Quartus
a) Generate the Nios core
i) Tools -> QSys -> File -> Open -> navigate to ./hdl/fpga/ip/altera/nios_system/nios_system.qsys
ii) After opening qsys file, go to Generation tab, click the "Generate" button
b) Compile the embedded Nios image
i) Tools -> Nios II Software Build Tools for Eclipse
I) File -> Import -> General -> Existing Projects into Workspace -> Next
-> Browse to checkout root directory -> check both lms_spi_controller and lms_spi_controller_bsp
-> Finish
II) right click lms_spi_controller_bsp -> NIOS II -> Generate BSP
III) right click lms_spi_controller -> Build
IV) right click lms_spi_controller -> Make Targets -> Build... -> select mem_init_generate -> Build
c) Synthesize FPGA image
i) Processing -> Start Compilation
2) Compile driver and user mode applications
a) cd linux/kernel ; make ; inmod bladeRF.ko
b) cd ../apps; make
c) To program the fpga execute ./simple_load c4images/blink.rbf
i) Load bladerf.rbf from the quartus output_files directory
3) Use bladeRF's UART as an FSK bridge!
NB. The firmware upgrade utility does work, only use it on valid .img files.