Commit Graph

94 Commits

Author SHA1 Message Date
Jaap de Wolff bc9b30ea77 add forward declaration to main() to prevent warnings 2018-02-16 12:16:08 +01:00
Jaap de Wolff c9d4bac58c adapt prototypes arm/syscalls.c to usual prototypes, and do not rely on implicit conversions 2018-02-16 12:16:07 +01:00
Yaakov Selkowitz 70ee6b17df ansification: remove _EXFUN, _EXFUN_NOTHROW
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17 11:47:29 -06:00
Yaakov Selkowitz eea249da3b ansification: remove _PARAMS
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17 11:47:13 -06:00
Tamar Christina d7d6ad7b6b Add support for Semihosting v2 support for ARM in libgloss.
Semihosting v2 changes are documented here:
https://developer.arm.com/docs/100863/latest/

The biggest change is the addition of an extensions mechanism
to add more extensions in the future.

Signed-off-by: Tamar Christina <tamar.christina@arm.com>
2017-07-05 14:41:27 +02:00
Tamar Christina cc142edbe7 Add the needed build system changes in order to compile and create the new libraries for Semihosting v2 for ARM.
This uses the new recursive build target in multi-build.in

The new spec files are:

For AArch32/ARM (m for mixed mode):
  - rdimon-v2m.specs
  - aprofile-validation-v2m.specs
  - aprofile-ve-v2m.specs

These spec files will be using the new libraries generated
by multi-build.in.

Signed-off-by: Tamar Christina <tamar.christina@arm.com>
2017-07-05 14:41:27 +02:00
Laurent ALFONSI 9b1167219a ARM/AArch64: Fix GetCmdLine semihosting directives
When simulating arm code, the target program startup code (crt0) uses
semihosting invocations to get the command line from the simulator. The
simulator returns the command line and its size into the area passed in
parameter. (ARM 32-bit specifications :
http://infocenter.arm.com/help/topic/com.arm.doc.dui0058d/DUI0058.pdf
chapter "5.4.19 SYS_GET_CMDLINE").

The memory area pointed by the semihosting register argument is located
in .text section (usually not writtable (RX)).

If we run this code on a simulator that respects this rights properties
(qemu user-mode for instance), the command line will not be written to
the .text program memory, in particular the length of the string. The
program runs with an empty command line. This problem hasn't been seen
earlier probably because qemu user-mode is not so much used, but this can
happen with another simulator that refuse to write in a read-only segment.

With this modification, the command line can be correctly passed to the
target program.

Changes:
- libgloss/arm/crt0.S : Arguments passed to the AngelSWI_Reason_GetCmdLine
  semihosting invocation are placed into .data section instead of .text
- libgloss/aarch64/crt0.S : Idem for aarch64 AngelSVC_Reason_GetCmdLine
  semihosting.
2017-05-19 15:45:58 -04:00
Carlos Santos 8ae6d8003a libgloss/arm: fix discovery of "eabihf" toolchains
ARM EABI toolchains can optionally use the "hf" suffix to identify
hardware floating point support. Use the "*-*-eabi*" pattern to match
these toolchains.

Original patch by Bryan Hundven for the Crosstool-NG project. Improved
by Alexey Neyman.

Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
CC: Bryan Hundven <bryanhundven@gmail.com
CC: Alexey Neyman <stilor@att.net>
2017-04-18 12:24:42 +02:00
Thomas Preud'homme be5926babb Fix elf-nano.specs to work without -save-temps
The changes in af272aca59 only works when
using gcc/g++ with -E or -save-temps, otherwise newlib's newlib.h gets
used even if -specs=nano.specs is specified. This is because the driver
only use cpp_options spec for the external cpp tool, not for the
integrated one.

This patch uses instead cpp_unique_options which is used in all cases:
it is used directly when the integrated preprocessor is used, and
indirectly by expansion of cpp_options otherwise.
2017-02-15 16:31:16 +01:00
Thomas Preudhomme af272aca59 Fix cpp invocation for C++ in nano spec
Hi,

The changes in c028685518 to use
newlib-nano's include directory work for cc1 but not cc1plus. cc1plus
comes with its own cpp spec which does not have a name attached to it.

This patch uses the renaming trick on cpp_options instead of cpp, as
cpp_options is used both by cc1 and cc1plus.
2017-02-13 09:18:00 +01:00
David Hoover 5c9403eaf4 Fixed semihosting for ARM when heapinfo not provided by debugger. 2016-04-21 09:51:08 +02:00
Jiong Wang 18b47e05d3 Initializing TTBR0 to inner/outer WB
While running tests on internal systems, we identified an issue in the
startup code for newlib on AArch32 systems with Multiprocessor
Extensions to the architecture.

