Arduino Mega 2560 build error: total size of local objects too large

조회 수: 4 (최근 30일)
C:/PROGRA~1/POLYSP~1/R2020a/toolbox/physmod/simscape/engine/sli/c/win64/ssc_sli_51dbd3b5.c: In function 'ssc_sli_VWUIfbRWEMtiV9ZRRaNbxF': C:/PROGRA~1/POLYSP~1/R2020a/toolbox/physmod/simscape/engine/sli/c/win64/ssc_sli_51dbd3b5.c:1166:1: error: total size of local objects too large ssc_sli_VWUIfbRWEMtiV9ZRRaNbxF(const PmIntVector ssc_sli_F7UcMb_yyWdcfq7zAn1cYG ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C:/PROGRA~1/POLYSP~1/R2020a/toolbox/physmod/simscape/engine/sli/c/win64/ssc_sli_51dbd3b5.c:1166:1: error: total size of local objects too large "C:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/hardware/tools/avr/bin/avr-gcc" -std=gnu11 -c -w -ffunction-sections -fdata-sections -MMD -DARDUINO=10801 -MMD -MP -MF"ssc_sli_9abcdb7f.dep" -MT"ssc_sli_9abcdb7f.o" -Os -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -D_RUNONTARGETHARDWARE_BUILD_ -DMODEL=Battery_two_RC_UKF -DNUMST=2 -DNCSTATES=12 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=1 -DTERMFCN=0 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DXCP_CUSTOM_PLATFORM -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DSTACK_SIZE=64 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DRT -D_MW_ARDUINO_LOOP_=1 -DMW_ARDUINO_STEP_SIZE=1000000 -DMW_ARDUINO_MICROS -D_RTT_BAUDRATE_SERIAL0_=9600 -D_RTT_ANALOG_REF_=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTERMFCN=0 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DTID01EQ=1 -DXCP_CUSTOM_PLATFORM -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DSTACK_SIZE=64 -DRT -DMODEL=Battery_two_RC_UKF -DNUMST=2 -DNCSTATES=12 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -IC:/Users/acer/Desktop/the_two_RC_model -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2020a/toolbox/target/shared/svd/include -IC:/Users/acer/Desktop/the_two_RC_model/Battery_two_RC_UKF_ert_rtw -IC:/PROGRA~1/POLYSP~1/R2020a/extern/include -IC:/PROGRA~1/POLYSP~1/R2020a/simulink/include -IC:/PROGRA~1/POLYSP~1/R2020a/rtw/c/src -IC:/PROGRA~1/POLYSP~1/R2020a/rtw/c/src/ext_mode/common -IC:/PROGRA~1/POLYSP~1/R2020a/rtw/c/ert -IC:/PROGRA~1/POLYSP~1/R2020a/toolbox/physmod/simscape/engine/sli/c/win64 -IC:/PROGRA~1/POLYSP~1/R2020a/toolbox/physmod/simscape/engine/core/c/win64 -IC:/PROGRA~1/POLYSP~1/R2020a/toolbox/physmod/simscape/compiler/core/c/win64 -IC:/PROGRA~1/POLYSP~1/R2020a/toolbox/physmod/network_engine/c/win64 -IC:/PROGRA~1/POLYSP~1/R2020a/toolbox/physmod/common/math/core/c/win64 -IC:/PROGRA~1/POLYSP~1/R2020a/toolbox/physmod/common/lang/core/c/win64 -IC:/PROGRA~1/POLYSP~1/R2020a/toolbox/physmod/common/external/library/c/win64 -IC:/PROGRA~1/POLYSP~1/R2020a/toolbox/physmod/common/foundation/core/c/win64 -IC:/Users/acer/Desktop/the_two_RC_model/slprj/ert/_sharedutils -IC:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/hardware/arduino/avr/cores/arduino -IC:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/hardware/arduino/avr/variants/standard -IC:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/libraries/Servo/src -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2020a/toolbox/target/SUPPOR~1/ARDUIN~1/include -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2020a/toolbox/target/SUPPOR~1/ARDUIN~1/SCHEDU~1/include -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2020a/toolbox/target/SUPPOR~1/ARDUIN~2/include -IC:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/hardware/tools/avr/avr/include/avr -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2020a/toolbox/target/shared/EXTERN~1/include -o "ssc_sli_9abcdb7f.o" "C:/PROGRA~1/POLYSP~1/R2020a/toolbox/physmod/simscape/engine/sli/c/win64/ssc_sli_9abcdb7f.c" "C:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/hardware/tools/avr/bin/avr-gcc" -std=gnu11 -c -w -ffunction-sections -fdata-sections -MMD -DARDUINO=10801 -MMD -MP -MF"ssc_sli_9b67747c.dep" -MT"ssc_sli_9b67747c.o" -Os -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -D_RUNONTARGETHARDWARE_BUILD_ -DMODEL=Battery_two_RC_UKF -DNUMST=2 -DNCSTATES=12 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=1 -DTERMFCN=0 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DXCP_CUSTOM_PLATFORM -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DSTACK_SIZE=64 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DRT -D_MW_ARDUINO_LOOP_=1 -DMW_ARDUINO_STEP_SIZE=1000000 -DMW_ARDUINO_MICROS -D_RTT_BAUDRATE_SERIAL0_=9600 -D_RTT_ANALOG_REF_=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTERMFCN=0 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DTID01EQ=1 -DXCP_CUSTOM_PLATFORM -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DSTACK_SIZE=64 -DRT -DMODEL=Battery_two_RC_UKF -DNUMST=2 -DNCSTATES=12 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -IC:/Users/acer/Desktop/the_two_RC_model -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2020a/toolbox/target/shared/svd/include -IC:/Users/acer/Desktop/the_two_RC_model/Battery_two_RC_UKF_ert_rtw -IC:/PROGRA~1/POLYSP~1/R2020a/extern/include -IC:/PROGRA~1/POLYSP~1/R2020a/simulink/include -IC:/PROGRA~1/POLYSP~1/R2020a/rtw/c/src -IC:/PROGRA~1/POLYSP~1/R2020a/rtw/c/src/ext_mode/common -IC:/PROGRA~1/POLYSP~1/R2020a/rtw/c/ert -IC:/PROGRA~1/POLYSP~1/R2020a/toolbox/physmod/simscape/engine/sli/c/win64 -IC:/PROGRA~1/POLYSP~1/R2020a/toolbox/physmod/simscape/engine/core/c/win64 -IC:/PROGRA~1/POLYSP~1/R2020a/toolbox/physmod/simscape/compiler/core/c/win64 -IC:/PROGRA~1/POLYSP~1/R2020a/toolbox/physmod/network_engine/c/win64 -IC:/PROGRA~1/POLYSP~1/R2020a/toolbox/physmod/common/math/core/c/win64 -IC:/PROGRA~1/POLYSP~1/R2020a/toolbox/physmod/common/lang/core/c/win64 -IC:/PROGRA~1/POLYSP~1/R2020a/toolbox/physmod/common/external/library/c/win64 -IC:/PROGRA~1/POLYSP~1/R2020a/toolbox/physmod/common/foundation/core/c/win64 -IC:/Users/acer/Desktop/the_two_RC_model/slprj/ert/_sharedutils -IC:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/hardware/arduino/avr/cores/arduino -IC:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/hardware/arduino/avr/variants/standard -IC:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/libraries/Servo/src -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2020a/toolbox/target/SUPPOR~1/ARDUIN~1/include -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2020a/toolbox/target/SUPPOR~1/ARDUIN~1/SCHEDU~1/include -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2020a/toolbox/target/SUPPOR~1/ARDUIN~2/include -IC:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/arduinoide.instrset/hardware/tools/avr/avr/include/avr -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2020a/toolbox/target/shared/EXTERN~1/include -o "ssc_sli_9b67747c.o" "C:/PROGRA~1/POLYSP~1/R2020a/toolbox/physmod/simscape/engine/sli/c/win64/ssc_sli_9b67747c.c" gmake[1]: *** [ssc_sli_51dbd3b5.o] Error 1 gmake[1]: *** Waiting for unfinished jobs.... gmake[1]: Leaving directory `C:/Users/acer/Desktop/the_two_RC_model/Battery_two_RC_UKF_ert_rtw' gmake: *** [all] Error 2 C:\Users\acer\Desktop\the_two_RC_model\Battery_two_RC_UKF_ert_rtw>echo The make command returned an error of 2 The make command returned an error of 2 C:\Users\acer\Desktop\the_two_RC_model\Battery_two_RC_UKF_ert_rtw>exit 1 Error(s) encountered while building "Battery_two_RC_UKF":

채택된 답변

Walter Roberson
Walter Roberson 2022년 8월 27일
There might be more than one way this can happen, but one of the ways it can happen is if you have a function that has local variables whose size exceeds the maximum stack size for the Arduino you are targetting.
In some cases, it can mean that you are asking for local variables larger than the entire memory of the Arduino. In other cases it can mean that the stack size is configured for smaller than that and you have exceeded the configured stack size.
It is not uncommon for a stack size to be configured when building programs. When you build a program, you are always having to balance between:
  • the stack
  • space for dynamic memory allocation
  • space for the code itself
  • space reserved for linking libraries
Some systems allow you to adjust the balance.
It is common that systems are configured so that the stack starts at one side and dynamic memory starts at the other side and they grow towards the middle. If you are working on an embedded system, there would not be any dynamic link libraries, and in theory you would not need to configure a maximum stack size for the purpose of reserving space for the dynamic libraries. On the other hand when you are using embedded systems it is often in the context of needing a guarantee that the program will never run out of stack space, so a maximum stack size is often configured anyhow...
  댓글 수: 4
Abdelkarem
Abdelkarem 2022년 9월 3일
thanks again but i still have the same issue

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Stefanie Schwarz
Stefanie Schwarz 2025년 10월 27일
From the build log, it appears that your Simulink model includes Simscape blocks. When Simscape components are present, the build process attempts to compile the Simscape runtime libraries from source, which are not designed for deployment on resource-constrained hardware.
Therefore, the 'Simulink Support Package for Arduino Hardware' does not officially support code generation and deployment for models that utilize Simscape blocks, due to the limited memory and computational capabilities of boards like the Arduino Mega 2560.

카테고리

Help CenterFile Exchange에서 Embedded Coder에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by