Closed dudmuck closed 8 years ago
ARM Internal Ref: IOTSFW-2385
This might be related to my earlier report : https://github.com/ARMmbed/mbed-drivers/issues/83
@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();
}
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.
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.
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.