From 47ee2ed90ff7bf1986a93c52abe210d940745379 Mon Sep 17 00:00:00 2001 From: sg- Date: Thu, 7 Apr 2016 10:22:59 -0500 Subject: [PATCH 1/2] rename error.c to mbed_error.c. add toolchain.h to mbed.h exposing to all. add extern filler to toolchain.h --- hal/api/mbed.h | 1 + hal/api/toolchain.h | 4 ++++ hal/common/error.c | 33 --------------------------------- 3 files changed, 5 insertions(+), 33 deletions(-) delete mode 100644 hal/common/error.c diff --git a/hal/api/mbed.h b/hal/api/mbed.h index b44d183122..9540ba65b4 100644 --- a/hal/api/mbed.h +++ b/hal/api/mbed.h @@ -18,6 +18,7 @@ #define MBED_LIBRARY_VERSION 117 +#include "toolchain.h" #include "platform.h" // Useful C libraries diff --git a/hal/api/toolchain.h b/hal/api/toolchain.h index b140643b38..7a79226941 100644 --- a/hal/api/toolchain.h +++ b/hal/api/toolchain.h @@ -24,6 +24,10 @@ typedef int FILEHANDLE; #endif +#ifndef EXTERN +#define EXTERN extern +#endif + #if defined (__ICCARM__) # define WEAK __weak # define PACKED __packed diff --git a/hal/common/error.c b/hal/common/error.c deleted file mode 100644 index b307d87565..0000000000 --- a/hal/common/error.c +++ /dev/null @@ -1,33 +0,0 @@ -/* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include -#include "device.h" -#include "toolchain.h" -#include "mbed_error.h" -#if DEVICE_STDIO_MESSAGES -#include -#endif - -WEAK void error(const char* format, ...) { -#if DEVICE_STDIO_MESSAGES - va_list arg; - va_start(arg, format); - vfprintf(stderr, format, arg); - va_end(arg); -#endif - exit(1); -} From 034d3e9c2751d6fe9115b4171e0a1598f4b085ad Mon Sep 17 00:00:00 2001 From: sg- Date: Thu, 7 Apr 2016 10:25:29 -0500 Subject: [PATCH 2/2] track mbed_error.c --- hal/common/mbed_error.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 hal/common/mbed_error.c diff --git a/hal/common/mbed_error.c b/hal/common/mbed_error.c new file mode 100644 index 0000000000..b307d87565 --- /dev/null +++ b/hal/common/mbed_error.c @@ -0,0 +1,33 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include +#include +#include "device.h" +#include "toolchain.h" +#include "mbed_error.h" +#if DEVICE_STDIO_MESSAGES +#include +#endif + +WEAK void error(const char* format, ...) { +#if DEVICE_STDIO_MESSAGES + va_list arg; + va_start(arg, format); + vfprintf(stderr, format, arg); + va_end(arg); +#endif + exit(1); +}