Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Commit [f3236c] Maximize Restore History

template cortexm: using os sources

Liviu Ionescu Liviu Ionescu 2014-03-20

1 2 3 > >> (Page 1 of 3)
added ilg.gnuarmeclipse.templates.cortexm/templates/common/system
added ilg.gnuarmeclipse.templates.cortexm/templates/common/system/include
added ilg.gnuarmeclipse.templates.cortexm/templates/common/system/include/arm
added ilg.gnuarmeclipse.templates.cortexm/templates/common/system/include/cmsis
added ilg.gnuarmeclipse.templates.cortexm/templates/common/system/include/cortexm
added ilg.gnuarmeclipse.templates.cortexm/templates/common/system/include/cortexm/ExceptionHandlers.h
added ilg.gnuarmeclipse.templates.cortexm/templates/common/system/src
added ilg.gnuarmeclipse.templates.cortexm/templates/common/system/src/cortexm
added ilg.gnuarmeclipse.templates.cortexm/templates/common/system/src/cortexm/_initialize_hardware.c
added ilg.gnuarmeclipse.templates.cortexm/templates/common/system/src/cortexm/_reset_hardware.c
added ilg.gnuarmeclipse.templates.cortexm/templates/common/system/src/newlib
added ilg.gnuarmeclipse.templates.cortexm/templates/common/system/src/newlib/README.txt
added ilg.gnuarmeclipse.templates.cortexm/templates/common/system/src/newlib/_exit.c
added ilg.gnuarmeclipse.templates.cortexm/templates/common/system/src/newlib/_sbrk.c
added ilg.gnuarmeclipse.templates.cortexm/templates/common/system/src/newlib/_write.c
added ilg.gnuarmeclipse.templates.cortexm/templates/common/system/src/newlib/hacks.cpp
removed ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/CMSIS
removed ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/CMSIS/CMSIS_END_USER_LICENCE_AGREEMENT.pdf
removed ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/CMSIS/Include
removed ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/newlib
removed ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/newlib/include
removed ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/newlib/src
changed ilg.gnuarmeclipse.templates.cortexm
changed ilg.gnuarmeclipse.templates.cortexm/templates
changed ilg.gnuarmeclipse.templates.cortexm/templates/common
changed ilg.gnuarmeclipse.templates.cortexm/templates/common/libs
changed ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/Vendor
changed ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/Vendor/DEVICE
changed ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/Vendor/DEVICE/Include
changed ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/Vendor/DEVICE/Source
changed ilg.gnuarmeclipse.templates.cortexm/templates/common/src
changed ilg.gnuarmeclipse.templates.cortexm/templates/common/src/Timer.cpp
changed ilg.gnuarmeclipse.templates.cortexm/templates/cortexm_project
changed ilg.gnuarmeclipse.templates.cortexm/templates/cortexm_project/template.properties
changed ilg.gnuarmeclipse.templates.cortexm/templates/cortexm_project/template.xml
copied ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/CMSIS/README.txt -> ilg.gnuarmeclipse.templates.cortexm/templates/common/system/include/cmsis/README.txt
copied ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/CMSIS/Include/arm_common_tables.h -> ilg.gnuarmeclipse.templates.cortexm/templates/common/system/include/cmsis/arm_common_tables.h
copied ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/CMSIS/Include/arm_const_structs.h -> ilg.gnuarmeclipse.templates.cortexm/templates/common/system/include/cmsis/arm_const_structs.h
copied ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/CMSIS/Include/arm_math.h -> ilg.gnuarmeclipse.templates.cortexm/templates/common/system/include/cmsis/arm_math.h
copied ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/CMSIS/Include/core_cm4_simd.h -> ilg.gnuarmeclipse.templates.cortexm/templates/common/system/include/cmsis/core_cm4_simd.h
copied ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/CMSIS/Include/core_cmFunc.h -> ilg.gnuarmeclipse.templates.cortexm/templates/common/system/include/cmsis/core_cmFunc.h
copied ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/CMSIS/Include/core_cmInstr.h -> ilg.gnuarmeclipse.templates.cortexm/templates/common/system/include/cmsis/core_cmInstr.h
copied ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/CMSIS/Include/core_sc000.h -> ilg.gnuarmeclipse.templates.cortexm/templates/common/system/include/cmsis/core_sc000.h
copied ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/CMSIS/Include/core_sc300.h -> ilg.gnuarmeclipse.templates.cortexm/templates/common/system/include/cmsis/core_sc300.h
copied ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/CMSIS/Include/core_cm0.h -> ilg.gnuarmeclipse.templates.cortexm/templates/common/system/include/cmsis/core_cm0.h
copied ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/CMSIS/Include/core_cm0plus.h -> ilg.gnuarmeclipse.templates.cortexm/templates/common/system/include/cmsis/core_cm0plus.h
copied ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/CMSIS/Include/core_cm3.h -> ilg.gnuarmeclipse.templates.cortexm/templates/common/system/include/cmsis/core_cm3.h
copied ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/CMSIS/Include/core_cm4.h -> ilg.gnuarmeclipse.templates.cortexm/templates/common/system/include/cmsis/core_cm4.h
copied ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/Vendor/DEVICE/README.txt -> ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/Vendor/DEVICE/Source/README_DEVICE.txt
copied ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/newlib/README.txt -> ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/Vendor/DEVICE/Include/README_DEVICE.txt
copied ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/newlib/include/semihosting.h -> ilg.gnuarmeclipse.templates.cortexm/templates/common/system/include/arm/semihosting.h
copied ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/newlib/src/_write.c -> ilg.gnuarmeclipse.templates.cortexm/templates/common/system/src/newlib/trace.c
copied ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/newlib/src/cmsis_startup.c -> ilg.gnuarmeclipse.templates.cortexm/templates/common/system/src/newlib/_startup.c
copied ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/newlib/src/cortexm_handlers.c -> ilg.gnuarmeclipse.templates.cortexm/templates/common/system/src/cortexm/exception_handlers.c
copied ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/newlib/src/syscalls.c -> ilg.gnuarmeclipse.templates.cortexm/templates/common/system/src/newlib/_syscalls.c
ilg.gnuarmeclipse.templates.cortexm/templates/common/system/include/cortexm/ExceptionHandlers.h Diff Switch to side-by-side view
Loading...
ilg.gnuarmeclipse.templates.cortexm/templates/common/system/src/cortexm/_initialize_hardware.c Diff Switch to side-by-side view
Loading...
ilg.gnuarmeclipse.templates.cortexm/templates/common/system/src/cortexm/_reset_hardware.c Diff Switch to side-by-side view
Loading...
ilg.gnuarmeclipse.templates.cortexm/templates/common/system/src/newlib/README.txt Diff Switch to side-by-side view
Loading...
ilg.gnuarmeclipse.templates.cortexm/templates/common/system/src/newlib/_exit.c Diff Switch to side-by-side view
Loading...
ilg.gnuarmeclipse.templates.cortexm/templates/common/system/src/newlib/_sbrk.c Diff Switch to side-by-side view
Loading...
ilg.gnuarmeclipse.templates.cortexm/templates/common/system/src/newlib/_write.c Diff Switch to side-by-side view
Loading...
ilg.gnuarmeclipse.templates.cortexm/templates/common/system/src/newlib/hacks.cpp Diff Switch to side-by-side view
Loading...
ilg.gnuarmeclipse.templates.cortexm/templates/common/src/Timer.cpp Diff Switch to side-by-side view
Loading...
ilg.gnuarmeclipse.templates.cortexm/templates/cortexm_project/template.properties Diff Switch to side-by-side view
Loading...
ilg.gnuarmeclipse.templates.cortexm/templates/cortexm_project/template.xml Diff Switch to side-by-side view
Loading...
ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/CMSIS/Include/core_cm0.h to ilg.gnuarmeclipse.templates.cortexm/templates/common/system/include/cmsis/core_cm0.h
--- a/ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/CMSIS/Include/core_cm0.h
+++ b/ilg.gnuarmeclipse.templates.cortexm/templates/common/system/include/cmsis/core_cm0.h
@@ -42,6 +42,14 @@
 #ifndef __CORE_CM0_H_GENERIC
 #define __CORE_CM0_H_GENERIC
 
