Related example project: Example
xmake will automatically detect the compiler installed by Keil/MDK, related issues #1753.
Compile with armcc
$ xmake f -p cross -a cortex-m3 --toolchain=armcc -c
$ xmake
Compile with armclang
$ xmake f -p cross -a cortex-m3 --toolchain=armclang -c
$ xmake
It should be noted that when some mdk programs all use the microlib library to run, it requires the compiler to add the __MICROLIB macro definition, and the linker to add various configurations such as --library_type=microlib.
We can set directly to the microlib runtime library through set_runtimes("microlib"), and all relevant options can be set automatically.