The issue is we were configuring page table flags to be Inner
cacheable/Outer non-cacheable, while for at least architectures with
Multiprocessor Extension, we'd configure it to Inner/Outer write-back, no
write-allocate, and cacheable.

The attached patch fixes this, and no regression on arm-none-eabi
bare-metal tests.

Adopted suggestion given by Richard offline to avoid using jump.

libgloss/
	* arm/cpu-init/rdimon-aem.S: Set TTBR0 to inner/outer
	cacheable WB, and no allocate on WB for arch with multiprocessor
	extension.
2016-03-26 12:45:07 +01:00
Thomas Preud'homme 69f4c40291 Make macro checks ARMv8-M baseline proof
libgloss:

        * arm/Makefile.in: Add newlib/libc/machine/arm to the include path if
        newlib is present.
        * arm/arm.h: Include acle-compat.h.
        (THUMB_V7_V6M): Rename to ...
        (PREFER_THUMB): This.  Use ACLE macros __ARM_ARCH_ISA_ARM instead of
        __ARM_ARCH_6M__ to decide whether to define it.
        (THUMB1_ONLY): Define for Thumb-1 only targets.
        (THUMB_V7M_V6M): Rename to ...
        (THUMB_VXM): This.  Defined based on __ARM_ARCH_ISA_ARM, excluding
        ARMv7.
        * arm/crt0.S: Use THUMB1_ONLY rather than __ARM_ARCH_6M__,
        !__ARM_ARCH_ISA_ARM rather than THUMB_V7M_V6M for fp enabling, and
        PREFER_THUMB rather than THUMB_V7_V6M.  Rename other occurences of
        THUMB_V7M_V6M to THUMB_VXM.
        * arm/linux-crt0.c: Likewise.
        * arm/redboot-crt0.S: Likewise.
        * arm/swi.h: Likewise.
        * arm/trap.S: Likewise.

newlib:

        * libc/machine/arm/memcpy-stub.c: Use ACLE macros __ARM_ARCH_ISA_THUMB
        and __ARM_ARCH_ISA_ARM to check for Thumb-2 only targets rather than
        __ARM_ARCH and __ARM_ARCH_PROFILE.
        * libc/machine/arm/memcpy.S: Likewise.
        * libc/machine/arm/setjmp.S: Likewise for Thumb-1 only target and
        include acle-compat.h.
        * libc/machine/arm/strcmp.S: Likewise for Thumb-1 and Thumb-2 only
        target and include acle-compat.h.
        * libc/sys/arm/arm.h: Include acle-compat.h.
        (THUMB_V7_V6M): Rename to ...
        (PREFER_THUMB): This.  Use ACLE macro __ARM_ARCH_ISA_ARM instead of
        __ARM_ARCH_6M__ to decide whether to define it.
        (THUMB1_ONLY): Define for Thumb-1 only targets.
        (THUMB_V7M_V6M): Rename to ...
        (THUMB_VXM): This.  Defined based on __ARM_ARCH_ISA_ARM, excluding
        ARMv7.
        * libc/sys/arm/crt0.S: Use PREFER_THUMB rather than THUMB_V7_V6M and
        rename THUMB_V7M_V6M into THUMB_VXM.
        * libc/sys/arm/swi.h: Likewise.
2016-01-28 11:26:37 +01:00
Andre Simoes Dias Vieira c028685518 Change to nano.specs to add nano's include dir
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-07-14 15:55:18 +02:00
Mike Frysinger 6803327326 libgloss: arm: fix copy & paste in syscall.h
This header was clearly copied from the common syscall.h and customized,
but the header comment is no longer accurate -- this isn't the general
file anymore.
2015-04-23 22:03:45 +02:00
Corinna Vinschen 8d98f956cc * arm/crt0.S: Initialise __heap_limit when ARM_RDI_MONITOR is defined.
* arm/syscalls.c: define __heap_limit global symbol.
	* arm/syscalls.c (_sbrk): Honour __heap_limit.
2015-02-17 09:30:52 +00:00
Corinna Vinschen 1b580c732a Add missing file from last patch 2014-08-15 10:52:38 +00:00
Corinna Vinschen 433de33ec2 * arm/elf-nano.specs: New file.
* arm/elf-rdimon.specs: Support nano.specs.
	* arm/Makefile.in: Support nano.specs.
	* libnosys/nosys.specs: Support nano.specs.