+// [ILG]
+#if defined ( __GNUC__ )
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#pragma GCC diagnostic ignored "-Wconversion"
+//#pragma GCC diagnostic ignored "-Wunused-parameter"
+#endif
+
 #ifdef __cplusplus
  extern "C" {
 #endif
@@ -699,4 +707,9 @@
 }
 #endif
 
+// [ILG]
+#if defined ( __GNUC__ )
+#pragma GCC diagnostic pop
+#endif
+
 #endif /* __CMSIS_GENERIC */
ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/CMSIS/Include/core_cm0plus.h to ilg.gnuarmeclipse.templates.cortexm/templates/common/system/include/cmsis/core_cm0plus.h
--- a/ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/CMSIS/Include/core_cm0plus.h
+++ b/ilg.gnuarmeclipse.templates.cortexm/templates/common/system/include/cmsis/core_cm0plus.h
@@ -42,6 +42,14 @@
 #ifndef __CORE_CM0PLUS_H_GENERIC
 #define __CORE_CM0PLUS_H_GENERIC
 
+// [ILG]
+#if defined ( __GNUC__ )
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#pragma GCC diagnostic ignored "-Wconversion"
+//#pragma GCC diagnostic ignored "-Wunused-parameter"
+#endif
+
 #ifdef __cplusplus
  extern "C" {
 #endif
@@ -810,4 +818,9 @@
 }
 #endif
 
+// [ILG]
+#if defined ( __GNUC__ )
+#pragma GCC diagnostic pop
+#endif
+
 #endif /* __CMSIS_GENERIC */
ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/CMSIS/Include/core_cm3.h to ilg.gnuarmeclipse.templates.cortexm/templates/common/system/include/cmsis/core_cm3.h
--- a/ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/CMSIS/Include/core_cm3.h
+++ b/ilg.gnuarmeclipse.templates.cortexm/templates/common/system/include/cmsis/core_cm3.h
@@ -41,6 +41,14 @@
 
 #ifndef __CORE_CM3_H_GENERIC
 #define __CORE_CM3_H_GENERIC
+
+// [ILG]
+#if defined ( __GNUC__ )
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#pragma GCC diagnostic ignored "-Wconversion"
+//#pragma GCC diagnostic ignored "-Wunused-parameter"
+#endif
 
 #ifdef __cplusplus
  extern "C" {
@@ -1635,4 +1643,9 @@
 }
 #endif
 
+// [ILG]
+#if defined ( __GNUC__ )
+#pragma GCC diagnostic pop
+#endif
+
 #endif /* __CMSIS_GENERIC */
ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/CMSIS/Include/core_cm4.h to ilg.gnuarmeclipse.templates.cortexm/templates/common/system/include/cmsis/core_cm4.h
--- a/ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/CMSIS/Include/core_cm4.h
+++ b/ilg.gnuarmeclipse.templates.cortexm/templates/common/system/include/cmsis/core_cm4.h
@@ -41,6 +41,14 @@
 
 #ifndef __CORE_CM4_H_GENERIC
 #define __CORE_CM4_H_GENERIC
+
+// [ILG]
+#if defined ( __GNUC__ )
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#pragma GCC diagnostic ignored "-Wconversion"
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+#endif
 
 #ifdef __cplusplus
  extern "C" {
@@ -1787,4 +1795,9 @@
 }
 #endif
 
+// [ILG]
+#if defined ( __GNUC__ )
+#pragma GCC diagnostic pop
+#endif
+
 #endif /* __CMSIS_GENERIC */
ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/Vendor/DEVICE/README.txt to ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/Vendor/DEVICE/Source/README_DEVICE.txt
--- a/ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/Vendor/DEVICE/README.txt
+++ b/ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/Vendor/DEVICE/Source/README_DEVICE.txt
@@ -4,9 +4,6 @@
 provided by the vendor.
 
 Extensions to the ARM CMSIS files:
-
-- the file cmsis_device.h was added, as a portable method to include the 
-vendor device header file in library sources. 
 
 - the assembly startup file was reimplemented in C, and split into 
 multiple files, portable for the entire Cortex-M family:
@@ -20,7 +17,7 @@
 
 The current version of the Eclipse managed build plug-in does not
 process .s, but only .S. If you want to use the assembly startup_Device.s,
-you must remove the _startup.c and cortex_handlers.c from build, and
+you must remove the _startup.c and exception_handlers.c from build, and
 rename the vendor provided assembly file to startup_XXX.S where XXX is the
 actual device name.
   
ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/newlib/README.txt to ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/Vendor/DEVICE/Include/README_DEVICE.txt
--- a/ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/newlib/README.txt
+++ b/ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/Vendor/DEVICE/Include/README_DEVICE.txt
@@ -1,10 +1,12 @@
-These files extend or replace the functionality provided by newlib.
+Thes "$(deviceName).h" and "system_$(deviceName).h" files are provided 
+only as a functional sample.
 
