- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
HI.
I'm doing my thesis on a DE2 board. I'm using a NIOS II processor. I've been writing all my source code in C. That way, it worked perfectly. I had to ****ch to C++ for a few reasons (which I'm not gonna explain here). The thing is: I have some problems to register an ISR. This is the "old" code (which works in C):void simpler_isr()
{
for(j=0; j<3; j++)
{
store_array = IORD(FULL_CLASIFIER_0_BASE, 0x00);
}
i++;
flag++;
}
and this is the part where I register the isr: alt_ic_isr_register(FULL_CLASIFIER_0_IRQ_INTERRUPT_CONTROLLER_ID,
FULL_CLASIFIER_0_IRQ,
simpler_isr,
NULL,
0x0);
When I tried to compile in C++, I got this error mesage: initializing argument 3 of `int alt_ic_isr_register(alt_u32, alt_u32, void (*)(void*), void*, void*)' invalid conversion from `void (*)()' to `void (*)(void*)' So, I changed the ISR this way: void simpler_isr(void*)
{
for(j=0; j<3; j++)
{
store_array = IORD(FULL_CLASIFIER_0_BASE, 0x00);
}
i++;
flag++;
}
Now, I get this message: Undefined reference to "main" I don't know what I'm missing. THANKS.
Link Copied
9 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I respond myself:
I did a "make clean" and I solve the last problem. Now, I have another one. It seems that the ISR registration never occurs. I put a cout next to alt_ic_isr_register, and it never appears on stdout (screen). Any suggestions?? thanks- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
1. You can "debug" ;-) 2. stdout = screen ? sure ? Look at if it is not an UART instead of JTAG UART (or the opposite). 3. Maybe you use light drivers for printf or cout. I don't know the new (since 9.2) NIOS Software Built Tool.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello.
As I said, the project was written in C, and it worked. The only thing I did was adding C++ stuff and "migrate" to a C++ project. Greetings.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you sure that any of your code is now running?
Or it might all be dying horribly before the text is actually written to the uart. Even in C++ I'd use use printf(), 'cout' adds an extra level complexity (and unusability) that might be masking things. If you suspect a lockup you need a synchronous write - not one that is buffered and/or requires interrupts to complete. You might also need to mark the ISR as 'extern "C"' - but that would (probably) only affect the symbol name, not the address passed.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello.
I've just tried the simpler C++ program (Hello World) and it didn't work. I tried with cout, I tried with printf. The project compiles, but the program does nothing. Once I compile the project, these are the commands I'm using: nios2-download -g holamundo.elf Using cable "USB-Blaster [USB 4-1.3]", device 1, instance 0x00 Pausing target processor: OK Initializing CPU cache (if present) OK Downloaded 53KB in 1.0s (53.0KB/s) Verified OK Starting processor at address 0x008001C4 nios2-terminal nios2-terminal: connected to hardware target using JTAG UART on cable nios2-terminal: "USB-Blaster [USB 4-1.3]", device 1, instance 0 nios2-terminal: (Use the IDE stop button or Ctrl-C to terminate) .... and nothing happens.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok,you meant to say code is downloaded ,you put printf after ISR declaration and nothing happens though all is perfectly fine as JTAG UART and all,right?
Do one thing,just put printf (or cout) immediately after main(),and see it displays on console when running.what happenes..!! It should display If still not then delete whole file from the project (save backup somehere),clean and add it again.And manually RESET ur hardware or download SOF again and then run the code.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Supal.
I had done everything you said. Nothing happened. I'm starting thinking that is a problem related to the PC I'm using. I'm gonna try to do it in other PC. Thanks!!!- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Check if your output is really your UART.. double check the adresses and everything else.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I re-assigned the addresses via SOPC
I check by BSP editor, and: stderr -> jtag_uart stdin -> jtag_uart stdout -> jtag_uart I regenerated the BSP I compiled the project I downloaded (nios2-dowload -g project.elf). I ran nios2-terminal... and nothing happened... I don't really know what to do.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page