ВходНаше всё Теги codebook 无线电组件 Поиск Опросы Закон Пятница
26 апреля
477938 Топик полностью
fk0, легенда (04.01.2014 14:42 - 14:47, просмотров: 780) ответил VVB на Вы работали с трассировщиками? Возможность получить трассу без вмешательства в код больше никто (никакая методика, никакой отладчик) не обеспечит, любой компорт это вмешательство и использование библиотек Си, без которых в ином случае можно
Снимаю лапшу с ушей. Цитирую документ по ссылке, начиная с раздела 8 (стр. 30): http://isystem.com/files/products/OnChip/TechnicalNotes/OCD%20Cortex%20M3.pdf
Cortex-M3 processors come equipped with one or more trace modules of different types:
  • ITM - Instrumentation Trace Macrocell (software instrumentation)
  • DWT - Data Watchpoint and Trace (DWT hardware event trace)
  • ETM - Embedded Trace Macrocell (instruction and/or data trace)
  • HTM - AMBA AHB Trace Macrocell (address and data tr ace of AHB bus)
  • If the processor is equipped with an ITM module, it is possible to use software instrumentation in the target application (same concept as with printf). Software instrumentation is performed by the tar get application writing application specific values into a series of 32 ITM stimulus port registers which cause trace messages to be output over the trace port, recorded and then displayed in winIDEA trace window as software instrumentation samples, where Address column contains the address of the ITM stimulus port register and Data column contains the data that was written to the stimulus port register. Using the ITM does not cause much delay for theapplication since a FIFO buffer is used inside the ITM. In any case, it’s necessary to check if FIFO i s full before writing to it. Т.е. тормозит работу программы. И вообще функции этого модуля -- собственно сделать printf для отладки. И ничем это от printf через компорт отличаться не будет. Разве что, возможно, работать будет побыстрей. DWT module provides means for generating various hardware trace events which are user configurable in a manner very similar to the way in which hardware ac cess breakpoints on Cortex-M3 are configured... DWT Features: Four comparators, each of which can be configured a s follows: hardware watchpoint, which stops the MCU on conditi on match, ETM trigger, PC sampler event trigger, Data address sampler trigger. The first comparator can also be used to compare against the clock cycle counter instead of comparing to a data address. Counters for counting the following: MCU clock cycles, Folder instructions, Load Store Unit (LSU) operations, Sleep cycles, Cycles per instruction (CPI), Interrupt overhead, PC sampling at periodic intervals. Interrupt events trace. Функции модуля DWT нужны преимущественно для отладки и ограниченного profiling. Про компараторы можно вообще забыть (4 шт. погоды не сделают). Вообще часто то же самое можно сделать руками без поддержки аппаратуры (выделено). The ETM is an optional debug component that enables reconstruction of program execution. The ETM is designed to support only instruction trace. To enable instruction trace to be supported with a low pin-count, data trace is not included in the ETM. ETM есть не во всех ARM Cortex-M. ETM только даёт запись регистра PC. Т.е. для юнит-тестирования в частности вовсе не применим (ход программы не говорит о её работе: тестируемая функция, например, всегда приходит к одной точке, но данные может посчитать ошибочно...) Для чего применима такая трассировка для меня вообще загадка. Что-то экзотическое. На PC, например, легко организовать пошаговое исполнение (по одной инструкции процессора) программы. Но что-то я не знаю, чтоб это активно использовалось для отладки... И уж запись трассы получить можно со всеми регистрами и т.п. Because the ETM does not generate data trace information, the complex triggering capabilities are reduced too. The ETM does not include internal comparators, counters and sequencers. The DWT provides four address comparators on the data bus, which can also be configured to generate ETM match input on comparator match event. These inputs are presented to the ETM as Embedded ICE comparator inputs. A single DWT resource can trigger an ETM event and also generate instrumentation trace directly from the same event. Т.е. можно поставить 4шт. брекпойнта и ограниченно что-то поотлаживать. Вот и вся суть такой трассировки. А никак не юнит тестирование и другие чудеса.
    [ZX]