Add stack checking functions

This commit is contained in:
2020-02-21 23:01:04 +01:00
parent b5d4bf5528
commit 68fc473372
3 changed files with 71 additions and 2 deletions

View File

@@ -29,6 +29,7 @@
#include <stm-periph/unique-id.h>
#include <reflow-controller/calibration.h>
#include <reflow-controller/temp-converter.h>
#include <reflow-controller/stack-check.h>
#ifndef GIT_VER
#define GIT_VER "VERSION NOT SET"
@@ -201,6 +202,24 @@ static shellmatta_retCode_t shell_cmd_cal(const shellmatta_handle_t handle,
calibration_sequence_shell_cmd(handle);
return SHELLMATTA_OK;
}
static shellmatta_retCode_t shell_get_sp(const shellmatta_handle_t handle,
const char *arguments,
uint32_t length)
{
(void)arguments;
(void)length;
shellmatta_printf(handle,
"Stack pointer: %p\r\n"
"Stack usage: 0x%x bytes\r\n"
"Lim to heap: 0x%x bytes\r\n",
read_stack_pointer(),
stack_check_get_usage(),
stack_check_get_free());
return SHELLMATTA_OK;
}
//typedef struct shellmatta_cmd
//{
// char *cmd; /**< command name */
@@ -211,7 +230,7 @@ static shellmatta_retCode_t shell_cmd_cal(const shellmatta_handle_t handle,
// struct shellmatta_cmd *next; /**< pointer to next command or NULL */
//} shellmatta_cmd_t;
static shellmatta_cmd_t cmd[7] = {
static shellmatta_cmd_t cmd[8] = {
{
.cmd = "version",
.cmdAlias = "ver",
@@ -266,6 +285,14 @@ static shellmatta_cmd_t cmd[7] = {
.helpText = "Calibrate resistance measurement",
.usageText = "",
.cmdFct = shell_cmd_cal,
.next = &cmd[7],
},
{
.cmd = "get-stack-pointer",
.cmdAlias = "sp",
.helpText = "Get the stack pointer",
.usageText = "",
.cmdFct = shell_get_sp,
.next = NULL,
}
};