- clang h743 build and run cdc_msc ok

- switch unit test back to gcc, since path to clang conflict on local setup (x86 and arm)
This commit is contained in:
hathach
2024-04-17 20:06:13 +07:00
parent 96f7ca02bf
commit 3442a87d5b
7 changed files with 33 additions and 15 deletions

View File

@@ -108,6 +108,25 @@ TU_ATTR_USED int sys_read (int fhdl, char *buf, size_t count) {
// st->st_mode = S_IFCHR;
//}
// Clang use picolibc
#if defined(__clang__)
static int cl_putc(char c, FILE *f) {
(void) f;
return sys_write(0, &c, 1);
}
static int cl_getc(FILE* f) {
(void) f;
char c;
return sys_read(0, &c, 1) > 0 ? c : -1;
}
static FILE __stdio = FDEV_SETUP_STREAM(cl_putc, cl_getc, NULL, _FDEV_SETUP_RW);
FILE *const stdin = &__stdio;
__strong_reference(stdin, stdout);
__strong_reference(stdin, stderr);
#endif
int board_getchar(void) {
char c;
return (sys_read(0, &c, 1) > 0) ? (int) c : (-1);

View File

@@ -56,10 +56,8 @@ function(add_board_target BOARD_TARGET)
${ST_CMSIS}/Include
${ST_HAL_DRIVER}/Inc
)
target_compile_options(${BOARD_TARGET} PUBLIC
)
target_compile_definitions(${BOARD_TARGET} PUBLIC
)
#target_compile_options(${BOARD_TARGET} PUBLIC)
#target_compile_definitions(${BOARD_TARGET} PUBLIC)
update_board(${BOARD_TARGET})
@@ -75,6 +73,7 @@ function(add_board_target BOARD_TARGET)
)
elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang")
target_link_options(${BOARD_TARGET} PUBLIC
#-ldummyhost
"LINKER:--script=${LD_FILE_GNU}"
)
endif ()