Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues building on MacOS #1

Open
robertlipe opened this issue Mar 29, 2022 · 5 comments
Open

Issues building on MacOS #1

robertlipe opened this issue Mar 29, 2022 · 5 comments

Comments

@robertlipe
Copy link

Because others are having problems with this code, I'm reporting the errors belched by MacOS just in case these issues (sometimes they're "real" code issues instead of just compiler whining) are blocking them.

First, you have to disable one of the internal modules because it won't compile:
configure --disable-internal-libjaylink

The random return valuess and the scoping issues are concerning.

✗ make -k 2>&1 | grep error:
src/flash/nor/wcharm.c:398:20: error: comparison of integers of different signs: 'int' and 'unsigned int' [-Werror,-Wsign-compare]
src/flash/nor/wcharm.c:416:1: error: non-void function does not return a value in all control paths [-Werror,-Wreturn-type]
src/flash/nor/wcharm.c:466:1: error: non-void function does not return a value in all control paths [-Werror,-Wreturn-type]
src/flash/nor/wcharm.c:474:11: error: unused variable 'cpuid' [-Werror,-Wunused-variable]
src/flash/nor/wcharm.c:474:18: error: unused variable 'device_id_register' [-Werror,-Wunused-variable]
src/flash/nor/wcharm.c:513:51: error: incompatible pointer types passing 'uint16_t *' (aka 'unsigned short *') to parameter of type 'uint32_t *' (aka 'unsigned int ') [-Werror,-Wincompatible-pointer-types]
src/flash/nor/wcharm.c:511:11: error: unused variable 'cpuid' [-Werror,-Wunused-variable]
src/flash/nor/wcharm.c:511:18: error: unused variable 'flash_size_reg' [-Werror,-Wunused-variable]
src/flash/nor/wcharm.c:512:14: error: unused variable 'temp' [-Werror,-Wunused-variable]
src/flash/nor/wcharm.c:528:14: error: variable 'rid' set but not used [-Werror,-Wunused-but-set-variable]
src/flash/nor/wcharm.c:997:17: error: comparison of integers of different signs: 'int' and 'unsigned int' [-Werror,-Wsign-compare]
src/flash/nor/wcharm.c:1070:11: error: incompatible function pointer types initializing 'int (
)(struct flash_bank *, unsigned int, unsigned int)' with an expression of type 'int (struct flash_bank , int, int)' [-Werror,-Wincompatible-function-pointer-types]
src/flash/nor/wcharm.c:1071:13: error: incompatible function pointer types initializing 'int (
)(struct flash_bank *, int, unsigned int, unsigned int)' with an expression of type 'int (struct flash_bank , int, int, int)' [-Werror,-Wincompatible-function-pointer-types]
src/flash/nor/wcharm.c:1078:10: error: incompatible function pointer types initializing 'int (
)(struct flash_bank *, struct command_invocation *)' with an expression of type 'int (struct flash_bank *, char , int)' [-Werror,-Wincompatible-function-pointer-types]
src/flash/nor/wchriscv.c:26:23: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
src/flash/nor/wchriscv.c:122:11: error: unused variable 'rid' [-Werror,-Wunused-variable]
src/flash/nor/wchriscv.c:172:11: error: incompatible function pointer types initializing 'int (
)(struct flash_bank *, unsigned int, unsigned int)' with an expression of type 'int (struct flash_bank *, int, int)' [-Werror,-Wincompatible-function-pointer-types]
src/flash/nand/davinci.c:560:60: error: parameter 'oob_size' set but not used [-Werror,-Wunused-but-set-parameter]
src/target/target.c:65:23: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
src/target/target.c:3356:1: error: non-void function does not return a value [-Werror,-Wreturn-type]
src/target/target.c:3860:13: error: unused variable 'addr' [-Werror,-Wunused-variable]
src/target/target.c:3898:20: error: declaration shadows a local variable [-Werror,-Wshadow]
src/target/target.c:3870:17: error: comparison of integers of different signs: 'int' and 'unsigned int' [-Werror,-Wsign-compare]
src/target/target.c:3875:17: error: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare]
src/target/target.c:3882:17: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare]
src/target/riscv/riscv-013.c:270:11: error: unused variable 's3' [-Werror,-Wunused-variable]
src/target/riscv/riscv-013.c:271:11: error: unused variable 's4' [-Werror,-Wunused-variable]
src/target/riscv/riscv-013.c:268:11: error: unused variable 'a7' [-Werror,-Wunused-variable]
src/target/riscv/riscv-013.c:269:11: error: unused variable 's2' [-Werror,-Wunused-variable]
src/target/riscv/riscv-013.c:266:11: error: unused variable 'a5' [-Werror,-Wunused-variable]
src/target/riscv/riscv-013.c:258:11: error: unused variable 'regs' [-Werror,-Wunused-variable]
src/target/riscv/riscv-013.c:280:11: error: unused variable 't5' [-Werror,-Wunused-variable]
src/target/riscv/riscv-013.c:267:11: error: unused variable 'a6' [-Werror,-Wunused-variable]
src/target/riscv/riscv-013.c:281:11: error: unused variable 't6' [-Werror,-Wunused-variable]
src/target/riscv/riscv-013.c:279:11: error: unused variable 't4' [-Werror,-Wunused-variable]
src/target/riscv/riscv-013.c:277:11: error: unused variable 's10' [-Werror,-Wunused-variable]
src/target/riscv/riscv-013.c:278:11: error: unused variable 's11' [-Werror,-Wunused-variable]
src/target/riscv/riscv-013.c:275:11: error: unused variable 's8' [-Werror,-Wunused-variable]
src/target/riscv/riscv-013.c:263:11: error: unused variable 'tp' [-Werror,-Wunused-variable]
src/target/riscv/riscv-013.c:276:11: error: unused variable 's9' [-Werror,-Wunused-variable]
src/target/riscv/riscv-013.c:273:11: error: unused variable 's6' [-Werror,-Wunused-variable]
src/target/riscv/riscv-013.c:274:11: error: unused variable 's7' [-Werror,-Wunused-variable]
src/target/riscv/riscv-013.c:272:11: error: unused variable 's5' [-Werror,-Wunused-variable]
src/target/riscv/riscv-013.c:330:1: error: non-void function does not return a value [-Werror,-Wreturn-type]
fatal error: too many errors emitted, stopping now [-ferror-limit=]
src/target/riscv/riscv.c:405:15: error: incompatible pointer types passing 'uint32_t *' (aka 'unsigned int *') to parameter of type 'uint8_t *' (aka 'unsigned char *') [-Werror,-Wincompatible-pointer-types]

