stm32h747/stm32h747i-disco/CM4/Src/syscalls.c
Go to the documentation of this file.
1 
24 /* Includes */
25 #include <sys/stat.h>
26 #include <stdlib.h>
27 #include <errno.h>
28 #include <stdio.h>
29 #include <signal.h>
30 #include <time.h>
31 #include <sys/time.h>
32 #include <sys/times.h>
33 
34 
35 /* Variables */
36 //#undef errno
37 extern int errno;
38 extern int __io_putchar(int ch) __attribute__((weak));
39 extern int __io_getchar(void) __attribute__((weak));
40 
41 register char * stack_ptr asm("sp");
42 
43 char *__env[1] = { 0 };
44 char **environ = __env;
45 
46 
47 /* Functions */
49 {
50 }
51 
52 int _getpid(void)
53 {
54  return 1;
55 }
56 
57 int _kill(int pid, int sig)
58 {
59  errno = EINVAL;
60  return -1;
61 }
62 
63 void _exit (int status)
64 {
65  _kill(status, -1);
66  while (1) {} /* Make sure we hang here */
67 }
68 
69 __attribute__((weak)) int _read(int file, char *ptr, int len)
70 {
71  int DataIdx;
72 
73  for (DataIdx = 0; DataIdx < len; DataIdx++)
74  {
75  *ptr++ = __io_getchar();
76  }
77 
78 return len;
79 }
80 
81 __attribute__((weak)) int _write(int file, char *ptr, int len)
82 {
83  int DataIdx;
84 
85  for (DataIdx = 0; DataIdx < len; DataIdx++)
86  {
87  __io_putchar(*ptr++);
88  }
89  return len;
90 }
91 
92 int _close(int file)
93 {
94  return -1;
95 }
96 
97 
98 int _fstat(int file, struct stat *st)
99 {
100  st->st_mode = S_IFCHR;
101  return 0;
102 }
103 
104 int _isatty(int file)
105 {
106  return 1;
107 }
108 
109 int _lseek(int file, int ptr, int dir)
110 {
111  return 0;
112 }
113 
114 int _open(char *path, int flags, ...)
115 {
116  /* Pretend like we always fail */
117  return -1;
118 }
119 
120 int _wait(int *status)
121 {
122  errno = ECHILD;
123  return -1;
124 }
125 
126 int _unlink(char *name)
127 {
128  errno = ENOENT;
129  return -1;
130 }
131 
132 int _times(struct tms *buf)
133 {
134  return -1;
135 }
136 
137 int _stat(char *file, struct stat *st)
138 {
139  st->st_mode = S_IFCHR;
140  return 0;
141 }
142 
143 int _link(char *old, char *new)
144 {
145  errno = EMLINK;
146  return -1;
147 }
148 
149 int _fork(void)
150 {
151  errno = EAGAIN;
152  return -1;
153 }
154 
155 int _execve(char *name, char **argv, char **env)
156 {
157  errno = ENOMEM;
158  return -1;
159 }
__io_putchar
int __io_putchar(int ch) __attribute__((weak))
Definition: pv_stm32f469.c:141
_open
int _open(char *path, int flags,...)
Definition: stm32h747/stm32h747i-disco/CM4/Src/syscalls.c:114
_kill
int _kill(int pid, int sig)
Definition: stm32h747/stm32h747i-disco/CM4/Src/syscalls.c:57
time.h
_isatty
int _isatty(int file)
Definition: stm32h747/stm32h747i-disco/CM4/Src/syscalls.c:104
_unlink
int _unlink(char *name)
Definition: stm32h747/stm32h747i-disco/CM4/Src/syscalls.c:126
errno
int errno
_times
int _times(struct tms *buf)
Definition: stm32h747/stm32h747i-disco/CM4/Src/syscalls.c:132
_link
int _link(char *old, char *new)
Definition: stm32h747/stm32h747i-disco/CM4/Src/syscalls.c:143
_execve
int _execve(char *name, char **argv, char **env)
Definition: stm32h747/stm32h747i-disco/CM4/Src/syscalls.c:155
python.setup.name
name
Definition: porcupine/binding/python/setup.py:69
_fork
int _fork(void)
Definition: stm32h747/stm32h747i-disco/CM4/Src/syscalls.c:149
_write
int _write(int file, char *ptr, int len)
Definition: stm32f407/stm32f407g-disc1/Src/syscalls.c:101
_wait
int _wait(int *status)
Definition: stm32h747/stm32h747i-disco/CM4/Src/syscalls.c:120
_read
int _read(int file, char *ptr, int len)
Definition: stm32f407/stm32f407g-disc1/Src/syscalls.c:133
__attribute__
__attribute__((weak))
Definition: stm32h747/stm32h747i-disco/CM4/Src/syscalls.c:69
_exit
void _exit(int status)
Definition: stm32h747/stm32h747i-disco/CM4/Src/syscalls.c:63
initialise_monitor_handles
void initialise_monitor_handles()
Definition: stm32h747/stm32h747i-disco/CM4/Src/syscalls.c:48
_stat
int _stat(char *file, struct stat *st)
Definition: stm32h747/stm32h747i-disco/CM4/Src/syscalls.c:137
_fstat
int _fstat(int file, struct stat *st)
Definition: stm32h747/stm32h747i-disco/CM4/Src/syscalls.c:98
__io_getchar
int __io_getchar(void)
Definition: stm32h747/stm32h747i-disco/CM4/Src/syscalls.c:39
_lseek
int _lseek(int file, int ptr, int dir)
Definition: stm32h747/stm32h747i-disco/CM4/Src/syscalls.c:109
python.test_porcupine.argv
argv
Definition: test_porcupine.py:158
_close
int _close(int file)
Definition: stm32h747/stm32h747i-disco/CM4/Src/syscalls.c:92
_getpid
int _getpid(void)
Definition: stm32h747/stm32h747i-disco/CM4/Src/syscalls.c:52
environ
char ** environ
Definition: stm32h747/stm32h747i-disco/CM4/Src/syscalls.c:44


picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:14:55