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.

TMS570LC43 optimization problem

Other Parts Discussed in Thread: HALCOGEN

(TMS570LC43, CCS55)

I've migrate from LS3 to LC4 in order to have less CPU load for the same code. I've configured the processor to 300Mhz (instead of 180Mhz in LS3).

My measurement shows the opposite of what I've targeted, It's worse. Even when I put my code in RAM.

It really seems to be an optimization problem or I'm not running at the expected frequency.

Anywhere I put a little piece of code (like a dummy while loop and calling it at high pace), the impact is enormous compare to my code in LS3.

I'm really talking about ADDING some code, the impact is huge.

I've tried many optimisation levels, no big difference, but I see optimization level take effect.

I don't have unwanted interrupt or stuff like that, all code seems to run OK for very slowly.

So I suspect my clock configuration:

Does it seem correct for you ?

  • Hi  Simon,

     I think the problem is that the LC43 device is a cache based architecture. You will need to enable cache to see the performance improvement along with the faster frequency. I will suggest  that you use the HalCoGen to generate the device startup.

  • That's make sense, my cache isn't enabled.

    I've used Halcogen to generate code and call enableCache() juste before __TI_auto_init(), but I've got plenty of ESM core errors after I activate the cache.

    I suspect that's why we've not activate the cache yet.

    Do you have a clue ?

  • Hi Simon,
    Can you move the enableCache() after the __TI_auto_init() and let me know if it makes a difference.
  • I've try it no change. In fact it doesn't run normally.  There is not just ESM error, it seems crashed or something after a while if I enable the cache.

    The code is:

    ; Enable Cache

    .global CoreEnableCache

    .asmfunc

    CoreEnableCache:

    MRC p15, #0, R1, c1, c0, #0 ; Read System Control Register configuration data

    ORR R1, R1, #0x1 <<12 ; instruction cache enable

    ORR R1, R1, #0x1 <<2 ; data cache enable

    DSB

    MCR p15, #0, r0, c15, c5, #0 ; Invalidate entire data cache

    MCR p15, #0, r0, c7, c5, #0 ; Invalidate entire instruction cache

    MCR p15, #0, R1, c1, c0, #0 ; enabled cache RAMs

    ISB

    bx lr

    .endasmfunc

  • Hi Simon,

     First of all when you get an ESM error which ESM error flags are set? If you are getting a Bus ECC error (Group 2, channel 3) then it is because the CPU  might have read (due to cache refill or due to speculative fetch) from some unimplemented addresses that do not have the corresponding ECC.

     If you have ESM GP2.3 error then please update the linker file per below example. Once you do this you need to make sure you turn off the auto-ECC in the CCS so you don't try to generate ECC on top of ECC. 

    /*----------------------------------------------------------------------------*/
    /* Linker Settings                                                            */
    --retain="*(.intvecs)"
    /* USER CODE BEGIN (1) */
    /* USER CODE END */
    /*----------------------------------------------------------------------------*/
    /* Memory Map                                                                 */
    MEMORY
    {
    /* USER CODE BEGIN (2) */
    #if 0
    /* USER CODE END */
        VECTORS (X)  : origin=0x00000000 length=0x00000020
        FLASH0  (RX) : origin=0x00000020 length=0x001FFFE0
        FLASH1  (RX) : origin=0x00200000 length=0x00200000
        STACKS  (RW) : origin=0x08000000 length=0x00001500
        RAM     (RW) : origin=0x08001500 length=0x0007EB00
    /* USER CODE BEGIN (3) */
    #endif
        VECTORS (X)  : origin=0x00000000 length=0x00000020 vfill = 0xffffffff
        FLASH0  (RX) : origin=0x00000020 length=0x001FFFE0 vfill = 0xffffffff
        FLASH1  (RX) : origin=0x00200000 length=0x00200000 vfill = 0xffffffff
        STACKS  (RW) : origin=0x08000000 length=0x00001500
        RAM     (RW) : origin=0x08001500 length=0x0002EB00
        ECC_VEC (R)  : origin=0xf0400000 length=0x4 ECC={ input_range=VECTORS }
        ECC_FLA0 (R) : origin=0xf0400000 + 0x4 length=0x3FFFC ECC={ input_range=FLASH0 }
        ECC_FLA1 (R) : origin=0xf0440000 length=0x40000 ECC={ input_range=FLASH1 }
    /* USER CODE END */
    }
    /* USER CODE BEGIN (4) */
    ECC
    {
       algo_name : address_mask = 0xfffffff8
       hamming_mask = R4
       parity_mask = 0x0c
       mirroring = F021
    }
    /* USER CODE END */
    /*----------------------------------------------------------------------------*/
    /* Section Configuration                                                      */
    SECTIONS
    {
    /* USER CODE BEGIN (5) */
    /* USER CODE END */
        .intvecs : {} > VECTORS
        .text   align(8) : {} > FLASH0 | FLASH1
        .const  align(8) : {} > FLASH0 | FLASH1
        .cinit  align(8) : {} > FLASH0 | FLASH1
        .pinit  align(8) : {} > FLASH0 | FLASH1
        .bss     : {} > RAM
        .data    : {} > RAM
        .sysmem  : {} > RAM
        
    /* USER CODE BEGIN (6) */
    /* USER CODE END */
    }
    /* USER CODE BEGIN (7) */
    /* USER CODE END */
    /*----------------------------------------------------------------------------*/
    /* Misc                                                                       */
    /* USER CODE BEGIN (8) */
    /* USER CODE END */
    /*----------------------------------------------------------------------------*/

    Below two posts may also be helpful to you.

  • Thank you.

    Yes that's right, the ESM error is Gr.2 bit 3 (0x08).

    Ok I'll use this linker config.

    My linker mapping is pretty different than yours tough, and I don't get it where you take the origin and length values of the ECC segments (ECC_VEC (R), ... )

    Could you help-me according to mine, for instance APPLCAN1_SPD (R) and FLASHMO (RX) below ?

    And by the way, I flash my code using a boot loader, so I don't have to take care about the auto ECC, do I have ?

    /*
     *
     */
    --heap_size=0x0100
    --retain="*(.intvects)"

    MEMORY
    {
        BOOTLOADER (RX)       : origin = 0x00000000 length = 0x00080000

        VECTORS (X)           : origin = 0x00080000 length = 0x00000040 vfill=0xFFFFFFFF
        CODECRC (R)           : origin = 0x00080040 length = 0x00000004 vfill=0xFFFFFFFF
        CODELENGTH (R)        : origin = 0x00080044 length = 0x00000004 vfill=0xFFFFFFFF
        APPLCAN1_SPD (R)      : origin = 0x00080048 length = 0x00000004 vfill=0xFFFFFFFF
        APPLCAN1_CRC (R)      : origin = 0x0008004C length = 0x00000004 vfill=0xFFFFFFFF
        APPLCAN2_SPD (R)      : origin = 0x00080050 length = 0x00000004 vfill=0xFFFFFFFF
        APPLCAN2_CRC (R)      : origin = 0x00080054 length = 0x00000004 vfill=0xFFFFFFFF
        CODE2ADDR (R)         : origin = 0x00080058 length = 0x00000004 vfill=0xFFFFFFFF
        CODE2LENGTH (R)       : origin = 0x0008005C length = 0x00000004 vfill=0xFFFFFFFF
        FLASHMO (RX)          : origin = 0x00080060 length = 0x0037FFA0 vfill=0xFFFFFFFF   

        RAM_DATA_EXCHANGE_ID  : origin = 0x08000000 length = 0x00000010   /* New meory map unique ID */
        RAM_BOOT_VER (R)      : origin = 0x08000010 length = 0x00000010
        RAM_CAN1_ADR (R)      : origin = 0x08000020 length = 0x00000004
        RAM_CAN2_ADR (R)      : origin = 0x08000024 length = 0x00000004
        RAM_CAN_SPD (R)       : origin = 0x08000030 length = 0x00000004
        RAM_CANPORT_USED (R)  : origin = 0x08000034 length = 0x00000004
        RAM_UDS_RX_ADDR (R)   : origin = 0x08000038 length = 0x00000004
        RAM_UDS_TX_ADDR (R)   : origin = 0x0800003C length = 0x00000004
        RAM_UDS_BOOT_MODE (RW): origin = 0x08000040 length = 0x00000004
        RAM_FREE (R)          : origin = 0x08000044 length = 0x000000BC   

        STACKS (RW)           : origin = 0x08000100 length = 0x00002000
        RAM_NOINIT (RW)       : origin = 0x08002100 length = 0x00000100
        IRAM (RW)             : origin = 0x08002200 length = 0x0007DE00   
    }

    SECTIONS
    {
       .intvecs       : {} palign=8 > VECTORS
       .text          : {} palign=8 > FLASHMO
       .const         : {} palign=8 > FLASHMO
       .cinit         : {} palign=8 > FLASHMO
       .pinit         : {} palign=8 > FLASHMO
       .init_array    : {} palign=8 LOAD = FLASHMO,
                           RUN_START(__TI_INIT_ARRAY_Base),
                           RUN_END( __TI_INIT_ARRAY_Limit)

       .bss           : {} > IRAM
       .data          : {} > IRAM
       .sysmem        : {} > IRAM
       .stack         : {} > STACKS,
                             RUN_START(__STACK_BASE),
                             RUN_END( __STACK_END)


       codecrc        : {} > CODECRC
       codelength     : {} > CODELENGTH
       applcan1_crc   : {} > APPLCAN1_CRC
       applcan1_spd   : {} > APPLCAN1_SPD
       applcan2_crc   : {} > APPLCAN2_CRC
       applcan2_spd   : {} > APPLCAN2_SPD
       bootversion    : {} > RAM_BOOT_VER,      type=NOINIT
       can1address    : {} > RAM_CAN1_ADR,      type=NOINIT
       can2address    : {} > RAM_CAN2_ADR,      type=NOINIT
       udsbootmode    : {} > RAM_UDS_BOOT_MODE, type=NOINIT
       ramNoInit      : {} > RAM_NOINIT,    type=NOINIT

       ramfuncs : {
                      //HighFreqTask.obj (.text)           /*36k*/
                  }
                  LOAD =  FLASHMO,
                  RUN = IRAM,
                  LOAD_START(_RamfuncsLoadStart),
                  LOAD_END(_RamfuncsLoadEnd),
                  RUN_START(_RamfuncsRunStart)

    }

  • Hi Simon,

      The ECC is memory mapped to address starting at 0xF0400000. Please refer to the Memory Map in the datasheet. There is a 8-bit ECC checksum for each 64-bit of data. This means the ECC occupies 1/8 the size of the corresponding data.  So if you look at the example I gave the ECC length is basically 1/8 of the data. Let's pick FLASH1 as example. The FLASH1 bank is memory mapped to start at 0x200000 and its size is 0x200000 as well. The ECC will be 1/8 of 0x200000 which is 0x40000. Since the ECC is memory mapped starting at 0xF0400000, this means the FLASH1 ECC will be starting 0xF0400000 + 0x40000 which is 0xF0440000 with the size of 0x40000. 

     
        FLASH1  (RX) : origin=0x00200000 length=0x00200000 vfill = 0xffffffff
     
        ECC_FLA1 (R) : origin=0xf0440000 length=0x40000 ECC={ input_range=FLASH1 }
  • Once you generate the .out file with the linking generating the corresponding ECC you don't want to use the CCS to further regenerate ECC. See below screenshot.  See the Auto ECC Generation checkbox needs to be unchecked.

  • One more step to do is that for the Flash Verification Settings in the screenshot, you want to check the 'None' checkbox instead of 'Verify'.

    Normally, for many of the code I have seen we don't really need to use the linker generated ECC to fully populate the unimplemented addresses. However, we do find sometimes an ESM GP2.3 error due to CPU speculative fetches and cache refill from not fully implemented addresses. This is when we need to use the linker generated ECC. One more note is that LC4357 is always enabled for ECC checking. You can never disable it. This is why you must have correct ECC at all times.
  • Thank you again. Still have problem though.  I've tried it with:

    ECC_VEC (R) : origin=0xf0400000 length=0x8 ECC={ input_range=VECTORS }

    //ECC_OTH0 (R) : origin=0xf0400000 + 0x8 length=0x1 ECC={ input_range=CODECRC }

    //ECC_OTH1 (R) : origin=0xf0400000 + 0x9 length=0x1 ECC={ input_range=CODELENGTH }

    //ECC_OTH2 (R) : origin=0xf0400000 + 0xa length=0x1 ECC={ input_range=APPLCAN1_SPD }

    //ECC_OTH3 (R) : origin=0xf0400000 + 0xb length=0x1 ECC={ input_range=APPLCAN1_CRC }

    //ECC_OTH4 (R) : origin=0xf0400000 + 0xc length=0x1 ECC={ input_range=APPLCAN2_SPD }

    //ECC_OTH5 (R) : origin=0xf0400000 + 0xd length=0x1 ECC={ input_range=APPLCAN2_CRC }

    //ECC_OTH6 (R) : origin=0xf0400000 + 0xe length=0x1 ECC={ input_range=CODE2ADDR }

    //ECC_OTH7 (R) : origin=0xf0400000 + 0xf length=0x1 ECC={ input_range=CODE2LENGTH }

    //

    //ECC_FLA0 (R) : origin=0xf0400000 + 0x10 length=0x6fff4 ECC={ input_range=FLASHMO }

    ECC_FLA0 (R) : origin=0xf0400000 + 0x8 length=0x6fff4 ECC={ input_range=FLASHMO }

    ...and stil have ESM error, at least no linker error.

    So I figured out ESM errors come from the others segments (ECC_OTHx). I've tried to add them but I don't know how to configure them, always have linker errors. Could-you help-me on this ? length 0x01 or 0x00 don't work.

    Another point: even without activate the cache, before I put vFill and adjust the segments like I did, I'd got some ESM errors, but they were trapped in a FIQ interrupt and successfully reset the fault with no crash at run time. Then I'd configured vFill properly and no ESM error. My point is the program could run with ESM errors at that point with no problem. That's not the case now with cache activated. So maybe the cache activation cause a crash and program goes everywhere causing ESM fault. What do you thing, could it be the case ?

  • Hi Simon,

     Sorry, I just got back.

     This is your memory map for  FLASHMO (RX)          : origin = 0x00080060 length = 0x0037FFA0 vfill=0xFFFFFFFF. So it starts at 0x00080060. If you divide by 8, it becomes 0x1000C. You will add 0x100C to the starting address of ECC space at 0xF0400000 which becomes 0xF041000C.

    However, you have ECC_FLA0 (R) : origin=0xf0400000 + 0x8 length=0x6fff4 ECC={ input_range=FLASHMO }. Please change to

    ECC_FLA0 (R) : origin=0xf041000C length=0x6fff4 ECC={ input_range=FLASHMO } and try again.

    Simon lapointe said:
    So I figured out ESM errors come from the others segments (ECC_OTHx). I've tried to add them but I don't know how to configure them, always have linker errors. Could-you help-me on this ? length 0x01 or 0x00 don't work.

    What linker errors do you have? You have 8 consecutive 32-bit words starting at 0x00080040-0x000805F. Since they are already consecutive and they are aligned with 64-bit boundary so I think you may not need to -vfill switch for these 8 words. If you still have linker error then I will have to move your post to the compiler forum. Perhaps it is better for you to open a new post in the compiler forum as we have gone through this post multiple times on other questions that I'm afraid the compiler forum team will not understand the MCU specific questions. 

    Simon lapointe said:
    Another point: even without activate the cache, before I put vFill and adjust the segments like I did, I'd got some ESM errors, but they were trapped in a FIQ interrupt and successfully reset the fault with no crash at run time.

    What ESM error flags were set before you activate cache? 

    Simon lapointe said:
    That's not the case now with cache activated. So maybe the cache activation cause a crash and program goes everywhere causing ESM fault. What do you thing, could it be the case ?

    What ESM error flags were set after you activate cache? I hope after you fix the memory map for ECC_FLA0 this crash problem will somehow go away. 

  • Thank you again for your support.

    We can put aside the cache issue for the moment cause I've realized it could really be related to ESM error in some way. I mean I can run with cache activated as long as there is only few ESM errors or no error. It crashes as there is too many. Maybe is related to FIQ handling also, I don’t know. For the moment I could deactivate the CACHE as long as I’ve still got ESM error.

     

    No linker error again. I've read an app note and I use this format:

     

    BOOTLOADER (RX) : origin = 0x00000000 length = 0x00080000 vfill=0xFFFFFFFF

    VECTORS (X) : origin = 0x00080000 length = 0x00000040 vfill=0xFFFFFFFF

    CODECRC (R) : origin = 0x00080040 length = 0x00000004 //vfill=0xFFFFFFFF

    …other 7 segments.

    FLASHMO (RX) : origin = 0x00080060 length = 0x0037FFA0 vfill=0xFFFFFFFF

    ECC={algorithm=algoL2R5F021, input_range=VECTORS}

    ECC_VEC (R) : origin=(0xf0400000 + (start(VECTORS) >> 3))

    length=(size(VECTORS) >> 3)

    ECC={algorithm=algoL2R5F021, input_range=VECTORS}

    ECC_FLA0 (R) : origin=(0xf0400000 + (start(FLASHMO) >> 3))

    length=(size(FLASHMO) >> 3)

    ECC={algorithm=algoL2R5F021, input_range=FLASHMO}

    Obviously this is not enough, I've still got many ESM error as I activate SOME code in my application. The ESM error is always the same in all cases: Gr 2, bit 3.

    In the TI wiki page Linked generated ECC, we see: « Please note, that CCS supports the automatic generation of the ECC code when downloading the binary to the target. This feature is enabled by default and could be configured in the Project Settings. It's not possible to use both the CCS integrated ECC generation and Linker Generated ECC at the same time. »

    The only CCS option I see is auto-ECC as in debug and flash using JTAG. Is there others places that I shall deactivate the auto-ECC generation ?

    I flash my application using an home-made CANBUS bootloader, the boot loader itself (0000-7ffff) is flash using JTAG port CCS environnement with auto-ECC activated.

    So 0-80000 is bootloader, the rest it’s application code. As I flash bootloader with JTAG, shall I erase appl area using auto-ECC, or don’t care ?

    Do you have any other hints ?

    Regards.

     

     

     

     

  • Hi Simon,
    I think I have better understanding of your setup now. The bootloader is only from 0-80000 and anything beyond 0x80000 is your application. You use the JTAG to load your booloader into the flash and your application code will be programmed to the flash via the CAN interface. Let me know if my understanding is correct.

    First what I want to know if you are getting ESM GP2.3 when you are running the bootloader or when you are already running the application code? is it possible to find out before your bootloader jumps to the application? It is also possible that you are getting ESM GP2.3 in both the bootloader and the application.

    Let's assume that you don't get ESM GP2.3 error while in bootloader than below is what I will suggest:

    - Go back to your original linker file and remove all the vfill commands and ecc command.
    - You will load your bootloader into flash as before using JTAG
    - Make sure in CCS you have auto-ECC ON and 'Verify' checked
    - Make sure you select the 'Entire Flash' under the Erase Options. Sofor the first time the entire flash is first erased before the bootloader is programmed
    - In your bootloader which is supposed to use the F021 Flash API, you must use the Fapi_issueProgrammingCommand() and specify Fapi_AutoEccGeneration. Please refer to the F021 Flash API Version 2.01.01 userguide and make sure the library you use for LC43 device is the F021_API_CortexR4_BE_L2FMC_xxx.lib such as F021_API_CortexR4_BE_L2FMC_V3D16.lib.

    When you use the Fapi_issueProgrammingCommand() with the Fapi_AutoEccGeneration switch specified then your application code will be programmed with automatic ECC calculated and programmed.

    If this is successful and in the future if you just want to reload a new bootloader without erasing your application code then in the CCS On-Chip Flash menu you can select 'Selected Sectors Only' under the Erase Options. You will also check the sectors that you want to erase. In your case you will select the first 10 sectors for erase but not others.
  • Yes your understanding is correct.

    I've got some ESM error while in bootloader, but that's NOT an issue apparently cause I'm able to flash my code using bootloader/CAN interface no problem.

    In the boot loader, I have to read the application checksum value at 0x00080040 (appl range), that's probablly why I've got error. But again, since I quit bootloader and run application after, I don't really care about boot loader.

    The ESM errors I'd talk about up to now is application ESM errors, while I'm running the application.

    The steps you describe above is pretty what I already do. I've check them and repeated them again to be sure, but same result.

    There is only one thing, the F021 lib, is that correct ?

  • Hi Simon,
    Talking to my colleague and what we suspect happening was that the cache refill might have fetched from some unimplemented locations as I explain in the beginning of the thread. Let's say you have a data section that ends in address 0xXXXXXX18. Each cache refill is 32-bytes long so it will read an entire 32-byte cache line from 0xXXXXXX00-0xXXXXXX1F. The problem is that the addresses from 0xXXXXXX18-0xXXXXXX1F is unimplemented and there is no corresponding ECC for it. When the cache refill is performed the CPU reads the entire 32-bytes. When the last 8-bytes are read, it is detected as uncorrectable ECC error and hence the ESM GP2.0. Normally, this problem is solved with the -vfill command. What the -vfill will do is to make the linker think that the entire 32-bytes are implemented with data, particularly the addresses from 0xXXXXXX18-0xXXXXXX1F will contain your vfill data which is 0xFFFFFFFF. The linker will generate the corresponding ECC for this last 8-byte of data. When the program image is flashed, the ECC is programmed for the the addresses corresponding to 0xXXXXXX18-0xXXXXXX1F. The -vfill command is a virtual fill in order to calculate ECC without blowing up your binary size. If you were to use the fill command rather than the vfill it will do the same thing to calculate the ECC for all the unimplemented addresses but the binary will be almost 4Mbytes because it forces the linker to fill the unimplemented locations with real data.

    In my last post I asked where the ECC error was coming from, whether from the bootloader or from the application. If the GP2.3 is generated while you are in the bootloader then I think the best course of action is still to do -vfill for your bootloader linker file. I believe the linker command file you show is for the application, correct? If you use -vfill for only your bootloader then you want to make sure you only vfill up to the sectors where the bootloader resides.
  • I call CoreDisableCache() at the very beginning in Startup (application) and do not activated it again. I could check my CPU load and it is high compare when I activate it, so I don't think my cache is activated at all for now. Is there cache refill even when the cache deactivated ?
    I've tried both with an without -vFill in the bootloader, no change.
    I've tried to JTAG erase all before, after flash bootloader JTAG chosing sectors within 0-7ffff only, and flash CANBUS application, no change.

    Once in application, the code don't access any code in boot loader area, at least as long as the application code call methode.

    Another information: I said that my code running inside my FIQ interrupt cause ESM errors. If I configure the same interrupt in IRQ and run the same code, no ESM error (if CACHE deactivated). Once I activate CACHE in this scenario, then plenty of ESM errors.

  • Hi Simon,

    Can you please tell with the cache disabled, do you still get ESM error and if yes what ESM flags are set? is it still GP2.3 or others?

    The FIQ vector is located at 0x1C. If your application code creates a FIQ interrupt then the CPU will jump to 0x1C. If you use the HalCoGen then at 0x1C there is the ldr pc, [pc, #-0x1b0] which is to load the PC with the FIQ ISR address from the VIM module FIQVECREG register at 0xFFFFFF74. Let's say the FIQ ISR is at 0x100000 and ends at 0x100117. What I want to emphasize as I explained earlier is that it is possible that the addresses from 0x100118-0x10011F are unimplemented without corresponding ECC. If you have the cache turned ON then the CPU will refill the entire 32-byte cache line by reading from 0x100100-0x10011F. Since there is no ECC for the last 8-byte of data the CPU will detect it as an un-correctable ECC error. Note this is only when cache is enabled.

    This is the reason I'd like to know if you are getting ESM errors when the cache is disabled then what are the ESM errors. Is it GP2.3? If it is not GP2.3 then we have different errors to deal with which is probably independent of the presence of cache.
  • In FIQ (high frequency code in FIQ), I confirm there are esm errors if cache disabled, and the value is Reg 1Ch= 0x008, Reg 28h=0x024, so the same like previous posts.

    In Irq  (high frequency code in IRQ), I confirm there is NO esm error if cache disabled.

  • ok, the only thing I can think of for the GP2.3 to occur when the cache is disabled is that the CPU is performing some sort of speculative fetch from unimplemented location in the FIQ code but not in the IRQ code.

    There is one experiment I have for you to try. In the linker command file for your application project, use FILL command. Don't use VFILL. You don't need the linker generated ECC as your F021 API will be called to program your application image along with the ECC automatically. Since FILL is used, your application binary will become large because all the empty holes will be filled with data of 0xFFFFFFFF. When you issue the F021 API to program the application image it will treat these filled data with 0xFFFFFFFF as real data and calculate ECC for them and program them. Your application download will take longer. Let's first try this before how to reduce the download time.

    Let's say you application does not use the second flash bank. There are two flash banks in LC43x. It is possible that you only do FILL upto the first bank and not having the FILL for the second bank. This will significantly cut down the binary size and the application download time.
  • Ok thanks. I've got little problem to do this experiement: if I use fill (instead of vFill) I've got a little problem with an home made tool that convert .out to another encrypted output format. I guess it could be fix but if it's possible to test the same thing in another way, it could be less time consuming.

    So I've just perform this experiment using JTAG flash instead (and use standard .out), using fill and activate the auto-ECC. Sadly I see no change, still ESM gr2:3 erros.

    Is it possible that the ESM errors are caused because, during application execution, FIQ interrupt happens, at 0x1c or something, then the automatic ESM check goes to 0x00400000 area to compare ? But since the application executable doesn't take care much of the bootloader vector segment, the 0x00400000 area is erased during the appl flash process, only the ECC code about the application vector segment (0x080000 and its corresponding 0x00400000 + 0x080000/8) is preserved ?

  • Hi Simon,
    Where is the 0x0040_0000 coming from? This is an unimplemented space. 0x0040_0000 is already beyond the 4MB implemented flash area. Can you check the MPU setup? Are you setting up the flash for more than 4MB? I don't know why the FIQ will jump to the 0x0040_0000. Perhaps it is due to the speculative fetch. I think this speculative fetch is eventually NOT TAKEN by the CPU's pipeline. However, even though the fetch is no t taken, it has caused the ECC un-correctable error. Did you notice any data abort exception? Normally I will expect an abort exception due to MPU or illegal address access.
  • No no no. Sorry, I was talking about the ECC memory 0xF0400000, where the linker generate CRCs. I don't say the FIQ goes there, it is just a guess, I'm searching an explanation why we have ESM error. I was asking myself, as the 0x1c fiq address is reached, where the ECC comparison is done, at 0xf0400000 or

    0xf0410000 ?

    Anyway, it's like we're going nowhere.

  • Thanks for the clarification. When the application jumps to the 0x1C for FIQ exception, this is part of the bootloader image. The 0x1C is part of the sector0 of flash bank0. Your application starts at 0x00080000 which is sector10. Logically the ECC are memory mapped to a different address starting at 0xF040_0000. However, physically the ECC checksums are in the same word line as the the rest of 256-bit. I don't want to get into too much details of the physical implementation for the flash. What I want to say is that it is not possible you only erase the ECC bits in sector0 without erasing the bootloader program image in sector0. The ECC for 0x0-0x1F will be memory mapped to 0xF040_0000. There are 4 64-bit words from 0x0-0x1F so there will be 4 8-bit ECC. The 0x1C is part of last 64-bit word so I think the ECC address will be at 0xF040_0003.

    How does your bootloader program linker command file look like? Did you try the FILL or VFILL for your bootloader image? If you try FILL or VFILL you should only do up to sector9 for which the bootloader image occupies.
  • In order to remove the incertainty regarding the bootloader, I've completly bypassed it by flashing the application code JTAG at the very beginning of the memory, 0x00000000. So no bootloader at all, but still have same ESM errors. Is the chip itself could be damaged ? Do you have others ideas ?
  • So you use JTAG to flash the application code and you still get ESM GP2.3 when the cache is NOT enabled and you have done the FILL command in the linker command file. If this is the case then I can't think of a reason why the ESM2.3 will still occur. This is news to me. I need to think about it.
  • Something new: in fact my last try was with vFill. I've just done the same thing with fill and there is NO ESM erros if cache NOT activated, and there are ESM errors as I activated the cache, but no crash this time.
    So I see a difference. What does it mean ?
  • When you do VFILL did you utilize the linker generated ECC feature or you use vfill along with the CCS auto-ECC feature? You must use vfill with the linker generated ECC feature and disable the CCS auto-ECC. If you use FILL then you can use the CCS auto-ECC.
  • When I did VFILL, I did it with auto-ECC and no linker generated.

    I've just done what you said (linker generated, VFILL, disable auto-ECC), the code doesn't work, it always goes to unrecognized (unused) interrupt.

    I had erased all flash memory before to flash it.

    VECTORS (X) : origin = 0x00000000 length = 0x00000040 vfill=0xFFFFFFFF

    CODECRC (R) : origin = 0x00000040 length = 0x00000004 vfill=0xFFFFFFFF

    CODELENGTH (R) : origin = 0x00000044 length = 0x00000004 vfill=0xFFFFFFFF

    APPLCAN1_SPD (R) : origin = 0x00000048 length = 0x00000004 vfill=0xFFFFFFFF

    APPLCAN1_CRC (R) : origin = 0x0000004C length = 0x00000004 vfill=0xFFFFFFFF

    APPLCAN2_SPD (R) : origin = 0x00000050 length = 0x00000004 vfill=0xFFFFFFFF

    APPLCAN2_CRC (R) : origin = 0x00000054 length = 0x00000004 vfill=0xFFFFFFFF

    CODE2ADDR (R) : origin = 0x00000058 length = 0x00000004 vfill=0xFFFFFFFF

    CODE2LENGTH (R) : origin = 0x0000005C length = 0x00000004 vfill=0xFFFFFFFF

    FLASHMO (RX) : origin = 0x00000060 length = 0x003FFFA0 vfill=0xFFFFFFFF

    ECC_VEC (R) : origin=(0xf0400000 + (start(VECTORS) >> 3))

    length=(size(VECTORS) >> 3)

    ECC={algorithm=algoL2R5F021, input_range=VECTORS}

    ECC_FLA0 (R) : origin=(0xf0400000 + (start(FLASHMO) >> 3))

    length=(size(FLASHMO) >> 3)

    ECC={algorithm=algoL2R5F021, input_range=FLASHMO}

  • I have never used the way you defined it for ECC_VEC and ECC_FLA0 so I don't know if it is the reason for the problem. I have no idea what algoL2R5F021 means to the linker and how it will guide the linker in calculating ECC. algoL2R5F021 seems like an algorithm for CortexR5 L2 Flash in F021 technology. But I'm not sure if it is sufficient for the linker. You have:

    ECC_VEC (R) : origin=(0xf0400000 + (start(VECTORS) >> 3)) length=(size(VECTORS) >> 3) ECC={algorithm=algoL2R5F021, input_range=VECTORS}

    ECC_FLA0 (R) : origin=(0xf0400000 + (start(FLASHMO) >> 3)) length=(size(FLASHMO) >> 3) ECC={algorithm=algoL2R5F021, input_range=FLASHMO}

    This is not how we have done it. If you refer to the example command file then I would have re-written for your application as:

    ECC_VEC (R) : origin=(0xf0400000 + (start(VECTORS) >> 3)) length=(size(VECTORS) >> 3) ECC={input_range=VECTORS}
    
    ECC_FLA0 (R) : origin=(0xf0400000 + (start(FLASHMO) >> 3)) length=(size(FLASHMO) >> 3) ECC={input_range=FLASHMO}
    
    ECC
    
    {
    
       algo_name : address_mask = 0xfffffff8
    
       hamming_mask = R4
    
       parity_mask = 0x0c
    
       mirroring = F021
    
    }
    
    

    Once you do this the linker will generate the ECC as part of the .out and you will need to disable the CCS auto-ECC and check the 'None' radio button for the Flash Verification settings. 

  • Below is the summary i gather. Perhaps you can help me fill out the symptoms you see in each case. 

      VFILL, Linker Generated ECC FILL, Auto-ECC
    Cache ON 1. Code goes to uncognized interrupt?
    2. ESM GP2.3?
    ESM GP2.3
    Cache OFF 1. Code goes to uncognized interrupt
    2. ESM GP2.3?
    OK
  • I've done the changes you proposed, no success:

    ECC_VEC (R) : origin=(0xf0400000 + (start(VECTORS) >> 3))

    length=(size(VECTORS) >> 3)

    ECC={input_range=VECTORS}

    ECC_FLA0 (R) : origin=(0xf0400000 + (start(FLASHMO) >> 3))

    length=(size(FLASHMO) >> 3)

    ECC={input_range=FLASHMO}

    ...

     

    IRAM (RW) : origin = 0x08002200 length = 0x0007DE00

    }

    ECC {

    algo_name : address_mask = 0xfffffff8 /* Address Bits 31:3 */

    hamming_mask = R4 /* Use R4/R5 build in Mask */

    parity_mask = 0x0c /* Set which ECC bits are Even and Odd parity */

    mirroring = F021 /* RM57Lx and TMS570LCx are build in F021 */

    }

    To sum up (without bootloader):

    - I've got no success at all using Linker Generated ECC (got uncognized interrupt all the way, cache or no cache);

    - All my ESM errors are GP2:3

    - FILL, Auto-ECC, cache OFF  => no ESM error, cache ON some ESMs error but no crash.

    With bootloader: FILL, Auto-ECC, cache OFF => ESM errors == Nb of FIQ interrupt, cache ON crash application.

    Regards.

  • Can you send me your project? The one without the bootloader. Can the problem be recreated in the HDK EVM board without any external stimulus on the I/Os? If your project contains I/O activities with external devices, can you remove them and still be able to reproduce the problem. That will help me to reproduce your problem. I only have HDK or the launchpad.
  • Ok, but I cannot post my code on the forum. Just send-me a message where I can send you my code.

  • Hi Simon,
    Did you receive the friend request I sent in the morning?