Kernel-space ctypes.h support?

Joel Sherrill joel at rtems.org
Thu Sep 13 12:07:11 UTC 2018


On Thu, Sep 13, 2018, 3:28 AM Sebastian Huber <
sebastian.huber at embedded-brains.de> wrote:

> Hello,
>
> I test currently the tqm8xx BSP which worked fine until RTEMS 5. The
> problem is that this BSP uses strtoul() to get some system configuration
> parameters from the boot loader. The Newlib used by RTEMS 5 has now
> support for C locales in strtoul(). The C locale support needs an
> executing thread with a valid Newlib reentrancy structure. This is
> definitely not the case during bsp_start().
>

Why do we now longer have a global reentrancy structure to fall back on?

If you disable newlib reentrancy via confdefs.h, what happens?

>
> I think we need a kernel-space ctypes.h implementation without this C
> locale stuff and string support functions which use this. For example
> FreeBSD has this:
>
> sys/sys/ctype.h
> sys/libkern/strtoul.c
>
> Maybe add a <rtems/string.h> header file with this content:
>
> #define rtems_isspace(c)    ((c) == ' ' || ((c) >= '\t' && (c) <= '\r'))
> #define rtems_isascii(c)    (((c) & ~0x7f) == 0)
> #define rtems_isupper(c)    ((c) >= 'A' && (c) <= 'Z')
> #define rtems_islower(c)    ((c) >= 'a' && (c) <= 'z')
> #define rtems_isalpha(c)    (rtems_isupper(c) || rtems_islower(c))
> #define rtems_isdigit(c)    ((c) >= '0' && (c) <= '9')
> #define rtems_isxdigit(c)    (rtems_isdigit(c) \
>                    || ((c) >= 'A' && (c) <= 'F') \
>                    || ((c) >= 'a' && (c) <= 'f'))
> #define rtems_isprint(c)    ((c) >= ' ' && (c) <= '~')
> #define rtems_toupper(c)    ((c) - 0x20 * (((c) >= 'a') && ((c) <= 'z')))
> #define rtems_tolower(c)    ((c) + 0x20 * (((c) >= 'A') && ((c) <= 'Z')))
>
> unsigned rtems_strtol(const char *nptr, char **endptr, int base);
> unsigned long rtems_strtoul(const char *nptr, char **endptr, int base);
>
> --
> Sebastian Huber, embedded brains GmbH
>
> Address : Dornierstr. 4, D-82178 Puchheim, Germany
> Phone   : +49 89 189 47 41-16
> Fax     : +49 89 189 47 41-09
> E-Mail  : sebastian.huber at embedded-brains.de
> PGP     : Public key available on request.
>
> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
>
> _______________________________________________
> 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/20180913/04d64f2e/attachment-0002.html>


More information about the devel mailing list