-They provide:
-- a customised startup routine, written in C
-- the common Cortex-M exception handlers
-- the implementation of several _write() routines used to reroute
-the tracing output either over SWO or semihosting
-- local versions of the libnosys/librdimon code
-- a custom _sbrk() to match the actual linker scripts (inside syscalls.c)
-- a custom _exit() to reset the core (inside syscalls.c)
+For real applications they must be replaced with the files 
+provided by the vendor.
+
+Extensions to the ARM CMSIS files:
+
+- the file "cmsis_device.h" was added, as a portable method to include the 
+vendor device header file in library sources. 
+
+  
ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/newlib/include/semihosting.h to ilg.gnuarmeclipse.templates.cortexm/templates/common/system/include/arm/semihosting.h
--- a/ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/newlib/include/semihosting.h
+++ b/ilg.gnuarmeclipse.templates.cortexm/templates/common/system/include/arm/semihosting.h
@@ -1,10 +1,10 @@
 //
-// This file is part of the GNU ARM Eclipse Plug-ins project.
-// Copyright (c) 2014 Liviu Ionescu
+// This file is part of the ÂľOS++ III distribution.
+// Copyright (c) 2014 Liviu Ionescu.
 //
 
-#ifndef SEMIHOSTING_H_
-#define SEMIHOSTING_H_
+#ifndef ARM_SEMIHOSTING_H_
+#define ARM_SEMIHOSTING_H_
 
 enum OperationNumber
 {
@@ -92,4 +92,4 @@
     ;
 }
 
-#endif /* SEMIHOSTING_H_ */
+#endif // ARM_SEMIHOSTING_H_
ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/newlib/src/_write.c to ilg.gnuarmeclipse.templates.cortexm/templates/common/system/src/newlib/trace.c
--- a/ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/newlib/src/_write.c
+++ b/ilg.gnuarmeclipse.templates.cortexm/templates/common/system/src/newlib/trace.c
@@ -1,112 +1,99 @@
 //
-// This file is part of the GNU ARM Eclipse Plug-ins project.
-// Copyright (c) 2014 Liviu Ionescu
-//
-
-#if !defined(USE_SEMIHOSTING)
+// This file is part of the ÂľOS++ III distribution.
+// Copyright (c) 2014 Liviu Ionescu.
+//
+
+// ----------------------------------------------------------------------------
+
+#include "cmsis_device.h"
+
+// ----------------------------------------------------------------------------
+
+// One of these definitions must be passed via the compiler command line
 
 #if defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__)
 
 // Cortex M3/M4 definitions
-#define INCLUDE_TRACE_ITM
-//#define INCLUDE_TRACE_SEMIHOSTING_DEBUG
-//#define INCLUDE_TRACE_SEMIHOSTING_STDOUT
+
+//#define USE_TRACE_ITM
+//#define USE_TRACE_SEMIHOSTING_DEBUG
+//#define USE_TRACE_SEMIHOSTING_STDOUT
 
 #elif defined(__ARM_ARCH_6M__)
 
 // Cortex M0/M0+ definitions
-#define INCLUDE_TRACE_SEMIHOSTING_DEBUG
-//#define INCLUDE_TRACE_SEMIHOSTING_STDOUT
-
-#endif
+
+#if defined(USE_TRACE_ITM)
+#undef USE_TRACE_ITM
+#endif
+
+//#define USE_TRACE_SEMIHOSTING_DEBUG
+//#define USE_TRACE_SEMIHOSTING_STDOUT
+
+#endif
+
+// ----------------------------------------------------------------------------
+
+
+#if defined(USE_TRACE_ITM)
+int
+_trace_write_itm(char* ptr, int len);
+#endif
+
+#if defined(USE_TRACE_SEMIHOSTING_STDOUT)
+int
+_trace_write_semihosting_stdout(char* ptr, int len);
+#endif
+
+#if defined(USE_TRACE_SEMIHOSTING_DEBUG)
+int
+_trace_write_semihosting_debug(char* ptr, int len);
+#endif
+
+// ----------------------------------------------------------------------------
+
+// The usual method to display trace messages is via printf(), routed
+// to _write() and rerouted here.
+
+int
+trace_write(char* ptr, int len);
+
+int
+trace_write(char* ptr __attribute__((unused)),
+    int len __attribute__((unused)))
+{
+#if defined(USE_TRACE_ITM)
+      return _trace_write_itm (ptr, len);
+#elif defined(USE_TRACE_SEMIHOSTING_STDOUT)
+      return _trace_write_semihosting_stdout(ptr, len);
+#elif defined(USE_TRACE_SEMIHOSTING_DEBUG)
+      return _trace_write_semihosting_debug(ptr, len);
+#endif
+
+  return -1;
+}
+
+// ----------------------------------------------------------------------------
+
+#if defined(USE_TRACE_ITM)
+
+#if defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__)
 
 // ITM is the ARM standard mechanism, running over SWD/SWO on Cortex-M3/M4
 // devices, and is the recommended setting, if available.
 //
 // The JLink probe and the GDB server fully support SWD/SWO
 // and the JLink Debugging plug-in enables it by default.
