This repository was archived by the owner on Mar 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathsyscalls_stm8.c
114 lines (92 loc) · 2.64 KB
/
syscalls_stm8.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*
Copyright (c) 2011 Arduino. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* \file syscalls_sam3.c
*
* Implementation of newlib syscall.
*
*/
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include <stdio.h>
#include <stdarg.h>
#if defined(__GNUC__) /* GCC CS3 */
#include <sys/types.h>
#include <sys/stat.h>
#endif
#include "Arduino.h"
// Helper macro to mark unused parameters and prevent compiler warnings.
// Appends _UNUSED to the variable name to prevent accidentally using them.
#undef UNUSED
#ifdef __GNUC__
#define UNUSED(x) x##_UNUSED __attribute__((__unused__))
#else
#define UNUSED(x) x##_UNUSED
#endif
/*----------------------------------------------------------------------------
* Exported variables
*----------------------------------------------------------------------------*/
#undef errno
extern int errno;
extern int _end;
/*----------------------------------------------------------------------------
* Exported functions
*----------------------------------------------------------------------------*/
extern void _exit(int status);
extern void _kill(int pid, int sig);
extern int _getpid(void);
extern int link(UNUSED(char *cOld), UNUSED(char *cNew))
{
return -1;
}
extern int _close(UNUSED(int file))
{
return -1;
}
extern int _isatty(UNUSED(int file))
{
return 1;
}
extern int _lseek(UNUSED(int file), UNUSED(int ptr), UNUSED(int dir))
{
return 0;
}
extern int _read(UNUSED(int file), UNUSED(char *ptr), UNUSED(int len))
{
return 0;
}
extern int __write(UNUSED(int file), char *ptr, int len)
{
int iIndex = 0;
for (iIndex = 0; iIndex < len; iIndex++)
{
}
return iIndex;
}
extern void _exit(int status)
{
printf("Exiting with status %d.\n", status);
for (;;)
;
}
extern void _kill(UNUSED(int pid), UNUSED(int sig))
{
return;
}
extern int _getpid(void)
{
return -1;
}