2014-08-14 15:00:33 +00:00
Corinna Vinschen 844557c9ed * arm/elf-aprofile-validation.specs (*link): Make text segment
64k-aligned.
	* arm/elf-aprofile-ve.specs (*link): Likewise.
2014-07-16 11:53:34 +00:00
Jeff Johnston d83d5c7d7b 2014-04-04 Ashish Kapania <akapania@ti.com>
* arm/configure.in: (*-*-tirtos*) Accept TIRTOS target when setting
        objtype
        * arm/configure: Regenerated.
2014-04-04 21:43:55 +00:00
Jeff Johnston 6a7a80d83c 2014-02-11 Joey Ye <joey.ye@arm.com>
* arm/syscalls.c (_sbrk): Define as weak symbols.
        (_read, _write): Ditto.
2014-02-11 19:55:22 +00:00
Jeff Johnston 9a0786ea68 2014-01-10 Jeff Johnston <jjohnstn@redhat.com>
* arm/configure.in: Revert previous fix and change host_makefile_frag
        to calculate the absolute location of srcdir/../config/default.mh.
        * arm/configure: Regenerated.
2014-01-10 23:04:01 +00:00
Jeff Johnston 847980a43b 2014-01-07 Jeff Johnston <jjohnstn@redhat.com>
* arm/configure.in: Fix host_makefile_frag to use ac_abs_srcdir.
        * arm/configure: Regenerated.
2014-01-07 22:41:38 +00:00
Marcus Shawcroft eee6552c95 [ARM] set errno in ftruncate and truncate stubs. 2013-11-21 15:49:05 +00:00
Marcus Shawcroft c709105913 [ARM] Provide ftruncate() and truncate() stubs. 2013-11-18 09:53:46 +00:00
Richard Earnshaw 639951dda7 2013-10-14 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
* arm/cpu-init/rdimon-aem.S: Disable for M class cores.
	* arm/crt0.S: Don't call _rdimon_hw_init_hook for non-A class cores.
	* arm/cpu-init/Makefile.in (CPU_INIT_OBJS): Use CFLAGS.
2013-10-14 15:15:12 +00:00
Marcus Shawcroft 1dafbdd853 [ARM] Add SPECS file for ARM validation model. 2013-09-27 15:40:39 +00:00
Richard Earnshaw 99be2bc4ff 2013-09-20 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
Ramana Radhakrishnan  <ramana.radhakrishnan@arm.com>
	    Greta Yorsh  <greta.yorsh@arm.com>

	* arm/Makefile.in: Add support for cpu-init directory and add
	elf-aprofile-ve.specs.
	* arm/configure.in: Likewise.
	* arm/configure: Regenerate.
	* arm/cpu-init: New directory.
	* arm/cpu-init/Makefile.in: New file.
	* arm/cpu-init/rdimon-aem.S: Likewise.
	* arm/crt0.S: Call _rdimon_init_hook
	* arm/elf-aprofile-ve.specs: New file.
2013-09-20 14:23:41 +00:00
Corinna Vinschen 387b584725 * aarch64/crt0.S: Remove 'start'.
* arm/crt0.S: Ditto.
	* arm/redboot-crt0.S: Ditto.
2013-08-12 11:27:37 +00:00
Jeff Johnston 2404223df6 2013-07-02 Joey Ye <joey.ye@arm.com>
* arm/crt0.S (_mainCRTStartup): Weak reference to atexit and _fini
        when lite exit is enabled.
2013-07-02 21:34:35 +00:00
Corinna Vinschen 6cb2bb7166 Fix wrongly applied patch 2013-02-12 15:26:30 +00:00
Corinna Vinschen 29507fecb4 * arm/elf-rdimon.specs (-lrdimon): Change link to lib. 2013-02-10 11:57:51 +00:00
Corinna Vinschen 03cd7bbbb1 * arm/redboot-crt0.S (__change_mode): Replace mov with movs. 2012-05-02 08:09:45 +00:00
Corinna Vinschen c3a549f687 * arm/linux-crt0.c: Use ldr instead of adr to get address of
_start_thumb.
2012-01-17 10:03:40 +00:00
Jeff Johnston 50e970d1b1 2011-12-13 Richard Earnshaw <rearnsha@arm.com>
Thomas Klein  <th.r.klein@web.de>

        * arm/crt0.S: Manually set the target architecture
        when compiling for Thumb1 on EABI targets.
        Avoid v6-only Thumb-1 MOV instruction.
