What about the Nios2?

Discussions related to embedded firmware, driver, and user mode application software development
jynik
Posts: 455
Joined: Thu Jun 06, 2013 8:15 pm

Re: What about the Nios2?

Post by jynik »

Hi Erik,

First, I just wanted to let you know that the updated code has been pushed to a dev-fpga_v0.2.0 branch on the Nuand repo. It will undergo some further review and testing there, before being merged to master.

Regarding the 2015.06.08.16:31:00 Info: No custom instruction connections, skipping transform message. Are you using Quartus 15.0? This is required for the new FPGA code. I honestly have no idea what this error message is actually trying to convey, and can only guess that your environment differs from ours in some significant way.

Timeouts
If you connect to the NIOS II core and the byte blaster is holding it in reset, then the host (libbladeRF) will not receive responses to its requests. This is why it times out. When stepping through code on the NIOS II, I use the -DLIBBLADERF_DISABLE_USB_TIMEOUTS CMake option to compile out the timeouts. (Note that since bladeRF-cli catches Ctrl-C, you'll want to kill it some other way, such as with SIGUSR1 if you find that you need to.)

If your FPGA image is bad or contains problems, timeouts will occur just because the device is not running.

To debug the NIOS code, I would load the FPGA as you normally do, and exit the CLI. Then I would attach the debugger, and have it load and reset the NIOS core. This should run fine.


libbladeRF version
If you checked out that code in the new branch or pulled it from my archive, you can build it the same way you normally would. See the wiki for this. If you're unfamiliar with using git to check out a branch, some of these resources should be of great help.
erik
Posts: 17
Joined: Mon May 18, 2015 12:35 am

Re: What about the Nios2?

Post by erik »

Good morning,

the first problem was that I not used Quartus II 15 I think.
But now Ihave changed to 15 nothing works any more.

When quartus is analysing the files from the hosted rev the following failure appears.: Error (12074): File /home/adminhtw/bladeRF-dev-nios_refactor/hdl/quartus/work/db/hosted.cmp.rdb is not a recognized design file type
When I start the compilation quartus hangs in analysis and synthesis. And it says "Sorry! The Quartus II software quit unexpectedly." With the following failure.
(The build_bladerf.sh throws the same failure!)

Info (286031): Timing-Driven Synthesis is running on partition "Top"

*** Fatal Error: Illegal Instruction
Module: quartus_map
Stack Trace:
0xbe5e9: MLS_NETLIST::factor_node_recursively(std::vector<std::vector<SGATE_OTERM_INV_PAIR, MEM_STL_ALLOCATOR<SGATE_OTERM_INV_PAIR> >, MEM_STL_ALLOCATOR<std::vector<SGATE_OTERM_INV_PAIR, MEM_STL_ALLOCATOR<SGATE_OTERM_INV_PAIR> > > > const&, CDB_SGATE_COMB*, bool) + 0xc99 (synth_mls)
0xea819: MLS_NETLIST::resynthesize_node(CDB_SGATE_COMB*, int*, int*, MLS_RESYNTHESIZE_CONFIG&, MLS_COLLAPSE_CACHE&, MLS_FFC&, std::vector<CDB_SGATE_OTERM*, MEM_STL_ALLOCATOR<CDB_SGATE_OTERM*> >&, std::vector<CDB_SGATE_NODE*, MEM_STL_ALLOCATOR<CDB_SGATE_NODE*> >&) + 0xc79 (synth_mls)
0xed37b: MLS_NETLIST::resynthesize_nodes(bool, bool, bool) + 0x61b (synth_mls)
0xf50bd: MLS_NETLIST::call_named_function(std::basic_string<char, std::char_traits<char>, MEM_STL_ALLOCATOR<char> > const&, std::basic_string<char, std::char_traits<char>, MEM_STL_ALLOCATOR<char> > const&, std::basic_string<char, std::char_traits<char>, MEM_STL_ALLOCATOR<char> > const&) + 0x10ad (synth_mls)
0x105eff: MLS_INTERFACE::call_named_function(char const*, char const*, char const*) + 0x6f (synth_mls)
0x16e5e3: RTL_SCRIPT::call_named_function(char const*, char const*, char const*, int, int, int) + 0x723 (synth_opt)
0x1711d2: RTL_SCRIPT::process_script(CDB_SGATE_NETLIST*, CDB_SGATE_HIERARCHY*, BASEX_ELABORATE_INFO*, CMP_FACADE*, RTL_SCRIPT_ENUM, char const* (*) [3], int, RTL_SCRIPT_STEP*, RTL_SCRIPT_STEP*) + 0x7b2 (synth_opt)
0x1889e6: opt_process_netlist_scripted(CMP_FACADE*, CDB_SGATE_HIERARCHY*, BASEX_ELABORATE_INFO*, RTL_SCRIPT_ENUM, bool) + 0x376 (synth_opt)
0x51620: RTL_ROOT::process_sgate_netlist(CMP_FACADE*, CDB_SGATE_HIERARCHY*, BASEX_ELABORATE_INFO*, RTL_PASS_ENUM) + 0x558 (synth_opt)
0x18147f: SGN_SYNTHESIS::high_level_synthesis() + 0x16f (synth_sgn)
0x182188: SGN_SYNTHESIS::process_current_stage() + 0x148 (synth_sgn)
0x19153a: SGN_EXTRACTOR::synthesize_partition(unsigned long) + 0x41a (synth_sgn)
0x191fb4: SGN_EXTRACTOR::synthesis() + 0x1d4 (synth_sgn)
0x1a49b8: SGN_EXTRACTOR::synthesis_and_post_processing() + 0x1a8 (synth_sgn)
0x1a52c2: sgn_qic_full(CMP_FACADE*, std::vector<std::basic_string<char, std::char_traits<char>, MEM_STL_ALLOCATOR<char> >, MEM_STL_ALLOCATOR<std::basic_string<char, std::char_traits<char>, MEM_STL_ALLOCATOR<char> > > >&, std::vector<double, MEM_STL_ALLOCATOR<double> >&) + 0x262 (synth_sgn)
0x248c8: qsyn_execute_sgn(CMP_FACADE*, std::vector<std::basic_string<char, std::char_traits<char>, MEM_STL_ALLOCATOR<char> >, MEM_STL_ALLOCATOR<std::basic_string<char, std::char_traits<char>, MEM_STL_ALLOCATOR<char> > > >&, std::basic_string<char, std::char_traits<char>, MEM_STL_ALLOCATOR<char> > const&, THR_NAMED_PIPE*, THR_NAMED_PIPE*) + 0x158 (quartus_map)
0x43cb9: QSYN_FRAMEWORK::execute_core(THR_NAMED_PIPE*, THR_NAMED_PIPE*) + 0x1e9 (quartus_map)
0x476ba: QSYN_FRAMEWORK::execute() + 0xbca (quartus_map)
0x2008c: qexe_standard_main(QEXE_FRAMEWORK*, QEXE_OPTION_DEFINITION const**, int, char const**) + 0x872 (comp_qexe)
0x3c458: qsyn_main(int, char const**) + 0x1e8 (quartus_map)
0x49ef0: msg_main_thread(void*) + 0x10 (ccl_msg)
0x5d4c: thr_final_wrapper + 0xc (ccl_thr)
0x49fa5: msg_thread_wrapper(void* (*)(void*), void*) + 0x5b (ccl_msg)
0x6ab3b: mem_thread_wrapper(void* (*)(void*), void*) + 0x9b (quartus_map)
0x8def: err_thread_wrapper(void* (*)(void*), void*) + 0x27 (ccl_err)
0x6112: thr_thread_wrapper + 0x15 (ccl_thr)
0x4bee2: msg_exe_main(int, char const**, int (*)(int, char const**)) + 0xa3 (ccl_msg)
0x21ec5: __libc_start_main + 0xf5 (c.so.6)


End-trace

Result: ERROR: Error(s) found while running an executable. See report file(s) for error message(s). Message log indicates which executable was run last.

ERROR: Analysis & Synthesis Failed
Info (23030): Evaluation of Tcl script ../build.tcl was successful
Info: Quartus II 64-Bit Shell was successful. 0 errors, 52 warnings
Info: Peak virtual memory: 745 megabytes
Info: Processing ended: Thu Jun 11 10:20:55 2015
Info: Elapsed time: 00:04:24
Info: Total CPU time (on all processors): 00:04:27


And the usb_blaster is not longer accessible from eclips to debug. In "Debug Configurations" I can not see the debugger when browse for it. (thats also in quartus 13.1 the problem after installing 15) I will check the devrules again.
But I can see it in quartus.


Im sorry for asking here again but I hope the reason is at least one problem and not a lot. Maybe you had to figure out some of these problems by yourself.

Have a nice day, ;)

