Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

FunctionPointerBase.h call() hardfault #106

Closed
dudmuck opened this issue Mar 22, 2016 · 5 comments
Closed

FunctionPointerBase.h call() hardfault #106

dudmuck opened this issue Mar 22, 2016 · 5 comments

Comments

@dudmuck
Copy link

dudmuck commented Mar 22, 2016

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
Copy link
Member

ARM Internal Ref: IOTSFW-2385

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 22, 2016

This might be related to my earlier report : ARMmbed/mbed-drivers#83

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 24, 2016

@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
Copy link
Contributor

0xc0170 commented Mar 24, 2016

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.

@0xc0170 0xc0170 closed this as completed Mar 24, 2016
@dudmuck
Copy link
Author

dudmuck commented Mar 24, 2016

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants