1
0
forked from me/IronOS

Clean up file locations

This commit is contained in:
Ben V. Brown
2020-05-29 20:13:18 +10:00
parent 45614ff397
commit 3b0fc9c6f8
2 changed files with 267 additions and 267 deletions

View File

@@ -1,184 +1,184 @@
/** /**
***************************************************************************** *****************************************************************************
** **
** File : syscalls.c ** File : syscalls.c
** **
** Author : Auto-generated by STM32CubeIDE ** Author : Auto-generated by STM32CubeIDE
** **
** Abstract : STM32CubeIDE Minimal System calls file ** Abstract : STM32CubeIDE Minimal System calls file
** **
** For more information about which c-functions ** For more information about which c-functions
** need which of these lowlevel functions ** need which of these lowlevel functions
** please consult the Newlib libc-manual ** please consult the Newlib libc-manual
** **
** Environment : STM32CubeIDE MCU ** Environment : STM32CubeIDE MCU
** **
** Distribution: The file is distributed as is, without any warranty ** Distribution: The file is distributed as is, without any warranty
** of any kind. ** of any kind.
** **
***************************************************************************** *****************************************************************************
** **
** <h2><center>&copy; COPYRIGHT(c) 2018 STMicroelectronics</center></h2> ** <h2><center>&copy; COPYRIGHT(c) 2018 STMicroelectronics</center></h2>
** **
** Redistribution and use in source and binary forms, with or without modification, ** Redistribution and use in source and binary forms, with or without modification,
** are permitted provided that the following conditions are met: ** are permitted provided that the following conditions are met:
** 1. Redistributions of source code must retain the above copyright notice, ** 1. Redistributions of source code must retain the above copyright notice,
** this list of conditions and the following disclaimer. ** this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright notice, ** 2. Redistributions in binary form must reproduce the above copyright notice,
** this list of conditions and the following disclaimer in the documentation ** this list of conditions and the following disclaimer in the documentation
** and/or other materials provided with the distribution. ** and/or other materials provided with the distribution.
** 3. Neither the name of STMicroelectronics nor the names of its contributors ** 3. Neither the name of STMicroelectronics nor the names of its contributors
** may be used to endorse or promote products derived from this software ** may be used to endorse or promote products derived from this software
** without specific prior written permission. ** without specific prior written permission.
** **
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE ** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER ** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
** **
** **
***************************************************************************** *****************************************************************************
*/ */
/* Includes */ /* Includes */
#include <sys/stat.h> #include <sys/stat.h>
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <signal.h> #include <signal.h>
#include <time.h> #include <time.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/times.h> #include <sys/times.h>
/* Variables */ /* Variables */
//#undef errno //#undef errno
extern int errno; extern int errno;
extern int __io_putchar(int ch) __attribute__((weak)); extern int __io_putchar(int ch) __attribute__((weak));
extern int __io_getchar(void) __attribute__((weak)); extern int __io_getchar(void) __attribute__((weak));
register char * stack_ptr asm("sp"); register char * stack_ptr asm("sp");
char *__env[1] = { 0 }; char *__env[1] = { 0 };
char **environ = __env; char **environ = __env;
/* Functions */ /* Functions */
void initialise_monitor_handles() void initialise_monitor_handles()
{ {
} }
int _getpid(void) int _getpid(void)
{ {
return 1; return 1;
} }
int _kill(int pid, int sig) int _kill(int pid, int sig)
{ {
errno = EINVAL; errno = EINVAL;
return -1; return -1;
} }
void _exit (int status) void _exit (int status)
{ {
_kill(status, -1); _kill(status, -1);
while (1) {} /* Make sure we hang here */ while (1) {} /* Make sure we hang here */
} }
__attribute__((weak)) int _read(int file, char *ptr, int len) __attribute__((weak)) int _read(int file, char *ptr, int len)
{ {
int DataIdx; int DataIdx;
for (DataIdx = 0; DataIdx < len; DataIdx++) for (DataIdx = 0; DataIdx < len; DataIdx++)
{ {
*ptr++ = __io_getchar(); *ptr++ = __io_getchar();
} }
return len; return len;
} }
__attribute__((weak)) int _write(int file, char *ptr, int len) __attribute__((weak)) int _write(int file, char *ptr, int len)
{ {
int DataIdx; int DataIdx;
for (DataIdx = 0; DataIdx < len; DataIdx++) for (DataIdx = 0; DataIdx < len; DataIdx++)
{ {
__io_putchar(*ptr++); __io_putchar(*ptr++);
} }
return len; return len;
} }
int _close(int file) int _close(int file)
{ {
return -1; return -1;
} }
int _fstat(int file, struct stat *st) int _fstat(int file, struct stat *st)
{ {
st->st_mode = S_IFCHR; st->st_mode = S_IFCHR;
return 0; return 0;
} }
int _isatty(int file) int _isatty(int file)
{ {
return 1; return 1;
} }
int _lseek(int file, int ptr, int dir) int _lseek(int file, int ptr, int dir)
{ {
return 0; return 0;
} }
int _open(char *path, int flags, ...) int _open(char *path, int flags, ...)
{ {
/* Pretend like we always fail */ /* Pretend like we always fail */
return -1; return -1;
} }
int _wait(int *status) int _wait(int *status)
{ {
errno = ECHILD; errno = ECHILD;
return -1; return -1;
} }
int _unlink(char *name) int _unlink(char *name)
{ {
errno = ENOENT; errno = ENOENT;
return -1; return -1;
} }
int _times(struct tms *buf) int _times(struct tms *buf)
{ {
return -1; return -1;
} }
int _stat(char *file, struct stat *st) int _stat(char *file, struct stat *st)
{ {
st->st_mode = S_IFCHR; st->st_mode = S_IFCHR;
return 0; return 0;
} }
int _link(char *old, char *new) int _link(char *old, char *new)
{ {
errno = EMLINK; errno = EMLINK;
return -1; return -1;
} }
int _fork(void) int _fork(void)
{ {
errno = EAGAIN; errno = EAGAIN;
return -1; return -1;
} }
int _execve(char *name, char **argv, char **env) int _execve(char *name, char **argv, char **env)
{ {
errno = ENOMEM; errno = ENOMEM;
return -1; return -1;
} }

