aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Roberts <anthony.roberts@arm.com>2020-03-09 15:13:03 +0000
committerjimqui01 <54316584+jimqui01@users.noreply.github.com>2020-03-23 17:14:30 +0000
commitf15afcef27dc63433985a2c10e5ec5981ffe55ca (patch)
treebdc2ab70faefa601075d5edf18ddc044c1fc689a
parentaf0b6a3273407c8d59491cf0b4584bc18cd29c50 (diff)
dbg: Replace checkpoint functionality with empty calls when flag is off
This allows CLI functions such as checkpoint() to be left in the code without having them behind an ifdef. Change-Id: I8680ef5cdd0ae126b41a059ca6219dd4f1674f92 Signed-off-by: Anthony Roberts <anthony.roberts@arm.com>
-rw-r--r--debugger/include/checkpoint.h62
-rw-r--r--debugger/include/cli.h19
-rw-r--r--framework/include/fwk_cli_dbg.h4
3 files changed, 80 insertions, 5 deletions
diff --git a/debugger/include/checkpoint.h b/debugger/include/checkpoint.h
index 38caceb9..af2d8921 100644
--- a/debugger/include/checkpoint.h
+++ b/debugger/include/checkpoint.h
@@ -65,16 +65,18 @@ typedef struct {
} checkpoint_st;
/*!
- * \brief Enables all checkpoints in the system.
+ * \brief Disables all checkpoints in the system.
*
*/
-void checkpoint_enable_all(void);
+void checkpoint_disable_all(void);
+
+#ifdef BUILD_HAS_DEBUGGER
/*!
- * \brief Disables all checkpoints in the system.
+ * \brief Enables all checkpoints in the system.
*
*/
-void checkpoint_disable_all(void);
+void checkpoint_enable_all(void);
/*!
* \brief Request a new checkpoint structure
@@ -107,6 +109,58 @@ int32_t checkpoint_register(checkpoint_st **c, char *name);
*/
void checkpoint(checkpoint_st *c, char *file, int32_t line, char *tag);
+#else
+
+/*!
+ * \brief Enables all checkpoints in the system.
+ *
+ */
+#define checkpoint_enable_all() (void)0
+
+/*!
+ * \brief Request a new checkpoint structure
+ *
+ * \param c Pointer to a checkpoint_st pointer, is set when the function returns
+ * successfully.
+ * \param name Name or description of the function registering. Must be less
+ * than CHECKPOINT_NAME_LEN characters in length.
+ * \retval FWK_SUCCESS if operation is successful.
+ * \retval FWK_E_NOMEM when checkpoints limit is reached.
+ *
+ */
+#define checkpoint_register(c, name) \
+ __extension__ ({ \
+ (void)c; \
+ (void)name; \
+ FWK_SUCCESS; \
+ })
+
+/*!
+ * \brief Insert a checkpoint
+ *
+ * \details Checkpoint function for use within code. When this function is
+ * called and checkpoints are disabled, it will return immediately.
+ * If checkpoints are enabled, it will print a message indicating that
+ * it is pausing and activate the CLI. When the command line exists This
+ * function will return and normal execution is resumed.
+ *
+ * \param c Pointer to valid checkpoint structure, obtained through a call to
+ * checkpoint_register.
+ * \param file Name of the file in which the checkpoint exists,
+ * use __FILE__ macro.
+ * \param line Line number of the checkpoint, use __LINE__ macro.
+ * \param tag Checkpoint tag string.
+ */
+#define checkpoint(c, file, line, tag) \
+ do { \
+ (void)c; \
+ (void)file; \
+ (void)line; \
+ (void)tag; \
+ } while (0)
+
+#endif
+
/*!
* @}
*/
diff --git a/debugger/include/cli.h b/debugger/include/cli.h
index f169bbcd..ef34d323 100644
--- a/debugger/include/cli.h
+++ b/debugger/include/cli.h
@@ -272,6 +272,8 @@ uint32_t cli_getline(
*/
int32_t cli_strncmp(const char *s1, const char *s2, uint32_t limit);
+#ifdef BUILD_HAS_DEBUGGER
+
/*!
* \brief Register a new CLI command at run time
*
@@ -282,4 +284,21 @@ int32_t cli_strncmp(const char *s1, const char *s2, uint32_t limit);
*/
int cli_command_register(cli_command_st new_cmd);
+#else
+
+/*!
+ * \brief Register a new CLI command at run time
+ *
+ * \param new_cmd The new command to register.
+ *
+ * \retval CLI_SUCCESS Operation succeeded.
+ * \retval CLI_ERR_MEM Not enough memory.
+ */
+#define cli_command_register(new_cmd) \
+ __extension__({ \
+ (void)new_cmd; \
+ FWK_SUCCESS; \
+ })
+#endif
+
#endif /* _CLI_H_ */
diff --git a/framework/include/fwk_cli_dbg.h b/framework/include/fwk_cli_dbg.h
index c9e6bc94..bcc13ffb 100644
--- a/framework/include/fwk_cli_dbg.h
+++ b/framework/include/fwk_cli_dbg.h
@@ -32,6 +32,7 @@
#define CLI_DEBUGGER() cli_init()
#else
+
/*!
* \brief Define the CLI Debugger function
*
@@ -39,7 +40,8 @@
* will be empty
*
*/
-#define CLI_DEBUGGER()
+#define CLI_DEBUGGER() do { } while (0)
+
#endif
/*!