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.

LAUNCHXL-F28379D: Failed to generate all binary outputs_LAUNCH-F28379D_Matlab Simulink

Part Number: LAUNCHXL-F28379D
Other Parts Discussed in Thread: TI-CGT

Hi guys,
I am using LAUNCH-F28379D via Matlab Simulink with External mode.
After I have added my code inside the "MATLAB function" block, I got the error below once I tried to run the Simulink model using RAM (boot from flash (stand-alone execution) is not activated).
What is this problem? is there any way to solve this problem? and how can I do that?
Please note that the Matlab model is running correctly when I activate (boot from flash (stand-alone execution).

Thank you in advance

the error is"

"C:/ProgramData/MATLAB/SupportPackages/R2017b/toolbox/target/supportpackages/tic2000/src/c28377D.cmd", line 107: error:
program will not fit into available memory. placement with
alignment/blocking fails for section ".text" size 0x7c20 page 0. Available
memory ranges:
RAMM0 size: 0x2de unused: 0x0 max hole: 0x0
RAMD0 size: 0x800 unused: 0x0 max hole: 0x0
RAMLS_PROG size: 0x2000 unused: 0x1 max hole: 0x1
RAMGS_PROG size: 0x4000 unused: 0x0 max hole: 0x0
"C:/ProgramData/MATLAB/SupportPackages/R2017b/toolbox/target/supportpackages/tic2000/src/c28377D.cmd", line 111: error:
program will not fit into available memory. placement with
alignment/blocking fails for section ".cinit" size 0x38f page 0. Available
memory ranges:
RAMM0 size: 0x2de unused: 0x0 max hole: 0x0
RAMD0 size: 0x800 unused: 0x0 max hole: 0x0
RAMLS_PROG size: 0x2000 unused: 0x1 max hole: 0x1
error: errors encountered during linking; "../finalnewcode2of3okok.out" not
built

>> Compilation failure
gmake: *** [../finalnewcode2of3okok.out] Error 1

C:\Users\Win7\Documents\MATLAB\paper-2\Final_idle_Ms_cells_25_3_2019\Prototype1_8_2020\C2000\system with 260us\S_function\finalnewcode2of3okok_ert_rtw>echo The make command returned an error of 2
The make command returned an error of 2

C:\Users\Win7\Documents\MATLAB\paper-2\Final_idle_Ms_cells_25_3_2019\Prototype1_8_2020\C2000\system with 260us\S_function\finalnewcode2of3okok_ert_rtw>An_error_occurred_during_the_call_to_make
'An_error_occurred_during_the_call_to_make' is not recognized as an internal or external command,
operable program or batch file.
### Creating HTML report file finalnewcode2of3okok_codegen_rpt.html
### Build procedure for model: 'finalnewcode2of3okok' aborted due to an error.
Error(s) encountered while building "finalnewcode2of3okok":
### Failed to generate all binary outputs."

  • Hi Ashraf,

    I am checking with MathWork team to take a look. Please expect response by Monday.

  • Thank you very much

    Matlab Simulink file is attached

    finalnewcode.rar

  • Hi Ashraf,

    From the error message, it looks like the available RAM size, RAMM0 is not sufficient for the program to fit when the program is being loaded into RAM i.e, Boot from flash (stand-alone execution) option is not selected. If you find an additional free space in any RAM section say RAMM1, you can use this free space by appending RAMM1 to RAMM0 by making below change in the linker command file:

    From

    .text : > RAMM0, PAGE = 0

    To

    .text : > RAMM0 | RAMM1 , PAGE = 0

    Note that RAMM1 is just for an illustration.

    Refer to the link below to see how to find the different sections of RAM and its used and unused memory sizes.
    https://e2e.ti.com/support/tools/ccs/f/81/t/417896?External-Mode-over-Serial-Communication

    If you still faces issue on how to modify the .cmd file, it would be best for you to get in touch with our support channel. When we have a support ticket, our internal process enables us to involve right people on this issue and we will immediately get in touch with you to understand the case in more detailed way.

    Please connect to us at:
    https://www.mathworks.com/support.html


    Best Regards,
    Ram Alla | MathWorks

  • Thank you very much for your answer. The problem is clear now.
    Actually, to solve the memory problem I have converted my code from double type to fixed-point using MATLAB "Fixed-point converter' tools.
    The memory problem looks solved but I got a new error as follows. Anyone knows how to solve this problem. please note that I got 20 "Assembly Errors" at the beginning then I reduced to "2 Assembly Errors" by changing some lines in the code. the code after converted to Fixed-point is attached.

    the error is

    "
    "C:/PROGRA~3/MATLAB/SUPPOR~1/R2017b/3P778C~1.INS/TIC200~1.INS/TI-CGT~1.LTS/include/stdbool.h", line 36: warning: incompatible redefinition of macro "false" (declared at line 26 of "rtwtypes.h")
    "C:/PROGRA~3/MATLAB/SUPPOR~1/R2017b/3P778C~1.INS/TIC200~1.INS/TI-CGT~1.LTS/include/stdbool.h", line 37: warning: incompatible redefinition of macro "true" (declared at line 30 of "rtwtypes.h")
    "C:\Users\Win7\AppData\Local\Temp\0343610", ERROR! at line 14294:
    [E0003]
    Invalid immediate value
    TBIT *+FP[AR0],#28 ; [CPU_] |2030|

    "C:\Users\Win7\AppData\Local\Temp\0343610", REMARK at line 14294:
    [R0001]
    After symbol substitution the line became:
    TBIT *+XAR2[AR0],#28 ; [CPU_] |2030|

    "C:\Users\Win7\AppData\Local\Temp\0343610", ERROR! at line 14294:
    [E0004]
    Illegal operand combination
    TBIT *+FP[AR0],#28 ; [CPU_] |2030|

    "C:\Users\Win7\AppData\Local\Temp\0343610", REMARK at line 14294:
    [R0001]
    After symbol substitution the line became:
    TBIT *+XAR2[AR0],#28 ; [CPU_] |2030|

    2 Assembly Errors, No Assembly Warnings

    Errors in Source - Assembler Aborted

    >> Compilation failure
    gmake: *** [finalnewcode1.obj] Error 1

    C:\Users\Win7\Documents\MATLAB\paper-2\Final_idle_Ms_cells_25_3_2019\Prototype1_8_2020\C2000\system_with_260us\S_function\finalnewcode1_ert_rtw>echo The make command returned an error of 2
    The make command returned an error of 2

    C:\Users\Win7\Documents\MATLAB\paper-2\Final_idle_Ms_cells_25_3_2019\Prototype1_8_2020\C2000\system_with_260us\S_function\finalnewcode1_ert_rtw>An_error_occurred_during_the_call_to_make
    'An_error_occurred_during_the_call_to_make' is not recognized as an internal or external command,
    operable program or batch file.

    4645.Code.txt
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %                                                                          %
    %           Generated by MATLAB 9.3 and Fixed-Point Designer 6.0           %
    %                                                                          %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %#codegen
    function [SOCs1,Rcells,SPII0,SPII] = bestcode8_fixpt(vref,Iref,Vbatteries)
    fm = get_fimath();
    
    persistent Capacityold
    if isempty (Capacityold)
    Capacityold =fi([12060 12060 12000 7000.0002 11000 11500 11300 5000.0003 10000 10000 10500 4000.0004 10500 10500 10000 11000 3000.0001 12000 12000 11000 2000.0311 9500 9900 9900 9800 1000.0222 9600 12000 10000 9900 9800 100.2222 400 300 350 50.222]', 0, 16, 2, fm);
    end
    SOCs1=fi(Capacityold*fi(0.008291873964, 0, 16, 22, fm), 0, 16, 9, fm); %output  % k=(1/(3.35*60*60))*100%
    SW=fi(zeros(13,9), 0, 1, 0, fm);%%instead of 120
    Icells=fi(zeros(4,9), 1, 16, 13, fm);
    SOCs = fi(reshape(SOCs1,[4,9]), 0, 16, 9, fm);
    AvgSOCs=fi(fi_div_by_shift(sum(SOCs), 2), 0, 16, 9, fm);
    [AvgSOCs(:), fmo_1] = sort(AvgSOCs, 'ascend');
    ix3 = fi(fmo_1, 0, 4, 0, fm); % modules with lowest SoC will use first with Iref with low current %%ix3 is the modules position
    [SOCs(:), fmo_2] = sort (SOCs, 'descend');
    ix4 = fi(fmo_2, 0, 6, 0, fm);  %% modules with highest SoC will use first with Iref with low current %to arrange the sub-module inside each module
    ix4(1,:)=ix4(1,:)+fi([0,4,8,12,16,20,24,28,32], 0, 6, 0, fm);
    ix4(2,:)=ix4(2,:)+fi([0,4,8,12,16,20,24,28,32], 0, 6, 0, fm);
    ix4(3,:)=ix4(3,:)+fi([0,4,8,12,16,20,24,28,32], 0, 6, 0, fm);
    ix4(4,:)=ix4(4,:)+fi([0,4,8,12,16,20,24,28,32], 0, 6, 0, fm);
    voltage=fi([fi(abs(vref(1)), 0, 16, 10, fm),abs(vref(2)),abs(vref(3))], 0, 16, 10, fm);
    [fmo_3, fmo_4] = sort(voltage, 'ascend');
    vrefs = fi(fmo_3, 0, 16, 10, fm);
    ixI = fi(fmo_4, 0, 2, 0, fm);
    NFV1=fi(0, 0, 4, 0, fm);
    NFV2=fi(0, 0, 6, 0, fm);
    Vout=fi(0, 0, 16, 10, fm);
    NFMF1=fi(0, 0, 3, 0, fm);
    %%%%%%%%%%%%%%%%%%%%
    SWP=fi([1 1 0 0 1 1 0 1 1; 0 1 1 1 1 0 0 1 1; 0 1 1 0 1 1 1 1 0], 0, 1, 0, fm);
    SWN=fi([1 0 1 0 1 1 0 1 1; 0 1 1 1 0 1 0 1 1; 0 1 1 0 1 1 1 0 1], 0, 1, 0, fm);
    SS=fi(ixI(1), 0, 2, 0, fm);
    for m = 1: 4
        g = fi(ix3(m), 0, 4, 0, fm);
        KKJ=fi(0, 0, 3, 0, fm);
        NOC=fi([0 0 0 0], 1, 16, 13, fm);
        NOCW=fi([0 0 0 0], 0, 1, 0, fm);
                  for mm= 1: 4
                      gg=fi(ix4(mm,g), 0, 6, 0, fm);
                      if abs(fi_signed(Vout + Vbatteries(gg)) - abs(vrefs(1))) < abs(fi_signed(Vout) - abs (vrefs(1))) %if we would be closer to the reference voltage with this cell...
                          Vout(:)=Vout+Vbatteries(gg);
                          NFV1(:)=NFV1+fi(1, 0, 1, 0, fm);
                          KKJ(:)=1;
                          NOCW(mm)=1;
                          NOC(mm)=Iref(SS);
                      else
                          break;
                      end
                  end
    if KKJ==fi(1, 0, 1, 0, fm)
       NFMF1(:)=NFMF1+fi(1, 0, 1, 0, fm);
       if vref(SS)> 0
          SW(:,g)=fi([fi(NOCW(1), 0, 1, 0, fm) NOCW(2) NOCW(3) NOCW(4) SWP(SS,1) SWP(SS,2) SWP(SS,3) SWP(SS,4) SWP(SS,5) SWP(SS,6) SWP(SS,7) SWP(SS,8) SWP(SS,9)], 0, 1, 0, fm);
          Icells(:,g)=fi([fi(NOC(1), 1, 16, 13, fm) NOC(2) NOC(3) NOC(4)]*(fi(-1, 1, 2, 0, fm)), 1, 16, 13, fm);
       end
       if vref(SS)< 0
          SW(:,g)=fi([fi(NOCW(1), 0, 1, 0, fm) NOCW(2) NOCW(3) NOCW(4) SWN(SS,1) SWN(SS,2) SWN(SS,3) SWN(SS,4) SWN(SS,5) SWN(SS,6) SWN(SS,7) SWN(SS,8) SWN(SS,9)], 0, 1, 0, fm);
          Icells(:,g)=fi([fi(NOC(1), 1, 16, 13, fm) NOC(2) NOC(3) NOC(4)], 1, 16, 13, fm);
       end
    else
     break;   
    end
    end
    %%%%%%%%%%%%%%%%%%%%%%%
    Vout(:)=0;
    NFMF2=fi(0, 0, 3, 0, fm);
    SS(:)=ixI(2);
    for m = NFMF1+fi(1, 0, 1, 0, fm): NFMF1+fi(4, 0, 3, 0, fm)
        g = fi(ix3(m), 0, 4, 0, fm);
        KKJ=fi(0, 0, 3, 0, fm);
        NOC=fi([0 0 0 0], 1, 16, 13, fm);
        NOCW=fi([0 0 0 0], 0, 1, 0, fm);
                  for mm=1:4
                      gg=fi(ix4(mm,g), 0, 6, 0, fm);
                      if abs(fi_signed(Vout + Vbatteries(gg)) - abs(vrefs(2))) < abs(fi_signed(Vout) - abs (vrefs(2))) %if we would be closer to the reference voltage with this cell...
                          Vout(:)=Vout+Vbatteries(gg);
                          NFV2(:)=NFV2+fi(1, 0, 1, 0, fm);
                          KKJ(:)=1;
                          NOCW(mm)=1;
                          NOC(mm)=Iref(SS);
                      else
                          break;
                      end
                  end
    if KKJ==fi(1, 0, 1, 0, fm)
       NFMF2(:)=NFMF2+fi(1, 0, 1, 0, fm);
       if vref(SS)> 0
          SW(:,g)=fi([fi(NOCW(1), 0, 1, 0, fm) NOCW(2) NOCW(3) NOCW(4) SWP(SS,1) SWP(SS,2) SWP(SS,3) SWP(SS,4) SWP(SS,5) SWP(SS,6) SWP(SS,7) SWP(SS,8) SWP(SS,9)], 0, 1, 0, fm);
          Icells(:,g)=fi([fi(NOC(1), 1, 16, 13, fm) NOC(2) NOC(3) NOC(4)]*(fi(-1, 1, 2, 0, fm)), 1, 16, 13, fm);
       end
       if vref(SS)< 0
          SW(:,g)=fi([fi(NOCW(1), 0, 1, 0, fm) NOCW(2) NOCW(3) NOCW(4) SWN(SS,1) SWN(SS,2) SWN(SS,3) SWN(SS,4) SWN(SS,5) SWN(SS,6) SWN(SS,7) SWN(SS,8) SWN(SS,9)], 0, 1, 0, fm);
          Icells(:,g)=fi([fi(NOC(1), 1, 16, 13, fm) NOC(2) NOC(3) NOC(4)], 1, 16, 13, fm);
       end
    else
    break;
    end             
    end
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    [Vout(:),fmo_5]=min(SOCs1);
    NUCd = fi(fmo_5, 0, 6, 0, fm);
    Ixnew=fi(ones(4,9), 0, 6, 0, fm);
    Ixnew=fi(Ixnew*NUCd, 0, 6, 0, fm);
    z=fi(NFMF1+NFMF2, 0, 4, 0, fm);
    for m= fi(1, 0, 1, 0, fm):(fi(9, 0, 4, 0, fm)-z)
        CC=fi(ix3(z+m), 0, 4, 0, fm);
        Ixnew(:,m)=fi(ix4(:,CC), 0, 6, 0, fm);
    %   Ixnew(:,1:9-(NFMF1+NFMF2))=ix4(:,ix3(NFMF1+NFMF2+1:9));
    end
    Ixnew=fi(Ixnew(:), 0, 6, 0, fm);
    
    ch4new=fi(SOCs1(Ixnew), 0, 16, 9, fm);
    [ch4new(:), fmo_6] = sort (ch4new, 'descend');
    ix4new = fi(fmo_6, 0, 6, 0, fm);
    SS(:)=ixI(3);
    FG=fi(Iref(SS), 1, 16, 13, fm);
    for m = (z+fi(1, 0, 1, 0, fm)):fi(9, 0, 4, 0, fm)
        g = fi(ix3(m), 0, 4, 0, fm);
       if vref(SS)>0
          SW(5:13,g)=fi(SWP(SS,:), 0, 1, 0, fm); 
       end
       if vref(SS)<0
          SW(5:13,g)=fi(SWN(SS,:), 0, 1, 0, fm);
       end
    end
    Icells=fi(Icells(:), 1, 16, 13, fm);
                     Vout(:)=0;
                  for mm=fi(1, 0, 1, 0, fm):fi(36, 0, 6, 0, fm)-(z*fi(4, 0, 3, 0, fm))
                      gg=fi(Ixnew(ix4new(mm)), 0, 6, 0, fm);
                      if abs(fi_signed(Vout + Vbatteries(gg)) - abs(vrefs(3))) < abs(fi_signed(Vout) - abs (vrefs(3))) %if we would be closer to the reference voltage with this cell...
                         Vout(:)=Vout+Vbatteries(gg); 
                         NFV2(:)=NFV2+fi(1, 0, 1, 0, fm);
                               v=fi(ceil(fi_div_by_shift(gg, 2)), 0, 4, 0, fm);
                               KKJ=fi(gg+fi(4, 0, 3, 0, fm)-(fi(4, 0, 3, 0, fm)*v), 0, 3, 0, fm);
                               SW(KKJ,v)=fi(1, 0, 1, 0, fm);
                               if vref(SS)> 0
                                  Icells(gg)= fi(FG*(fi(-1, 1, 2, 0, fm)), 1, 16, 13, fm);
                               end
                               if vref(SS)< 0
                                  Icells(gg)= fi(FG, 1, 16, 13, fm);
                               end
                      else
                          break;
                      end      
                   end
    %%%%%%%%%%%%%%%%%%%%%%%%%
    Rcells=fi(fi(36, 0, 6, 0, fm)-(NFV1+NFV2), 0, 5, 0, fm);
    SW=fi(SW(:), 0, 1, 0, fm);
    SPII0=fi(0, 0, 1, 0, fm);
    SPII=fi([fi(sum(SW(113:117).*fi([1 2 4 8 16]', 0, 5, 0, fm)), 0, 8, 0, fm),sum(SW(105:112).*fi([1 2 4 8 16 32 64 128]', 0, 8, 0, fm)),sum(SW(97:104).*fi([1 2 4 8 16 32 64 128]', 0, 8, 0, fm)),sum(SW(89:96).*fi([1 2 4 8 16 32 64 128]', 0, 8, 0, fm)),sum(SW(81:88).*fi([1 2 4 8 16 32 64 128]', 0, 8, 0, fm)),sum(SW(73:80).*fi([1 2 4 8 16 32 64 128]', 0, 8, 0, fm)),sum(SW(65:72).*fi([1 2 4 8 16 32 64 128]', 0, 8, 0, fm)),sum(SW(57:64).*fi([1 2 4 8 16 32 64 128]', 0, 8, 0, fm)),sum(SW(49:56).*fi([1 2 4 8 16 32 64 128]', 0, 8, 0, fm)),sum(SW(41:48).*fi([1 2 4 8 16 32 64 128]', 0, 8, 0, fm)),sum(SW(33:40).*fi([1 2 4 8 16 32 64 128]', 0, 8, 0, fm)),sum(SW(25:32).*fi([1 2 4 8 16 32 64 128]', 0, 8, 0, fm)),sum(SW(17:24).*fi([1 2 4 8 16 32 64 128]', 0, 8, 0, fm)),sum(SW(9:16).*fi([1 2 4 8 16 32 64 128]', 0, 8, 0, fm)),sum(SW(1:8).*fi([1 2 4 8 16 32 64 128]', 0, 8, 0, fm))], 0, 8, 0, fm);
    %%%%%%%%%%%%%%%%%%%%%%%%%
    Ts=fi(0.0002, 0, 16, 28, fm);
    Icells=fi(Icells(:), 1, 16, 13, fm);
    Icells=fi(Icells*Ts, 1, 16, 13, fm);
    Capacityold(:)=Icells+Capacityold;%%OUTPUT %the last cells capacity update
    % SOCs1=Capacityold*0.008291873964; %output  % k=(1/(3.35*60*60))*100%
    end
    
    
    
    function y = fi_div_by_shift(a,shift_len)
        coder.inline( 'always' );
        if isfi( a )
            nt = numerictype( a );
            fm = fimath( a );
            nt_bs = numerictype( nt.Signed, nt.WordLength + shift_len, nt.FractionLength + shift_len );
            y = bitsra( fi( a, nt_bs, fm ), shift_len );
        else
            y = a/2^shift_len;
        end
    end
    
    
    function y = fi_signed(a)
        coder.inline( 'always' );
        if isfi( a ) && ~(issigned( a ))
            nt = numerictype( a );
            new_nt = numerictype( 1, nt.WordLength + 1, nt.FractionLength );
            y = fi( a, new_nt, fimath( a ) );
        else
            y = a;
        end
    end
    
    function fm = get_fimath()
    	fm = fimath('RoundingMethod', 'Floor',...
    	     'OverflowAction', 'Wrap',...
    	     'ProductMode','FullPrecision',...
    	     'MaxProductWordLength', 128,...
    	     'SumMode','FullPrecision',...
    	     'MaxSumWordLength', 128);
    end
    

  • Ashraf,

    Checking with MathWork team. Due to holiday in India, it will be by Tuesday next week.

  • Ashraf,

    Good to know that the memory issue is resolved. As we need to understand the issue in depth to resolve the Assembly errors, it would be best for you to get in touch with our support channel. When we have a support ticket, our internal process enables us to involve right people on this issue and we will immediately get in touch with you to understand the case in more detailed way.

    Please connect to us at:
    https://www.mathworks.com/support.html

    Best Regards,
    Ram Alla | MathWorks