A1210/Core/Src/syscalls.c

208 lines
4.3 KiB
C
Raw Normal View History

new file: .cproject new file: .gitignore new file: .mxproject new file: .project new file: .settings/com.atollic.truestudio.debug.hardware_device.prefs new file: .settings/language.settings.xml new file: .settings/org.eclipse.cdt.managedbuilder.core.prefs new file: A1210.elf.launch new file: A1210.ioc new file: Core/Inc/OLED_Fonts.h new file: Core/Inc/adc.h new file: Core/Inc/dma.h new file: Core/Inc/flash.h new file: Core/Inc/gpio.h new file: Core/Inc/main.h new file: Core/Inc/modbus.h new file: Core/Inc/my.h new file: Core/Inc/spi.h new file: Core/Inc/ssd1306.h new file: Core/Inc/ssd1306_conf.h new file: Core/Inc/ssd1306_fonts.h new file: Core/Inc/stm32f4xx_hal_conf.h new file: Core/Inc/stm32f4xx_it.h new file: Core/Inc/struct.h new file: Core/Inc/tim.h new file: Core/Inc/usart.h new file: Core/Src/OLED_Fonst.c new file: Core/Src/adc.c new file: Core/Src/dma.c new file: Core/Src/flash.c new file: Core/Src/gpio.c new file: Core/Src/main.c new file: Core/Src/spi.c new file: Core/Src/ssd1306.c new file: Core/Src/ssd1306_fonts.c new file: Core/Src/stm32f4xx_hal_msp.c new file: Core/Src/stm32f4xx_it.c new file: Core/Src/syscalls.c new file: Core/Src/system_stm32f4xx.c new file: Core/Src/tim.c new file: Core/Src/usart.c new file: Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f446xx.h new file: Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h new file: Drivers/CMSIS/Device/ST/STM32F4xx/Include/system_stm32f4xx.h new file: Drivers/CMSIS/Include/cmsis_armcc.h new file: Drivers/CMSIS/Include/cmsis_armclang.h new file: Drivers/CMSIS/Include/cmsis_compiler.h new file: Drivers/CMSIS/Include/cmsis_gcc.h new file: Drivers/CMSIS/Include/cmsis_iccarm.h new file: Drivers/CMSIS/Include/cmsis_version.h new file: Drivers/CMSIS/Include/core_armv8mbl.h new file: Drivers/CMSIS/Include/core_armv8mml.h new file: Drivers/CMSIS/Include/core_cm0.h new file: Drivers/CMSIS/Include/core_cm0plus.h new file: Drivers/CMSIS/Include/core_cm1.h new file: Drivers/CMSIS/Include/core_cm23.h new file: Drivers/CMSIS/Include/core_cm3.h new file: Drivers/CMSIS/Include/core_cm33.h new file: Drivers/CMSIS/Include/core_cm4.h new file: Drivers/CMSIS/Include/core_cm7.h new file: Drivers/CMSIS/Include/core_sc000.h new file: Drivers/CMSIS/Include/core_sc300.h new file: Drivers/CMSIS/Include/mpu_armv7.h new file: Drivers/CMSIS/Include/mpu_armv8.h new file: Drivers/CMSIS/Include/tz_context.h new file: Drivers/STM32F4xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h new file: Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal.h new file: Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_adc.h new file: Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_adc_ex.h new file: Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_cortex.h new file: Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h new file: Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h new file: Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma_ex.h new file: Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_exti.h new file: Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash.h new file: Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ex.h new file: Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ramfunc.h new file: Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h new file: Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio_ex.h new file: Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr.h new file: Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr_ex.h new file: Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc.h new file: Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc_ex.h new file: Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_spi.h new file: Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h new file: Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim_ex.h new file: Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_uart.h new file: Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_adc.h new file: Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c new file: Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc.c new file: Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc_ex.c new file: Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c new file: Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c new file: Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c new file: Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.c new file: Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c new file: Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c new file: Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c new file: Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c new file: Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c new file: Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c new file: Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c new file: Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c new file: Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.c new file: Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c new file: Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c new file: Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c new file: Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_adc.c new file: STM32F446RE_FLASH.ld new file: startup/startup_stm32f446xx.s
2023-09-25 13:12:41 +03:00
/**
*****************************************************************************
**
** File : syscalls.c
**
** Author : Auto-generated by TrueSTUDIO for STM32
**
** Abstract : TrueSTUDIO Minimal System calls file
**
** For more information about which c-functions
** need which of these lowlevel functions
** please consult the Newlib libc-manual
**
** Target : STMicroelectronics STM32
**
** Distribution: The file is distributed <EFBFBD>as is,<EFBFBD> without any warranty
** of any kind.
**
*****************************************************************************
** @attention
**
** <h2><center>&copy; COPYRIGHT(c) 2019 STMicroelectronics</center></h2>
**
** Redistribution and use in source and binary forms, with or without modification,
** are permitted provided that the following conditions are met:
** 1. Redistributions of source code must retain the above copyright notice,
** this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright notice,
** this list of conditions and the following disclaimer in the documentation
** and/or other materials provided with the distribution.
** 3. Neither the name of STMicroelectronics nor the names of its contributors
** may be used to endorse or promote products derived from this software
** without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
** 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
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
*****************************************************************************
*/
/* Includes */
#include <sys/stat.h>
#include <stdlib.h>
#include <errno.h>
#include <stdio.h>
#include <signal.h>
#include <time.h>
#include <sys/time.h>
#include <sys/times.h>
/* Variables */
//#undef errno
extern int errno;
extern int __io_putchar(int ch) __attribute__((weak));
extern int __io_getchar(void) __attribute__((weak));
register char * stack_ptr asm("sp");
char *__env[1] = { 0 };
char **environ = __env;
/* Functions */
void initialise_monitor_handles()
{
}
int _getpid(void)
{
return 1;
}
int _kill(int pid, int sig)
{
errno = EINVAL;
return -1;
}
void _exit (int status)
{
_kill(status, -1);
while (1) {} /* Make sure we hang here */
}
__attribute__((weak)) int _read(int file, char *ptr, int len)
{
int DataIdx;
for (DataIdx = 0; DataIdx < len; DataIdx++)
{
*ptr++ = __io_getchar();
}
return len;
}
__attribute__((weak)) int _write(int file, char *ptr, int len)
{
int DataIdx;
for (DataIdx = 0; DataIdx < len; DataIdx++)
{
__io_putchar(*ptr++);
}
return len;
}
caddr_t _sbrk(int incr)
{
extern char end asm("end");
static char *heap_end;
char *prev_heap_end;
if (heap_end == 0)
heap_end = &end;
prev_heap_end = heap_end;
if (heap_end + incr > stack_ptr)
{
// write(1, "Heap and stack collision\n", 25);
// abort();
errno = ENOMEM;
return (caddr_t) -1;
}
heap_end += incr;
return (caddr_t) prev_heap_end;
}
int _close(int file)
{
return -1;
}
int _fstat(int file, struct stat *st)
{
st->st_mode = S_IFCHR;
return 0;
}
int _isatty(int file)
{
return 1;
}
int _lseek(int file, int ptr, int dir)
{
return 0;
}
int _open(char *path, int flags, ...)
{
/* Pretend like we always fail */
return -1;
}
int _wait(int *status)
{
errno = ECHILD;
return -1;
}
int _unlink(char *name)
{
errno = ENOENT;
return -1;
}
int _times(struct tms *buf)
{
return -1;
}
int _stat(char *file, struct stat *st)
{
st->st_mode = S_IFCHR;
return 0;
}
int _link(char *old, char *new)
{
errno = EMLINK;
return -1;
}
int _fork(void)
{
errno = EAGAIN;
return -1;
}
int _execve(char *name, char **argv, char **env)
{
errno = ENOMEM;
return -1;
}