Commit Graph

109 Commits

Author SHA1 Message Date
Maciej-Mudita
1b03981b06 [BH-1701] Add extended user heap statistics for debugging
Added extended statistics to help track potential memory leaks:
* used user heap size per task
* number of successful allocations
* number of successful frees
2023-05-31 14:39:33 +02:00
Adam Wulkiewicz
d2bf42d411 [BH-1655] Fix memory leaks in clock faces and shortcuts
Disable libphonenumber initialization since it is not used in Harmony
but takes around 1.4MB of memory

Add heap allocation statistics
2023-03-17 12:44:30 +01:00
Maciej-Mudita
e6adfdb39a [MOS-75] Fix incorrect data in pure heapstats tool
"pure heapstats" command was returning incorrect
system heap data
2023-01-25 16:50:28 +01:00
Maciej-Mudita
f4aaf4e302 [MOS-775] Create run-time statistics for tasks
Every hour, statistics of tasks that put a heavy load
on the CPU will be logged
2022-10-25 18:46:54 +02:00
Mateusz Piesta
25f3e2e2cd [BH-1423] Enable tickless option
Made required changes to be able to compile
freeRTOS in tickless mode.
2022-05-17 14:52:21 +02:00
Adam Dobrowolski
3343f02809 [MOS-266] Call StateMachine implementation
With some tests, documentation and so on
2022-05-02 15:54:33 +02:00
Mateusz Piesta
40ff11f8ac [MOS-422] Fix pure gdb tools
Fixed issues with gdb pure due to the DEBUG_FREERTOS
flag not propagating correctly.
2022-04-27 09:58:10 +02:00
Mateusz Piesta
1ea2c45350 [BH-1452] Remove board directory from module-os
Moved board-specific code to module-bsp.
Extracted several smaller CMake targets to avoid
circural dependencies and reduce compile time.
2022-04-13 13:14:22 +02:00
Mateusz Piesta
2f42cd5e73 [BH-1424] FreeRTOS update
Updated FreeRTOS source code to 10.4.6.
Moved FreeRTOS sources to the third-party directory.
Added necessary changes to the CMake configuration.
Split FreeRTOSConfig.h. From now, each board has its own.
Added missing log headers.
Minor refactor of the module-os cmake.
Fixed stack overflows in bell application main and time service.
2022-04-07 13:31:28 +02:00
Adam Dobrowolski
cc02ffffbb [MOS-258] System profile util works with separate rtt
Profiling Move RTT handling to interfacing library
Library for msgpack sink
magic enum updated
performance monitor fixups
2022-04-07 11:32:49 +02:00
Adam Dobrowolski
30487c6008 [MOS-110] Statistics api for system
Gets data from freertos and prints on frequency change depending
if it's important. Gathering is not costly, printing is though.
For less intrusive checks I would rather disable names gathering
as in worst case scenario it hangs rtos context switching till
thread id is found.
2022-02-17 16:46:56 +01:00
Alek Rudnik
390a223637 [EGD-8154] Added watchdog thread closure on system exit
Made sure that watchdog thread is properly closed while exiting OS.
2022-01-12 22:12:33 +01:00
Alek Rudnik
9cf11913a1 [EGD-8129] Add atexit functionality
Added atexit functionality. All global destructors and functions
registered with atexit() should be called at program exit.
It was possbile to reuse original newlib implementation with
MALLOC_PROVIDED flag set.

Made sure logger destructructor is called as last one.

Due to mudita OS legacy, it was not possible to simply fix dependencies
in global objectes and hence there are neither global objects
destructors nor functions registered with atexit() called when exit()
is called.
Possibly it will be changed later.
2022-01-05 13:59:51 +01:00
Lucjan Bryndza
e9ee2af0dc [EGD-8131] Add Reboot/Poweroff for _platform_exit()
Add support for Reboot and Power off for the
_platform_exit code.

