Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
16556 Discussions

Error in altera_avalon_i2c.h

riwerf
Beginner
1,025 Views

I have a problem with the NIOS code generation code:

We have a project where we use Quartus Prime 20.3p, but it also appears 22.2.0, and while checking the code quality we ran into an issue.

 

The issue is around  the bsp/drivers/inc/altera_avalon_i2c.h where it gives an error here:



alt_u32 ip_freq_in_hz;
/*!< freq of clock to ip */
ALT_AVALON_I2C_ADDR_MODE_t address_mode;
/*!< address mode 7 or 10 bit */
ALT_SEM (regs_lock);                                         <=== here is the issue.
/*!< Semaphore used to control access registers
in multi-threaded mode */
} ALT_AVALON_I2C_DEV_t;

The macro ALT_SEM(x) is evaluated as 'empty' and that a “;” is left. What is invalid C code.

 

This macro is defined in bsp/HAL/inc/os/alt_sem.h and is indeed defined as ‘empty’.

But this file also contains a warning:


* It's important to be careful in the use of the macros: ALT_SEM,
* ALT_EXTERN_SEM, and ALT_STATIC_SEM. In these three cases the semi-colon is
* included in the macro definition; so, for example, you should use:
*
* ALT_SEM(mysem)
*
* not:
*
* ALT_SEM(mysem);
*
* The inclusion of the semi-colon has been necessary to ensure the macros can
* compile with no warnings when used in a single threaded HAL environment.

This warning is not followed in bsp/drivers/inc/altera_avalon_i2c.h. Where it does contain the semicolon.

Since this is ‘generated’ code I think it is a problem in the software. 

0 Kudos
12 Replies
KellyJialin_Goh
Employee
997 Views

Hi,

Greetings and thank you for notifying us regarding this issue/bug. I will ask the internal engineering team about this issue and at the mean time, is it a roadblock for you when compiling your projects?


Hope to hear from you.

Thank you.

Regards,

Kelly


0 Kudos
KellyJialin_Goh
Employee
953 Views

Hi,

Any updates from your side? Are there any further clarification needed from my end?

Hope to hear from you.


Thank you.

Regards,

Kelly


0 Kudos
riwerf
Beginner
944 Views

Hi Kelly,

 

I replied in email. That did not work apparently.

 

Thanks for picking this up.

We now patch the file manually after it has been created. It is a pain, because we have to do this over and over.

And I do not want to ‘fix’ this in the installation until I know more, as that potentially will affect lots of other people too.

 

Regards,

 

Richard

0 Kudos
KellyJialin_Goh
Employee
932 Views

Hi,

At the mean time, you may have a look at the Avalon I2C(Host) core API fore more information.

https://www.intel.com/content/www/us/en/docs/programmable/683130/21-3/fpga-i2c-host-core-api.html

Do bare in mind that the Intel's I2C ONLY acts as a master, and will not act as I2C slave.


Let me know if you need further clarifications from my end.

Thank you.

Regards,

Kelly


0 Kudos
KellyJialin_Goh
Employee
905 Views

Hi,

Any updates from your side?

Hope to hear on your findings.


Thank you.

Regards,

Kelly


0 Kudos
riwerf
Beginner
892 Views

Hi Kelly,

I am still waiting for your confirmation that this is indeed an error and how we can fix this on short term. I am waiting for updates from your side. Hope to hear from you soon.

Regards,

Richard

0 Kudos
KellyJialin_Goh
Employee
856 Views

Hi,

We need more information from you to determine whether it is a bug. At the moment there will be no fix for this issue.


1) May I know if your compilation is using NIOS II or NIOS V?

2) The alt_sem is empty because altera HAL don't support semaphore.

For Micro C/OS-II that supports semaphore, the ALT_SEM(sem) will be defined.

3) Is it also possible for you to try out on the 22.4p version to see whether you are able to avoid this issue?

4) Is this bug a major roadblock for your project? If not, has deleting the semicolon ' ; ' help resolve the error?


Hope to hear on your feedback soon.

Thank you.


Regards,

Kelly




0 Kudos
riwerf
Beginner
780 Views

Sorry, I have been out for a while. Here are some answers:

1) The project is I think for a NIOSII on a Stratix 10.

2) The fact that the ALT_SEM is empty is indeed causing the issue. Then in the structure there is an additional semicolon.

3) I have tried the 22.2.0. I will see if this still is the case in that latest greatest. This will take some time however to test.

4) When I remove the extra ; it is correct C-code. And everthing checks out. I just want your confirmation that this indeed correct, and that you fix (or have fixed) in any upcoming version.

 

Regards

 

Richard

0 Kudos
KellyJialin_Goh
Employee
826 Views

Hi,

Any updates from you on providing feedback for us to decide what are the next steps?

You feedback is highly appreciated and important to ensure we provide the best support services.

Hope to hear from you.


Thank you.

Regards,

Kelly


0 Kudos
KellyJialin_Goh
Employee
815 Views

Hi,

Any updates from your end? We are keen on your feedback in order to investigate further on this potential bug.

Hope to hear from you soon. Thank you.


Regards,

Kelly






0 Kudos
KellyJialin_Goh
Employee
768 Views

Hi,

Thank you for your feedback. Do try out on the 22.4 latest Quartus version at the mean time as it should eliminate the error. You could also go ahead with the workaround you suggested by deleting the semicolon.


Thank you and I shall set this case to close pending in the next few days.


Regards,

Kelly


0 Kudos
KellyJialin_Goh
Employee
744 Views

Hi,

I’m glad that your question has been addressed, I now transition this thread to community support. If you have a new question, Please login to ‘https://supporttickets.intel.com’, view details of the desire request, and post a feed/response within the next 15 days to allow me to continue to support you. After 15 days, this thread will be transitioned to community support. The community users will be able to help you on your follow-up questions.


p/s: If any answer from the community or Intel Support are helpful, please feel free to give best answer or rate 4/5 survey.


Thank you.

Regards,

Kelly Jialin, GOH


0 Kudos
Reply