mtb.c 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. //*****************************************************************************
  2. // +--+
  3. // | ++----+
  4. // +-++ |
  5. // | |
  6. // +-+--+ |
  7. // | +--+--+
  8. // +----+ Copyright (c) 2013 Code Red Technologies Ltd.
  9. //
  10. // mtb.c
  11. //
  12. // Optionally defines an array to be used as a buffer for Micro Trace
  13. // Buffer (MTB) instruction trace on Cortex-M0+ parts
  14. //
  15. // Version : 130502
  16. //
  17. // Software License Agreement
  18. //
  19. // The software is owned by Code Red Technologies and/or its suppliers, and is
  20. // protected under applicable copyright laws. All rights are reserved. Any
  21. // use in violation of the foregoing restrictions may subject the user to criminal
  22. // sanctions under applicable laws, as well as to civil liability for the breach
  23. // of the terms and conditions of this license.
  24. //
  25. // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
  26. // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
  27. // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
  28. // USE OF THIS SOFTWARE FOR COMMERCIAL DEVELOPMENT AND/OR EDUCATION IS SUBJECT
  29. // TO A CURRENT END USER LICENSE AGREEMENT (COMMERCIAL OR EDUCATIONAL) WITH
  30. // CODE RED TECHNOLOGIES LTD.
  31. //
  32. //*****************************************************************************
  33. /*******************************************************************
  34. * Symbols controlling behavior of this code...
  35. *
  36. * __MTB_DISABLE
  37. * If this symbol is defined, then the buffer array for the MTB
  38. * will not be created.
  39. *
  40. * __MTB_BUFFER_SIZE
  41. * Symbol specifying the sizer of the buffer array for the MTB.
  42. * This must be a power of 2 in size, and fit into the available
  43. * RAM. The MTB buffer will also be aligned to its 'size'
  44. * boundary and be placed at the start of a RAM bank (which
  45. * should ensure minimal or zero padding due to alignment).
  46. *
  47. * __MTB_RAM_BANK
  48. * Allows MTB Buffer to be placed into specific RAM bank. When
  49. * this is not defined, the "default" (first if there are
  50. * several) RAM bank is used.
  51. *******************************************************************/
  52. // Ignore with none Code Red tools
  53. #if defined (__CODE_RED)
  54. // Allow MTB to be removed by setting a define (via command line)
  55. #if !defined (__MTB_DISABLE)
  56. // Allow for MTB buffer size being set by define set via command line
  57. // Otherwise provide small default buffer
  58. #if !defined (__MTB_BUFFER_SIZE)
  59. #define __MTB_BUFFER_SIZE 128
  60. #endif
  61. // Check that buffer size requested is >0 bytes in size
  62. #if (__MTB_BUFFER_SIZE > 0)
  63. // Pull in MTB related macros
  64. #include <cr_mtb_buffer.h>
  65. // Check if MYTB buffer is to be placed in specific RAM bank
  66. #if defined(__MTB_RAM_BANK)
  67. // Place MTB buffer into explicit bank of RAM
  68. __CR_MTB_BUFFER_EXT(__MTB_BUFFER_SIZE,__MTB_RAM_BANK);
  69. #else
  70. // Place MTB buffer into 'default' bank of RAM
  71. __CR_MTB_BUFFER(__MTB_BUFFER_SIZE);
  72. #endif // defined(__MTB_RAM_BANK)
  73. #endif // (__MTB_BUFFER_SIZE > 0)
  74. #endif // !defined (__MTB_DISABLE)
  75. #endif // defined (__CODE_RED)