Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12603 Discussions

Problems with C-Code in Eclipse for NIOS II

JBlec2
Beginner
745 Views

Hi ,

i wrote a program for a test in C++ on my PC in Eclipse. I thought : if i change it into C Nios will have it easier. So I translated it into C. I Thought copy and pasting it would be enough. Then i discovered NIOS 2 Eclipse hat some difficulties with my Code. It wasnt able to include conio.h , math.h and so on. I thought ok.. Even if the Error is not written explicit there , i will change those functions to own written ones . It worked But other Error with no description appeared. It was jsut a global 2 D Array which i had to put into my main. I passed the pointer to all my functions . Then it compiled with no Error. I thought , ok, now the output on screen must be correct. But it wasnt. I also copied it back into my Eclipse on my PC. There it worked fine. I discovered , that my Program on NIOS Eclipse does 3 functions in the main and then jumps back xD. It was a deep shock for me.

Maybe you can tell me what is going on here .

Thank you for any advice :D

It may has something to do with the compiler or the BSP package.

Ah yeah fopen also didnt work. Even if i activeted something in the BSP ( maybe i need to do it different)

 

:D

A a nice time !

0 Kudos
4 Replies
Ahmed_H_Intel1
Employee
577 Views

Hi,

I am expecting you checked the code by running it step by step to know that the NIOS II jumps back after executing the three functions. Can you check if the NIOS II restarts after executing these three functions?

If yes you have to check for any invalid instructions made by the system. I recommend you to set an IP in the Qsys design to be the "Default Slave" IP to clear any invalid instructions to avoid the false reset. This false reset happens if the cash is full/overlapped and etc.

Regards,

 

0 Kudos
JBlec2
Beginner
577 Views

>I am expecting you checked the code by running it step by step to know that the NIOS II jumps back after executing the three >functions. Can you check if the NIOS II restarts after executing these three functions?

>If yes you have to check for any invalid instructions made by the system.

Yes I first was just surprised. Then I launched the Debugger ( the Bug-icon) it goes through instructions step by step. Even as a beginner I saw clear signs that it really "jumps" back.

 

>Can you check if the NIOS II restarts after executing these three functions?

This is what I am really curious about. I couldn't understand it with my methods of debugging I will change some pointers to be not global. Maybe this is what crashes it down. I also will check if the error messages are allowed on all levels so I can see if there are some hidden errors noticed by the compiler

 

> I recommend you to set an IP in the Qsys design to be the "Default Slave" IP to clear any invalid instructions to avoid the false >reset. This false reset happens if the cash is full/overlapped and etc.

Interesting ! First I will check, like I said the global variables and pointers. If this won't help I will invest time to setup a "Default Slave" ( havn't done it before - this is why I didnt do first).

 

Thank you a lot . It was improtant for me to talk about this- I will check it out :D

Regards :D

 

0 Kudos
JBlec2
Beginner
578 Views

Wow I now put all my global variables into the main and it works better now. It is just a little bit slower and ONE!!!! character is missing xD

Maybe because the connection between NIOS and the console is bad ?

 

 

0 Kudos
Ahmed_H_Intel1
Employee
578 Views

Greate, so let's check why it is slow and how it is missing a character.

Having the connection between the NIOS II and the console can happen but you can check the cable and set up the JTAG frequency to bet better connection.

Please check the following link to change the JTAg configurations:

https://www.intel.com/content/www/us/en/programmable/support/support-resources/knowledge-base/solutions/rd06242013_922.html

 

Regards,

 

0 Kudos
Reply