Erik
bpadalino
Posts: 303
Joined: Mon Mar 04, 2013 4:53 pm

Re: What about the Nios2?

Post by bpadalino »

Unfortunately we didn't need to figure out those problems.

Can you successfully create any design at all, or is it just the bladeRF one that is killing you?

If you do the ATSC TX image instead of hosted, does it still crash?

How much memory are you using? What host OS? How much free space on your hard drive?

Brian
erik
Posts: 17
Joined: Mon May 18, 2015 12:35 am

Re: What about the Nios2?

Post by erik »

Hello,

I have tested and it seams like I cant create any design with Quartus II 15 but the 13.1 still works but not with the newest code. May this is because of incompatibility and the reason to switch to Quartus II 15.

I am using:

Ubuntu 14.04 64-Bit
3GB RAM
Intel® Pentium(R) D CPU 2.66GHz × 2
Gallium 0.4 on AMD CEDAR
1TB HDD almost free

Because of the last line before "End-trace" in my last post I think the problem hangs on a library. I try to install the right libc.
Maybe I have to uninstall the tons of i386 libs I had to install for the use of Quartus II 13.1. but I will try it first without that because I would go crazy :lol: .

In the worst case I will switch to Windows maybe this will figure out all problems and easily all is running. But it would also take some time so it would be better to get linux running again I think.
I will report when it works.

