- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
altera_avalon_i2c.h defines:
typedef alt_u32 ALT_AVALON_I2C_STATUS_CODE;
Which is an unsigned type, which is a problem because the errors are all negative.
This compiles with a warning:
ALT_AVALON_I2C_STATUS_CODE status = alt_avalon_i2c_master_tx(
i2c_dev,
txbuffer,
2,
ALT_AVALON_I2C_NO_INTERRUPTS
);
if (status == ALT_AVALON_I2C_ERROR) {
uart.println("error");
}
main.cpp:221:15: warning: comparison of integer expressions of different signedness: 'ALT_AVALON_I2C_STATUS_CODE' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
221 | if (status == ALT_AVALON_I2C_ERROR) {
And a switch(status) errors:
freertos_bsp/drivers/inc/altera_avalon_i2c.h:102:33: error: narrowing conversion of '-1' from 'int' to 'long unsigned int' [-Wnarrowing]
102 | #define ALT_AVALON_I2C_ERROR (-1)
Please change ALT_AVALON_I2C_STATUS_CODE to a signed type.
-Andy
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for the feedback, let me verify it on our side.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Could you share your design that faced this error? That would be helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Not easily. But I can tell you how to recreate it pretty easy.
1) create a platform designer with a NiosV and an i2c master. Just enough to generate the .socpinfo file, you dont need anything in quartus.
2) create a default hal bsp, make sure altera_avalon_i2c is being included.
3) create an app, add this to your CMakeLists.txt:
target_compile_options(app.elf PRIVATE
-fno-exceptions
-fno-common
-fno-rtti
-fvisibility=hidden
-fvisibility-inlines-hidden
-D_FORTIFY_SOURCE=2
-fstack-protector
-Wall
-Wextra
-Wshadow
-Wdouble-promotion
-Wnon-virtual-dtor
-Wcast-align
-Wunused
-Wundef
-Woverloaded-virtual
-Wpedantic
-Wconversion # warn on type conversions that may lose data
-Wsign-conversion
-Wnull-dereference
-Wformat=2
-Wmisleading-indentation
-Wduplicated-cond
-Wduplicated-branches
-Wlogical-op
)
4) In your main add something like:
ALT_AVALON_I2C_DEV_t *i2c_dev = alt_avalon_i2c_open(IPMB_0_I2C_MASTER_NAME);
if (i2c_dev == nullptr)
{
uart.println("Error: Cannot find /dev/i2c_0");
return;
}
// set remote address
alt_avalon_i2c_master_target_set(i2c_dev, addr);
ALT_AVALON_I2C_STATUS_CODE status = alt_avalon_i2c_master_tx(
i2c_dev,
txbuffer,
numValues,
ALT_AVALON_I2C_NO_INTERRUPTS
);
// this gives warnings
if (status == ALT_AVALON_I2C_SUCCESS) {
uart.println("send success (staus = %d)", status);
}
// this errors
switch(status) {
case ALT_AVALON_I2C_SUCCESS:
uart.println("send success (staus = %d)", status);
break;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks a lot for the inputs, I will test and channel this to our internal team as feedback.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I got it, just to confirm again, is this warning is on the FreeRTOS? Did you see same warning on the Altera HAL?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the steps posed above:
Step 2) create a default hal bsp
Its in HAL.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Reason I ask was because in the initial post, it was calling out the "freertos_bsp" folder regarding the switch(status) error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks again, this feedback have been channeled to our internal team.
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.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page