Improved BACnet Development Kit object handling and storing to SEEPROM and EEPROM. Added device property to check C-Stack size and amount unused.

This commit is contained in:
skarg
2009-05-12 20:25:31 +00:00
parent fa3607d948
commit 9235ebeee2
11 changed files with 256 additions and 45 deletions
+27 -2
View File
@@ -29,10 +29,10 @@ extern uint8_t _end;
extern uint8_t __stack;
#define STACK_CANARY (0xC5)
void stack_paint(
void stack_init(
void) __attribute__ ((naked)) __attribute__ ((section(".init1")));
void stack_paint(
void stack_init(
void)
{
#if 0
@@ -50,3 +50,28 @@ void stack_paint(
" cpc r31,r25\n" " brlo .loop\n" " breq .loop"::);
#endif
}
unsigned stack_size(void)
{
return (&__stack) - (&_end);
}
uint8_t stack_byte(unsigned offset)
{
return *(&_end + offset);
}
unsigned stack_unused(void)
{
uint8_t *p = &_end;
unsigned count = 0;
while (p <= &__stack) {
if ((*p) != STACK_CANARY) {
count = p - (&_end);
break;
}
p++;
}
return count;
}