Commit Graph

18 Commits (0e7d172d0f3e3e424fcb7e6ac156517767cc6764)

Author SHA1 Message Date
Kevin Bracey 3056ba730c mbed_die: Use wait_us not wait_ms
mbed_die was calling wait_ms in a critical section - this is deprecated
behaviour, and caused a fatal error in debug builds, potentially leading
to an infinite reboot loop if this was caused due to a reboot limit
halt.

Switch to using wait_us - this is safe in a critical section. This does
trigger a call to mbed_warning, due to the large parameter, but that is
harmless - it doesn't output anything to the console, and won't
overwrite the error context if it already contains something.
2019-01-30 13:29:13 +02:00
Martin Kojtal bf36ff77c1
Merge pull request #8855 from michalpasztamobica/warnings_fix
Fix compilation warnings (apart from nanostack)
2018-12-03 13:31:55 +01:00
Martin Kojtal ad759b7749 platform: add spdx license 2018-11-28 10:39:52 +00:00
Michal Paszta e101943cce Fix compilation warnings (apart from nanostack) 2018-11-26 14:27:48 +01:00
Kevin Bracey ea16a6ba1d Add MBED_NORETURN attributes
Save some ROM space by putting MBED_NORETURN attributes on error
functions and failed asserts.

mbed_error was documented as returning an error code. It never
actually could return, so documentation updated, but return type
kept.
2018-10-29 13:58:06 +02:00
Kevin Bracey e20edbdb46 Add mbed_error_puts
This is potentially useful for printing long strings such as filenames
from assert messages, avoiding the buffer limit inherent in
mbed_error_printf.
2018-10-22 09:53:20 +03:00
Kevin Bracey 2df322c43d Don't overrun in error prints
vsprintf returns the amount it would have written if the buffer had been
big enough, but we used that value directly when outputting, thus
overrunning memory and dumping stack contents.

Indicate truncation by inserting an ellipsis and newline. Slightly
increase the buffer size, so that we don't slightly decrease the maximum
printable characters because of the ellipsis insertion.

Partially addresses https://github.com/ARMmbed/mbed-os/issues/6850 by
forcing a newline when truncation happens - often truncation will drop a
newline and prevent a flush.
2018-10-17 12:55:20 +03:00
Kevin Bracey c989845d5a mbed_error_vfprintf -> mbed_error_vprintf
Name vfprintf doesn't make sense - if we have mbed_error_printf, this is
vprintf.
2018-10-17 12:55:20 +03:00
Kevin Bracey 78f4b4bc82 Make mbed_error not serial-specific
Use write() on current output device instead - this works on the
assumption that write() is safe to call from critical section.

UARTSerial has previously been upgraded to support this, and this also
improves the behaviour when buffered serial is in use - the current
buffered output will be fully flushed before outputting the error
message.
2018-10-17 12:55:20 +03:00
Martin Kojtal ffcb6ecfb5 platform: astyle update 2018-06-29 10:38:44 +01:00
Steve Cartmell 9c87f5936c Unified the LED error pattern for all boards
- Removed the patterned LED sequence, all boards now use the 4 fast pulse, 4 slow pulses LED sequence.
  - Changed the LED used from LED_RED to LED1. Only 58/174 targets seem to define LED_RED but they all define LED1.
  - Removed all ERROR_RED and ERROR_PATTERN definitions from targets/targets.json
2017-08-16 11:55:24 +01:00
Steve Cartmell 942f71a9c4 Modify LED error sequence to be more recognisable
The current error sequence for microcontrollers with less than 4 LEDs is
to toggle an LED at a fixed rate. Change the sequence to 4 short pulses
followed by 4 long pulses.
2017-08-09 16:15:31 +01:00
Francisco J. Manno 4398b1f3c1 Fix gcc [-Wsign-compare] warning
[Warning] mbed_board.c@99,36: comparison between signed and unsigned
integer expressions [-Wsign-compare] is seen during compilation.
Fix the warning and small improvements.

1. Change type of loop variable "i" to the same type as "size".
   Size is > 0 checked by the if statement and i stops at == size
   so none can be negative. However size still needs to be signed
   to detect error codes from vsnprintf.
2. Reduced scope of stdio_out_prev and make sure it's initialized.
3. Define a name for the error buffer size and use vsnprintf instead
   of vsprintf to avoid writing outside of the array.
   NOTE: the if(size > 0) statement doesn't need to change. If
   the message to write is larger than the buffer size vsnprintf
   truncates it automatically but still returns a positive value.
2017-04-19 18:37:37 +01:00
Tony Wu 913febd3db Fix mbed_board.c compiler warning
Fix the following compiler warning.

Compile [ 63.7%]: mbed_board.c
[Warning] mbed_board.c@99,36: comparison between signed and unsigned integer expressions [-Wsign-compare]

