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.

AM263P4: Flash offset alignment issue when writing to external flash

Part Number: AM263P4
Other Parts Discussed in Thread: UNIFLASH

Tool/software:

Hi,

As part of a test for a future key management architecture, I flashed a dummy 256-bit AES key to the MCU's external flash (starting at 0x60000000). Alongside my tiimage SBL and mcelf application, I added the following line to my uniflash config file, which is passed to uart_uniflash.py:

# Key test --file="C:/KeyManagement/keys.bin" --operation=flash-sector-write --flash-offset=0x9A000

When debugging, I inspect memory starting at 0x60000000 + 0x9A000 = 0x6009A000, expecting to see the key start there. However, the key actually appears to begin two bytes earlier, at 0x60099FFE (i.e., offset 0x99FFE).

My questions:

  1. Why is there a discrepancy of 2 bytes between the flash offset (0x9A000) and where the key actually appears (0x99FFE)?

  2. What is the difference between the flash-sector-write operation and a standard flash operation that you can specify in the uniflash config file?

  3. When I try to change the offset to 0x99FFE in the uniflash config file and reflash, the flash operation fails. I assume this is due to alignment requirements. What is the alignment block size for flash writes on this device?

Thank you!

  • Hi Oliver,

    Allow me some time check on this. Apologies for the delay as I was OOO for the past week. 

    Meanwhile can you please tell me, which SDK version you are using ?

    Regards,

    Aswin

  • Hi Aswin,

    No worries, I am using the newest version 11 of the sdk.

    Thanks,

    Olivier H

  • Hi Olivier,

    I did some experiments on my side. I tried to flash 256 bytes of data at the flash offset 0x9A000 in UART boot mode using the uart_uniflash.py python script. 

    This is how my configuration file look.

    Once flashing was done, I checked this memory area in flash via the memory browser in CCS. I saw that the keys were present at the address they were supposed to be.

    May I know if 

    - if you tried to flash using the uniflash GUI tool at the required address ?

    - Is this being done on a custom board or on TI EVM. I have did this on AM263P LP launchpad ?

    - If using custom board, may I know which flash is being used ?

    - Also, may I know how was the memory was viewed ?

    I will get back to you with response for reset of the questions.

    Regards,

    Aswin

  • Hi Olivier,

    Why is there a discrepancy of 2 bytes between the flash offset (0x9A000) and where the key actually appears (0x99FFE)?

    This needs to be checked. I did some experiment on my side which I mentioned in the previous message. Is there any particular method being done differently from my steps. DId you test on a custom flash/board. 

    What is the difference between the flash-sector-write operation and a standard flash operation that you can specify in the uniflash config file?

    The difference lies in how the erase is done. Flash-sector-write does sector erase while flash-write does a block erase. This can be analyzed by checking the function Bootloader_uniflashProcessFlashCommands() in the file bootloader_uniflash.c file. In this function there are cases in a switch statement that equates to this flags.

    When I try to change the offset to 0x99FFE in the uniflash config file and reflash, the flash operation fails. I assume this is due to alignment requirements. What is the alignment block size for flash writes on this device?

    All writes should be sector aligned. If not then it will fail. That would be the reason why the failure message came.

    Regards,

    Aswin