AnsweredAssumed Answered

What is the correct C/C++ library to use with mcu-boot / kboot?

Question asked by Lucas Magasweran on Nov 28, 2018
Latest reply on Dec 2, 2018 by Hui_Ma

What is the correct C/C++ library to use with mcu-boot / kboot? Specifically, the "freedom_bootloader" project from the FRDM-K22F SDK version 2.4.1.

 

Using the MCUXpresso IDE 10.2.1 (on Ubuntu Linux 16.04 64-bit) "Import SDK example(s)", and accepting the default, "Redlib (semihost-nf)" will be selected. However, this fails to compile with the following error.

 

Building file: ../source/usb/bm_composite/msc_disk.c
Invoking: MCU C Compiler
arm-none-eabi-gcc -std=gnu99 -D__REDLIB__ -DCPU_MK22FN512VDC12_cm4 -DCPU_MK22FN512VDC12 -D__SEMIHOST_HARDFAULT_DISABLE=1 -DCPU_MK22FN512VLH12 -DFREEDOM -DBL_TARGET_FLASH -DFRDM_K22F -DUSB_STACK_BM -DSDK_DEBUGCONSOLE=0 -DCR_INTEGER_PRINTF -DPRINTF_FLOAT_ENABLE=0 -D__MCUXPRESSO -D__USE_CMSIS -DDEBUG -I../board -I../source -I../ -I../MK22F51212_application_0x0000_linker -I../drivers -I../CMSIS -I../usb/device/source/khci -I../usb/include -I../osa -I../startup -I../source/autobaud -I../source/bootloader -I../source/crc -I../source/drivers/microseconds -I../source/include -I../source/memory/src -I../source/memory -I../source/packet -I../source/property -I../source/sbloader -I../source/utilities -I../source/drivers/smc -I../MK22F51212 -I../source/usb/bm_composite -I../usb/device/class/hid -I../usb/device/class/msc -I../usb/device/class -I../usb/device/source -I../usb/device/include -Os -fno-common -g -c -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -D__REDLIB__ -specs=redlib.specs -MMD -MP -MF"source/usb/bm_composite/msc_disk.d" -MT"source/usb/bm_composite/msc_disk.o" -MT"source/usb/bm_composite/msc_disk.d" -o "source/usb/bm_composite/msc_disk.o" "../source/usb/bm_composite/msc_disk.c"
In file included from ../source/usb/bm_composite/msc_disk.c:27:0:
../source/usb/bm_composite/fat_directory_entry.h:11:10: fatal error: wchar.h: No such file or directory
#include <wchar.h>
^~~~~~~~~
compilation terminated.
source/usb/bm_composite/subdir.mk:27: recipe for target 'source/usb/bm_composite/msc_disk.o' failed
make: *** [source/usb/bm_composite/msc_disk.o] Error 1

 

Changing "Library headers" under “MCU Compiler” -> “Miscellaneous” and “Architecture & Headers” -> “MCU Assembler” to NewlibNano (auto) fixes the build. However, the setting does not persist. Reopening the project properties immediately after a build or after restarting the IDE shows the "Library headers" reverted back to "Redlib (auto)". Also, after changing the "Library headers" to "NewlibNano (auto)" the built-in include paths under "C/C++ General" -> "Paths and Symbols" does not change from the relib paths to the arm-none-eabi include paths.

 

The "Quick Settings" -> "Set library/header type" is also not available (grayed out).

 

The only way I can fix this permanently is if I re-import the project and select the C/C++ library before importing.

 

Am I doing this wrong? Is "NewlibNano (auto)" the correct library to use for the bootloader?

Outcomes