mirror of
https://github.com/WeActStudio/ArduinoCore-AT32F4.git
synced 2026-05-21 01:12:00 +00:00
fix compile printf bug
This commit is contained in:
@@ -274,6 +274,24 @@ size_t Print::printFloat(double number, uint8_t digits)
|
||||
return n;
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
__attribute__((weak))
|
||||
int _write(int file, char *ptr, int len)
|
||||
{
|
||||
switch (file) {
|
||||
case STDOUT_FILENO:
|
||||
case STDERR_FILENO:
|
||||
break;
|
||||
case STDIN_FILENO:
|
||||
break;
|
||||
default:
|
||||
((class Print *)file)->write((uint8_t *)ptr, len);
|
||||
break;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
}
|
||||
|
||||
int Print::printf (const char *__restrict __format, ...)
|
||||
{
|
||||
char printf_buff[PRINT_PRINTF_BUFFER_LENGTH];
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#undef errno
|
||||
extern int errno;
|
||||
|
||||
extern size_t uart_debug_write(uint8_t *data, uint32_t size);
|
||||
|
||||
// Helper macro to mark unused parameters and prevent compiler warnings.
|
||||
// Appends _UNUSED to the variable name to prevent accidentally using them.
|
||||
@@ -12,7 +12,7 @@
|
||||
{
|
||||
"name": "AT32F403ACGU7 Core Board",
|
||||
"architecture": "at32f403a",
|
||||
"version": "0.0.2",
|
||||
"version": "0.0.3",
|
||||
"category": "Contributed",
|
||||
"url": "https://github.com/WeActStudio/ArduinoCore-AT32F4/archive/refs/heads/main.zip",
|
||||
"archiveFileName": "ArduinoCore-AT32F4-main.zip",
|
||||
|
||||
11
platform.txt
11
platform.txt
@@ -21,12 +21,13 @@ compiler.size.cmd=arm-none-eabi-size
|
||||
##Set the compiler flags
|
||||
compiler.ar.flags=rcs
|
||||
compiler.asm.flags=-mthumb -Wall -g -Os
|
||||
compiler.c.flags=-mthumb -Wall -std=gnu11 -ffunction-sections -g -Os -fno-exceptions
|
||||
compiler.cpp.flags=-mthumb -Wall -std=gnu++11 -ffunction-sections -g -Os -fno-exceptions -fno-rtti
|
||||
compiler.elf.flags=-mthumb -g -Wl,--gc-sections -Wall --specs=nano.specs -lstdc++ -lm
|
||||
compiler.c.flags=-mthumb -Wall -MMD -std=gnu11 -ffunction-sections -g -Os -fno-exceptions
|
||||
compiler.cpp.flags=-mthumb -Wall -MMD -std=gnu++11 -ffunction-sections -g -Os -fno-exceptions -fno-rtti
|
||||
compiler.elf.flags=-mthumb -g -Wl,--gc-sections -Wall -lstdc++ -lm
|
||||
compiler.hex.flags=-Oihex
|
||||
compiler.bin.flags=-Obinary
|
||||
|
||||
compiler.combine.flags=-u _printf_float -u _sbrk -u link -u _close -u _fstat -u _isatty -u _lseek -u _read -u _write -u _exit -u kill -u _getpid
|
||||
compiler.c.elf.extra_flags="-L{build.variant.path}/ld" -specs=nosys.specs -specs=nano.specs {compiler.combine.flags}
|
||||
build.common_flags=-mthumb
|
||||
|
||||
##===============================================##
|
||||
@@ -44,7 +45,7 @@ recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -m
|
||||
|
||||
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} "{archive_file_path}" "{object_file}"
|
||||
|
||||
recipe.c.combine.pattern="{compiler.path}{compiler.elf.cmd}" {compiler.elf.flags} -mcpu={build.mcu} "-L{build.variant.path}" "-T{build.variant.path}/{build.ldscript}" {object_files} "{archive_file_path}" "{build.variant.path}/{build.variant_system_lib}" -o "{build.path}/{build.project_name}.elf"
|
||||
recipe.c.combine.pattern="{compiler.path}{compiler.elf.cmd}" {compiler.elf.flags} -mcpu={build.mcu} "-L{build.variant.path}" "-T{build.variant.path}/{build.ldscript}" {object_files} "{archive_file_path}" "{build.variant.path}/{build.variant_system_lib}" {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf"
|
||||
##recipe.c.combine.pattern="{compiler.path}{compiler.elf.cmd}" {compiler.elf.flags} -mcpu={build.mcu} "-T{build.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" -o "{build.path}/{build.project_name}.elf" "-L{build.path}" -lm -lgcc -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols -Wl,--start-group {object_files} -Wl,--whole-archive "{archive_file_path}" -Wl,--no-whole-archive -Wl,--end-group
|
||||
|
||||
recipe.objcopy.eep.pattern=
|
||||
|
||||
Reference in New Issue
Block a user