Actually, I did have "%llu" in my code to display a 64-bit unsigned. And as I noted, 64-bit values are displayed correctly if my application is linked with Newlib, but not NewlibNano. I've isolated an example into a separate function this morning:
#include <stdio.h>
#include <stdint.h>
#include <math.h>
#include <MK22F12810.h>
int cmd_test(int argc, char *argv[]) {
uint64_t i = 0xfedcba9876543210;
double x = 355.0 / 113.0;
printf("i = %llu (0x%llx)\n", (unsigned long long int) i, (unsigned long long int) i);
printf("x = %f\n", x);
return 0;
}
Results, if linked with NewlibNano (nohost):
QTG-1.0 > test
i = lu (0xlx)
x = 3.141593
If I highlight the project name, then select QuickSettings>> -> Set library/header type -> Newlib (nohost), execution terminates at the semihost hardfault exception handler when the second printf() is encountered. In my application code, I've isolated this fault to that statement by commenting it out. And, if I comment the second printf() out of my example linked with Newlib, I see this result:
QTG-1.0 > test
i = 18364758544493064720 (0xfedcba9876543210)
Compiler/linker outputs for the two cases follow.
QuickSettings>> -> Set library/header type -> NewlibNano (nohost)
Building file: ../source/cmd_test.c
Invoking: MCU C Compiler
arm-none-eabi-gcc -DFSL_RTOS_BM -DSDK_OS_BAREMETAL -DCPU_MK22FN128VDC10 -DCPU_MK
22FN128VDC10_cm4 -D__MCUXPRESSO -D__USE_CMSIS -DDEBUG -D__NEWLIB__ -I/usr/local/
mcuxpressoide/arm-none-eabi/include/ -I"/home/username/MCUXpresso/QTG/source" -I
"/home/username/MCUXpresso/QTG/device" -I"/home/username/MCUXpresso/QTG/CMSIS" -
O0 -fno-common -g3 -Wall -c -ffunction-sections -fdata-sections -ffreestanding -
fno-builtin -fsingle-precision-constant -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloa
t-abi=softfp -mthumb -D__NEWLIB__ -MMD -MP -MF"source/cmd_test.d" -MT"source/cmd
_test.o" -MT"source/cmd_test.d" -o "source/cmd_test.o" "../source/cmd_test.c"
Finished building: ../source/cmd_test.c
Building target: QTG.axf
Invoking: MCU Linker
arm-none-eabi-gcc -nostdlib -Xlinker -Map="QTG.map" -Xlinker --gc-sections -Xlin
ker -print-memory-usage -Xlinker --sort-section=alignment -mcpu=cortex-m4 -mfpu=
fpv4-sp-d16 -mfloat-abi=softfp -mthumb -T "QTG_Debug.ld" -u _printf_float -o "QT
G.axf" ./startup/startup_mk22f12810.o ./source/FTM0_IRQHandler.o ./source/FTM2
_IRQHandler.o ./source/PIT0_IRQHandler.o ./source/PIT1_IRQHandler.o ./source/PIT
2_IRQHandler.o ./source/PIT3_IRQHandler.o ./source/QTG.o ./source/UARTGPS_RX_TX_
IRQHandler.o ./source/UARTUSB_RX_TX_IRQHandler.o ./source/advance_time_date.o ./
source/atolx.o ./source/calculate_crc.o ./source/cli.o ./source/cmd_baud.o ./sou
rce/cmd_cal.o ./source/cmd_date.o ./source/cmd_geo.o ./source/cmd_help.o ./sourc
e/cmd_nmea.o ./source/cmd_pinstress.o ./source/cmd_strobe.o ./source/cmd_sysrese
t.o ./source/cmd_tbcmp.o ./source/cmd_test.o ./source/crc_n.o ./source/delay.o .
/source/enqueue_char.o ./source/getchar.o ./source/global_constants.o ./source/g
lobal_variables.o ./source/inpstr.o ./source/parse_cmd_line.o ./source/parse_nme
a.o ./source/qtg.o ./source/queue_full.o ./source/semihost_hardfault.o ./source/
sysclk_start.o ./source/uart_rw.o ./device/system_MK22F12810.o ./board/board.o
./board/clock_config.o ./board/peripherals.o ./board/pin_mux.o
Memory region Used Size Region Size %age Used
PROGRAM_FLASH: 45352 B 128 KB 34.60%
SRAM_UPPER: 4024 B 16 KB 24.56%
SRAM_LOWER: 0 GB 8 KB 0.00%
Finished building target: QTG.axf
QuickSettings>> -> Set library/header type -> Newlib (nohost)
Building file: ../source/cmd_test.c
Invoking: MCU C Compiler
arm-none-eabi-gcc -DFSL_RTOS_BM -DSDK_OS_BAREMETAL -DCPU_MK22FN128VDC10 -DCPU_MK22FN128VDC10_cm4 -D__MCUXPRESSO -D__USE_CMSIS -DDEBUG -D__NEWLIB__ -I/usr/local/mcuxpressoide/arm-none-eabi/include/ -I"/home/username/MCUXpresso/QTG/source" -I"/home/username/MCUXpresso/QTG/device" -I"/home/username/MCUXpresso/QTG/CMSIS" -O0 -fno-common -g3 -Wall -c -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -fsingle-precision-constant -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -mthumb -D__NEWLIB__ -MMD -MP -MF"source/cmd_test.d" -MT"source/cmd_test.o" -MT"source/cmd_test.d" -o "source/cmd_test.o" "../source/cmd_test.c"
Finished building: ../source/cmd_test.c
Building target: QTG.axf
Invoking: MCU Linker
arm-none-eabi-gcc -nostdlib -Xlinker -Map="QTG.map" -Xlinker --gc-sections -Xlinker -print-memory-usage -Xlinker --sort-section=alignment -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -mthumb -T "QTG_Debug.ld" -o "QTG.axf" ./startup/startup_mk22f12810.o ./source/FTM0_IRQHandler.o ./source/FTM2_IRQHandler.o ./source/PIT0_IRQHandler.o ./source/PIT1_IRQHandler.o ./source/PIT2_IRQHandler.o ./source/PIT3_IRQHandler.o ./source/QTG.o ./source/UARTGPS_RX_TX_IRQHandler.o ./source/UARTUSB_RX_TX_IRQHandler.o ./source/advance_time_date.o ./source/atolx.o ./source/calculate_crc.o ./source/cli.o ./source/cmd_baud.o ./source/cmd_cal.o ./source/cmd_date.o ./source/cmd_geo.o ./source/cmd_help.o ./source/cmd_nmea.o ./source/cmd_pinstress.o ./source/cmd_strobe.o ./source/cmd_sysreset.o ./source/cmd_tbcmp.o ./source/cmd_test.o ./source/crc_n.o ./source/delay.o ./source/enqueue_char.o ./source/getchar.o ./source/global_constants.o ./source/global_variables.o ./source/inpstr.o ./source/parse_cmd_line.o ./source/parse_nmea.o ./source/qtg.o ./source/queue_full.o ./source/semihost_hardfault.o ./source/sysclk_start.o ./source/uart_rw.o ./device/system_MK22F12810.o ./board/board.o ./board/clock_config.o ./board/peripherals.o ./board/pin_mux.o
Memory region Used Size Region Size %age Used
PROGRAM_FLASH: 59660 B 128 KB 45.52%
SRAM_UPPER: 6112 B 16 KB 37.30%
SRAM_LOWER: 0 GB 8 KB 0.00%
Finished building target: QTG.axf