Refactoring of startup code, mainly dealing with detection of unexpec… (#4275)
* Refactoring of startup code, mainly dealing with detection of unexpected restart/shutdown * Added g_FATFS_Obj initialization [Horus] * Fix normal startup * Use g_eeGeneral.unexpectedShutdown only on radios that have PWRMANAGE defined Fixes for radios that don't have power control. Other fixes * CLI test for new() * [Horus] Reboot protection reworked to also handle non-WDT events (cherry picked from commit fe9a52779d062e3f24639479273c906abe6e440b) Conflicts: radio/src/targets/horus/board.h * Reverting most of the changes * Cleanup * Added comment that explains apparent non usage of the wdt_disable() function * More cleanup * Missing include * Compilation fix
This commit is contained in:
committed by
Bertrand Songis
parent
bf15410bf1
commit
b3f4870da7
+30
-45
@@ -2,7 +2,7 @@
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
@@ -37,7 +37,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "debug.h"
|
||||
/*----------------------------------------------------------------------------
|
||||
* Exported variables
|
||||
*----------------------------------------------------------------------------*/
|
||||
@@ -50,11 +50,12 @@ extern int _heap_end;
|
||||
/*----------------------------------------------------------------------------
|
||||
* Exported functions
|
||||
*----------------------------------------------------------------------------*/
|
||||
extern void _exit( int status ) ;
|
||||
extern void _kill( int pid, int sig ) ;
|
||||
extern int _getpid ( void ) ;
|
||||
// extern void _exit( int status ) ;
|
||||
// extern void _kill( int pid, int sig ) ;
|
||||
// extern int _getpid ( void ) ;
|
||||
|
||||
unsigned char * heap = (unsigned char *)&_end;
|
||||
|
||||
extern caddr_t _sbrk(int nbytes)
|
||||
{
|
||||
if (heap + nbytes < (unsigned char *)&_heap_end) {
|
||||
@@ -70,84 +71,68 @@ extern caddr_t _sbrk(int nbytes)
|
||||
|
||||
extern int _gettimeofday(void *p1, void *p2)
|
||||
{
|
||||
return 0 ;
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern int _link( char *old, char *nw )
|
||||
extern int _link(char *old, char *nw)
|
||||
{
|
||||
return -1 ;
|
||||
return -1;
|
||||
}
|
||||
|
||||
extern int _unlink (const char *path)
|
||||
extern int _unlink(const char *path)
|
||||
{
|
||||
return -1 ;
|
||||
return -1;
|
||||
}
|
||||
|
||||
extern int _open(const char *name, int flags, int mode)
|
||||
{
|
||||
return -1 ;
|
||||
return -1;
|
||||
}
|
||||
|
||||
extern int _close( int file )
|
||||
extern int _close(int file)
|
||||
{
|
||||
return -1 ;
|
||||
return -1;
|
||||
}
|
||||
|
||||
extern int _fstat( int file, struct stat *st )
|
||||
extern int _fstat(int file, struct stat * st)
|
||||
{
|
||||
st->st_mode = S_IFCHR ;
|
||||
|
||||
return 0 ;
|
||||
st->st_mode = S_IFCHR ;
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern int _isatty( int file )
|
||||
extern int _isatty(int file)
|
||||
{
|
||||
return 1 ;
|
||||
return 1;
|
||||
}
|
||||
|
||||
extern int _lseek( int file, int ptr, int dir )
|
||||
extern int _lseek(int file, int ptr, int dir)
|
||||
{
|
||||
return 0 ;
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern int _read(int file, char *ptr, int len)
|
||||
{
|
||||
return 0 ;
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern int _write( int file, char *ptr, int len )
|
||||
extern int _write(int file, char *ptr, int len)
|
||||
{
|
||||
int iIndex ;
|
||||
|
||||
|
||||
// for ( ; *ptr != 0 ; ptr++ )
|
||||
for ( iIndex=0 ; iIndex < len ; iIndex++, ptr++ )
|
||||
{
|
||||
// TODO UART_PutChar( *ptr ) ;
|
||||
}
|
||||
|
||||
return iIndex ;
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern void _exit( int status )
|
||||
extern void _exit(int status)
|
||||
{
|
||||
#if defined(SIMU)
|
||||
printf( "Exiting with status %d.\n", status ) ;
|
||||
#endif
|
||||
for ( ; ; ) ;
|
||||
TRACE("_exit(%d)", status);
|
||||
for (;;);
|
||||
}
|
||||
|
||||
extern void _kill( int pid, int sig )
|
||||
extern void _kill(int pid, int sig)
|
||||
{
|
||||
return ;
|
||||
return ;
|
||||
}
|
||||
|
||||
extern int _getpid ( void )
|
||||
extern int _getpid()
|
||||
{
|
||||
return -1 ;
|
||||
}
|
||||
|
||||
//void _init (void)
|
||||
//{
|
||||
|
||||
//}
|
||||
|
||||
Reference in New Issue
Block a user