Add _platform_exit mode handle

Signed-off-by: Lucjan Bryndza <lucjan.bryndza@mudita.com>
2021-12-22 15:55:24 +01:00
Lucjan Bryndza
6142f6670b [EGD-8127] Add FreeRTOS return to main when scheduler exits
Add support to the FreeRTOS to be able to back to main
functon when the scheduler is terminated.

Signed-off-by: Lucjan Bryndza <lucjan.bryndza@mudita.com>
2021-12-22 11:54:52 +01:00
Lucjan Bryndza
9fba3f1ecf [EGD-7727] Fix userrealloc to ANSI standard capable
Fix userrealloc() function to the ANSI to comply
ANSI C standard

Signed-off-by: Lucjan Bryndza <lucjan.bryndza@mudita.com>
2021-11-24 06:01:40 +01:00
Lucjan Bryndza
e9177f23aa [EGD-7996] Prevent crashdump recursion from ISR
Calling abort() or exit() from the interrupt context
causes that the phone enters into bootloop, because
in the exception mode ISR cannot be used.
We are add guards for prevent clean system shudown
when abort is called from the ISR context.

Signed-off-by: Lucjan Bryndza <lucjan.bryndza@mudita.com>
2021-11-23 14:10:01 +01:00
Alek Rudnik
65d67e2690 [EGD-7948] Extend log dumping
Log are now dumped:
* on system shutdown including hard faults and aborts
* every 5 minutes

Fixed some logs
2021-11-16 17:56:28 +01:00
Lucjan Bryndza
47a1183165 [EGD-7976] Umount all filesystems on failure
Umount all mounted filesystems in case of fault like
Hardfault, abort, uncautched exception.

Signed-off-by: Lucjan Bryndza <lucjan.bryndza@mudita.com>
2021-11-16 15:57:36 +01:00
Lucjan Bryndza
22cf942253 [CP-670] Fix save crash dump
Fix saving crash dump and add create crash dump
when exit function is called.
Also crashdumps size is slighthy reduced
because for backtrace we don't need to grab
the text section and heap section.

Signed-off-by: Lucjan Bryndza <lucjan.bryndza@mudita.com>
2021-11-16 13:24:10 +01:00
Alek Rudnik
5418f9b5e7 [EGD-7423] Fix for _exit() not included in binary
Looks like recent cmake changes introduced this issue.
For some reason overwritten _exit() function was not included in
binary
2021-11-05 13:37:00 +01:00
Kuba
1ab84f774f [EGD-7720] Unmounting file system on system closure
Make sure file system is properly unmounted on gentle system
shut down.
2021-10-20 14:38:08 +02:00
Marcin Smoczyński
bd90e57516 [BH-907] Split utils module into components
Split module-utils into smaller components for better dependency
management. Fix many dependencies throughout the project.

Signed-off-by: Marcin Smoczyński <smoczynski.marcin@gmail.com>
2021-09-23 15:14:40 +02:00
Marcin Smoczyński
e0fae087a6 [BH-908] Fix macros header location
Remove duplicated header for linux; move header for rt1051 to the same
tree as for linux.
_exit.c uses os so it should be placed in the os.

Signed-off-by: Marcin Smoczyński <smoczynski.marcin@gmail.com>
2021-09-22 10:26:32 +02:00
Adam Dobrowolski
3e57a07b43 [EGD-7495] Fixed log use on Linux to be the same as on Rt1051
- Log headers were incomplete
- Log filtering was broken on linux
2021-09-06 09:12:21 +02:00
Marcin Smoczyński
b355d5ce00 [BH-733] Cleanup target dependencies
Remove obsolete target dependencies across modules.
Remove 'cross' and 'unittests' targets.
Refactor some remaining target dependencies to use board include macro.

Signed-off-by: Marcin Smoczyński <smoczynski.marcin@gmail.com>
2021-08-13 01:43:56 +02:00
Marek Niepieklo
6c32205e1b [CP-371] Updater miscelanous developer mode and logs changes
This reverts commit cb93d58d85.
2021-07-27 17:03:28 +02:00
Adam Dobrowolski
cb93d58d85 [CP-371] Updater miscelanous developer mode and logs changes
Changed:
- Runtime disabled logs which didn't add value from ServiceDesktop
- Runtime disabled logs which didn't add value from SystemManager
- Added possibility to change runtime logging levels
- Integrated ServiceDesktop developer code a bit - it might be used
  as virtual base with little to no modifications for other endpoints
  which would result with less redundant code
2021-07-27 13:56:37 +02:00
Mateusz Grzegorzek
8521193df8 [BH-362] Move segger to a separate directory
Move segger to a separate directory
2021-07-12 15:19:40 +02:00
Radoslaw Wicik
943fef9643 [BH-353] Add Documentation for main targets
* clean up mimimu required cmake version
* fixes for release workflow

Add documentation for targets, fixes for cmake
and release workflow.
2021-06-11 09:07:41 +02:00
Lukasz Skrzypczak
2911b6b4a1 [BH-378] PR changes
PR changes - mainly includes
2021-06-08 12:24:29 +02:00
Lukasz Skrzypczak
7fee0d9cfb [BH-378] Utils move log to library
Moved log to separate library
2021-06-08 12:24:29 +02:00
Maciej Gibowicz
77e37561cd [EGD-6769] Preventing use of allocators in interrupts
Abort when trying to use an allocator in an interrupt.
This prevents the heap from being overwritten.
2021-05-19 09:34:08 +02:00
Adam Dobrowolski
b38adceced [EGD-6019] Minimum settings ownership lifetime fixups
added weakptr link to settings and checks
    it wont crash on deinitialized setings now
Pseuto UT are passing
Added:
    - deregistration on Settings destrution
    - weak referencing of Service to not crash Settings on missuse
    - Proxy as initialization parameter to Settings
Unused code removed
Enabled tests to be written for Settings
Removed dependency from freertos in test global file
EntryPath tests updated and compilation slimed
2021-05-18 13:25:54 +02:00
Marek Niepieklo
55de4a64a0 [EGD-6603] Add and enable catching of OOM failures
Catch Out-Of-Memory and stack overflow in OS hooks
2021-04-27 10:33:58 +02:00
Maciej Gibowicz
2b313398f0 [EGD-6344] Fix SystemView compilation
Add necessary FreeRTOS configurations to run SystemView
2021-04-22 09:51:14 +02:00
Mateusz Grzegorzek
a60e27fa4b [EGD-4593] Dump logs to file on timeout
- Dump logs to file every 10 sec.
- max file size is 50 MB
  (after reaching it, no more logs will be logged),
- Add `LockGuard` with locking mechanism
  supporting IRQ and use it in `Logger`.
- Fix minor style issues in `Logger`.
- Add `mount_user_lfs_partition.py` script for mounting LFS on Linux FS
  in order to get `MuditaOS.log` file from `user` partition
