Skip to content

Commit e12889d

Browse files
committed
microlib support: Fix build with Arm Compiler 6 and MicroLib
Building binaries with MicroLib and Arm compiler 6 has been failing because of a bug in Arm compiler 6. The compiler introduces a symbol, `__scanf_mbtowc`, which is not present in MicroLib C library. The present commit adds a weak reference to the symbol to allow a successful linkage. This is a temporary fix until the bug in the compiler is fixed. It should be removed after the compiler bug is fixed.
1 parent 9cc1caa commit e12889d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

rtos/TARGET_CORTEX/TOOLCHAIN_ARM_MICRO/mbed_boot_arm_micro.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,20 @@ MBED_WEAK void __aeabi_assert(const char *expr, const char *file, int line)
6868
{
6969
mbed_assert_internal(expr, file, line);
7070
}
71+
72+
// The below resolves the linker error generated by a bug in Arm Compiler 6
73+
// When building with MicroLib, the compiler inadvertently introduces the
74+
// _scanf_mbtowc symbol to the build. The code below provides a weak reference
75+
// for the missing symbol
76+
#include <stdio.h>
77+
typedef int ScanfReadRec;
78+
MBED_WEAK long int _scanf_mbtowc(
79+
int ignored,
80+
FILE *p,
81+
ScanfReadRec *sr,
82+
int *charmap,
83+
int exact
84+
)
85+
{
86+
return 0;
87+
}

0 commit comments

Comments
 (0)