Add nano.specs to the project

This commit is contained in:
Erki 2022-07-11 01:29:31 +03:00
parent 1bbe29b5d9
commit bbe259c29a
3 changed files with 42 additions and 3 deletions

View File

@ -51,6 +51,7 @@ add_executable(skl_tunnel
app/src/app_logging.cpp app/src/app_logging.cpp
main.cpp main.cpp
syscalls.c
) )
target_include_directories(skl_tunnel target_include_directories(skl_tunnel

View File

@ -34,9 +34,9 @@ set(CMAKE_CXX_COMPILER arm-none-eabi-g++)
set(CMAKE_ASM_COMPILER arm-none-eabi-as) set(CMAKE_ASM_COMPILER arm-none-eabi-as)
set(CMAKE_RANLIB arm-none-eabi-ranlib) set(CMAKE_RANLIB arm-none-eabi-ranlib)
set(COMMON_C_FLAGS "-mcpu=cortex-m0plus -mfloat-abi=soft -mthumb -mlong-calls -fdata-sections -ffunction-sections -Wall -Wextra -O2") set(COMMON_C_FLAGS "-mcpu=cortex-m0plus -mfloat-abi=soft -mthumb -mlong-calls -fdata-sections -ffunction-sections -Wall -Wextra -Wswitch-enum -Og")
set(CMAKE_C_FLAGS_INIT "${COMMON_C_FLAGS}") set(CMAKE_C_FLAGS_INIT "${COMMON_C_FLAGS}")
set(CMAKE_CXX_FLAGS_INIT "${COMMON_C_FLAGS} -fno-exceptions -fno-rtti") set(CMAKE_CXX_FLAGS_INIT "${COMMON_C_FLAGS} -fno-exceptions -fno-rtti -fno-use-cxa-atexit")
set(CMAKE_ASM_FLAGS_INIT "${COMMON_C_FLAGS}") set(CMAKE_ASM_FLAGS_INIT "${COMMON_C_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS_INIT "${COMMON_C_FLAGS} -specs=nosys.specs") set(CMAKE_EXE_LINKER_FLAGS_INIT "${COMMON_C_FLAGS} -specs=nano.specs -specs=nosys.specs")

38
syscalls.c Normal file
View File

@ -0,0 +1,38 @@
//
// Created by erki on 10.07.22.
//
#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>
extern int __io_putchar(int ch) __attribute__((weak));
extern int __io_getchar(void) __attribute__((weak));
__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;
}