[PATCH 06/11] Inserted inttype macros, fix 11 format warnings.

Joel Sherrill joel at rtems.org
Fri Apr 7 22:58:49 UTC 2017


On Fri, Apr 7, 2017 at 5:37 PM, Cillian O'Donnell <cpodonnell8 at gmail.com>
wrote:

> When I got rid of the casts I was left with char * and couldn't find an
> inttype to fit it so I left the casts in.
>

char * can be printed with %p. printk() should support that but check.
Do a simple test on Linux to see but I don't think you have to put 0x%p,
it just prints an address correctly.

Another approach would be to cast it to a uintptr_t and (hopefully), there
is a PRI constant for that. but %p is preferable.

--joel


> ---
>  .../lib/libbsp/powerpc/virtex5/startup/bspstart.c  | 25
> +++++++++++-----------
>  1 file changed, 13 insertions(+), 12 deletions(-)
>
> diff --git a/c/src/lib/libbsp/powerpc/virtex5/startup/bspstart.c
> b/c/src/lib/libbsp/powerpc/virtex5/startup/bspstart.c
> index 9d610e4..fef18d3 100644
> --- a/c/src/lib/libbsp/powerpc/virtex5/startup/bspstart.c
> +++ b/c/src/lib/libbsp/powerpc/virtex5/startup/bspstart.c
> @@ -69,6 +69,7 @@
>
>  #include <string.h>
>  #include <fcntl.h>
> +#include <inttypes.h>
>
>  #define DO_DOWN_ALIGN(x,a) ((x) & ~((a)-1))
>
> @@ -227,20 +228,20 @@ void bsp_start(void)
>
>    /* Let the user know what parameters we were compiled with */
>    printk("                  Base/Start     End         Size\n"
> -         "RAM:              0x%08x              0x%x\n"
> -         "RTEMS:                        0x%08x\n"
> +         "RAM:              0x%08" PRIx32 " 0x%" PRIx32 "\n"
> +         "RTEMS:                        0x%08" PRIx32 "\n"
>           "Interrupt Stack:  0x%08x              0x%x\n"
> -         "Stack:            0x%08x  0x%08x  0x%x\n"
> -         "Workspace:        0x%08x  0x%08x\n"
> -         "MsgArea:          0x%08x              0x%x\n"
> -         "Physical RAM                  0x%08x\n",
> -         (uint32_t)RamBase,
>  (uint32_t)RamSize,
> -         (uint32_t)__rtems_end,
> +         "Stack:            0x%08" PRIx32 "0x%08" PRIx32 "0x%" PRIx32 "\n"
> +         "Workspace:        0x%08" PRIx32 "0x%08" PRIx32 "\n"
> +         "MsgArea:          0x%08" PRIx32 "0x%" PRIx32 "\n"
> +         "Physical RAM                  0x%08" PRIx32 "\n",
> +         (uint32_t) RamBase,  (uint32_t) RamSize,
> +         (uint32_t) __rtems_end,
>           intrStackStart,                                  intrStackSize,
> -         (uint32_t)__stack_base, (uint32_t)_stack,
> (uint32_t)StackSize,
> -         (uint32_t)WorkAreaBase, (uint32_t)__bsp_ram_end,
> -         (uint32_t)MsgAreaBase,
>  (uint32_t)MsgAreaSize,
> -         (uint32_t)__phy_ram_end);
> +         (uint32_t) __stack_base, (uint32_t) _stack, (uint32_t) StackSize,
> +         (uint32_t) WorkAreaBase, (uint32_t) __bsp_ram_end,
> +         (uint32_t) MsgAreaBase, (uint32_t) MsgAreaSize,
> +         (uint32_t) __phy_ram_end);
>
>    /*
>     * Initialize RTEMS IRQ system
> --
> 2.7.4
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20170407/1106278b/attachment-0002.html>


More information about the devel mailing list