2011-12-13 22:45:12 +00:00
Nick Clifton 5b495afe51 * arm/crt0.s: Support 0 heap base response from HeapInfo syscall. 2011-09-29 11:23:29 +00:00
Nick Clifton 29deef8805 * arm/arm.h (HAVE_CALL_INDIRECT): Define.
* arm/crt0.S (indirect_call): New macro.  Encodes indirect
	function calls.  Does not use blx for pre-armv5 targets.
2011-09-29 11:06:49 +00:00
Nick Clifton 415e1ecce4 * arm/crt0.S: Support armv6-m processors in libgloss.
* arm/swi.h: Likewise.
	* arm/trap.S: Likewise.
	* arm/redboot-crt0.S: Likewise.
	* arm/linux-crt0.c: Likewise.
	* arm/arm.h: New.
2011-07-13 15:06:21 +00:00
Jeff Johnston 53ffbf09d5 2011-06-29 Jeff Johnston <jjohnstn@redhat.com>
* arm/Makefile.in: Add $CFLAGS to compile commands for specified .o targets.
2011-06-29 15:32:09 +00:00
Corinna Vinschen 95c929196b * syscalls.c (_isatty): Fix return value. 2010-08-27 11:55:36 +00:00
Nick Clifton f7e0cae24b * arm/linux-syscalls0.S (SYSCALL0, SYSCALL3, SYSCALL6, SYSCALL4):
Delete Thumb definitions - the ARM versions work correctly in
        Thumb mode.
2009-10-26 10:00:41 +00:00
Jeff Johnston 455e95b5bd 2008-10-06 Bill Tompkins <bill+newlib@key-square.com>
* arm/crt0.S: Fix calling hardware_init_hook() or software_init_hook()
        under thumb and thumb2.
2008-10-06 20:55:19 +00:00
Nick Clifton 026f9d290f * libc/machine/arm/setjmp.S: Fix thumb2 support.
* arm/crt0.S: Allow assembly under ARMv7 ISA.  Support for
            initializing stack pointers for interrupt modes is still pending.
2008-04-25 09:02:40 +00:00
DJ Delorie 6f810581fb [newlib]
* libm/machine/spu/configure: Regenerate with autoconf 2.61.
	* libc/sys/configure: Regenerate with autoconf 2.61.
	* libc/machine/configure: Regenerate with autoconf 2.61.
[libgloss]
	* hp74x/configure: Regenerate with autoconf 2.61.
	* fr30/configure: Regenerate with autoconf 2.61.
	* mips/configure: Regenerate with autoconf 2.61.
	* xstormy16/configure: Regenerate with autoconf 2.61.
	* rs6000/configure: Regenerate with autoconf 2.61.
	* d30v/configure: Regenerate with autoconf 2.61.
	* i386/configure: Regenerate with autoconf 2.61.
	* configure: Regenerate with autoconf 2.61.
	* wince/configure: Regenerate with autoconf 2.61.
	* pa/configure: Regenerate with autoconf 2.61.
	* m32r/configure: Regenerate with autoconf 2.61.
	* mn10200/configure: Regenerate with autoconf 2.61.
	* iq2000/configure: Regenerate with autoconf 2.61.
	* cris/configure: Regenerate with autoconf 2.61.
	* m68k/configure: Regenerate with autoconf 2.61.
	* spu/configure: Regenerate with autoconf 2.61.
	* m32c/configure: Regenerate with autoconf 2.61.
	* mn10300/configure: Regenerate with autoconf 2.61.
	* i960/configure: Regenerate with autoconf 2.61.
	* arm/configure: Regenerate with autoconf 2.61.
	* libnosys/configure: Regenerate with autoconf 2.61.
	* m68hc11/configure: Regenerate with autoconf 2.61.
	* bfin/configure: Regenerate with autoconf 2.61.
	* crx/configure: Regenerate with autoconf 2.61.
	* mt/configure: Regenerate with autoconf 2.61.
	* sparc/configure: Regenerate with autoconf 2.61.
	* sparc/libsys/configure: Regenerate with autoconf 2.61.
	* mcore/configure: Regenerate with autoconf 2.61.
	* mep/configure: Regenerate with autoconf 2.61.
	* frv/configure: Regenerate with autoconf 2.61.
	* doc/configure: Regenerate with autoconf 2.61.
