ContributionsMost RecentMost LikesSolutionsRe: Nios - II memory alignment issue while accessing integer from non word align location Hi Anand, We have tested as per your suggestion and it worked. Thanks for your efforts and prompt response. Thanks, Vasu. Re: Nios - II memory alignment issue while accessing integer from non word align location Hi Anand, Thanks for your support. I have gone through your given design & noticed one difference in the eclipse project. I think you have used the template "hello world small" for eclipse project. I used NIOS code(hello_sw_leds.c) from your design on MAX10 Deca board with BSP template "hello world" & observed wrong result(int = 0x44332211). In a similar way, I also checked NIOS code with "hello world small" template & got expected result(int = 0x66554433). This could be happened due to reduced driver size. So with the above issue, I want your guidance on how we can get the expected output with "hello world" template in eclipse or in other words what settings need to be done in "hello world" project? Because we already design our project with "hello world" template. I have attached screenshots of eclipse project for your reference. Thanks, Vasu. Re: Nios - II memory alignment issue while accessing integer from non word align location Anand, We have tested it with Cyclone III (CoreCommander Board), Max 10 (DECA Board) and Cyclone 10 GX (custom board). But seeing same issue with all of them. Which FPGA board you are using to test this? Can you share Quartus design? We are using default settings in eclipse. Have you made any change in eclipse settings? Thanks, Vasu. Re: Nios - II memory alignment issue while accessing integer from non word align location Hi Anand, We have tried using Quartus 18 and at first sight we got expected result. But when we checked for memory address of C[2] it was already word aligned, so it was expected behavior. Can you please check below program with your system? char c[10] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88}; printf("int starting c[0] = 0x%08x and address = 0x%08x\n", *(int*)(&c[0]), (int)&c[0]); printf("int starting c[2] = 0x%08x and address = 0x%08x\n", *(int*)(&c[2]), (int)&c[2]); // We are expecting following output: // int starting c[0] = 0x44332211 and address = ..... // int starting c[2] = 0x66554433 and address = ..... Thanks, Vasu. Re: Nios - II memory alignment issue while accessing integer from non word align location Hi Anand, Thanks for quick reply. We have tried this with quartus version 13 and 16. Please check below version details. We are seeing same behavior with both of eclipse. Also can you provide details, which NIOS version you are using? Thanks, Vasu. Nios - II memory alignment issue while accessing integer from non word align location Error Msg : Not getting any error message but getting unexpected behavior - Using Nios-II with eclipse. While accessing integer(32 bit) form non word align location getting incorrect value as described in below example. - Tested with eclipse version 13 and 16, both are giving same result. - Test case : -------------------------------------------------------------------------------- char c[10] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88}; printf("int = 0x%08x", *(int*)(&c[2])); -------------------------------------------------------------------------------- above code should print "int = 0x66554433" but getting "int = 0x44332211" Solved