Soldered SD Card Arduino Library 1.0.0
Easily read and write files to and form the SD card breakout! A fork of the original SDFat library by Bill Greiman.
Loading...
Searching...
No Matches
FreeStack.h
Go to the documentation of this file.
1
25#ifndef FreeStack_h
26#define FreeStack_h
31#include <stdint.h>
32#if defined(__AVR__) || defined(DOXYGEN)
33#include <avr/io.h>
35#define HAS_UNUSED_STACK 1
37extern char *__brkval;
39extern char __bss_end;
43inline int FreeStack()
44{
45 char *sp = reinterpret_cast<char *>(SP);
46 return __brkval ? sp - __brkval : sp - &__bss_end;
47}
48#elif defined(ARDUINO_ARCH_APOLLO3)
49#define HAS_UNUSED_STACK 0
50#elif defined(PLATFORM_ID) // Particle board
51#include "Arduino.h"
52inline int FreeStack()
53{
54 return System.freeMemory();
55}
56#elif defined(__IMXRT1062__)
57#define HAS_UNUSED_STACK 1
58extern uint8_t _ebss;
59inline int FreeStack()
60{
61 register uint32_t sp asm("sp");
62 return reinterpret_cast<char *>(sp) - reinterpret_cast<char *>(&_ebss);
63}
64#elif defined(__arm__)
65#define HAS_UNUSED_STACK 1
66extern "C" char *sbrk(int incr);
67inline int FreeStack()
68{
69 register uint32_t sp asm("sp");
70 return reinterpret_cast<char *>(sp) - reinterpret_cast<char *>(sbrk(0));
71}
72#else // defined(__AVR__) || defined(DOXYGEN)
73#ifndef FREE_STACK_CPP
74#warning FreeStack is not defined for this system.
75#endif // FREE_STACK_CPP
76inline int FreeStack()
77{
78 return 0;
79}
80#endif // defined(__AVR__) || defined(DOXYGEN)
81#if defined(HAS_UNUSED_STACK) || defined(DOXYGEN)
83void FillStack();
93int UnusedStack();
94#else // HAS_UNUSED_STACK
95#define HAS_UNUSED_STACK 0
96inline void FillStack()
97{
98}
99inline int UnusedStack()
100{
101 return 0;
102}
103#endif // defined(HAS_UNUSED_STACK)
104#endif // FreeStack_h
int UnusedStack()
Definition FreeStack.h:99
void FillStack()
Definition FreeStack.h:96
uint8_t _ebss
int FreeStack()
Definition FreeStack.h:43
char * __brkval
char __bss_end
char * sbrk(int incr)