2008-04-04 21:52:01 +00:00
Jeff Johnston 277723722f 2008-01-03 Jeff Johnston <jjohnstn@redhat.com>
* arm/redboot-syscalls.c: Consistently supply _isatty if syscalls
        dir is used in newlib.
        * bfin/syscalls.c: Ditto.
        * cris/gensyscalls: Ditto.
        * fr30/syscalls.c: Ditto.
        * frv/isatty.c: Ditto.
        * iq2000/isatty.c: Ditto.
        * libnosys/isatty.c: Ditto.
        * m32r/isatty.c: Ditto.
        * mn10200/isatty.c: Ditto.
        * mn10300/isatty.c: Ditto.
        * xstormy16/isatty.c: New file with _isatty function.
2008-01-03 22:38:31 +00:00
Jeff Johnston a9a6f94229 2007-08-13 Carlos O'Donell <carlos@codesourcery.com>
* arm/crt0.S: Remove '.set' for __stack, hardware_init_hook,
	and software_init_hook.
2007-08-13 18:13:39 +00:00
Jeff Johnston 847e89f8e1 2007-08-10 Carlos O'Donell <carlos@codesourcery.com>
2007-07-12  Daniel Jacobowitz  <dan@codesourcery.com>

        * arm/syscalls.c (_stat): Use _close

        * arm/syscalls.c (struct poslog): Rename to...
        (struct fdent): ... this.
        (FILE_HANDLE_OFFSET): Remove.
        (findslot): Return a struct fdent* if fd is valid, otherwise return NULL.
        (newslot): New function.
        (remap_handle): Remove.
        (initialise_monitor_handles): Use stdout as fallback for stderr.
        (wrap): Rename to...
        (checkerror): ...  this.
        (_swiread): Use checkerror() for the return of SWI calls.  Correct the use of r0.
        (_read): Use findslot().  Return EBADF on bad handle.
        (_swilseek): Call findslot().  Check for valid whence.  Check for negative offset when using
        SEEK_CUR, and check for overflow.  Use checkerror().  Check *_Flen calls for errors.
        (_swiwrite): Correct the use of r0.
        (_write): Call findslot().
        (_swiopen): Call findslot().  Check for valid flags.  Use checkerror().  Call newslot().
        Handle O_TRUNC, and O_WRONLY.  Return index into openfiles[] for fd.
        (_swiclose): Correct the use of r0.
        (_close): Handle stderr == stdout case.  Only reclaim handle if _swiclose succeeded.
        (_getpid): Use __attribute__((unused)).
        (_sbrk): Fix formatting.
        (_swistat): New function.
        (_stat): Call _swistat().
        (_fstat): Call _swistat().
        (_unlink): Correct the use of r0.
        (isatty): Call finslot().  Correct the use of r0.
        (_system): Call checkerror().  Correct the use of r0.
        (_rename): Correct the use of r0.
2007-08-10 19:36:46 +00:00
Jeff Johnston de229adb1a 2007-07-06 Jeff Johnston <jjohnstn@redhat.com>
* arm/syscalls.c (gettimeofday): Change to POSIX signature
        where second argument is passed as void *.
        * bfin/syscalls.c (gettimeofday): Ditto.
        * cris/gensyscalls (gettimeofday): Ditto.
        * cris/linunistd.h (gettimeofday): Ditto.
        * crx/time.c (gettimeofday): Ditto.
        * frv/sim-time.c (gettimeofday): Ditto.
        * i386/cygmon-salib.c (gettimeofday): Ditto.
        * libnosys/gettod.c (gettimeofday): Ditto.
        * m68k/io-gettimeofday.c (gettimeofday): Ditto.
        * sparc/cygmon-salib.c (gettimeofday): Ditto.
        * spu/gettimeofday.c (gettimeofday): Ditto.
2007-07-06 17:00:13 +00:00
Jeff Johnston 4d95d0e99a 2006-01-03 Kazu Hirata <kazu@codesourcery.com>
* arm/Makefile (RDPMON_OBJS): Add _exit.o and _kill.o.
        (RDIMON_OBJS): Define in terms of RDPMON_OBJS.
        (rdimon-_exit.o, rdimon-_kill.o): New.
        * arm/_exit.c, arm/_kill.c: New.
        * arm/syscalls.c (_exit, _kill): Remove.
2007-01-03 16:55:25 +00:00
Kazu Hirata 3e0c6ff3a7 * arm/licfunc.c (do_AngelSWI): Remove.
* arm/syscalls.c (do_AngelSWI): Remove.
	* arm/swi.h (do_AngelSWI): New.
2006-12-25 23:05:24 +00:00