This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28021: How do I select a part of the code to run from RAM using #pragma?

Part Number: TMS320F28021
Other Parts Discussed in Thread: CONTROLSUITE

I have developed a program for TMS320F28021. To increase my execution speed, I want to run a part of the code from RAM. I have included my main program to run from RAM using the following statement:

#pragma CODE_SECTION(HF_1KVA_Current_step,"ramfuncs")

But the size of my main code is very high. I'm getting the following error while building the program:

**** Build of configuration Debug for project HF_1KVA_Current ****

"C:\\ti\\ccs1010\\ccs\\utils\\bin\\gmake" -k all

Building file: "E:/Frontline/HF_UPS/1KVA/CHECK123_Current/HF_1KVA_Current_ert_rtw/HF_1KVA_Current.c"
Invoking: C2000 Compiler
"C:/PROGRA~3/MATLAB/SUPPOR~1/R2020a/3P778C~1.INS/TIC200~1.INS/ti-cgt-c2000_18.12.2.LTS/bin/cl2000" --include_path="C:/PROGRA~3/MATLAB/SUPPOR~1/R2020a/3P778C~1.INS/TIC200~1.INS/ti-cgt-c2000_18.12.2.LTS/include" --include_path="E:/Frontline/HF_UPS/1KVA/CHECK123_Current" --include_path="C:/ProgramData/MATLAB/SupportPackages/R2020b/toolbox/target/supportpackages/tic2000_base/crl" --include_path="E:/Frontline/HF_UPS/1KVA/CHECK123_Current/HF_1KVA_Current_ert_rtw" --include_path="C:/Program Files/MATLAB/R2020b/extern/include" --include_path="C:/Program Files/MATLAB/R2020b/simulink/include" --include_path="C:/Program Files/MATLAB/R2020b/rtw/c/src" --include_path="C:/Program Files/MATLAB/R2020b/rtw/c/src/ext_mode/common" --include_path="C:/Program Files/MATLAB/R2020b/rtw/c/ert" --include_path="E:/Frontline/HF_UPS/1KVA/CHECK123_Current/slprj/ert/_sharedutils" --include_path="C:/ProgramData/MATLAB/SupportPackages/R2020b/toolbox/target/supportpackages/tic2000/src" --include_path="C:/ProgramData/MATLAB/SupportPackages/R2020b/toolbox/target/supportpackages/tic2000/inc" --include_path="C:/ProgramData/MATLAB/SupportPackages/R2020b/toolbox/shared/supportpackages/tic2000/src" --include_path="C:/ProgramData/MATLAB/SupportPackages/R2020b/toolbox/shared/supportpackages/tic2000/inc" --include_path="C:/ti/controlSUITE/device_support/f2802x/v230/f2802x_common/include" --include_path="C:/ti/controlSUITE/device_support/f2802x/v230/f2802x_headers/include" --include_path="C:/ti/controlSUITE/device_support/f2802x/v230" --include_path="C:/ProgramData/MATLAB/SupportPackages/R2020b/toolbox/target/shared/externalmode_daemon/include" --define=MODEL=HF_1KVA_Current --define=NUMST=1 --define=NCSTATES=0 --define=HAVESTDIO --define=MODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 --define=CLASSIC_INTERFACE=0 --define=ALLOCATIONFCN=0 --define=TID01EQ=0 --define=TERMFCN=0 --define=ONESTEPFCN=1 --define=MAT_FILE=0 --define=MULTI_INSTANCE_CODE=0 --define=INTEGER_CODE=0 --define=MT=0 --define=DAEMON_MODE=1 --define=XCP_CUSTOM_PLATFORM --define=MW_PIL_SCIFIFOLEN=4 --define=STACK_SIZE=768 --define=__MW_TARGET_USE_HARDWARE_RESOURCES_H__ --define=RT --define=F28021 --define=BOOT_FROM_FLASH=1 -s -v28 -ml --preproc_dependency=HF_1KVA_Current.dep --preproc_with_compile --large_memory_model --silicon_version=28 -I -O2 -v28 -ml -DF28021 -DBOOT_FROM_FLASH=1 --preproc_with_compile --preproc_dependency="HF_1KVA_Current.d_raw" "E:/Frontline/HF_UPS/1KVA/CHECK123_Current/HF_1KVA_Current_ert_rtw/HF_1KVA_Current.c"
Finished building: "E:/Frontline/HF_UPS/1KVA/CHECK123_Current/HF_1KVA_Current_ert_rtw/HF_1KVA_Current.c"

