|
| 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 | +/******************************************************************* |
| 35 | + * Symbols controlling behavior of this code... |
| 36 | + * |
| 37 | + * __MTB_DISABLE |
| 38 | + * If this symbol is defined, then the buffer array for the MTB |
| 39 | + * will not be created. |
| 40 | + * |
| 41 | + * __MTB_BUFFER_SIZE |
| 42 | + * Symbol specifying the sizer of the buffer array for the MTB. |
| 43 | + * This must be a power of 2 in size, and fit into the available |
| 44 | + * RAM. The MTB buffer will also be aligned to its 'size' |
| 45 | + * boundary and be placed at the start of a RAM bank (which |
| 46 | + * should ensure minimal or zero padding due to alignment). |
| 47 | + * |
| 48 | + * __MTB_RAM_BANK |
| 49 | + * Allows MTB Buffer to be placed into specific RAM bank. When |
| 50 | + * this is not defined, the "default" (first if there are |
| 51 | + * several) RAM bank is used. |
| 52 | + *******************************************************************/ |
| 53 | + |
| 54 | +// Ignore with none Code Red tools |
| 55 | +#if defined (__CODE_RED) |
| 56 | + |
| 57 | +// Allow MTB to be removed by setting a define (via command line) |
| 58 | +#if !defined (__MTB_DISABLE) |
| 59 | + |
| 60 | + // Allow for MTB buffer size being set by define set via command line |
| 61 | + // Otherwise provide small default buffer |
| 62 | + #if !defined (__MTB_BUFFER_SIZE) |
| 63 | + #define __MTB_BUFFER_SIZE 128 |
| 64 | + #endif |
| 65 | + |
| 66 | + // Check that buffer size requested is >0 bytes in size |
| 67 | + #if (__MTB_BUFFER_SIZE > 0) |
| 68 | + // Pull in MTB related macros |
| 69 | + #include <cr_mtb_buffer.h> |
| 70 | + |
| 71 | + // Check if MYTB buffer is to be placed in specific RAM bank |
| 72 | + #if defined(__MTB_RAM_BANK) |
| 73 | + // Place MTB buffer into explicit bank of RAM |
| 74 | + __CR_MTB_BUFFER_EXT(__MTB_BUFFER_SIZE,__MTB_RAM_BANK); |
| 75 | + #else |
| 76 | + // Place MTB buffer into 'default' bank of RAM |
| 77 | + __CR_MTB_BUFFER(__MTB_BUFFER_SIZE); |
| 78 | + |
| 79 | + #endif // defined(__MTB_RAM_BANK) |
| 80 | + |
| 81 | + #endif // (__MTB_BUFFER_SIZE > 0) |
| 82 | + |
| 83 | +#endif // !defined (__MTB_DISABLE) |
| 84 | + |
| 85 | +#endif // defined (__CODE_RED) |
0 commit comments