2018-12-25 13:06:24 -08:00
|
|
|
/*
|
2019-11-19 22:35:08 -08:00
|
|
|
* @file global_shared.h
|
2018-12-25 13:06:24 -08:00
|
|
|
*
|
|
|
|
* part of global.h which is shared between firmware and simulator
|
|
|
|
* See also common_headers.h
|
|
|
|
*
|
|
|
|
* Dec 25, 2018
|
2020-01-07 21:02:40 -08:00
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2020
|
2018-12-25 13:06:24 -08:00
|
|
|
*/
|
|
|
|
|
2019-11-19 22:35:08 -08:00
|
|
|
#pragma once
|
2018-12-25 13:06:24 -08:00
|
|
|
|
|
|
|
/**
|
2019-12-13 13:47:26 -08:00
|
|
|
* Of note is that interrupts are NOT serviced on the stack of the thread that was running when the
|
|
|
|
* interrupt occurred. The only thing that happens on that thread's stack is that its registers are
|
|
|
|
* pushed (by hardware) when an interrupt occurs, just before swapping the stack pointer out for the
|
|
|
|
* main stack (currently 0x400=1024 bytes), where the ISR actually runs.
|
2019-12-13 15:05:08 -08:00
|
|
|
* see also __main_stack_size__
|
|
|
|
* see also __process_stack_size__
|
2019-12-13 13:47:26 -08:00
|
|
|
*
|
|
|
|
* see also http://www.chibios.org/dokuwiki/doku.php?id=chibios:kb:stacks
|
2018-12-25 13:06:24 -08:00
|
|
|
*
|
2022-09-01 08:20:27 -07:00
|
|
|
* In the firmware we are using 'extern *Engine' - in the firmware Engine is a singleton
|
2018-12-25 13:06:24 -08:00
|
|
|
*
|
|
|
|
* On the other hand, in order to have a meaningful unit test we are passing Engine * engine as a parameter
|
|
|
|
*/
|
|
|
|
|
2019-11-19 22:35:08 -08:00
|
|
|
#include "global.h"
|
|
|
|
|
2019-12-13 15:02:24 -08:00
|
|
|
#define EXPECTED_REMAINING_STACK 128
|
2020-02-26 22:32:26 -08:00
|
|
|
|
2020-08-02 08:39:20 -07:00
|
|
|
/*
|
|
|
|
* Stack debugging
|
|
|
|
*/
|
|
|
|
EXTERNC int getRemainingStack(thread_t *otp);
|
|
|
|
int CountFreeStackSpace(const void* wabase);
|
2023-04-11 16:32:47 -07:00
|
|
|
void validateStack(const char*msg, ObdCode code, int stackUnusedSize);
|