Update MRI to first alpha release, version 0.1-20120510.1
[clinton/Smoothieware.git] / gcc4mbed / mri / mri.h
CommitLineData
6c79da43 1/* Copyright 2012 Adam Green (http://mbed.org/users/AdamGreen/)\r
3c132bd0 2\r
ee8a0081
AG
3 This program is free software: you can redistribute it and/or modify\r
4 it under the terms of the GNU Lesser General Public License as published\r
5 by the Free Software Foundation, either version 3 of the License, or\r
6 (at your option) any later version.\r
3c132bd0 7\r
ee8a0081
AG
8 This program is distributed in the hope that it will be useful,\r
9 but WITHOUT ANY WARRANTY; without even the implied warranty of\r
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
11 GNU Lesser General Public License for more details.\r
3c132bd0 12\r
ee8a0081
AG
13 You should have received a copy of the GNU Lesser General Public License\r
14 along with this program. If not, see <http://www.gnu.org/licenses/>. \r
3c132bd0 15*/\r
ee8a0081 16/* Monitor for Remote Inspection. */\r
3c132bd0
AW
17#ifndef _MRI_H_\r
18#define _MRI_H_\r
19\r
6c79da43
AG
20#include <stdint.h>\r
21\r
22/* Used to insert hardcoded breakpoint into user's code. */\r
3c132bd0
AW
23#define __debugbreak() { __asm volatile ("bkpt #0"); }\r
24\r
ee8a0081
AG
25/* Error strings that can be returned to GDB. */\r
26#define MRI_ERROR_INVALID_ARGUMENT "E01" /* Encountered error when parsing command arguments. */\r
27#define MRI_ERROR_MEMORY_ACCESS_FAILURE "E03" /* Couldn't access requested memory. */\r
28#define MRI_ERROR_BUFFER_OVERRUN "E04" /* Overflowed internal input/output buffer. */\r
29#define MRI_ERROR_NO_FREE_BREAKPOINT "E05" /* No free FPB breakpoint comparator slots. */\r
30\r
31\r
6c79da43
AG
32#ifdef __cplusplus\r
33extern "C"\r
34{\r
35#endif\r
36\r
37\r
38/* pDebuggerParameters string passed into __mriInit contains a space separated list of configuration parameters to be\r
39 used to initialize the debug monitor. The supported options include:\r
40 \r
41 One of these options to indicate which UART to be used for the debugger connection:\r
42 MRI_UART_MBED_USB\r
43 MRI_UART_MBED_P9_P10\r
44 MRI_UART_MBED_P13_P14\r
45 MRI_UART_MBED_P28_P27\r
46 \r
47 By default the debug monitor expects to take full control of the UART to configure baud rate, etc. However \r
48 including the following option will tell the monitor to assume that the user's firmware will configure and use the\r
49 serial port until the first exception occurs:\r
50 MRI_UART_SHARE\r
6c79da43
AG
51*/\r
52void __mriInit(const char* pDebuggerParameters);\r
53\r
54\r
ee8a0081
AG
55/* Simple assembly language stubs that can be called from user's newlib _write and _read routines which will cause the \r
56 reads and writes to be redirected to the gdb host via mri. */\r
57int __mriNewlib_SemihostWrite(int file, char *ptr, int len);\r
58int __mriNewlib_SemihostRead(int file, char *ptr, int len);\r
59\r
60\r
6c79da43
AG
61#ifdef __cplusplus\r
62}\r
63#endif\r
64\r
3c132bd0 65#endif /* _MRI_H_ */\r
ee8a0081
AG
66\r
67\r
68#ifndef MRI_VERSION_STRING\r
69\r
70#define MRI_BRANCH "https://github.com/adamgreen/mri/tree/version_0.1"\r
71\r
72#define MRI_VERSION_MAJOR 0\r
73#define MRI_VERSION_MINOR 1\r
74#define MRI_VERSION_BUILD 20120510\r
75#define MRI_VERSION_SUBBUILD 1\r
76\r
77#define MRI_STR(X) MRI_STR2(X)\r
78#define MRI_STR2(X) #X\r
79\r
80#define MRI_VERSION_STRING MRI_STR(MRI_VERSION_MAJOR) "." MRI_STR(MRI_VERSION_MINOR) "-" MRI_STR(MRI_VERSION_BUILD) "." MRI_STR(MRI_VERSION_SUBBUILD)\r
81\r
82#endif\r