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.

Flashing data part by part in TMS570LS20216

Other Parts Discussed in Thread: TMS570LS20216

Hello,

How shall we control the alignment of code and data  in TMS570LS20216 ?

Is it by using the using the palign(n) in the sys_link.cmd file ? Please correct me if i am wrong.

    .intvecs : palign(4), fill = 0xffffffff {} > VECTORS
    .text       : palign(4), fill = 0xffffffff {} > FLASH0
    .const   : palign(4), fill = 0xffffffff {} > FLASH0
    .cinit     : palign(4), fill = 0xffffffff {} > CINIT
    .pinit     : palign(4), fill = 0xffffffff {} > FLASH0

 

This is because i need all data to be flashed aligned to 32 bit boundary.

When i try Flash API -   Flash_Prog_B((void *)Start_Address , (UINT32 *)Data, FlashDataSize, Bank_Val, REdelay,(FLASH_ARRAY_ST)0xfff87000, &status);

i observed that Start_Address required to be aligned to 32 bit boundary and FlashDataSize also as number of 32 bit words. Hope it is right.

So when we have to flash a code  part by part i did not always get exactly at the 32 bit boundary( maybe due to alignment issue ) . In that case how we can ensure that still we are able to flash the data ?

An example may make the picture more clear.

Please follow the sequence below.

step 1:  Address is 0x80000(Flash Bank1) and number of data is 6 bytes. When we call the Flash_Prog_B API we gave Start_Address = 0x80000 and FlashDataSize = round to upper(6/4) = 2. Then it will get flashed into the sections from 0x80000 to 0x80007.

step2. Address is 0x80007(Flash Bank1) and number of data is 1 byte. This will not get written into flash as already the 0x80000 - 0x80007 section has been written by a previous write operation . If we need to write again we have to erase(convert to 0xFFFFFFFF) the 0x80000 - 0x80007(32 bit boundary) and rewrite it.

How can i solve this issue to write to 0x080007 ?

Thanks in advance,

Regards,

Renjith George

 

  • Hello,

    One way i found out.

    If the byte we want to modify is 0x80007. Follow the steps below:-

    1. Read the 32 bit aligned data from flash(here 0x80004 - 0x80007) .

    eg  0xFEFEFFFF

    2. Copy the data from 0x80004 - 0x80007 to RAM.

    3. Mask and edit only the byte which we require to modify and keep in the RAM.(data to be flashed is 0xB0)

    eg 0xFEFEFFB0

    4. Flash the modified data available in RAM to the flash with that Flash_Prog_B API.

    Can anyone suggest any other way if it is there to avoid the  data starting at non 32bit boundaries ?(I use the fld(FastLoad Format) format data)

    With Best Regards,

    Renjith George

  • Hello Renjith,

    The start address for programming flash must be aligned to a 32-bit boundary. The read-modify-write operation you described is the recommended way of programming a byte to an address that is not aligned to a 32-bit boundary.

    Regards,

    Sunil