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.

TMS320F280049C: TMS320F280049C flashapi_ex2_sci_kernel example project queries

Part Number: TMS320F280049C
Other Parts Discussed in Thread: C2000WARE

Hi,

I am trying to implement LFDU for my project. I have few queries related to flashapi_ex2_sci_kernel project.

1. How address is calculated to be 0x9EFF0 refer line 1222 and 0x8EFF0 (line number 1234) of flashapi_ex2_ldfu.c

2.Why return value of ldfuLoad() is assigned to EntryAddr (line 226  flashapi_ex2_ldfu.c)

3. Line number 277 has a check for sciaGetWordData()!=0x08AA . Can you please shed some light on this as to why this is required?

4. As per cmd linker file each sector has size approximately equal to 0x001000 but the size calculated at line number 529 of flashapi_ex2_ldfu.c is found to be 0x0800 which is the value of macro B_8KSector_u32length? With this size how it is possible to erase entire flash sectors correctly?

5. Can anyone please shed some light on function ldfuCopyData() from line number 650-714?

Please can anyone help on above queries

Thanks,

Suhail.B 

  • Suhail,

    1. Please check Table 4-30. Flash Boot Options section in TRM (https://www.ti.com/lit/ug/sprui33b/sprui33b.pdf). 

    In the below linker command files available at \C2000Ware_3_02_00_00\device_support\f28004x\common\cmd, you can see that in bank0, the codestart section is mapped at address 0x08EFF0.  In bank1, the codestart section is mapped at address 0x09EFF0.

    28004x_flash_api_liveFirmwareUpdate_bank0_lnk.cmd

    28004x_flash_api_liveFirmwareUpdate_bank1_lnk.cmd

    2. It is to return the start address given in the streamed hex file.

    3. Please see section 4.6.7.2 SCI Boot Mode and section 4.6.8.1 Bootloader Data Stream Structure in TRM.  If the keyvalue streamed is not 0x08AA, loader will exit.

    4. It is the sector length in 32-bit words (not 16-bit words).

    5. Did you read the description of this function in the flashapi_ex2_ldfu.c()?  Do you have any specific question?  Also, which file are you referring when you say line numbers 650-714?

    Thanks and regards,
    Vamsi

  • Thank you the reply. However i have below queries 
    1. Yes agree in linker cmd file In bank0, the codestart section is mapped at address 0x08EFF0.  In bank1, the codestart section is mapped at address 0x09EFF0. I had a doubt like codestart section will just jump to main function or it has some other functionality as well? Can you please shed some more light on this?

    2. But is has not been used after getting assigned ? 

    3. Does it mean serial_flash_programmer_appln.exe will be setting the key value as 0x08AA?

    4. Thanks for the input really helpful. I got it .

    5. Yes i have read the description of it in flashapi_ex2_ldfu.c. I am referring to flashapi_ex2_ldfu.c file.

             a.  Why blocksize is compared to Buffer size of 0X80? does it mean input data stream will have maximum 0x80 (16 bit words) of data? Line number 679 comparison to BlockHeader.DestAddr>=(uint32_t)B_START_ADD is required? Similarly at line number 699? 

             b. I also wanted to understand how data is filled into buffer. Can you please shed some light on portion of code (line numbers 714-935)

    Please help me on above queries.

    Thanks,

    Suhail.B

  • Suhail,

    1. Codestart will branch to c_init routine, which initializes all the global variables.  C-init routine branches to main. Codestartbranch.asm also provides a provision to disable watchdog if application needs it.

    2. Yes, it can be used to jump to the application start address when no reset is needed.

    3. C2000 Hex utility (hex2000) can be used to generate the hex file to include this value.

        Syntax is here: hex2000.exe -boot -sci8 -a -o <file.txt> <file.out>

        Serial programmer executable sends the hex file to the target MCU.

    4. Ok. Glad it helped.

    5. Regarding block size: Yes.

    Regarding address comparison: It is required.  While updating the Bank1 image, the kernel does not erase or program the addresses less than 0x92008 (B1_RESERVED).  This is to prevent erasure of the kernels that exist in Bank1's sector0 and sector1.  Similarly, while updating the Bank0 image, the kernel does not erase or program the addresses less than 0x82008 (B0_RESERVED).  This is to prevent erasure of the kernels that exist in Bank0's sector0 and sector1.  

    Regarding the data fill: Sure, I can review it and let you know.  Is it not clear from the comments in the code?

    Thanks and regards,
    Vamsi

  • Thank you so much for the information i got first 4 points. However i have query on 5th point

    5. Line number 679 comparison to BlockHeader.DestAddr>=(uint32_t)B_START_ADD is required? Similarly at line number 699? Agree to explanation about to prevent erasure of the kernels that exist in Bank0's sector0 and sector1 and Bank1's sector0 and sector1 related to B0_RESERVED and B1_RESERVED. But i have doubt why the check BlockHeader.DestAddr>=(uint32_t)B_START_ADD is required?

    I got little bit idea on data fil but unable to understand how data fill will happen when Blockheadr.BloackSize is greater than BUFFER_SIZE.Can you please shed some light on this?

    I have another query related to bank selection logic. How bankSelect (line 1148- 1209 flashapi_ex2_ldfu.c) will branch to SCI kernel setup when no banks have been programmed?

    Let me know if my understanding is wrong--- I assume that when no bank is programmed, execution will jump to sciGetFunction thorugh EntryAddr= sciGetFunction(0x01);[line 1209 flashapi_ex2_ldfu.c] so my query is how this sciGetFunction will make sure LDFU? Can you please shed some light on this as to which part of the code does this functionality?

    Thanks and Regards,

    Suhail.B 

  • Suhail,

    I am not available this week and hence I notified my colleague yesterday to support this thread.  Please expect a reply in a day or two.

    Thanks and regards,
    Vamsi

  • Suhail,

    The check BlockHeader.DestAddr>=(uint32_t)B_START_ADD is required because we are only testing if the forbidden portions of the Application portion of Flash are being written to. Yes, the kernel portion should not be overwritten either, so in theory maybe this check can be replaced by the start of the bank's kernel space.

    The kernel seems to handle only the case where the size of the block of data is less than BUFFER_SIZE.

    Your understanding is correct - if no banks are programmed, code will remain in SCI_lockAutobaud() of SCIGetFunction(), waiting to autobaud lock with the host, which will occur on a host command (e.g. LFU). Following this, the code will enter the below portion of SCIGetFunction().

    if (command == LIVE_DFU_CPU1)

    {
    liveDFU();
    }

    Thanks,

    Sira

  • Sira,

    I still could not figure out the check BlockHeader.DestAddr>=(uint32_t)B_START_ADD requirement. If you could please help me out with little bit description it would be of great help. 

    So do we have to modify kernel for when size of the block of data is greater than BUFFER_SIZE?

    SCI_lockAutobaud() is necessary for any application or it is been used just as example? 

    Thanks and Regards,

    Suhail.B

  • Suhail,

    Kernel addresses are 90000-92000. Application forbidden space is 92000-92008. So the check is to make sure those forbidden locations aren't written to with Application code. Those locations contain a START, KEY, and VERSION.

    I don't believe you need to modify the kernel.

    The host .exe is implemented with autobaud lock - therefore the target side also implements the same.

    Thanks,

    Sira

  • Sira,

    Thank you for the clarification .

    Thanks and Regards,

    Suhail.B