From 848369608bcc13b3f6cf117af337272f80beff96 Mon Sep 17 00:00:00 2001 From: Markus Hitter Date: Sun, 12 Jul 2015 14:11:50 +0200 Subject: [PATCH] ARM: get rid of mbed-mbed_assert.h. No functional change, binary size 16 bytes smaller. --- mbed-gpio_object.h | 4 ---- mbed-mbed_assert.h | 59 ---------------------------------------------- mbed-pinmap.c | 3 --- mbed-serial_api.c | 6 ----- 4 files changed, 72 deletions(-) delete mode 100644 mbed-mbed_assert.h diff --git a/mbed-gpio_object.h b/mbed-gpio_object.h index 24df410..63546b3 100644 --- a/mbed-gpio_object.h +++ b/mbed-gpio_object.h @@ -28,8 +28,6 @@ #ifndef MBED_GPIO_OBJECT_H #define MBED_GPIO_OBJECT_H -#include "mbed-mbed_assert.h" - #ifdef __cplusplus extern "C" { #endif @@ -42,7 +40,6 @@ typedef struct { } gpio_t; static inline void gpio_write(gpio_t *obj, int value) { - MBED_ASSERT(obj->pin != (PinName)NC); uint32_t pin_number = ((obj->pin & 0x0F00) >> 8); if (value) *obj->reg_write |= (1 << pin_number); @@ -51,7 +48,6 @@ static inline void gpio_write(gpio_t *obj, int value) { } static inline int gpio_read(gpio_t *obj) { - MBED_ASSERT(obj->pin != (PinName)NC); return ((*obj->reg_mask_read) ? 1 : 0); } diff --git a/mbed-mbed_assert.h b/mbed-mbed_assert.h deleted file mode 100644 index d93d0bc..0000000 --- a/mbed-mbed_assert.h +++ /dev/null @@ -1,59 +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. - */ -/* - Notes for Teacup: - - Copied from $(MBED)/libraries/mbed/api/mbed_assert.h. - - Used only to get things running quickly. Without serial it's almost - impossible to see wether code changes work. Should go away soon, because - all this MBED stuff is too bloated for Teacup's purposes. -*/ -#ifndef MBED_ASSERT_H -#define MBED_ASSERT_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** Internal mbed assert function which is invoked when MBED_ASSERT macro failes. - * This function is active only if NDEBUG is not defined prior to including this - * assert header file. - * In case of MBED_ASSERT failing condition, the assertation message is printed - * to stderr and mbed_die() is called. - * @param expr Expresion to be checked. - * @param file File where assertation failed. - * @param line Failing assertation line number. - */ -void mbed_assert_internal(const char *expr, const char *file, int line); - -#ifdef __cplusplus -} -#endif - -#ifdef NDEBUG -#define MBED_ASSERT(expr) ((void)0) - -#else -#define MBED_ASSERT(expr) \ -do { \ - if (!(expr)) { \ - mbed_assert_internal(#expr, __FILE__, __LINE__); \ - } \ -} while (0) -#endif - -#endif diff --git a/mbed-pinmap.c b/mbed-pinmap.c index 0af9733..01f4a6d 100644 --- a/mbed-pinmap.c +++ b/mbed-pinmap.c @@ -28,12 +28,10 @@ AVR builds. */ #ifdef __ARMEL__ -#include "mbed-mbed_assert.h" #include "mbed-pinmap.h" #include "mbed-mbed_error.h" void pin_function(PinName pin, int function) { - MBED_ASSERT(pin != (PinName)NC); uint32_t offset = (uint32_t)pin & 0xff; __IO uint32_t *reg = (__IO uint32_t*)(LPC_IOCON_BASE + offset); @@ -42,7 +40,6 @@ void pin_function(PinName pin, int function) { } void pin_mode(PinName pin, PinMode mode) { - MBED_ASSERT(pin != (PinName)NC); uint32_t offset = (uint32_t)pin & 0xff; uint32_t drain = ((uint32_t)mode & (uint32_t)OpenDrain) >> 2; diff --git a/mbed-serial_api.c b/mbed-serial_api.c index aad4031..fb8f812 100644 --- a/mbed-serial_api.c +++ b/mbed-serial_api.c @@ -31,7 +31,6 @@ - Fixed mbed_uart0_irq() function prototype. */ #ifdef __ARMEL__ -#include "mbed-mbed_assert.h" #include #include #include @@ -74,7 +73,6 @@ void mbed_serial_init(serial_t *obj, PinName tx, PinName rx) { UARTName uart_tx = (UARTName)pinmap_peripheral(tx, PinMap_UART_TX); UARTName uart_rx = (UARTName)pinmap_peripheral(rx, PinMap_UART_RX); UARTName uart = (UARTName)pinmap_merge(uart_tx, uart_rx); - MBED_ASSERT((int)uart != NC); obj->uart = (LPC_UART_TypeDef *)uart; LPC_SYSCON->SYSAHBCLKCTRL |= (1<<12); @@ -202,10 +200,6 @@ void mbed_serial_baud(serial_t *obj, int baudrate) { } void mbed_serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_bits) { - MBED_ASSERT((stop_bits == 1) || (stop_bits == 2)); // 0: 1 stop bits, 1: 2 stop bits - MBED_ASSERT((data_bits > 4) && (data_bits < 9)); // 0: 5 data bits ... 3: 8 data bits - MBED_ASSERT((parity == ParityNone) || (parity == ParityOdd) || (parity == ParityEven) || - (parity == ParityForced1) || (parity == ParityForced0)); stop_bits -= 1; data_bits -= 5;