Ticker hangs when migrating existing code to mbedos5

I had a very vexing problem, the Ticker object would cause the previously working program to hang.
I have found that if an array is filled beyond its bounds then it would trigger an error or hang with os5 though not with os2.
Hope it helps with migrating.
Pramod Joglekar

Hi there,

what error you get from serial terminal?
Place an example of the code, where it occur.

```
// your code
```

BR, Jan

This is the error I got:

++ MbedOS Error Info ++
Error Status: 0x80FF0144 Code: 324 Module: 255
Error Message: Assertion failed: “OS timer not available - check MBED_CONF_TARGET_TICKLESS_FROM_US_TICKER” && false
Location: 0x25CB7
File: /extras/mbed-os.lib/platform/source/mbed_os_timer.cpp+55
Error Value: 0x0
For more info, visit: mbedos-error
– MbedOS Error Info –

Target: LPC1768
mbedos5

Hello Pramod,

When an array is filled beyond its bounds then the memory locations beyond the array are overwritten. If you are “lucky” and those locations are not used for any other variable then the program will run (like in your case when using Mbed OS 2). But you shall not rely on good luck when programming. You better make provisions that the array is not filled beyond its bounds. Otherwise the program behaviour is unpredictable.

Best regards,

Zoltan

for the tickless error, try this in your mbed_app.json:

{
    "target_overrides": {
        "*": {
            "target.tickless-from-us-ticker": true
        }
    }
}

Thanks, have included it as “Good Practice”.

Thanks Zoltan,
It was hell locating the error. Thanks to Covid-Lockdown in my country I had a lot of time to hack and find it.
Some other time I would have given up and gone back to os2.
Can Mbed do something about array/memory leak error reporting?
I follow your posts regularly, they are very helpful.
Best Regards,
Pramod