Greetings,

Erik

edit:

I can now use Quartus 13.1 again :). Will try to get 15 working next week.
bpadalino
Posts: 303
Joined: Mon Mar 04, 2013 4:53 pm

Re: What about the Nios2?

Post by bpadalino »

We've tested here successfully with Ubuntu 14.10 and 15.04.

It sounds like it may just be a library compatibility issue on Quartus' part?

Keep us posted with your status and good luck.

Brian
erik
Posts: 17
Joined: Mon May 18, 2015 12:35 am

Re: What about the Nios2?

Post by erik »

Hello again,

at first I have to tell that all hardware and software is running now.
Quartus is still not running on the workstation I used before but now I have a new notebook and it runs.
Further the USB cable was broken. Thats the reason fore the failures.

The last weeks I have developed a VHDL block and at next I will try to get it up and running on the bladeRF.
I'm able to set the gains and the bandwidth by setting up registers of the lms.
I further need to set up the XB200, the samplerate and the frequency.
I have seen on an other thread here that I can use the lms_set_precalculated_frequency() function to set the frequency I want.
But thats my old problem in understanding what about "struct bladerf *dev".
I am not a software developer so maybe someone can explain what I have to do.
As far as I can understand it is the device handler but isn't it only in use if I want to access the bladeRF from the host?
It seams that there are all functions I need but all of them uses the device handler so it will be a great help to know how I have to use it inside the nios.

Thanks,

Erik
erik
Posts: 17
Joined: Mon May 18, 2015 12:35 am

Re: What about the Nios2?

Post by erik »

Hello,

I have figured out that I have just to type 0 for the device handler.
Now i can set up all things from inside the NIOS but can't attatch the xb200 and can't enable tx and rx.
Maybe there is such an easy way like using lms_set_precalculated_frequency() for setting up the frequency.
If so than please let me know.

My goal is to set up the bladeRF completely from the NIOS.
I have only one configuration to set.

Currently I'm using the cli to attach the xb200 and start tx an rx by configuring a file for both one to read from and one to write to. Inside the fpga I throw away the samples from host and use my own sine-generator on tx side and on the rx side I get my signal directly from the lms and ignore the rest is following. (using the hosted rev)
Further I have to use the cli still to set the frequency even if I'm able to set it up by NIOS but it appears an error.
I think this error is because the bladeRF trys to retune in this case.

Thanks for your answer,

Erik
Jordaw
Posts: 8
Joined: Thu Mar 17, 2016 8:10 am

Re: What about the Nios2?

Post by Jordaw »

Hello,

I try to work on the Nios 2, so i follow the instruction on the readme, and find this topic who explain in details the steps to have a debug session on eclipse.
For me that work until the step (12). Now it's impossible for me launching the debug session i think because of "path" problems, but i can't solves it. In the make file i've already verify than this line is present: QUARTUS_PROJECT_DIR := ../../../../../../quartus/work/output_files, i try to change this line but no way

In debug configuration, this warning appear:

WARNING: Unable to locate SOF or JDI file in Quartus project directory "/home/jordi/bladeRF/hdl/fpga/ip/altera/nios_system/software/bladeRF_nios". Processor name might not be shown correctly in selection dialog but the functionality is not affected. Please make sure "QUARTUS_PROJECT_DIR" is set correctly in Makefile.

So i can't launch a debug session because of that so>>>> "Lauching new configuration has encountered a problem"

the error message is:
Error reported by System Console
java.util.concurrent.ExecutionException: java.lang.Exception: design_load: /home/jordi/bladeRF/hdl/fpga/ip/altera/nios_system/software/bladeRF_nios does not contain any Quartus project files
invoked from within
"design_load {/home/jordi/bladeRF/hdl/fpga/ip/altera/nios_system/software/bladeRF_nios}"
invoked from within
"interp eval $slave {
design_load {/home/jordi/bladeRF/hdl/fpga/ip/altera/nios_system/software/bladeRF_nios}

}"



