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: sbl_can_uniflash Won't Flash With --flash-offset=0x81000

Part Number: TMDSCNCD263P
Other Parts Discussed in Thread: UNIFLASH

Tool/software: MCU_PLUS_SDK 10.01.00.34

Hello,

The latest SBL (sbl_ospi.release.tiimage) expects the application to be flashed at offset 0x81000, i.e. similar to GUI UniFlash:

I want to emulate this with project 'sbl_can_uniflash_am263px-cc_r5fss0-0_nortos_ti-arm-clang'.

However, I make the following change in 'default_sbl_can_uniflash_app.cfg'

--file=myFile.appimage --operation=flash --flash-offset=0x81000


However, when I debug 'sbl_can_uniflash' I can see that the following test is always true in Bootloader_uniflashFlashFile():

	if((status == SystemP_SUCCESS) && ((flashOffset % eraseBlockSize) != 0))
	{
		/* Only flash to offsets which are a multiple of blockSize */
		status=SystemP_FAILURE;
	}

This is because flashOffset (0x81000) is not a multiple of blockSize. Of course, it works just fine if --flash-offset=0x80000.

<Question>
Can project 'sbl_can_uniflash' be used to flash my application at 0x81000 to match the SBL expected offset? If so, what should be the contents of 'default_sbl_can_uniflash_app.cfg'?

Thank you.

  • Hi Kier,

    Please share few more info,

    which boot mode are you using?

    Is this a custom board or TI EVM

    Also which flash are you using?

    What is the frequency at which you are running OSPI? Are you using the PHY mode in OSPI?

  • Hi Nilabh,

    I can't see the relevance of the questions. Flashing works fine with offset 0x80000. Anyway....

    which boot mode are you using?

    I'm using OSPI 1S mode.

    Is this a custom board or TI EVM

    Also which flash are you using?

    As it says in the Part Number field, I'm using TMDSCNCD263P.

    What is the frequency at which you are running OSPI? Are you using the PHY mode in OSPI?

    As per the TI project ''sbl_can_uniflash_am263px-cc_r5fss0-0_nortos_ti-arm-clang".

  • The relevance is due to the dependence of OSPI being used at higher speed vs using at slower speed.

    When using OSPI to access flash at higher speed needs flash tuning data at 0x80000 location, so you cannot flash application there, but if you are using at slower speed, flash tuning data is not needed. Then you can flash at that location.

  • Yes but the problem described is that I cannot flash at 0x81000 and furthermore, the cause is a failure of this test (flashOffset % eraseBlockSize) == 0.

    This is probably more to do with the incorrect or missing advice in config file:

    # When sending application image, make sure to flash at offset 0x80000 (default) or to whatever offset your bootloader is configured for
    --file=../../examples/drivers/ipc/ipc_notify_echo/am263px-cc/system_freertos_nortos/ipc_notify_echo_system.release.appimage --operation=flash --flash-offset=0x80000

    Changing the offset to "whatever offset your bootloader is configured for" doesn't work for SBLs expecting the application at 0x81000.

  • Hi Kier,

    Can you once try 

    BOOTLOADER_UNIFLASH_OPTYPE_FLASH_SECTOR = 0xF7
    in your can uniflash python file.
  • Hi Nilabh,

    Thank you but not 100% sure what you mean. There is already a line as follows:

    BOOTLOADER_UNIFLASH_OPTYPE_FLASH_SECTOR               = 0xF7

    Not sure what you want me to do.

  • Apologies if I was not clear,

    The write fails because the SBL is trying to do a write which is not block size aligned.

    So what I asked was to send a sector write command from the can_uniflash python script instead of default block write command.

  • OK thank you.

    After some consideration of the Python script, I think what you're asking for is --operation=flash-sector-write rather than --operation=flash in the configuration file.

    optypewords = {
    "flash" : BOOTLOADER_UNIFLASH_OPTYPE_FLASH,
    "flashverify" : BOOTLOADER_UNIFLASH_OPTYPE_FLASH_VERIFY,
    "flash-xip" : BOOTLOADER_UNIFLASH_OPTYPE_FLASH_XIP,
    "flashverify-xip" : BOOTLOADER_UNIFLASH_OPTYPE_FLASH_VERIFY_XIP,
    "flash-phy-tuning-data" : BOOTLOADER_UNIFLASH_OPTYPE_FLASH_TUNING_DATA,
    "erase" : BOOTLOADER_UNIFLASH_OPTYPE_FLASH_ERASE,
    "flash-emmc":BOOTLOADER_UNIFLASH_OPTYPE_EMMC_FLASH,
    "flashverify-emmc":BOOTLOADER_UNIFLASH_OPTYPE_EMMC_VERIFY,
    "flash-sector-write":BOOTLOADER_UNIFLASH_OPTYPE_FLASH_SECTOR,
    "flash-mcelf-xip":BOOTLOADER_UNIFLASH_OPTYPE_FLASH_MCELF_XIP,
    "flashverify-mcelf-xip" : BOOTLOADER_UNIFLASH_OPTYPE_FLASH_VERIFY_MCELF_XIP
    }
    
    

    Unfortunately the argument 'flash-sector-write' is not supported in the Python script:

    Parsing config file ...
    Traceback (most recent call last):
      File "C:\ti\mcu_plus_sdk_am263px_10_01_00_34\tools\boot\can_uniflash.py", line 912, in <module>
        main(sys.argv[1:])
      File "C:\ti\mcu_plus_sdk_am263px_10_01_00_34\tools\boot\can_uniflash.py", line 635, in main
        parse_status = filecfg.parse()
      File "C:\ti\mcu_plus_sdk_am263px_10_01_00_34\tools\boot\can_uniflash.py", line 893, in parse
        status = linecfg.validate()
      File "C:\ti\mcu_plus_sdk_am263px_10_01_00_34\tools\boot\can_uniflash.py", line 793, in validate
        f = open(self.filename)
    TypeError: expected str, bytes or os.PathLike object, not NoneType

    So I hacked the script itself as you requested from:

        file_header = struct.pack(file_header_str,
                                  BOOTLOADER_UNIFLASH_FILE_HEADER_MAGIC_NUMBER,
                                  optypewords[linecfg.optype],
                                  offset_val,
                                  erase_size_val,
                                  actual_file_size,
                                  rsv_word, rsv_word, rsv_word
                                 )

    ...to...

        file_header = struct.pack(file_header_str,
                                  BOOTLOADER_UNIFLASH_FILE_HEADER_MAGIC_NUMBER,
                                  BOOTLOADER_UNIFLASH_OPTYPE_FLASH_SECTOR,
                                  offset_val,
                                  erase_size_val,
                                  actual_file_size,
                                  rsv_word, rsv_word, rsv_word
                                 )

    This does seem to successfully flash.

    Therefore the problem can be summarised as follows:

    SDK can_uniflash.py is incompatible with SDK sbl_ospi.release.tiimage (since SBL expects offset 0x81000 and flash-sector-write is not supported).

    Can you raise a ticket to correct this please?

    Also note that the failure to flash with offset 0x81000 is still reported as a success in the Python script....

    ....even though the response header says otherwise:

  • Hi Kier,

    We are planning to make changes to Flash writes itself, to check if block aligned writes are requested, else proceed with sector aligned writes.

    Glad it worked for you.