97 lines
1.8 KiB
C
97 lines
1.8 KiB
C
/**
|
|
******************************************************************************
|
|
* @file syscalls.c
|
|
* @author Auto-generated by STM32CubeIDE
|
|
* @brief STM32CubeIDE Minimal System calls file
|
|
*
|
|
* For more information about which c-functions
|
|
* need which of these lowlevel functions
|
|
* please consult the Newlib libc-manual
|
|
******************************************************************************
|
|
* @attention
|
|
*
|
|
* Copyright (c) 2020-2024 STMicroelectronics.
|
|
* All rights reserved.
|
|
*
|
|
* This software is licensed under terms that can be found in the LICENSE file
|
|
* in the root directory of this software component.
|
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
|
*
|
|
******************************************************************************
|
|
*/
|
|
|
|
/* 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>
|
|
#include <unistd.h>
|
|
|
|
#include "main.h"
|
|
|
|
int _getpid(void)
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
int _kill(int pid, int sig)
|
|
{
|
|
UNUSED(pid);
|
|
UNUSED(sig);
|
|
|
|
errno = EINVAL;
|
|
return -1;
|
|
}
|
|
|
|
int _read(int file, char *ptr, int len)
|
|
{
|
|
UNUSED(file);
|
|
|
|
*ptr = '\0'; //未实现
|
|
return 0;
|
|
}
|
|
|
|
int _write(int file, char *ptr, int len)
|
|
{
|
|
if (file == STDOUT_FILENO || file == STDERR_FILENO) {
|
|
HAL_UART_Transmit(&DEBUG_UART, (uint8_t*)ptr, len, 0xFFFF); //使用串口打印printf信息
|
|
}
|
|
|
|
return len;
|
|
}
|
|
|
|
int _close(int file)
|
|
{
|
|
UNUSED(file);
|
|
|
|
return -1;
|
|
}
|
|
|
|
int _fstat(int file, struct stat *st)
|
|
{
|
|
UNUSED(file);
|
|
|
|
st->st_mode = S_IFCHR;
|
|
return 0;
|
|
}
|
|
|
|
int _isatty(int file)
|
|
{
|
|
UNUSED(file);
|
|
|
|
return 1;
|
|
}
|
|
|
|
int _lseek(int file, int ptr, int dir)
|
|
{
|
|
UNUSED(file);
|
|
UNUSED(ptr);
|
|
UNUSED(ptr);
|
|
|
|
return 0;
|
|
}
|