If someone have an idea :)

Jordaw!
jynik
Posts: 455
Joined: Thu Jun 06, 2013 8:15 pm

Re: What about the Nios2?

Post by jynik »

Could you confirm that you're launching nios2-eclipse from the nio2-command-shell? This shell launcher script ensures you have all of the necessary environment variables set when working with the tools.

For example?

Code: Select all

user@host $ ~/software/altera/15.1/nios2eds/nios2_command_shell.sh
------------------------------------------------
Altera Nios2 Command Shell [GCC 4]

Version 15.1, Build 193
------------------------------------------------
user@host:~$ eclipse-nios2 
Also, can you ensure that you can clean and build the project from the command line? This can help determine whether you have a general environment setup problem vs an Eclipse problem.
Jordaw
Posts: 8
Joined: Thu Mar 17, 2016 8:10 am

Re: What about the Nios2?

Post by Jordaw »

I'm not very sure understand you :s, i launch Eclipse by this way. is it ok?

Code: Select all

jordi@jordi-Aspire-5742Z:~/altera/15.0/nios2eds$ eclipse-nios2
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
jordi@jordi-Aspire-5742Z:~/altera/15.0/nios2eds$ ./nios2_command_shell.sh
------------------------------------------------
Altera Nios2 Command Shell [GCC 4]

Version 15.0, Build 145
------------------------------------------------
jordi@jordi-Aspire-5742Z:~/altera/15.0/nios2eds$ cd
jordi@jordi-Aspire-5742Z:~$ eclipse-nios2
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0

I don't understand what you mean by clean and build the project from the command line? if you can explain me ...

So, after lauching eclipse by this way, i follow all the step you describe on the topic, but impossible launching debug session cause of "bladeRF_nios does not contain any Quartus project files"

Jordaw.
Jordaw
Posts: 8
Joined: Thu Mar 17, 2016 8:10 am

Re: What about the Nios2?

Post by Jordaw »

Solving my problem, rebuilding with" ./build_bladerf.sh -s 40 -r hosted ". An error probably occured the first time, but always impossible for me launching a debug session with case "connect JTAG UART to console", this way the message is" Error occured while communicating with System Console Unable to connect to JTAG UART. The device might be occupied by another application.".
jynik
Posts: 455
Joined: Thu Jun 06, 2013 8:15 pm

Re: What about the Nios2?

Post by jynik »

I've seen those JTAG UART errors as well. This stopped working for me after Quartus 14.x was release. However, I ended up just added debug variables and such when I needed to debug, rather than actually figure this out.

If you end up pinging Altera support and/or figuring out an answer to this, please do share it here!
xor
Posts: 3
Joined: Wed Mar 25, 2015 11:01 am

Re: What about the Nios2?

Post by xor »

Hi,

I decided to keep posting in this thread because I have an issue with Terasic USB Blaster and Eclipse since I cannot create a debug target.
Being more specific, this is my setup:
Ubuntu 14.04 64 bit, Quartus II 15.0.

running jtagd and jtagconfig all seems working fine, the USB blaster is successfully recognised so I started following the guide section "Build and Debug".
I completed all the steps successfully until I got stuck at this point: when i click "Browse" under "Connections-->Processor" I get:: <<Unable to connect to JTAG Server. Please kill and restart System Console from Eclipse menu: Nios II->System Console.>>
Then I followed the instruction and started the System Console. USB Blaster is correctly detected and recognized from the console under "devices" in system explorer.
Now coming back to debug configurations and clicking again "browse" I got the following error popping up on the NIOS II console: <<design_load: /home/born/bladeRF-master/hdl/fpga/ip/altera/nios_system/software/bladeRF_nios does not contain any Quartus project files>>.
The result is that the USB blaster isn't recognized under the debug configuration.

Please help me understand how to solve this issue.

Thanks

xor
Konstantin
Posts: 22
Joined: Sun Oct 18, 2015 11:43 am

Re: What about the Nios2?

Post by Konstantin »

Hello,
I have one question about LMS initiliazation in the NIOS II.
I have qpsk modulator, my pursopose is just plug in bladerf and transmit signals. As I understood for this I have to modify NIOS II code.
I found that
https://github.com/Nuand/bladeRF/blob/m ... riv.c#L138
this is the device initialization
after this I think I need put it before the big loop in the nios and rebuild
https://github.com/Nuand/bladeRF/blob/m ... ios.c#L160
place for device initialization code

Do you have any ideas how to implement it?
Post Reply