Signed-off-by: Tony Wu <tonyw@realtek.com>
2017-04-10 11:42:14 +08:00
Christopher Haster aff49d8d1e Renamed files in platform to match source names
critical.h     -> mbed_critical.h
sleep.h        -> mbed_sleep.h
toolchain.h    -> mbed_toolchain.h
rtc_time.h     -> mbed_rtc_time.h
semihost_api.h -> mbed_semihost_api.h
wait_api.h     -> mbed_wait_api.h
2017-02-22 18:17:54 -06:00
YarivCol 2c6eba35c2 fix in mbed_error_vfprintf
MBED_CONF_PLATFORM_STDIO_CONVERT_NEWLINES was not used in mbed_error_vfprintf causing wrong behavior when the option was selected (no new line is some terminals like putty).
2017-02-13 00:54:51 +02:00
Sam Grove 301b77c4b2 For drivers, events, hal, platform, rtos and mbed.h add one level of path to make sure specific and unique includes files are found. 2016-10-01 02:11:36 -05:00
Christopher Haster 15904b7544 restructure - Split hal into drivers+platform+hal
hal/common/AnalogIn.cpp -> drivers/AnalogIn.cpp
hal/api/AnalogIn.h -> drivers/AnalogIn.h
hal/api/AnalogOut.h -> drivers/AnalogOut.h
hal/common/BusIn.cpp -> drivers/BusIn.cpp
hal/api/BusIn.h -> drivers/BusIn.h
hal/common/BusInOut.cpp -> drivers/BusInOut.cpp
hal/api/BusInOut.h -> drivers/BusInOut.h
hal/common/BusOut.cpp -> drivers/BusOut.cpp
hal/api/BusOut.h -> drivers/BusOut.h
hal/common/CAN.cpp -> drivers/CAN.cpp
hal/api/CAN.h -> drivers/CAN.h
hal/api/CircularBuffer.h -> drivers/CircularBuffer.h
hal/api/DigitalIn.h -> drivers/DigitalIn.h
hal/api/DigitalInOut.h -> drivers/DigitalInOut.h
hal/api/DigitalOut.h -> drivers/DigitalOut.h
hal/api/DirHandle.h -> drivers/DirHandle.h
hal/common/Ethernet.cpp -> drivers/Ethernet.cpp
hal/api/Ethernet.h -> drivers/Ethernet.h
hal/common/FileBase.cpp -> drivers/FileBase.cpp
hal/api/FileBase.h -> drivers/FileBase.h
hal/api/FileHandle.h -> drivers/FileHandle.h
hal/common/FileLike.cpp -> drivers/FileLike.cpp
hal/api/FileLike.h -> drivers/FileLike.h
hal/common/FilePath.cpp -> drivers/FilePath.cpp
hal/api/FilePath.h -> drivers/FilePath.h
hal/common/FileSystemLike.cpp -> drivers/FileSystemLike.cpp
hal/api/FileSystemLike.h -> drivers/FileSystemLike.h
hal/common/I2C.cpp -> drivers/I2C.cpp
hal/api/I2C.h -> drivers/I2C.h
hal/common/I2CSlave.cpp -> drivers/I2CSlave.cpp
hal/api/I2CSlave.h -> drivers/I2CSlave.h
hal/common/InterruptIn.cpp -> drivers/InterruptIn.cpp
hal/api/InterruptIn.h -> drivers/InterruptIn.h
hal/common/InterruptManager.cpp -> drivers/InterruptManager.cpp
hal/api/InterruptManager.h -> drivers/InterruptManager.h
hal/common/LocalFileSystem.cpp -> drivers/LocalFileSystem.cpp
hal/api/LocalFileSystem.h -> drivers/LocalFileSystem.h
hal/api/LowPowerTicker.h -> drivers/LowPowerTicker.h
hal/api/LowPowerTimeout.h -> drivers/LowPowerTimeout.h
hal/api/LowPowerTimer.h -> drivers/LowPowerTimer.h
hal/api/PortIn.h -> drivers/PortIn.h
hal/api/PortInOut.h -> drivers/PortInOut.h
hal/api/PortOut.h -> drivers/PortOut.h
hal/api/PwmOut.h -> drivers/PwmOut.h
hal/common/RawSerial.cpp -> drivers/RawSerial.cpp
hal/api/RawSerial.h -> drivers/RawSerial.h
hal/common/SPI.cpp -> drivers/SPI.cpp
hal/api/SPI.h -> drivers/SPI.h
hal/common/SPISlave.cpp -> drivers/SPISlave.cpp
hal/api/SPISlave.h -> drivers/SPISlave.h
hal/common/Serial.cpp -> drivers/Serial.cpp
hal/api/Serial.h -> drivers/Serial.h
hal/common/SerialBase.cpp -> drivers/SerialBase.cpp
hal/api/SerialBase.h -> drivers/SerialBase.h
hal/common/Stream.cpp -> drivers/Stream.cpp
hal/api/Stream.h -> drivers/Stream.h
hal/common/Ticker.cpp -> drivers/Ticker.cpp
hal/api/Ticker.h -> drivers/Ticker.h
hal/common/Timeout.cpp -> drivers/Timeout.cpp
hal/api/Timeout.h -> drivers/Timeout.h
hal/common/Timer.cpp -> drivers/Timer.cpp
hal/api/Timer.h -> drivers/Timer.h
hal/common/TimerEvent.cpp -> drivers/TimerEvent.cpp
hal/api/TimerEvent.h -> drivers/TimerEvent.h
hal/api/Transaction.h -> drivers/Transaction.h
hal/api/can_helper.h -> drivers/can_helper.h
hal/.yotta_ignore
hal/CMakeLists.txt
hal/hal/analogin_api.h -> hal/analogin_api.h
hal/hal/analogout_api.h -> hal/analogout_api.h
hal/hal/buffer.h -> hal/buffer.h
hal/hal/can_api.h -> hal/can_api.h
hal/hal/dma_api.h -> hal/dma_api.h
hal/hal/ethernet_api.h -> hal/ethernet_api.h
hal/hal/gpio_api.h -> hal/gpio_api.h
hal/hal/gpio_irq_api.h -> hal/gpio_irq_api.h
hal/hal/i2c_api.h -> hal/i2c_api.h
hal/hal/lp_ticker_api.h -> hal/lp_ticker_api.h
hal/common/mbed_gpio.c -> hal/mbed_gpio.c
hal/common/mbed_lp_ticker_api.c -> hal/mbed_lp_ticker_api.c
hal/common/mbed_pinmap_common.c -> hal/mbed_pinmap_common.c
hal/common/mbed_ticker_api.c -> hal/mbed_ticker_api.c
hal/common/mbed_us_ticker_api.c -> hal/mbed_us_ticker_api.c
hal/module.json
hal/hal/pinmap.h -> hal/pinmap.h
hal/hal/port_api.h -> hal/port_api.h
hal/hal/pwmout_api.h -> hal/pwmout_api.h
hal/hal/rtc_api.h -> hal/rtc_api.h
hal/hal/serial_api.h -> hal/serial_api.h
hal/hal/sleep_api.h -> hal/sleep_api.h
hal/hal/spi_api.h -> hal/spi_api.h
hal/hal/storage_abstraction/Driver_Common.h -> hal/storage_abstraction/Driver_Common.h
hal/hal/storage_abstraction/Driver_Storage.h -> hal/storage_abstraction/Driver_Storage.h
hal/hal/ticker_api.h -> hal/ticker_api.h
hal/hal/trng_api.h -> hal/trng_api.h
hal/hal/us_ticker_api.h -> hal/us_ticker_api.h
hal/api/mbed.h -> mbed.h
hal/api/CThunk.h -> platform/CThunk.h
hal/common/CallChain.cpp -> platform/CallChain.cpp
hal/api/CallChain.h -> platform/CallChain.h
hal/api/Callback.h -> platform/Callback.h
hal/api/FunctionPointer.h -> platform/FunctionPointer.h
hal/api/PlatformMutex.h -> platform/PlatformMutex.h
hal/api/SingletonPtr.h -> platform/SingletonPtr.h
hal/api/critical.h -> platform/critical.h
hal/common/mbed_alloc_wrappers.cpp -> platform/mbed_alloc_wrappers.cpp
hal/common/mbed_assert.c -> platform/mbed_assert.c
hal/api/mbed_assert.h -> platform/mbed_assert.h
hal/common/mbed_board.c -> platform/mbed_board.c
hal/common/mbed_critical.c -> platform/mbed_critical.c
hal/api/mbed_debug.h -> platform/mbed_debug.h
hal/common/mbed_error.c -> platform/mbed_error.c
hal/api/mbed_error.h -> platform/mbed_error.h
hal/common/mbed_interface.c -> platform/mbed_interface.c
hal/api/mbed_interface.h -> platform/mbed_interface.h
hal/common/mbed_mem_trace.c -> platform/mbed_mem_trace.c
hal/api/mbed_mem_trace.h -> platform/mbed_mem_trace.h
hal/common/mbed_rtc_time.cpp -> platform/mbed_rtc_time.cpp
hal/common/mbed_semihost_api.c -> platform/mbed_semihost_api.c
hal/api/mbed_stats.h -> platform/mbed_stats.h
hal/common/mbed_wait_api_no_rtos.c -> platform/mbed_wait_api_no_rtos.c
hal/common/mbed_wait_api_rtos.cpp -> platform/mbed_wait_api_rtos.cpp
hal/api/platform.h -> platform/platform.h
hal/common/retarget.cpp -> platform/retarget.cpp
hal/api/rtc_time.h -> platform/rtc_time.h
hal/api/semihost_api.h -> platform/semihost_api.h
hal/api/toolchain.h -> platform/toolchain.h
hal/api/wait_api.h -> platform/wait_api.h
2016-09-30 19:18:09 -05:00