-// The current OpenOCD does not support SWD/SWO, so this configuration
-// will not work on OpenOCD (will not crash, but nothing will be displayed).
-//
-// Choosing between semihosting stdout and debug depends on the capabilities
-// of your GDB server, and also on specific needs; STDOUT is buffered, so
-// nothing is displayed until a \n; DEBUG is not buffered, but can be slow.
-// It is recommended to test DEBUG first, and if too slow, try STDOUT.
-//
-// The JLink GDB server fully support semihosting, and both configurations
-// are available; to activate it, use "monitor semihosting enable" or check
-// the corresponding button in the JLink Debugging plug-in.
-// In OpenOCD, support for semihosting can be enabled using
-// "monitor arm semihosting enable".
-//
-// Note: Applications built with semihosting output active cannot be
-// executed without the debugger connected and active, since they use
-// BKPT to communicate with the host. Attempts to run them standalone or
-// without semihosting enabled will usually be terminated with hardware faults.
-
-#if defined(INCLUDE_TRACE_ITM)
-int
-_write_trace_itm(char* ptr, int len);
-#endif
-
-#if defined(INCLUDE_TRACE_SEMIHOSTING_STDOUT)
-int
-_write_trace_semihosting_stdout(char* ptr, int len);
-#endif
-
-#if defined(INCLUDE_TRACE_SEMIHOSTING_DEBUG)
-int
-_write_trace_semihosting_debug(char* ptr, int len);
-#endif
-
-// The standard write() system call, after a long way inside newlib,
-// finally calls this implementation function.
-
-// Based on the file descriptor, it can send arrays of characters to
-// different physical devices.
-
-// Currently only the output file descriptor is tested, and there are
-// three output channels implemented, mainly for debugging purposes.
-
-// The usual method to display trace messages is via printf().
-
-// The preprocessor definitions used for selection are in trace_impl.h.
-
-int
-_write(int fd __attribute__((unused)), char* ptr __attribute__((unused)),
-    int len __attribute__((unused)))
-{
-  if (fd == 1)
-    {
-#if defined(DEBUG)
-
-#if defined(INCLUDE_TRACE_ITM)
-      return _write_trace_itm (ptr, len);
-#elif defined(INCLUDE_TRACE_SEMIHOSTING_STDOUT)
-      return _write_trace_semihosting_stdout(ptr, len);
-#elif defined(INCLUDE_TRACE_SEMIHOSTING_DEBUG)
-      return _write_trace_semihosting_debug(ptr, len);
-#else
-#warning "no trace implementation"
-#endif
-
-#endif // DEBUG
-    }
-  return -1;
-}
-
-// ----------------------------------------------------------------------------
-
-#if defined(INCLUDE_TRACE_ITM)
-
-#if defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__)
-
-#include "cmsis_device.h"
-
+// The current OpenOCD does not include support to parse the SWO stream,
+// so this configuration will not work on OpenOCD (will not crash, but
+// nothing will be displayed in the output console).
+
+#if !defined(ITM_STIMULUS_PORT)
 #define ITM_STIMULUS_PORT     (0)
