Commit graph

11 commits

Author SHA1 Message Date
Wilfried Chauveau d79ba86c04 lib: libc: armstdc: add missing retarget of fputc to _stdout_hook
Fixes #62677 where printf defaults to using armclang's semihosting backed
implementation of printf.

Signed-off-by: Wilfried Chauveau <wilfried.chauveau@arm.com>
2023-10-04 11:02:37 +02:00
Daniel Leung 0a50ff366e kernel: rename z_current_get() to k_sched_current_thread_query()
The original idea of z_current_get() was to be the counterpart
of k_current_get() when thread local variable for current has
not been initialized if TLS is enabled, otherwise they are
the same function. Now since z_current_get() is being used
outside of core kernel, rename it under kernel namespace so
other subsystem can conceptually use them too.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-09-28 16:15:46 +02:00
Kumar Gala ca4dc50ec1 libc: Move strnlen into common
Move the strnlen implementation into common so its available to any
libc that may not implement strnlen.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-05-08 09:59:27 +02:00
Kumar Gala 48cd295a7f armstdc: add limits.h header
Add limits.h header that defines PATH_MAX as this is not defined
by the toolchain headers.

The value of 256 for PATH_MAX is based on how it is set in
lib/libc/minimal/include/limits.h.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-04-25 12:18:55 +02:00
Kumar Gala af79019146 armstdc: add string.h & strings.h header
Add string.h header that declerates prototype for strnlen()
as this is not provided by the toolchain headers.

Add strings.h to allow anything that expects strncasecmp() to
be defined there to build correctly.  The arm toolchain actually
defines strncasecmp() in <string.h> so we just have <strings.h>
include <string.h>.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-04-10 16:32:10 -05:00
Kumar Gala 20b21091cc armstdc: Fixup headers as needed by posix
* Move 'struct _timespec' into sys/_timespec.h as expected by
  <posix/time.h>.

* Introduce 'struct timeval' in sys/_timeval.h as expected by
  <posix/time.h>.

* Add mode_t to <sys/types.h> as expected by <posix/stat.h>

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-04-10 16:32:10 -05:00
Kumar Gala 82538a2d28 armclang: add empty sys/cdefs.h
Various headers include <sys/cdefs.h> like zephyr/posix/sys/stat.h.
When building with the arm-clang toolchain we utilize armstdc
so we need an empty cdefs.h similar to what minimal libc has so
things will build.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-04-10 16:32:10 -05:00
Gerard Marull-Paretas cbd31d720b lib: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all lib code to the new
prefix <zephyr/...>. Note that the conversion has been scripted, refer
to zephyrproject-rtos#45388 for more details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 19:58:09 +02:00
Nazar Kazakov 9713f0d47c everywhere: fix typos
Fix a lot of typos

Signed-off-by: Nazar Kazakov <nazar.kazakov.work@gmail.com>
2022-03-14 20:22:24 -04:00
Torsten Rasmussen 16e848b57c armclang: threading_weak.c source file added for armclang
The stub file threading_weak.c has been added containing weak stub
implementation of threading related kernel functions.

The file is needed for armlink.

When linking with armlink the linker will resolve undefined symbols for
all undefined functions even if those functions the reference the
undefined symbol is never actually called.

This file provides weak stub implementations that are compiled when
CONFIG_MULTITHREADING=n to ensure proper linking.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-08-30 08:54:23 -04:00
Torsten Rasmussen 36bb00d1f5 armclang: ARM Compiler C library support
Support for ARM Compiler C library.

This commit add support for the ARM Compiler C libary in:
- Kconfig
- libc/armstdc

A new Kconfig symbol is added to allow a toolchain to specify if they
support linking with the minimal C library.
Also the CMake variable `TOOLCHAIN_HAS_NEWLIB` is exported to Kconfig
so that CONFIG_NEWLIB_LIBS can only be enabled if the toolchain has
newlib.

The armclang toolchain selects the CMake scatter file generator and
disables support for the LD linker template which is not supported by
armlink.

For the ARM Compiler C library, a corresponding lib/libc/armstc/ folder
with a minimal implementation to work with the ARM Compiler C library
is added.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-08-30 08:54:23 -04:00