From b1fa1e2e885297bf32a718c16e05aea6c0d2a318 Mon Sep 17 00:00:00 2001 From: Nico Tonnhofer Date: Sat, 7 Nov 2015 00:15:59 +0100 Subject: [PATCH] STM32F411: get rid of asserts. No functional change, binary size 118 bytes smaller. --- Makefile-ARM | 1 - mbed-assert.c | 22 ---------------------- mbed-gpio_object_stm32.h | 3 --- mbed-pinmap_stm32.c | 3 --- mbed-serial_api_stm32.c | 2 -- 5 files changed, 31 deletions(-) delete mode 100644 mbed-assert.c diff --git a/Makefile-ARM b/Makefile-ARM index 3d023fe..6a4deae 100644 --- a/Makefile-ARM +++ b/Makefile-ARM @@ -127,7 +127,6 @@ ifeq ($(MCU), stm32f411) SOURCES += mbed-stm32f4xx_hal_rcc.c SOURCES += mbed-stm32f4xx_hal_tim.c SOURCES += mbed-stm32f4xx_hal_uart.c - SOURCES += mbed-assert.c SOURCES += mbed-cmsis_nvic_stm32.c SOURCES += mbed-pinmap_stm32.c SOURCES += mbed-PeripheralPins_stm32.c diff --git a/mbed-assert.c b/mbed-assert.c deleted file mode 100644 index 4b1aa8c..0000000 --- a/mbed-assert.c +++ /dev/null @@ -1,22 +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 "mbed-mbed_assert.h" -#include "mbed-mbed_error.h" - -void mbed_assert_internal(const char *expr, const char *file, int line) -{ - error("mbed assertation failed: %s, file: %s, line %d \n", expr, file, line); -} diff --git a/mbed-gpio_object_stm32.h b/mbed-gpio_object_stm32.h index 4a5f3b8..9c8d814 100644 --- a/mbed-gpio_object_stm32.h +++ b/mbed-gpio_object_stm32.h @@ -42,7 +42,6 @@ #ifndef MBED_GPIO_OBJECT_H #define MBED_GPIO_OBJECT_H -#include "mbed-mbed_assert.h" #include "mbed-cmsis_stm32.h" #include "mbed-PortNames_stm32.h" #include "mbed-PeripheralNames_stm32.h" @@ -61,7 +60,6 @@ typedef struct { static inline void gpio_write(gpio_t *obj, int value) { - MBED_ASSERT(obj->pin != (PinName)NC); if (value) { *obj->reg_set_clr = obj->mask; } else { @@ -71,7 +69,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_in & obj->mask) ? 1 : 0); } diff --git a/mbed-pinmap_stm32.c b/mbed-pinmap_stm32.c index f3d56d8..4c9ef62 100644 --- a/mbed-pinmap_stm32.c +++ b/mbed-pinmap_stm32.c @@ -42,7 +42,6 @@ AVR builds. */ #ifdef __ARM_STM32F411__ -#include "mbed-mbed_assert.h" #include "mbed-pinmap.h" #include "mbed-PortNames_stm32.h" #include "mbed-mbed_error.h" @@ -141,7 +140,6 @@ uint32_t Set_GPIO_Clock(uint32_t port_idx) */ void pin_function(PinName pin, int data) { - MBED_ASSERT(pin != (PinName)NC); // Get the pin informations uint32_t mode = STM_PIN_MODE(data); uint32_t pupd = STM_PIN_PUPD(data); @@ -178,7 +176,6 @@ void pin_function(PinName pin, int data) */ void pin_mode(PinName pin, PinMode mode) { - MBED_ASSERT(pin != (PinName)NC); uint32_t port_index = STM_PORT(pin); uint32_t pin_index = STM_PIN(pin); diff --git a/mbed-serial_api_stm32.c b/mbed-serial_api_stm32.c index 443925b..5f90639 100644 --- a/mbed-serial_api_stm32.c +++ b/mbed-serial_api_stm32.c @@ -44,7 +44,6 @@ - Fixed mbed_uart0_irq() function prototype. */ #ifdef __ARM_STM32F411__ -#include "mbed-mbed_assert.h" #include "mbed-serial_api.h" #if DEVICE_SERIAL @@ -97,7 +96,6 @@ void mbed_serial_init(serial_t *obj, PinName tx, PinName rx) // Get the peripheral name (UART_1, UART_2, ...) from the pin and assign it to the object obj->uart = (UARTName)pinmap_merge(uart_tx, uart_rx); - MBED_ASSERT(obj->uart != (UARTName)NC); // Enable USART clock switch (obj->uart) {