-
-int
-_write_trace_itm (char* ptr, int len)
+#endif
+
+int
+_trace_write_itm(char* ptr, int len)
 {
   for (int i = 0; i < len; i++)
     {
@@ -121,7 +108,7 @@
       while (ITM->PORT[ITM_STIMULUS_PORT].u32 == 0)
         ;
       // then send data, one byte at a time
-      ITM->PORT[ITM_STIMULUS_PORT].u8 = *ptr++;
+      ITM->PORT[ITM_STIMULUS_PORT].u8 = (uint8_t)(*ptr++);
     }
 
   return len; // all characters successfully sent
@@ -129,103 +116,124 @@
 
 #endif // defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__)
 
-#endif // INCLUDE_TRACE_ITM
-
-// ----------------------------------------------------------------------------
-
-#if defined(INCLUDE_TRACE_SEMIHOSTING_DEBUG) || defined(INCLUDE_TRACE_SEMIHOSTING_STDOUT)
-
-#include "semihosting.h"
+#endif // USE_TRACE_ITM
+
+// ----------------------------------------------------------------------------
+
+#if defined(USE_TRACE_SEMIHOSTING_DEBUG) || defined(USE_TRACE_SEMIHOSTING_STDOUT)
+
+#include "arm/semihosting.h"
+
+// Semihosting is the other output channel that can be used for the trace
+// messages. It comes in two flavours: STDOUT and DEBUG. The STDOUT channel
+// is the equivalent of the stdout in POSIX and in most cases it is forwarded
+// to the GDB server stdout stream. The debug channel is a separate
+// channel. STDOUT is buffered, so nothing is displayed until a \n;
+// DEBUG is not buffered, but can be slow.
+//
+// Choosing between semihosting stdout and debug depends on the capabilities
+// of your GDB server, and also on specific needs. It is recommended to test
+// DEBUG first, and if too slow, try STDOUT.
+//
+// The JLink GDB server fully support semihosting, and both configurations
+// are available; to activate it, use "monitor semihosting enable" or check
+// the corresponding button in the JLink Debugging plug-in.
+// In OpenOCD, support for semihosting can be enabled using
+// "monitor arm semihosting enable".
+//
+// Note: Applications built with semihosting output active cannot be
+// executed without the debugger connected and active, since they use
+// BKPT to communicate with the host. Attempts to run them standalone or
+// without semihosting enabled will usually be terminated with hardware faults.
 
 #endif // INCLUDE_TRACE_SEMIHOSTING_*
 
 // ----------------------------------------------------------------------------
 
-#if defined(INCLUDE_TRACE_SEMIHOSTING_STDOUT)
-
-int
-_write_trace_semihosting_stdout (char* ptr, int len)
-{
-  static int handle;
-  void* block[3];
-  int ret;
-
-  if (handle == 0)
-    {
-      // On the first call get the file handle from the host
-      block[0] = ":tt"; // special filename to be used for stdin/out/err
-      block[1] = (void*) 4; // mode "w"
-      // length of ":tt", except null terminator
-      block[2] = (void*) sizeof(":tt") - 1;
-
-      ret = call_host (SEMIHOSTING_SYS_OPEN, (void*) block);
-      if (ret == -1)
+#if defined(USE_TRACE_SEMIHOSTING_STDOUT)
+
+int
+_trace_write_semihosting_stdout(char* ptr, int len)
+  {
+    static int handle;
+    void* block[3];
+    int ret;
+
+    if (handle == 0)
+      {
+        // On the first call get the file handle from the host
+        block[0] = ":tt";// special filename to be used for stdin/out/err
+        block[1] = (void*) 4;// mode "w"
+        // length of ":tt", except null terminator
+        block[2] = (void*) sizeof(":tt") - 1;
+
+        ret = call_host (SEMIHOSTING_SYS_OPEN, (void*) block);
+        if (ret == -1)
         return -1;
 
-      handle = ret;
-    }
-
-  block[0] = (void*) handle;
-  block[1] = ptr;
-  block[2] = (void*) len;
-  // send character array to host file/device
-  ret = call_host (SEMIHOSTING_SYS_WRITE, (void*) block);
-  // this call returns the number of bytes NOT written (0 if all ok)
-
-  // -1 is not a legal value, but SEGGER seems to return it
-  if (ret == -1)
+        handle = ret;
+      }
+
+    block[0] = (void*) handle;
+    block[1] = ptr;
+    block[2] = (void*) len;
+    // send character array to host file/device
+    ret = call_host (SEMIHOSTING_SYS_WRITE, (void*) block);
+    // this call returns the number of bytes NOT written (0 if all ok)
+
+    // -1 is not a legal value, but SEGGER seems to return it
+    if (ret == -1)
     return -1;
 
-  // The compliant way of returning errors
-  if (ret == len)
+    // The compliant way of returning errors
+    if (ret == len)
     return -1;
 
-  return len - ret;
-}
-
-#endif // INCLUDE_TRACE_SEMIHOSTING_STDOUT
-
-// ----------------------------------------------------------------------------
-
-#if defined(INCLUDE_TRACE_SEMIHOSTING_DEBUG)
+    return len - ret;
+  }
+
+#endif // USE_TRACE_SEMIHOSTING_STDOUT
+
+// ----------------------------------------------------------------------------
+
+#if defined(USE_TRACE_SEMIHOSTING_DEBUG)
 
 #define TRACE_SEMIHOSTING_DEBUG_TMP_ARRAY_SIZE  (16)
 
 int
-_write_trace_semihosting_debug (char* ptr, int len)
-{
-  // Since the single character debug channel is quite slow, try to
-  // optimise and send a null terminated string, if possible.
-  if (ptr[len] == '\0')
-    {
-      // send string
-      call_host (SEMIHOSTING_SYS_WRITE0, (void*) ptr);
-    }
-  else
-    {
-      // If not, use a local buffer to speed things up
-      char tmp[TRACE_SEMIHOSTING_DEBUG_TMP_ARRAY_SIZE];
-      unsigned int togo = len;
-      while (togo > 0)
-        {
-          unsigned int n = ((togo < sizeof(tmp)) ? togo : sizeof(tmp));
-          unsigned int i = 0;
-          for (; i < n; ++i, ++ptr)
-            {
-              tmp[i] = *ptr;
-            }
-          tmp[i] = '\0';
-
-          call_host (SEMIHOSTING_SYS_WRITE0, (void*) tmp);
-
-          togo -= n;
-        }
-    }
-  return len;
-}
-
-#endif // INCLUDE_TRACE_SEMIHOSTING_DEBUG
-
-// ----------------------------------------------------------------------------
-
-#endif // USE_SEMIHOSTING
+_trace_write_semihosting_debug(char* ptr, int len)
+  {
+    // Since the single character debug channel is quite slow, try to
+    // optimise and send a null terminated string, if possible.
+    if (ptr[len] == '\0')
+      {
+        // send string
+        call_host(SEMIHOSTING_SYS_WRITE0, (void*) ptr);
+      }
+    else
+      {
+        // If not, use a local buffer to speed things up
+        char tmp[TRACE_SEMIHOSTING_DEBUG_TMP_ARRAY_SIZE];
+        unsigned int togo = len;
+        while (togo > 0)
+          {
+            unsigned int n = ((togo < sizeof(tmp)) ? togo : sizeof(tmp));
+            unsigned int i = 0;
+            for (; i < n; ++i, ++ptr)
+              {
+                tmp[i] = *ptr;
+              }
+            tmp[i] = '\0';
+
+            call_host(SEMIHOSTING_SYS_WRITE0, (void*) tmp);
+
+            togo -= n;
+          }
+      }
+    return len;
+  }
+
+#endif // USE_TRACE_SEMIHOSTING_DEBUG
+
+// ----------------------------------------------------------------------------
+
ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/newlib/src/cmsis_startup.c to ilg.gnuarmeclipse.templates.cortexm/templates/common/system/src/newlib/_startup.c
--- a/ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/newlib/src/cmsis_startup.c
+++ b/ilg.gnuarmeclipse.templates.cortexm/templates/common/system/src/newlib/_startup.c
@@ -1,41 +1,36 @@
 //
-// This file is part of the GNU ARM Eclipse Plug-ins project.
-// Copyright (c) 2014 Liviu Ionescu
-//
-
-// This module contains the startup code for a portable Cortex-M
-// C/C++ application, built with CMSIS and newlib.
-//
-// Control reaches here from Reset_Handler via jump or call.
+// This file is part of the ÂľOS++ III distribution.
+// Copyright (c) 2014 Liviu Ionescu.
+//
+
+// ----------------------------------------------------------------------------
+
+// This module contains the startup code for a portable embedded
+// C/C++ application, built with newlib.
+//
+// Control reaches here from the reset handler via jump or call.
 //
 // The actual steps performed by _start are:
 // - clear the BSS area
 // - copy the initialised data section
-// - initialise the system via the CMSIS SystemInit()
+// - initialise the system
 // - run the preinit/init array (for the C++ static constructors)
 // - initialise the arc/argv
 // - branch to main()
 // - run the fini array (for the C++ static destructors)
 // - call _exit(), directly or via exit()
 //
-// After Reset the Cortex-M processor is in Thread mode,
-// priority is Privileged, and the Stack is set to Main.
-//
 // The normal configuration is standalone, with all support
 // functions implemented locally.
 //
 // For this to be called, the project linker must be configured without
 // the startup sequence (-nostartfiles).
 
+// ----------------------------------------------------------------------------
+
 #include <sys/types.h>
 
-#include "cmsis_device.h"
-
-// ----------------------------------------------------------------------------
-
-// The CMSIS system initialisation routine.
-extern void
-SystemInit (void);
+// ----------------------------------------------------------------------------
 
 // Begin address for the initialisation values of the .data section.
 // defined in linker script
@@ -51,25 +46,50 @@
 extern unsigned int __bss_end__;
 
 extern void
-__initialise_args (int*, char***);
-
-// The entry point for the application.
-// main() is the entry point for Newlib based applications
+__initialize_args(int*, char***);
+
+// main() is the entry point for newlib based applications.
+// By default, there are no arguments, but this can be customised
+// by redefining __initialize_args(), which is done when the
+// semihosting configurations are used.
 extern int
-main (int argc, char* argv[]);
-
-// The implementation for the exit routine, where for embedded
-// applications, a system reset is performed.
+main(int argc, char* argv[]);
+
+// The implementation for the exit routine; for embedded
+// applications, a system reset will be performed.
 extern void
 __attribute__((noreturn))
-_exit (int);
-
-// ----------------------------------------------------------------------------
-
-inline void
-__attribute__((always_inline))
-__initialise_data (unsigned int* from, unsigned int* section_begin,
-		   unsigned int* section_end)
+_exit(int);
+
+// ----------------------------------------------------------------------------
+
+// Forward declarations
+
+void
+_start(void);
+
+void
+__initialize_data(unsigned int* from, unsigned int* section_begin,
+    unsigned int* section_end);
+
+void
+__initialize_bss(unsigned int* section_begin, unsigned int* section_end);
+
+void
+__run_init_array(void);
+
+void
+__run_fini_array(void);
+
+void
+__initialize_hardware(void);
+
+// ----------------------------------------------------------------------------
+
+inline void
+__attribute__((always_inline))
+__initialize_data(unsigned int* from, unsigned int* section_begin,
+    unsigned int* section_end)
 {
   // Iterate and copy word by word.
   // It is assumed that the pointers are word aligned.
@@ -80,7 +100,7 @@
 
 inline void
 __attribute__((always_inline))
-__initialise_bss (unsigned int* section_begin, unsigned int* section_end)
+__initialize_bss(unsigned int* section_begin, unsigned int* section_end)
 {
   // Iterate and clear word by word.
   // It is assumed that the pointers are word aligned.
@@ -91,104 +111,97 @@
 
 // These magic symbols are provided by the linker.
 extern void
-(*__preinit_array_start[]) (void) __attribute__((weak));
-extern void
-(*__preinit_array_end[]) (void) __attribute__((weak));
-extern void
-(*__init_array_start[]) (void) __attribute__((weak));
-extern void
-(*__init_array_end[]) (void) __attribute__((weak));
-extern void
-(*__fini_array_start[]) (void) __attribute__((weak));
-extern void
-(*__fini_array_end[]) (void) __attribute__((weak));
-
-// Iterate over all the preinit/init routines.
-inline void
-__attribute__((always_inline))
-__run_init_array (void)
-{
-  size_t count;
-  size_t i;
+(*__preinit_array_start[])(void) __attribute__((weak));
+extern void
+(*__preinit_array_end[])(void) __attribute__((weak));
+extern void
+(*__init_array_start[])(void) __attribute__((weak));
+extern void
+(*__init_array_end[])(void) __attribute__((weak));
+extern void
+(*__fini_array_start[])(void) __attribute__((weak));
+extern void
+(*__fini_array_end[])(void) __attribute__((weak));
+
+// Iterate over all the preinit/init routines (mainly static constructors).
+inline void
+__attribute__((always_inline))
+__run_init_array(void)
+{
+  int count;
+  int i;
 
   count = __preinit_array_end - __preinit_array_start;
   for (i = 0; i < count; i++)
-    __preinit_array_start[i] ();
+    __preinit_array_start[i]();
 
   // If you need to run the code in the .init section, please use
   // the startup files, since this requires the code in crti.o and crtn.o
   // to add the function prologue/epilogue.
-  //_init();
+  //_init(); // DO NOT ENABE THIS!
 
   count = __init_array_end - __init_array_start;
   for (i = 0; i < count; i++)
-    __init_array_start[i] ();
-}
-
-// Run all the cleanup routines.
-inline void
-__attribute__((always_inline))
-__run_fini_array (void)
-{
-  size_t count;
-  size_t i;
+    __init_array_start[i]();
+}
+
+// Run all the cleanup routines (mainly static destructors).
+inline void
+__attribute__((always_inline))
+__run_fini_array(void)
+{
+  int count;
+  int i;
 
   count = __fini_array_end - __fini_array_start;
   for (i = count; i > 0; i--)
-    __fini_array_start[i - 1] ();
+    __fini_array_start[i - 1]();
 
   // If you need to run the code in the .fini section, please use
   // the startup files, since this requires the code in crti.o and crtn.o
   // to add the function prologue/epilogue.
-  //_fini();
+  //_fini(); // DO NOT ENABE THIS!
 }
 
 // This is the place where Cortex-M core will go immediately after reset,
 // via a call or jump from the Reset_Handler
 void __attribute__ ((section(".after_vectors"),noreturn))
-_start (void)
+_start(void)
 {
 
   // Use Old Style Data and BSS section initialisation,
-  // That will initialise a single BSS sections.
+  // that will initialise a single BSS sections.
 
   // Zero fill the bss segment
-  __initialise_bss (&__bss_start__, &__bss_end__);
+  __initialize_bss(&__bss_start__, &__bss_end__);
 
   // Copy the data segment from Flash to RAM.
   // When using startup files, this code is executed via the preinit array.
-  __initialise_data (&_sidata, &_sdata, &_edata);
-
-  // Call the CSMSIS system initialisation routine
-  SystemInit ();
-
-#if defined (__VFP_FP__) && !defined (__SOFTFP__)
-
-  // Enable the Cortex-M4 FPU only when -mfloat-abi=hard.
-  // Code taken from Section 7.1, Cortex-M4 TRM (DDI0439C)
-
-  // Set bits 20-23 to enable CP10 and CP11 coprocessor
-  SCB->CPACR |= (0xF << 20);
-
-#endif // (__VFP_FP__) && !(__SOFTFP__)
+  __initialize_data(&_sidata, &_sdata, &_edata);
+
+  __initialize_hardware();
 
   // Eventually get the args (useful in semihosting configurations).
   int argc;
   char** argv;
-  __initialise_args (&argc, &argv);
+  __initialize_args(&argc, &argv);
 
   // Call the standard library initialisation (mandatory for C++ to
   // execute the constructors for the static objects).
-  __run_init_array ();
+  __run_init_array();
 
   // Call the main entry point, and save the exit code.
-  int code = main (argc, argv);
+  int code = main(argc, argv);
 
   // Run the C++ static destructors.
-  __run_fini_array ();
-
-  // On embedded platforms, usually reset the processor (or hang in
-  // a loop in DEBUG configurations).
-  // On test platforms, like semihosting, inform the host on the test result.
-  _exit (code);
-}
+  __run_fini_array();
+
+  _exit(code);
+
+  // Should never reach this, _exit() should have already
+  // performed a reset.
+  for (;;)
+    ;
+}
+
+// ----------------------------------------------------------------------------
ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/newlib/src/cortexm_handlers.c to ilg.gnuarmeclipse.templates.cortexm/templates/common/system/src/cortexm/exception_handlers.c
--- a/ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/newlib/src/cortexm_handlers.c
+++ b/ilg.gnuarmeclipse.templates.cortexm/templates/common/system/src/cortexm/exception_handlers.c
@@ -1,11 +1,17 @@
 //
-// This file is part of the GNU ARM Eclipse Plug-ins project.
-// Copyright (c) 2014 Liviu Ionescu
+// This file is part of the ÂľOS++ III distribution.
+// Copyright (c) 2014 Liviu Ionescu.
 //
+
+// ----------------------------------------------------------------------------
+
+#include "cortexm/ExceptionHandlers.h"
+
+// ----------------------------------------------------------------------------
 
 extern void
 __attribute__((noreturn))
-_start (void);
+_start(void);
 
 // ----------------------------------------------------------------------------
 // Default exception handlers. Override the ones here by defining your own
@@ -17,29 +23,29 @@
 // The DEBUG version is not naked, to allow breakpoints at Reset_Handler
 void __attribute__ ((section(".after_vectors"),noreturn))
 Reset_Handler (void)
-{
-  _start ();
-}
+  {
+    _start ();
+  }
 
 #else
 
 // The Release version is optimised to a quick branch to _start.
 void __attribute__ ((section(".after_vectors"),naked))
 Reset_Handler(void)
-  {
-    asm volatile
-    (
-	" b _start \n"
-	:
-	:
-	:
-    );
-  }
+{
+  asm volatile
+  (
+      " b _start \n"
+      :
+      :
+      :
+  );
+}
 
 #endif
 
 void __attribute__ ((section(".after_vectors"),weak))
-NMI_Handler (void)
+NMI_Handler(void)
 {
   while (1)
     {
@@ -47,7 +53,7 @@
 }
 
 void __attribute__ ((section(".after_vectors"),weak))
-HardFault_Handler (void)
+HardFault_Handler(void)
 {
   while (1)
     {
@@ -57,23 +63,43 @@
 #if defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__)
 
 void __attribute__ ((section(".after_vectors"),weak))
-MemManage_Handler (void)
+MemManage_Handler(void)
+  {
+    while (1)
+      {
+      }
+  }
+
+void __attribute__ ((section(".after_vectors"),weak))
+BusFault_Handler(void)
+  {
+    while (1)
+      {
+      }
+  }
+
+void __attribute__ ((section(".after_vectors"),weak))
+UsageFault_Handler(void)
+  {
+    while (1)
+      {
+      }
+  }
+
+#endif
+
+void __attribute__ ((section(".after_vectors"),weak))
+SVC_Handler(void)
 {
   while (1)
     {
     }
 }
 
-void __attribute__ ((section(".after_vectors"),weak))
-BusFault_Handler (void)
-{
-  while (1)
-    {
-    }
-}
+#if defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__)
 
 void __attribute__ ((section(".after_vectors"),weak))
-UsageFault_Handler (void)
+DebugMon_Handler(void)
 {
   while (1)
     {
@@ -83,27 +109,7 @@
 #endif
 
 void __attribute__ ((section(".after_vectors"),weak))
-SVC_Handler (void)
-{
-  while (1)
-    {
-    }
-}
-
-#if defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__)
-
-void __attribute__ ((section(".after_vectors"),weak))
-DebugMon_Handler (void)
-{
-  while (1)
-    {
-    }
-}
-
-#endif
-
-void __attribute__ ((section(".after_vectors"),weak))
-PendSV_Handler (void)
+PendSV_Handler(void)
 {
   while (1)
     {
@@ -111,7 +117,7 @@
 }
 
 void __attribute__ ((section(".after_vectors"),weak))
-SysTick_Handler (void)
+SysTick_Handler(void)
 {
   while (1)
     {
ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/newlib/src/syscalls.c to ilg.gnuarmeclipse.templates.cortexm/templates/common/system/src/newlib/_syscalls.c
--- a/ilg.gnuarmeclipse.templates.cortexm/templates/common/libs/newlib/src/syscalls.c
+++ b/ilg.gnuarmeclipse.templates.cortexm/templates/common/system/src/newlib/_syscalls.c
@@ -1,6 +1,6 @@
 //
-// This file is part of the GNU ARM Eclipse Plug-ins project.
-// Parts of this file are from the newlib, issued under GPL.
+// This file is part of the ÂľOS++ III distribution.
+// Parts of this file are from the newlib sources, issued under GPL.
 // Copyright (c) 2014 Liviu Ionescu
 //
 
@@ -14,95 +14,22 @@
 char** environ = __env;
 #endif
 
-// ----------------------------------------------------------------------------
-
-#include <sys/types.h>
-#include <errno.h>
-
-// The definitions used here should be kept in sync with the
-// stack definitions in the linker script.
-
-caddr_t
-_sbrk(int incr)
-{
-  extern char _Heap_Begin; // Defined by the linker.
-  extern char _Heap_Limit; // Defined by the linker.
-
-  static char* current_heap_end;
-  char* current_block_address;
-
-  if (current_heap_end == 0)
-    current_heap_end = &_Heap_Begin;
-
-  current_block_address = current_heap_end;
-
-  // Need to align heap to word boundary, else will get
-  // hard faults on Cortex-M0. So we assume that heap starts on
-  // word boundary, hence make sure we always add a multiple of
-  // 4 to it.
-  incr = (incr + 3) & (~3); // align value to 4
-  if (current_heap_end + incr > &_Heap_Limit)
-    {
-      // Some of the libstdc++-v3 tests rely upon detecting
-      // out of memory errors, so do not abort here.
-#if 0
-      extern void abort (void);
-
-      _write (1, "_sbrk: Heap and stack collision\n", 32);
-
-      abort ();
-#else
-      // Heap has overflowed
-      errno = ENOMEM;
-      return (caddr_t) - 1;
-#endif
-    }
-
-  current_heap_end += incr;
-
-  return (caddr_t) current_block_address;
-}
-
-// ----------------------------------------------------------------------------
-
 #if !defined(USE_SEMIHOSTING)
-
-// If you don't like this indirection, replace it with
-// the actual vendor device name.
-#include "cmsis_device.h"
-
-// Usually main() doesn't return, but if it does, on Debug
-// we'll enter an infinite loop, to be noticed when halting the debugger
-// while on Release we restart using the NVIC.
-//
-// You can redefine it in the application, if more functionality
-// is required.
-
-void
-__attribute__((weak))
-_exit(int code __attribute__((unused)))
-{
-#if defined(DEBUG)
-  while (1)
-  ;
-#else
-  NVIC_SystemReset();
-  while (1)
-    ;
-#endif
-}
 
 // ----------------------------------------------------------------------------
 
 #include <_ansi.h>
 #include <_syslist.h>
-//#include <errno.h>
+#include <errno.h>
 //#include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <sys/times.h>
 #include <limits.h>
 
+void
+__initialize_args(int* p_argc, char*** p_argv);
+
 // This is the standard default implementation for the routine to
 // process args. It returns a single empty arg.
 // For semihosting applications, this is redefined to get the real
@@ -110,7 +37,7 @@
 // some args in a non-volatile memory.
 
 void __attribute__((weak))
-__initialise_args(int* p_argc, char*** p_argv)
+__initialize_args(int* p_argc, char*** p_argv)
 {
   // By the time we reach this, the data and bss should have been initialised.
 
@@ -133,6 +60,71 @@
 
 // ----------------------------------------------------------------------------
 
+
+// Forward declarations
+
+int
+_chown(const char* path, uid_t owner, gid_t group);
+
+int
+_close(int fildes);
+
+int
+_execve(char* name, char** argv, char** env);
+
+int
+_fork(void);
+
+int
+_fstat(int fildes, struct stat* st);
+
+int
+_getpid(void);
+
+int
+_gettimeofday(struct timeval* ptimeval, void* ptimezone);
+
+int
+_isatty(int file);
+
+int
+_kill(int pid, int sig);
+
+int
+_link(char* existing, char* _new);
+
+int
+_lseek(int file, int ptr, int dir);
+
+int
+_open(char* file, int flags, int mode);
+
+int
+_read(int file, char* ptr, int len);
+
+int
+_readlink(const char* path, char* buf, size_t bufsize);
+
+int
+_stat(const char* file, struct stat* st);
+
+int
+_symlink(const char* path1, const char* path2);
+
+clock_t
+_times(struct tms* buf);
+
+int
+_unlink(char* name);
+
+int
+_wait(int* status);
+
+int
+_write(int file, char* ptr, int len);
+
+// Definitions
+
 int __attribute__((weak))
 _chown(const char* path __attribute__((unused)),
     uid_t owner __attribute__((unused)), gid_t group __attribute__((unused)))
@@ -201,7 +193,8 @@
 }
 
 int __attribute__((weak))
-_link(char* existing __attribute__((unused)), char* _new __attribute__((unused)))
+_link(char* existing __attribute__((unused)),
+    char* _new __attribute__((unused)))
 {
   errno = ENOSYS;
   return -1;
@@ -259,7 +252,7 @@
 _times(struct tms* buf __attribute__((unused)))
 {
   errno = ENOSYS;
-  return -1;
+  return ((clock_t) -1);
 }
 
 int __attribute__((weak))
@@ -303,14 +296,14 @@
 #include <time.h>
 #include <sys/time.h>
 #include <sys/times.h>
-//#include <errno.h>
+#include <errno.h>
 #include <reent.h>
 #include <unistd.h>
 #include <sys/wait.h>
 #include <ctype.h>
 #include <signal.h>
 
-#include "semihosting.h"
+#include "arm/semihosting.h"
 
 int
 __attribute__((noreturn))
@@ -320,7 +313,7 @@
 __attribute__((noreturn))
 _exit (int status);
 
-#if 0
+#if 1
 /* Forward prototypes.  */
 int
 _system (const char*);
@@ -339,7 +332,7 @@
 #endif
 int
 _stat (const char*, struct stat*);
-#if 0
+#if 1
 int
 _fstat (int, struct stat*);
 int
@@ -371,6 +364,9 @@
 #endif
 void
 initialise_monitor_handles (void);
+
+void
+__initialize_args (int* p_argc, char*** p_argv);
 
 static int
 checkerror (int);
@@ -391,7 +387,7 @@
   }CommandLineBlock;
 
 void
-__initialise_args (int* p_argc, char*** p_argv)
+__initialize_args (int* p_argc, char*** p_argv)
   {
 
     // Array of chars to receive the command line from the host
@@ -419,7 +415,7 @@
         // The command line is a null terminated string
         char* p = cmdBlock.pCommandLine;
 
-        char delim = '\0';
+        int delim = '\0';
         int ch;
 
         while ((ch = *p) != '\0')
@@ -809,7 +805,7 @@
 _swiopen (const char* path, int flags)
   {
     int aflags = 0, fh;
-    int block[3];
+    uint32_t block[3];
 
     int fd = newslot ();
 
@@ -853,9 +849,9 @@
         aflags |= 8;
       }
 
-    block[0] = (int) path;
+    block[0] = (uint32_t) path;
     block[2] = strlen (path);
-    block[1] = aflags;
+    block[1] = (uint32_t) aflags;
 
     fh = call_host (SEMIHOSTING_SYS_OPEN, block);
 
@@ -979,8 +975,8 @@
 _unlink (const char* path)
   {
     int res;
-    int block[2];
-    block[0] = (int) path;
+    uint32_t block[2];
+    block[0] = (uint32_t) path;
     block[1] = strlen (path);
     res = call_host (SEMIHOSTING_SYS_REMOVE, block);
 
@@ -1016,7 +1012,7 @@
   {
     clock_t timeval;
 
-    timeval = call_host (SEMIHOSTING_SYS_CLOCK, NULL);
+    timeval = (clock_t)call_host (SEMIHOSTING_SYS_CLOCK, NULL);
     return timeval;
   }
 
@@ -1062,7 +1058,7 @@
 int
 _system (const char* s)
   {
-    int block[2];
+    uint32_t block[2];
     int e;
 
     /* Hmmm.  The ARM debug interface specification doesn't say whether
@@ -1070,7 +1066,7 @@
      meaning to its return value.  Try to do something reasonable....  */
     if (!s)
     return 1; /* maybe there is a shell available? we can hope. :-P */
-    block[0] = (int) s;
+    block[0] = (uint32_t) s;
     block[1] = strlen (s);
     e = checkerror (call_host (SEMIHOSTING_SYS_SYSTEM, block));
     if ((e >= 0) && (e < 256))
@@ -1089,12 +1085,35 @@
 int
 _rename (const char* oldpath, const char* newpath)
   {
-    int block[4];
-    block[0] = (int) oldpath;
+    uint32_t block[4];
+    block[0] = (uint32_t) oldpath;
     block[1] = strlen (oldpath);
-    block[2] = (int) newpath;
+    block[2] = (uint32_t) newpath;
     block[3] = strlen (newpath);
     return checkerror (call_host (SEMIHOSTING_SYS_RENAME, block)) ? -1 : 0;
   }
 
+// ----------------------------------------------------------------------------
+// Required by Google Tests
+
+int
+mkdir(const char *path __attribute__((unused)), mode_t mode __attribute__((unused)))
+  {
+#if 0
+    // always return true
+    return 0;
+#else
+    errno = ENOSYS;
+    return -1;
 #endif
+  }
+
+char *
+getcwd(char *buf, size_t size)
+  {
+    // no cwd available via semihosting, so we use the temporary folder
+    strncpy(buf, "/tmp", size);
+    return buf;
+  }
+
+#endif
1 2 3 > >> (Page 1 of 3)