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

Cannot compile Zephyr project with standard macros INT8_C, UINT8_C, UINT16_C #30117

Closed
rohand87 opened this issue Nov 18, 2020 · 3 comments · Fixed by #30498
Closed

Cannot compile Zephyr project with standard macros INT8_C, UINT8_C, UINT16_C #30117

rohand87 opened this issue Nov 18, 2020 · 3 comments · Fixed by #30498
Assignees
Labels
bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug

Comments

@rohand87
Copy link

Hello,

I am trying to build this library in Zephyr. I am getting compiler errors for implicit declaration of function 'INT8_C', UINT8_C, UINT16_C. These are standard macros from stdint.h. I can build the same code in other platforms but not in Zephyr. I am not sure whether it is a issue with my setup. Please help.

To Reproduce
Steps to reproduce the behavior:

  1. Use the attached project
  2. Create an alias in device tree called i2c0. I am using a custom board
  3. west build -b
  4. Get the below warnings which ultimately lead to errors

Impact
showstopper

Logs and console output

In file included from ../src/bmp3.h:47,
                 from ../src/bmp3.c:41:
../src/bmp3.c: In function 'bmp3_init':
../src/bmp3_defs.h:280:49: warning: implicit declaration of function 'INT8_C'; did you mean 'INT8_MAX'? [-Wimplicit-function-declaration]
  280 | #define BMP3_OK                                 INT8_C(0)
      |                                                 ^~~~~~
../src/bmp3.c:708:17: note: in expansion of macro 'BMP3_OK'
  708 |     if (rslt == BMP3_OK)
      |                 ^~~~~~~
../src/bmp3_defs.h:167:49: warning: implicit declaration of function 'UINT8_C'; did you mean 'UINT8_MAX'? [-Wimplicit-function-declaration]
  167 | #define BMP3_REG_CHIP_ID                        UINT8_C(0x00)
      |                                                 ^~~~~~~

Environment (please complete the following information):

  • OS: Linux
  • Toolchain: zephyr-sdk-0.11.4
  • Version: 2.4.99

Attachment
bmp3_zephyr.zip

Thanks

@rohand87 rohand87 added the bug The issue is a bug, or the PR is fixing a bug label Nov 18, 2020
@galak
Copy link
Collaborator

galak commented Nov 18, 2020

I think this is just a missing feature of lib/libc/newlib/include/stdint.h

@rohand87
Copy link
Author

Thanks for your reply @galak. What should be a good workaround to resolved this issue?

@galak
Copy link
Collaborator

galak commented Nov 19, 2020

Thanks for your reply @galak. What should be a good workaround to resolved this issue?

you can submit a PR to add the macro's to lib/libc/newlib/include/stdint.h

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants