Author Topic: Embedded Trace  (Read 9975 times)

Offline FAQ

  • Newbie
  • *
  • Posts: 27
    • View Profile
Embedded Trace
« on: September 29, 2017, 01:40:43 PM »
Have you ever tried using Embedded Trace Buffer or ETM with embedded ARM microcontrollers? Usually I find I don't need it but it may help significantly especially with issues  that occur rarely and timing related issues.

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3243
    • View Profile
    • uTasker
Re: Embedded Trace
« Reply #1 on: September 29, 2017, 01:43:33 PM »
Hi

Trace is not available on all devices - mainly the larger ones. I have never used it and have only really thought that it would be useful in quite a few circumstances.

The reasons is that uTasker is quite conservative in that it generally doesn't use nested interrupts and its OS is co-operative. This avoids complications with context switching, data sharing etc. where problems can otherwise be difficult to find without knowing what the code flow actually did before the error occurred.

The toughest problems that I generally have are with DMA (eg. debugging customer's projects where there has been an error due to DMA operations corrupting variables) - I don't think that trace can monitor such things and so wouldn't be of any help in such circumstances where is is not the CPU instruction flow that actually causes the error.

Since Trace is limited to a few parts I prefer to concentrate on (error detection/debugging) techniques that can be used on any device - although I could imagine that it may save a little time in some circumstances if available, but not necessarily be a game-changer. With FreeRTOS there are RTOS awareness aids in KDS (never used them though) and in the case of problems due to incorrect pre-emptive designs trace could them make a bigger difference.

Note that FreeRTOS is also integrated in the present Kinetis project http://www.utasker.com/forum/index.php?topic=1947.0 which allows mixing uTasker OS and FreeRTOS (for pre-emptive operations). In fact I haven't actually found a use for FreeRTOS pre-emptive operations just yet in my own work since I have always been able to do what I needed with a simple mix of interrupts and tasks, but the idea is that anyone using FreeRTOS but needing something like Modbus can then simply add it without needing any redesigns (a uTasker task does the MODBUS) or others who have libraries and FreeRTOS already working in their projects can then mix the two (uTasker components and existing FreeRTOS based projects) without any real effort.

Regards

Mark