sifive / freedom-e-sdk

Open Source Software for Developing on the Freedom E Platform - Deprecated
Other
581 stars 209 forks source link

Build error in openocd with recent gcc #10

Closed tdaede closed 7 years ago

tdaede commented 7 years ago

openocd builds with -Werror, and this warning occurs with gcc 6.2.1:

In file included from /home/thomas/sandbox/freedom-e-sdk/openocd/src/target/riscv/riscv.c:12:0:
/home/thomas/sandbox/freedom-e-sdk/openocd/src/target/riscv/riscv.c: In function ‘riscv_examine’:
/home/thomas/sandbox/freedom-e-sdk/openocd/src/target/riscv/riscv.c:61:69: error: left shift of negative value [-Werror=shift-negative-value]
 #define get_field(reg, mask) (((reg) & (mask)) / ((mask) & ~((mask) << 1)))
timsifive commented 7 years ago

I don't have easy access to gcc 6. Can you paste the full output of the build command?

tdaede commented 7 years ago

The simple solution is just to patch Makefile (this will prevent accidental breakage from future gcc versions too):

-       $(openocd_srcdir)/configure --prefix=$(openocd_dest)
+       $(openocd_srcdir)/configure --prefix=$(openocd_dest) --disable-werror

The patch to openocd will be a bit bigger as it looks like it's using signed types when it should be using unsigned.

Attached is the whole output before the patch. error.txt

timsifive commented 7 years ago

This is also https://github.com/sifive/openocd/issues/6

timsifive commented 7 years ago

Is the patch to general parts of OpenOCD, or just the riscv portion? I'd like to fix the riscv portion regardless. I'll have to set up gcc 6 so I can quickly iterate.

tdaede commented 7 years ago

The only instance of this warning is in the riscv portion, and I can confirm that the linked patch fixes the warning and allows the build to complete successfully. (the one in sifive/openocd#6)

timsifive commented 7 years ago

Thanks. I just pushed that patch.

Tim

On Thu, Dec 1, 2016 at 3:13 PM, Thomas Daede notifications@github.com wrote:

The only instance of this warning is in the riscv portion, and I can confirm that the linked patch fixes the warning and allows the build to complete successfully.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/sifive/freedom-e-sdk/issues/10#issuecomment-264324854, or mute the thread https://github.com/notifications/unsubscribe-auth/APYH7Z6HGyMfGB93qhrJHm4wxGETl_rRks5rD1SSgaJpZM4LA5zE .

mwachs5 commented 7 years ago

I'll bump OpenOCD version and close this issue once that's tested and pushed to master.

timsifive commented 7 years ago

On Mon, Dec 5, 2016 at 8:49 AM, Megan Wachs notifications@github.com wrote:

I'll bump OpenOCD version and close this issue once that's tested and pushed to master.

It was tested, and pushed to "master." In this repo "riscv" is the master branch.

Tim

mwachs5 commented 7 years ago

Sorry, I mean the master branch of freedom-e-sdk. I believe it's still pointing to a slightly older OpenOCD.