Building target: "HF_1KVA_Current.out"
Invoking: C2000 Linker
"C:/PROGRA~3/MATLAB/SUPPOR~1/R2020a/3P778C~1.INS/TIC200~1.INS/ti-cgt-c2000_18.12.2.LTS/bin/cl2000" --define=MODEL=HF_1KVA_Current --define=NUMST=1 --define=NCSTATES=0 --define=HAVESTDIO --define=MODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 --define=CLASSIC_INTERFACE=0 --define=ALLOCATIONFCN=0 --define=TID01EQ=0 --define=TERMFCN=0 --define=ONESTEPFCN=1 --define=MAT_FILE=0 --define=MULTI_INSTANCE_CODE=0 --define=INTEGER_CODE=0 --define=MT=0 --define=DAEMON_MODE=1 --define=XCP_CUSTOM_PLATFORM --define=MW_PIL_SCIFIFOLEN=4 --define=STACK_SIZE=768 --define=__MW_TARGET_USE_HARDWARE_RESOURCES_H__ --define=RT --define=F28021 --define=BOOT_FROM_FLASH=1 -s -v28 -ml --preproc_dependency=HF_1KVA_Current.out --preproc_with_compile --large_memory_model --silicon_version=28 -I -O2 -v28 -ml -DF28021 -DBOOT_FROM_FLASH=1 -z --warn_sections -i"C:/PROGRA~3/MATLAB/SUPPOR~1/R2020a/3P778C~1.INS/TIC200~1.INS/ti-cgt-c2000_18.12.2.LTS/lib" -i"C:/PROGRA~3/MATLAB/SUPPOR~1/R2020a/3P778C~1.INS/TIC200~1.INS/ti-cgt-c2000_18.12.2.LTS/include" --reread_libs --define=F28021 --define=BOOT_FROM_FLASH=1 --define=BOOT_USING_BL=0 --rom_model -z --stack_size=768 --warn_sections --heap_size=1024 --reread_libs --rom_model --priority -mHF_1KVA_Current.map -o "HF_1KVA_Current.out" "./DSP28xx_SciUtil.obj" "./F2802x_GlobalVariableDefs.obj" "./HF_1KVA_Current.obj" "./MW_c28xGPIO.obj" "./MW_c28xGlobalInterrupts.obj" "./MW_c28xx_adc.obj" "./MW_c28xx_board.obj" "./MW_c28xx_csl.obj" "./MW_c28xx_pwm.obj" "./c2802xBoard_Realtime_Support.obj" "./c2802xSchedulerTimer0.obj" "./ert_main.obj" "./f2802x_adc.obj" "./f2802x_codestartbranch.obj" "./f2802x_cputimers.obj" "./f2802x_defaultisr.obj" "./f2802x_piectrl.obj" "./f2802x_pievect.obj" "./f2802x_sysctrl.obj" "./f2802x_usdelay.obj" "./mw_C28x_addsubasm_s32.obj" "./profiler_Support.obj" -l"E:/Frontline/HF_UPS/1KVA/CHECK123_Current/slprj/ert/_sharedutils/rtwshared.lib" -l"C:/ProgramData/MATLAB/SupportPackages/R2020b/toolbox/shared/supportpackages/tic2000/rtlib/IQmath.lib" -l"C:/ProgramData/MATLAB/SupportPackages/R2020b/toolbox/target/supportpackages/tic2000/src/c2802xPeripherals.cmd" -l"C:/ProgramData/MATLAB/SupportPackages/R2020b/toolbox/target/supportpackages/tic2000/src/c28021.cmd" -lrts2800_ml.lib
<Linking>
"C:/ProgramData/MATLAB/SupportPackages/R2020b/toolbox/target/supportpackages/tic2000/src/c28021.cmd", line 44: error:
program will not fit into available memory. run placement with
alignment/blocking fails for section "ramfuncs" size 0xfb4 page 0.
Available memory ranges:
PRAML0 size: 0xc00 unused: 0xc00 max hole: 0xc00
error: errors encountered during linking; "HF_1KVA_Current.out" not built

>> Compilation failure
makefile:158: recipe for target 'HF_1KVA_Current.out' failed
gmake: *** [HF_1KVA_Current.out] Error 1
gmake: Target 'all' not remade because of errors.

**** Build Finished ****

Is there a way to include a part of the main function in the RAM?

Thanks in advance!