View File

@@ -1,83 +1,83 @@
/** /**
***************************************************************************** *****************************************************************************
** **
** File : sysmem.c ** File : sysmem.c
** **
** Author : Auto-generated by STM32CubeIDE ** Author : Auto-generated by STM32CubeIDE
** **
** Abstract : STM32CubeIDE Minimal System Memory calls file ** Abstract : STM32CubeIDE Minimal System Memory calls file
** **
** For more information about which c-functions ** For more information about which c-functions
** need which of these lowlevel functions ** need which of these lowlevel functions
** please consult the Newlib libc-manual ** please consult the Newlib libc-manual
** **
** Environment : STM32CubeIDE MCU ** Environment : STM32CubeIDE MCU
** **
** Distribution: The file is distributed as is, without any warranty ** Distribution: The file is distributed as is, without any warranty
** of any kind. ** of any kind.
** **
***************************************************************************** *****************************************************************************
** **
** <h2><center>&copy; COPYRIGHT(c) 2018 STMicroelectronics</center></h2> ** <h2><center>&copy; COPYRIGHT(c) 2018 STMicroelectronics</center></h2>
** **
** Redistribution and use in source and binary forms, with or without modification, ** Redistribution and use in source and binary forms, with or without modification,
** are permitted provided that the following conditions are met: ** are permitted provided that the following conditions are met:
** 1. Redistributions of source code must retain the above copyright notice, ** 1. Redistributions of source code must retain the above copyright notice,
** this list of conditions and the following disclaimer. ** this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright notice, ** 2. Redistributions in binary form must reproduce the above copyright notice,
** this list of conditions and the following disclaimer in the documentation ** this list of conditions and the following disclaimer in the documentation
** and/or other materials provided with the distribution. ** and/or other materials provided with the distribution.
** 3. Neither the name of STMicroelectronics nor the names of its contributors ** 3. Neither the name of STMicroelectronics nor the names of its contributors
** may be used to endorse or promote products derived from this software ** may be used to endorse or promote products derived from this software
** without specific prior written permission. ** without specific prior written permission.
** **
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE ** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER ** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
** **
** **
***************************************************************************** *****************************************************************************
*/ */
/* Includes */ /* Includes */
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
/* Variables */ /* Variables */
extern int errno; extern int errno;
register char * stack_ptr asm("sp"); register char * stack_ptr asm("sp");
/* Functions */ /* Functions */
/** /**
_sbrk _sbrk
Increase program data space. Malloc and related functions depend on this Increase program data space. Malloc and related functions depend on this
**/ **/
caddr_t _sbrk(int incr) caddr_t _sbrk(int incr)
{ {
extern char end asm("end"); extern char end asm("end");
static char *heap_end; static char *heap_end;
char *prev_heap_end; char *prev_heap_end;
if (heap_end == 0) if (heap_end == 0)
heap_end = &end; heap_end = &end;
prev_heap_end = heap_end; prev_heap_end = heap_end;
if (heap_end + incr > stack_ptr) if (heap_end + incr > stack_ptr)
{ {
errno = ENOMEM; errno = ENOMEM;
return (caddr_t) -1; return (caddr_t) -1;
} }
heap_end += incr; heap_end += incr;
return (caddr_t) prev_heap_end; return (caddr_t) prev_heap_end;
} }