2021-03-17 16:33:02 +01:00
Marcin Smoczyński
bd92e3759a [EGD-6065] Increase system heap size
Increase system heap size by 64 kB to fight with heap shortage.
2021-03-08 11:37:54 +01:00
Marcin Smoczyński
7c65f04452 [EGD-5893] Disable optimization for os
Disable FreeRTOS optimization for RelWithDebInfo configuration in order
to be able to analyze system memory (heap and tasks' stacks).

Signed-off-by: Marcin Smoczyński <smoczynski.marcin@gmail.com>
2021-02-25 15:35:36 +01:00
Wiktor S. Ovalle Correa
3b141041e9 [EGD-5737] Merge master into experimental
Keep experimental up to date with changes from master
2021-02-17 17:09:37 +01:00
Hubert Chrzaniuk
bb92b333da [EGD-5355] Fix emulator crash
lIndexOfLastAddedTask is shared between two separate functions
that should run consecutively but in some cases the thread
running can be yield in between which results in broken thread
stack.

This change reduces the risk but it does not entirely solve
the problem. It is still possible for the threads to return in
different order. Nevertheless the tests did not confirm that.
2021-02-17 17:06:59 +01:00
Lucjan Bryndza
dcc72e0bec [EGD-5332] Fix heap size and other merge fixes
After merge with master we are unable to run any application
It was caused by the insufficent heap size
2021-02-17 17:06:49 +01:00
Artur Śleszyński
8bbb57776a [EGD-4115] Implement FreeRTOS configASSERT macro
The configASSERT() macro was modified to use assert instead of
an infinite loop.
2021-02-08 10:40:46 +01:00
Alek Rudnik
f08ad0a038 [EGD-5620] Increase configTOTAL_HEAP_SIZE for linux
configTOTAL_HEAP_SIZE was set too small for linux build
2021-02-05 12:12:23 +01:00
Piotr Tański
3f29c30bed [EGD-4968] Change GUI service to optimize flow and memory management
Gui and Eink services refactor.
Displaying frames performance optimization.
Critical resources management.
2021-01-08 16:36:12 +01:00
Marcin Smoczyński
871b250d86 [EGD-4534] Change audio data path synchronization
Refactor audio data path to fix several synchronization issues and
excessive copy operations on large memory blocks. Introduce
audio::Stream data structure to allow connecting audio source and sink
with a zero-copy capability.

Introduce system mechanisms:
 - critical section guard lock needed for stream synchronization
 - non-cacheable memory allocator to allocate memory for DMA safe
   buffers

Update the Googletest CMake template to match the capabilities of the
Catch2 template.

Signed-off-by: Marcin Smoczyński <smoczynski.marcin@gmail.com>
Signed-off-by: Hubert Chrzaniuk <hubert.chrzaniuk@mudita.com>
2020-12-17 12:20:40 +01:00
Piotr Tanski
5c57dff00e [EGD-4713] Add task control block into a heap allocated memory block for debug purposes. (#1143) 2020-12-14 11:44:56 +01:00
Maciej Gibowicz
9c9e921ab4 [EGD-4693] PowerManagement: CPU load measurement (#1156)
Add FreeRTOS idle tasks Run Time Statistics

This will allow to measure the CPU load
2020-12-10 17:27:54 +01:00
Maciej Gibowicz
fb22548963 [EGD-4723] PowerManagement: Enable FreeRTOS Run Time Statistics (#1147)
Add FreeRTOS Run Time Statistics for measuring CPU load
2020-12-08 10:58:36 +01:00
Lucjan Bryndza
e5199a3764 [EGD-4261] stdlib file access syscalls for RT1051 platform (#952)
* [EGD-4261] Initial version of syscalls

* [EGD-4261]  CR small fixes

* [EGD-4261] Rename namespace and fsync call

Rename namespace vfs::internal for clarify that syscall functions are for internal use only

* [EGD-4261] Handle manager for stdlib

Handle manager layer for STDIO compatibility.

* [EGD-4261] Initial version of sysscall (old vfs)

* [EGD-4261] Direntry syscalls completed

* [EGD-4261] Fixes in handle manager

* [EGD-4261] Add support for std::filesystem.

libstdc++ from compiler is compiled without <dirent.h>
, so std::directory_iterator doesn't work.
Our implementation fix this issue and override
libstdc++ library code

* [EGD-4261] Compile syscalls only on RT1051 target

* [EGD-4261] RT compile fix

* [EGD-4261] Code review small fixes

* [EGD-4261] Code review fixes

* [EGD-4261] Remove redundant noisy debug log msg.

Co-authored-by: Lucjan Bryndza <lucjan.bryndza@mudita.com>
2020-11-06 09:45:15 +01:00