Skip to contentSkip to conversation

RFA: libfdt: using missing type uintptr_t

U-Boot Jerry Van Baren 2 participants 2 messages Aug 20, 2008

lore
Share & tools
lore
#0 lore raw

Hello all, I have a Request For Advice.

I've pulled down the dtc/libfdt updates and applied them to my personal working git repository. It turns out that David Gibson added a use of the typedef "uintptr_t" found in linux-land in /usr/include/stdint.h.

<http://thread.gmane.org/gmane.linux.ports.ppc64.devel/43379>

The problem is, currently u-boot doesn't have stdint.h. It looks like we have three options:
1) Hack in the typedef for uintptr_t into "libfdt_env.h"
2) Add the linux stdint.h to u-boot
3) Find an alternative for uintptr_t and convince David and Jon that it is A Better Thing to use.

As I see it, #3 is extremely unlikely, especially since David is using uintptr_t for exactly the purpose for which it was created. #1 is, well, a hack. #2 (add linux' stdint.h to u-boot) seems like the best approach, but my initial try caused redefinitions between stdint.h and types.h as well as missing files:
#include <features.h>
#include <bits/wchar.h>
#include <bits/wordsize.h>
Sigh.

At this point, adding stdint.h seems to be the best option. Anybody have a better approach?

Thanks,
gvb

#1 lore raw
Quoted 11 lines · Jerry Van Baren

Hello all, I have a Request For Advice.

I've pulled down the dtc/libfdt updates and applied them to my personal working git repository. It turns out that David Gibson added a use of the typedef "uintptr_t" found in linux-land in /usr/include/stdint.h.

<http://thread.gmane.org/gmane.linux.ports.ppc64.devel/43379>

The problem is, currently u-boot doesn't have stdint.h. It looks like we have three options:
1) Hack in the typedef for uintptr_t into "libfdt_env.h"

This doesn't strike me as a hack. It's exactly the sort of thing that libfdt_env.h is for. In fact, I think I already did this when I updated the in-kernel dtc/libfdt to a recent version (the kernel has a stdint.h, but the bootwrapper environment doesn't, or not a complete one).

Quoted 1 line

2) Add the linux stdint.h to u-boot

Doesn't have to be the Linux one, though that's probably easy as any. Any more-or-less C99ish stdint.h will do.

Quoted 19 lines

3) Find an alternative for uintptr_t and convince David and Jon that it is A Better Thing to use.

As I see it, #3 is extremely unlikely, especially since David is using uintptr_t for exactly the purpose for which it was created. #1 is, well, a hack. #2 (add linux' stdint.h to u-boot) seems like the best approach, but my initial try caused redefinitions between stdint.h and types.h as well as missing files:
#include <features.h>
#include <bits/wchar.h>
#include <bits/wordsize.h>
Sigh.

At this point, adding stdint.h seems to be the best option. Anybody have a better approach?

Thanks,
gvb

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson