I am currently using the mcxn947 board to develop an object detection project, and I have already utilized the W25Q64JVSSIQ QuadSPI external flash to build my project. However, I still face the issue of insufficient SRAM size, as detailed in the following information. Could you suggest a good solution?
09:23:09 **** Incremental Build of configuration Debug for project frdmmcxn947_multi_face_detection ****
make -r -j4 all
Building file: ../source/model/model.cpp
Invoking: MCU C++ Compiler
arm-none-eabi-c++ -std=gnu++11 -DCPU_MCXN947VDF -DCPU_MCXN947VDF_cm33 -DCPU_MCXN947VDF_cm33_core0 -DSDK_DEBUGCONSOLE_UART -DARM_MATH_CM33 -D__FPU_PRESENT=1 -DTF_LITE_STATIC_MEMORY -DMCUXPRESSO_SDK -DSDK_DEBUGCONSOLE=1 -D__MCUXPRESSO -D__USE_CMSIS -DDEBUG -I"C:\nxp\neutron\dm-multiple-face-detection-on-mcxn947\source" -I"C:\nxp\neutron\dm-multiple-face-detection-on-mcxn947\source\video" -I"C:\nxp\neutron\dm-multiple-face-detection-on-mcxn947\utilities" -I"C:\nxp\neutron\dm-multiple-face-detection-on-mcxn947\eiq\tensorflow-lite" -I"C:\nxp\neutron\dm-multiple-face-detection-on-mcxn947\eiq\tensorflow-lite\third_party\flatbuffers\include" -I"C:\nxp\neutron\dm-multiple-face-detection-on-mcxn947\eiq\tensorflow-lite\third_party\gemmlowp" -I"C:\nxp\neutron\dm-multiple-face-detection-on-mcxn947\component\lists" -I"C:\nxp\neutron\dm-multiple-face-detection-on-mcxn947\component\uart" -I"C:\nxp\neutron\dm-multiple-face-detection-on-mcxn947\drivers" -I"C:\nxp\neutron\dm-multiple-face-detection-on-mcxn947\device" -I"C:\nxp\neutron\dm-multiple-face-detection-on-mcxn947\startup" -I"C:\nxp\neutron\dm-multiple-face-detection-on-mcxn947\eiq\tensorflow-lite\tensorflow\lite\micro\kernels\neutron" -I"C:\nxp\neutron\dm-multiple-face-detection-on-mcxn947\eiq\tensorflow-lite\third_party\ruy" -I"C:\nxp\neutron\dm-multiple-face-detection-on-mcxn947\CMSIS" -I"C:\nxp\neutron\dm-multiple-face-detection-on-mcxn947\eiq\tensorflow-lite\third_party\neutron\common\include" -I"C:\nxp\neutron\dm-multiple-face-detection-on-mcxn947\eiq\tensorflow-lite\third_party\neutron\driver\include" -I"C:\nxp\neutron\dm-multiple-face-detection-on-mcxn947\source\image" -I"C:\nxp\neutron\dm-multiple-face-detection-on-mcxn947\source\model" -I"C:\nxp\neutron\dm-multiple-face-detection-on-mcxn947\board" -O3 -fno-common -g3 -gdwarf-4 -Wall -fno-rtti -fno-exceptions -Wno-sign-compare -Wno-strict-aliasing -Wno-deprecated-declarations -mcpu=cortex-m33 -c -ffunction-sections -fdata-sections -fmacro-prefix-map="../source/model/"= -mcpu=cortex-m33 -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mthumb -fstack-usage -MMD -MP -MF"source/model/model.d" -MT"source/model/model.o" -MT"source/model/model.d" -o "source/model/model.o" "../source/model/model.cpp"
Finished building: ../source/model/model.cpp
Building target: frdmmcxn947_multi_face_detection.axf
Invoking: MCU C++ Linker
arm-none-eabi-c++ -nostdlib -L"C:\nxp\neutron\dm-multiple-face-detection-on-mcxn947\eiq\tensorflow-lite\lib" -L"C:\nxp\neutron\dm-multiple-face-detection-on-mcxn947\eiq\tensorflow-lite\third_party\neutron" -Xlinker -no-warn-rwx-segments -Xlinker -Map="frdmmcxn947_multi_face_detection.map" -Xlinker --gc-sections -Xlinker -print-memory-usage -Xlinker --sort-section=alignment -Xlinker --cref -mcpu=cortex-m33 -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mthumb -T frdmmcxn947_multi_face_detection_Debug.ld -o "frdmmcxn947_multi_face_detection.axf" ./utilities/fsl_assert.o ./utilities/fsl_debug_console.o ./utilities/fsl_memcpy.o ./utilities/fsl_str.o ./startup/boot_multicore_slave.o ./startup/startup_mcxn947_cm33_core0.o ./source/video/EZH_Camera.o ./source/video/display.o ./source/video/lcd_impl_flexio.o ./source/video/ov7670.o ./source/video/st7796_lcd.o ./source/model/get_top_n.o ./source/model/model.o ./source/model/model_data.o ./source/model/model_ops_npu.o ./source/model/output_postproc.o ./source/model/post_processing.o ./source/image/image_decode_raw.o ./source/image/image_load.o ./source/demo_info.o ./source/face_det.o ./source/main.o ./source/semihost_hardfault.o ./source/timer.o ./eiq/tensorflow-lite/tensorflow/lite/micro/kernels/neutron/neutron.o ./eiq/tensorflow-lite/tensorflow/lite/micro/debug_log.o ./drivers/fsl_clock.o ./drivers/fsl_common.o ./drivers/fsl_common_arm.o ./drivers/fsl_ctimer.o ./drivers/fsl_edma.o ./drivers/fsl_edma_soc.o ./drivers/fsl_flexio.o ./drivers/fsl_flexio_mculcd.o ./drivers/fsl_flexio_mculcd_edma.o ./drivers/fsl_gpio.o ./drivers/fsl_inputmux.o ./drivers/fsl_lpflexcomm.o ./drivers/fsl_lpi2c.o ./drivers/fsl_lpuart.o ./drivers/fsl_reset.o ./drivers/fsl_sctimer.o ./drivers/fsl_smartdma.o ./drivers/fsl_spc.o ./device/system_MCXN947_cm33_core0.o ./component/uart/fsl_adapter_lpuart.o ./component/lists/fsl_component_generic_list.o ./board/board.o ./board/board_init.o ./board/clock_config.o ./board/pin_mux.o -ltflm -lNeutronDriver -lNeutronFirmware
C:/nxp/MCUXpressoIDE_11.10.0_3148/ide/plugins/com.nxp.mcuxpresso.tools.win32_11.10.0.202311280810/tools/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld.exe: frdmmcxn947_multi_face_detection.axf section `.bss' will not fit in region `SRAM'
C:/nxp/MCUXpressoIDE_11.10.0_3148/ide/plugins/com.nxp.mcuxpresso.tools.win32_11.10.0.202311280810/tools/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld.exe: region `SRAM' overflowed by 523528 bytes
Memory region Used Size Region Size %age Used
QSPI_FLASH: 1153372 B 262140 KB 0.43%
QSPI_FCB: 0 GB 1 KB 0.00%
PROGRAM_FLASH0: 0 GB 1 MB 0.00%
PROGRAM_FLASH1: 0 GB 1 MB 0.00%
SRAM: 941320 B 408 KB 225.31%
SRAMX: 62 KB 96 KB 64.58%
SRAMH: 0 GB 4 KB 0.00%
USB_RAM: 0 GB 4 KB 0.00%
collect2.exe: error: ld returned 1 exit status
make[1]: *** [makefile:80: frdmmcxn947_multi_face_detection.axf] Error 1
make: *** [makefile:71: all] Error 2
"make -r -j4 all" terminated with exit code 2. Build might be incomplete.
09:23:30 Build Failed. 4 errors, 0 warnings. (took 20s.997ms)
I would like to clarify that I used NXP's eIQ software to train an SSD MobileNet V3 model, but when converting it to be used with the NPU, the header file requires a kTensorArenaSize of at least around 910KB. However, this variable exceeds the total RAM capacity of 512KB.
The current build message :
Building target: frdmmcxn947_multi_face_detection.axf
Invoking: MCU C++ Linker
arm-none-eabi-c++ -nostdlib -L"C:\nxp\neutron\dm-multiple-face-detection-on-mcxn947\eiq\tensorflow-lite\lib" -L"C:\nxp\neutron\dm-multiple-face-detection-on-mcxn947\eiq\tensorflow-lite\third_party\neutron" -Xlinker -no-warn-rwx-segments -Xlinker -Map="frdmmcxn947_multi_face_detection.map" -Xlinker --gc-sections -Xlinker -print-memory-usage -Xlinker --sort-section=alignment -Xlinker --cref -mcpu=cortex-m33 -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mthumb -T frdmmcxn947_multi_face_detection_Debug.ld -o "frdmmcxn947_multi_face_detection.axf" ./utilities/fsl_assert.o ./utilities/fsl_debug_console.o ./utilities/fsl_memcpy.o ./utilities/fsl_str.o ./startup/boot_multicore_slave.o ./startup/startup_mcxn947_cm33_core0.o ./source/video/EZH_Camera.o ./source/video/display.o ./source/video/lcd_impl_flexio.o ./source/video/ov7670.o ./source/video/st7796_lcd.o ./source/model/get_top_n.o ./source/model/model.o ./source/model/model_data.o ./source/model/model_ops_npu.o ./source/model/output_postproc.o ./source/model/yolo_post_processing.o ./source/image/image_decode_raw.o ./source/image/image_load.o ./source/demo_info.o ./source/face_det.o ./source/main.o ./source/semihost_hardfault.o ./source/servo_motor_control.o ./source/timer.o ./eiq/tensorflow-lite/tensorflow/lite/micro/kernels/neutron/neutron.o ./eiq/tensorflow-lite/tensorflow/lite/micro/debug_log.o ./drivers/fsl_clock.o ./drivers/fsl_common.o ./drivers/fsl_common_arm.o ./drivers/fsl_ctimer.o ./drivers/fsl_edma.o ./drivers/fsl_edma_soc.o ./drivers/fsl_flexio.o ./drivers/fsl_flexio_mculcd.o ./drivers/fsl_flexio_mculcd_edma.o ./drivers/fsl_gpio.o ./drivers/fsl_inputmux.o ./drivers/fsl_lpflexcomm.o ./drivers/fsl_lpi2c.o ./drivers/fsl_lpuart.o ./drivers/fsl_reset.o ./drivers/fsl_sctimer.o ./drivers/fsl_smartdma.o ./drivers/fsl_spc.o ./device/system_MCXN947_cm33_core0.o ./component/uart/fsl_adapter_lpuart.o ./component/lists/fsl_component_generic_list.o ./board/board.o ./board/board_init.o ./board/clock_config.o ./board/pin_mux.o -ltflm -lNeutronDriver -lNeutronFirmware
C:/nxp/MCUXpressoIDE_11.10.0_3148/ide/plugins/com.nxp.mcuxpresso.tools.win32_11.10.0.202311280810/tools/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld.exe: frdmmcxn947_multi_face_detection.axf section `.bss' will not fit in region `SRAM'
C:/nxp/MCUXpressoIDE_11.10.0_3148/ide/plugins/com.nxp.mcuxpresso.tools.win32_11.10.0.202311280810/tools/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld.exe: region `SRAM' overflowed by 581884 bytes
Memory region Used Size Region Size %age Used
QSPI_FLASH: 1158648 B 131070 KB 0.86%
QSPI_FCB: 0 GB 1 KB 0.00%
PROGRAM_FLASH0: 0 GB 1 MB 0.00%
PROGRAM_FLASH1: 0 GB 1 MB 0.00%
SRAM: 999676 B 408 KB 239.28%
SRAMX: 62 KB 96 KB 64.58%
SRAMH: 0 GB 4 KB 0.00%
USB_RAM: 0 GB 4 KB 0.00%
collect2.exe: error: ld returned 1 exit status
make[1]: *** [makefile:80: frdmmcxn947_multi_face_detection.axf] Error 1
make: *** [makefile:71: all] Error 2
"make -r -j4 all" terminated with exit code 2. Build might be incomplete.
16:02:55 Build Failed. 4 errors, 22 warnings. (took 56s.753ms)
Is there a way to make the kTensorArenaSize use the QSPI_FLASH space?
Or are there any other solutions?