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.

UCD3138 Compiler error

Use UCD3138RHAR to make a PSFB Module(DC/DC),Compile error,As shown in Figure.Help me analyze the reasons,Ths!~~~~~

  • Dears,

    Please following the below steps to change your project configuration:

    1. If you’re using CCS6.1, and the compiler version is higher than 5.1.10. Then you should do some additional actions:

    - In CCS6.1, import the project.

    - Right click on project ->properties ->General -> Change the compiler version to 5.2.4 or higher than this version. Then click OK

    PS: If the compiler 5.2.4 is not installed on your PC, please follow this step. Otherwise, you can skip this.

    Select Help -> Install New Software.  Set Work with to Code Generation Tools Updates.  Be sure Show only the latest versions ... is not checked.  Expand TI Compiler Updates.  

     

    2. Right click on project -> Properties -> Build -> Steps, please take out the bracket at the post build steps.

    ( "${CG_TOOL_HEX}.exe" -x "${BuildArtifactFileName}" -o "${BuildArtifactFileBaseName}.x0" -memwidth 8 )

     The correct post-build command should be like this:

    "${CG_TOOL_HEX}.exe" -x "${BuildArtifactFileName}" -o "${BuildArtifactFileBaseName}.x0" -memwidth 8

    3. As for this compiler only support ‘ti_arm9_abi’, which all of the 16bit and 32bit entry point with underscore. Open load.asm, change the entry point from ‘$’ to ‘_’.

    Original code:

    _c1_: 

                     BL     $c_int00    

    New code:

    _c1_: 

                 BL     _c_int00

    4. Configure the interrupt.c, standard_interrupt.c, software_interrupt.c(if your project have), clear_program_flash.c, zero_out_intergrity_word.c(if your project have) as 32bit code state.

     

    Right click on those files one by one, -> properties -> ARM compiler -> processor options

     

    Select the code state as 32bit.

     

    5. Changes to software interrupt, the SWI entry in some of the demo EVM looks like as below:

    #pragma INTERRUPT(software_interrupt,SWI)
    void software_interrupt(Uint32 arg1, Uint32 arg2, Uint32 arg3, Uint8 swi_number)
    //void software_interrupt(Uint32 *address, Uint32 data, Uint32 more_data, Uint8 swi_number)
    {
     //make sure interrupts are disabled
        asm(" MRS     r4, cpsr ");   // get psr
        asm(" ORR     r4, r4, #0xc0 "); // set interrupt disables
        asm(" MSR     cpsr_cf, r4");   // restore psr

       switch (swi_number) //handle flash write/erase and ROM backdoor first

    }

    With some codes and newer versions of the compiler, the compiler is moving a parameter in the software interrupt call into R4, which is then corrupted by the write to the CPSR to disable the interrupts.  The safest is to push R4 onto the stack disable the interrupts, and then pop it again when done:

    So the entry of SWI should be changed as below:

           //make sure interrupts are disabled

        asm(" STMFD   SP!, {R4} "); //Store R4

        asm(" MRS     r4, cpsr ");          // get psr

        asm(" ORR     r4, r4, #0xc0 "); // set interrupt disables

        asm(" MSR     cpsr_cf, r4"); // restore psr

    asm(" LDMFD   SP!, {R4}  ");    //Restore R4

     

    6. The MFBALR2 register is designed to word write only, Byte and Half word writing to this register will cause a problem. So it’s highly recommended to use write word to this register while enabling dflash to write. Please update it with using the new code.

     

    Original code:

    DecRegs.MFBALR2.bit.RONLY = 0; //clear RONLY bit    

    DecRegs.MFBALR2.bit.RONLY = 1; // set RONLY bit

     

    New code:

    DecRegs.MFBALR2.all &= ~(1<<1); // clear RONLY bit

    DecRegs.MFBALR2.all |= (1<<1); // set RONLY bit

    Hope it helps you.

     Regards,

    Jack Tan

  • For no 4.

    4. Configure the interrupt.c, standard_interrupt.c, software_interrupt.c(if your project have), clear_program_flash.c, zero_out_intergrity_word.c(if your project have) as 32bit code state.

    Can we use 32bit code state for the whole project as shown below? It works just fine for me..

  • You certainly can make it all 32 bit.  We don't do it because we are worried about program flash space.  So we put the background tasks, mostly the PMBus interface, into 16 bit mode.  This makes it about 30% slower and about 30% smaller. 

    If you've got the space, by all means go for it.   

  • I am no programmer, but I thought so.
    Anyway, I compiled both procedures and my .x0 file size are still the same , that is from Windows Explorer.
    Any way to check and compare the flash size in the MCU after programmed?
  • the best way is to look at the start of the .map file. It should be pretty obvious.