diff --git a/cpu/avr8_common/Kconfig b/cpu/avr8_common/Kconfig index e982adc423..54bd222d82 100644 --- a/cpu/avr8_common/Kconfig +++ b/cpu/avr8_common/Kconfig @@ -12,6 +12,7 @@ config CPU_ARCH_AVR8 select HAS_ARCH_AVR8 select MODULE_MALLOC_THREAD_SAFE if TEST_KCONFIG + select MODULE_TINY_STRERROR_AS_STRERROR if TEST_KCONFIG # static C++ constructors need guards for thread safe initialization select MODULE_CXX_CTOR_GUARDS if MODULE_CPP # new and delete operators needed diff --git a/cpu/avr8_common/Makefile.dep b/cpu/avr8_common/Makefile.dep index 8a35c0ac99..6f0042d7b1 100644 --- a/cpu/avr8_common/Makefile.dep +++ b/cpu/avr8_common/Makefile.dep @@ -9,6 +9,9 @@ USEMODULE += avr8_common # instead. USEMODULE += malloc_thread_safe +# The AVR-libc provides no strerror, so we provide it via tiny_strerror +USEMODULE += tiny_strerror_as_strerror + # the atmel port uses stdio_uart by default ifeq (,$(filter stdio_% slipdev_stdio,$(USEMODULE))) USEMODULE += stdio_uart diff --git a/cpu/avr8_common/avr_libc_extra/posix_unistd.c b/cpu/avr8_common/avr_libc_extra/posix_unistd.c index 93c6d67fda..05aa350997 100644 --- a/cpu/avr8_common/avr_libc_extra/posix_unistd.c +++ b/cpu/avr8_common/avr_libc_extra/posix_unistd.c @@ -177,80 +177,4 @@ ssize_t write(int fd, const void *src, size_t count) #endif } -const char *strerror(int errnum) -{ - if (errnum < 0) { - errnum = -errnum; - } - - switch (errnum) { - case 0: return "OK"; - case EDOM: return "EDOM"; - case ERANGE: return "ERANGE"; - case ENOSYS: return "ENOSYS"; - case EINTR: return "EINTR"; - case E2BIG: return "E2BIG"; - case EACCES: return "EACCES"; - case EADDRINUSE: return "EADDRINUSE"; - case EADDRNOTAVAIL: return "EADDRNOTAVAIL"; - case EAFNOSUPPORT: return "EAFNOSUPPORT"; - case EAGAIN: return "EAGAIN"; - case EALREADY: return "EALREADY"; - case EBADF: return "EBADF"; - case EBUSY: return "EBUSY"; - case ECHILD: return "ECHILD"; - case ECONNABORTED: return "ECONNABORTED"; - case ECONNREFUSED: return "ECONNREFUSED"; - case ECONNRESET: return "ECONNRESET"; - case EDEADLK: return "EDEADLK"; - case EDESTADDRREQ: return "EDESTADDRREQ"; - case EEXIST: return "EEXIST"; - case EFAULT: return "EFAULT"; - case EFBIG: return "EFBIG"; - case EHOSTUNREACH: return "EHOSTUNREACH"; - case EILSEQ: return "EILSEQ"; - case EINPROGRESS: return "EINPROGRESS"; - case EINVAL: return "EINVAL"; - case EIO: return "EIO"; - case EISCONN: return "EISCONN"; - case EISDIR: return "EISDIR"; - case ELOOP: return "ELOOP"; - case EMFILE: return "EMFILE"; - case EMLINK: return "EMLINK"; - case EMSGSIZE: return "EMSGSIZE"; - case ENAMETOOLONG: return "ENAMETOOLONG"; - case ENETDOWN: return "ENETDOWN"; - case ENETRESET: return "ENETRESET"; - case ENETUNREACH: return "ENETUNREACH"; - case ENFILE: return "ENFILE"; - case ENOBUFS: return "ENOBUFS"; - case ENODEV: return "ENODEV"; - case ENOENT: return "ENOENT"; - case ENOEXEC: return "ENOEXEC"; - case ENOLCK: return "ENOLCK"; - case ENOMEM: return "ENOMEM"; - case ENOMSG: return "ENOMSG"; - case ENOPROTOOPT: return "ENOPROTOOPT"; - case ENOSPC: return "ENOSPC"; - case ENOTCONN: return "ENOTCONN"; - case ENOTDIR: return "ENOTDIR"; - case ENOTEMPTY: return "ENOTEMPTY"; - case ENOTSOCK: return "ENOTSOCK"; - case ENOTTY: return "ENOTTY"; - case ENXIO: return "ENXIO"; - case EOPNOTSUPP: return "EOPNOTSUPP"; - case EPERM: return "EPERM"; - case EPIPE: return "EPIPE"; - case EPROTONOSUPPORT: return "EPROTONOSUPPORT"; - case EPROTOTYPE: return "EPROTOTYPE"; - case EROFS: return "EROFS"; - case ESPIPE: return "ESPIPE"; - case ESRCH: return "ESRCH"; - case ETIMEDOUT: return "ETIMEDOUT"; - case EWOULDBLOCK: return "EWOULDBLOCK"; - case EXDEV: return "EXDEV"; - default: return "unknown"; - } -} - /** @} */