@robertlipe
Copy link
Author

I have a deadlock on this patch. I can't submit MY changes because the original is such a mess and I didn't totally clean it all. So I'm going to go back and take another pass at this. For expedience in the hopes that it helps others, here is my patch. I'll now go back t omaster and fix the egregious style violations, then come back and try to layer this in.[
pm.patch.txt
](url)

@robertlipe
Copy link
Author

Here's an additional set of patches since I can't push to github. This fixes ALL warnings identified by the presumit . Please layer this in and then merge/apply the one with the real fixes.

Yes, this is all very messy. I don't know why Github won't let me push:
remote: Permission to kprasadvnsi/riscv-openocd-wch.git denied to robertlipe.
fatal: unable to access 'https://github.com/kprasadvnsi/riscv-openocd-wch.git/': The requested URL returned error: 403
formatting.patch.txt

@robertlipe
Copy link
Author

Modernized, rebased, and continued in
karlp/openocd-hacks#3
karlp/openocd-hacks#2 and
karlp/openocd-hacks#1

I'll leave this PR open for a bit until we figure out which of https://github.com/newbrain/riscv-openocd-wch, https://github.com/karlp/openocd-hacks/, or this one get traction.

@fdarling
Copy link

The reason you cannot push to GitHub is that you checked it out using the HTTPS method, and without using any credentials on the URL. If you had write access to the repo, you could alter the URL to be https://[email protected]/kprasadvnsi/riscv-openocd-wch.git in your .git/config file inside the cloned repo. More likely you'd need to fork the repo, apply your changes there, then push that to your forked version and do a pull request back to the original repo.

Let me know if you need any help...

@fdarling
Copy link

After patching an ungodly amount of improper use of signed/unsigned integers, unused variables, bad forward declarations, etc. I finally got this to build on Ubuntu 20.04 LTS! I imagine my changes would also help it compile under macOS. I will see if I can get my patches into a fork so you guys can see them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants