ARMmbed / core-util

DEPRECATED: Mbed 3 utilities library
Other
12 stars 17 forks source link

FunctionPointerBase.h call() hardfault #106

Closed dudmuck closed 8 years ago

dudmuck commented 8 years ago

When _object is uninitialized (== NULL), the call() should probably have the OR CORE_UTIL_ASSERT((_membercaller != NULL) || (_object != NULL)); but this would only be caught in debug build. I noticed hardfault occuring here when user had serial.attach() for RX callback. serial_api.c uart_isr can call TX handler when RX interrupt occurs. Yet if TX function pointer isnt initialized, then hardfault occurs. The mbed library on developer.mbed.org is skipping function pointer call if the called object is null.

ciarmcom commented 8 years ago

ARM Internal Ref: IOTSFW-2385

0xc0170 commented 8 years ago

This might be related to my earlier report : https://github.com/ARMmbed/mbed-drivers/issues/83

0xc0170 commented 8 years ago

@dudmuck What is the platform you are working on? If you can pinpoint to the sources (code reference) that would be helpful.

Is this function causing the hardfault. Which does not check if irq was attached:

void SerialBase::_irq_handler(uint32_t id, SerialIrq irq_type) {
    SerialBase *handler = (SerialBase*)id;
    handler->_irq[irq_type].call();
}
0xc0170 commented 8 years ago

I am closing this as a duplicate of the mbed-drivers 83 I referenced above. If you consider that a serial should not invoke non attached (Tx in your case) object, it should be reported in the mbed-drivers.

dudmuck commented 8 years ago

Its the uart_irq() in https://github.com/ARMmbed/mbed-hal-st-stm32f4/blob/master/source/serial_api.c Its calling both TxIrq and RxIrq if the RX callback is echoing the received character.