Commit Graph

7 Commits

Author SHA1 Message Date
Andrew Tridgell 1283d42fbf AP_HAL: added micros16() method
fast method for both 16 and 32 bit timers
2021-10-02 18:26:39 +10:00
Peter Barker 2f7603e08e AP_HAL: generate a core file for a given PID
Similarly to dumpstack.sh, uses gdb to dump a core file
2021-07-08 15:46:07 +10:00
Siddharth Purohit 15abca8ba4 AP_HAL: add native clock info methods used inside other than main thread 2020-08-19 17:31:09 +10:00
Peter Barker c3a99c8eb0 AP_HAL: move dump_strack_trace into HAL
Use a weak definition to allow subclasses to override
2019-06-13 09:25:42 +10:00
Peter Barker 8a0e3dd657 AP_HAL: add millis16 to HAL; provide weak implementation
This wraps every minute or so - but if you only need to track intervals
under ~65 seconds could save RAM
2018-12-10 12:52:41 +09:00
Lucas De Marchi d19c5035b6 Global: Rename printf format attribute
As commented in 8218140 ("AP_Common: add scanf format macro"), "FORMAT"
was a bad name for this macro since there's also the scanf. Rename to
FMT_PRINTF to follow the scanf name.
2015-12-01 07:22:12 +11:00
Caio Marcelo de Oliveira Filho efbc7648b1 AP_HAL: create AP_HAL namespace and use for some HAL functionality
For certain basic functionality, there aren't much benefit to be able to
vary the implementation easily at runtime. So instead of using virtual
functions, use regular functions that are "resolved" at link time. The
implementation of such functions is provided per board/platform.

Examples of functions that fit this include: getting the current
time (since boot), panic'ing, getting system information, rebooting.

These functions are less likely to benefit from the indirection provided
by virtual interfaces. For more complex hardware access APIs the
indirection makes more sense and ease the testing (when we have it!).

The idea is that instead of calling

    hal.scheduler->panic("on the streets of london");

now use

    AP_HAL::panic("on the streets of london");

A less important side-effect is that call-site code gets
smaller. Currently the compiler needs to get the hal, get the scheduler
pointer, get the right function pointer in the vtable for that
scheduler. And the call must include an extra parameter ("this"). Now it
will be just a function call, with the address resolved at link time.

This patch introduces the first functions that will be in the namespace,
further patches will implementations for each board and then switch the
call-sites. The extra init() function allow any initial setup needed for
the functions to work.
2015-11-20 12:25:24 +09:00