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

printf("%llu",...) #3

Open
vervaekejonathan opened this issue Aug 25, 2017 · 2 comments
Open

printf("%llu",...) #3

vervaekejonathan opened this issue Aug 25, 2017 · 2 comments

Comments

@vervaekejonathan
Copy link

vervaekejonathan commented Aug 25, 2017

When I use:

uint64_t nr = 123;
printf("%llu", nr);

without the newlib-nano, it shows correctly
123
but when I enable newlib-nano, it shows
lu

Am I missing a linker/compiler option or is this not supported in newlib-nano?

@cotodevel
Copy link

cotodevel commented Dec 7, 2017

from my experience with newlibnano in NintendoDS, you need to add SOFT VP support somehow. (I didn't care to recompile newlib nano through make config package, I recompiled everything, so it would fit my toolchain, ToolchainGenericDS)

Variadic functions is one thing (multiple arguments), to test if it works correctly, try something pretty simple as:
printf("test:%x - %x",0x1234,0x5678), if you see "test:0x1234 - 0x5678" then variadic functions are working.

Then after you tested that, you need to add support for: VFP IEEE-754 compliant 64bit double / float :

https://github.com/cotodevel/newlib-nano-2/commit/cc82224b5e2ae5e463c430ab7c52370116051df4

I just tailored newlib nano for ToolchainGenericDS, so it may not be what you want, but gives an insight as of why that happens.

Also, when linking libmath, make sure the library supports your processor. I failed to run any variadic-like function from ARM7, using newlibnano (printf, sprintf failed) and that was due to that. So I had to recompile libmath, newlib nano for each processor (ARM7 and ARM9)

@MauroMombelli
Copy link

Please note you should noto sue %lld bit the macro from stdint.h Luke

printf("%" PRIu64 "\n", ram);

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

3 participants