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.

AM2432: uart_uniflash.py failed with buffer of 256 KB, as well as 1024 KB

Part Number: AM2432
Other Parts Discussed in Thread: UNIFLASH

Tool/software:

Hello TI team, 

We recently noticed that when our image size is slightly above 400 KB, using 256 KB as BOOTLOADER_UNIFLASH_BUF_SIZE would fail to program the app image into flash. 

We have seen issues with default 1024 KB as well when trying to work with a 8 MB image. 

What is the constrain here regarding the BOOTLOADER_UNIFLASH_BUF_SIZE?


Thanks, 
Hong 

  • Hi Hong,

    We recently noticed that when our image size is slightly above 400 KB, using 256 KB as BOOTLOADER_UNIFLASH_BUF_SIZE would fail to program the app image into flash. 

    Please elaborate what kind of failure you are seeing. Please help me with pasting/attaching the logs.

    Also the macro you are talking about should be 

    BOOTLOADER_UNIFLASH_BUF_SIZE_BYTES right instead of 
    BOOTLOADER_UNIFLASH_BUF_SIZE
    Looking forward to your response.

    Regards,

    Vaibhav

  • Hello Vaibhav,

    The uart_flash passed and didn't report any failure when using 256 KB as BOOTLOADER_UNIFLASH_BUF_SIZE_BYTES ( Our engineer renamed it to BOOTLOADER_UNIFLASH_BUF_SIZE, which is the same), but at next power up, we checked the hash, the SBL reported hash mismatched for the app image. 

    Thanks, 
    Hong 

  • but at next power up, we checked the hash, the SBL reported hash mismatched for the app image.

    When the power up was done, the booting succeeded or it the flow is stuck somewhere.

    the SBL reported hash mismatched for the app image. 

    How did you confirmed this information, by connecting to the cores?

    Regards,

    Vaibhav

  • Hello Vaibhav, 

    We have hash check added in SBL, and the SBL reported the HASH for the FW, which was different from the actual HASH. 

    This means that the FW was not properly loaded via uart_uniflash.py. 


    Thanks, 
    Hong 

  • Hello Vaibhav, 

    Does TI have a suggested value for BOOTLOADER_UNIFLASH_BUF_SIZE_BYTES that are known to work for different image sizes

    Thanks, 
    Hong 

  • Hi Vaibhav,

    Seems that the UniFlash command line tool is working well.. except for certain image sizes and buffer sizes and/or image/buffer size combo(s).  The Customer has high confidence that their UART interface is reliable, accurate and stable.  Can you please have someone on the UniFlash tool team replicate this issue at TI so we can understand the issue and provide a recommend on the max buffer size, max image size and buffer/image size combo(s).  Can you also please confirm the UART baud rate (recommended/max)?  Else the customer has no confidence in using the tool reliably. 

    Thanks, Merril

  • Hi,

    I will check the recommendation on the max buffer size and the maximum baud rate.

    Please allow me sometime to check this internally and come back here.

    Regards,

    Vaibhav

  • Hello Vaibhav, 

    Thanks a lot for the help on this. Just to clarify here, we used uart_uniflash.py Python script, because this works better in our environment. We didn't use the Uniflash GUI. 

    Thanks, 
    Hong 

  • Hi Hong,

    The default values are ofcourse the recommended ones. However, if required, you may change the value to a multiple of 256KB as also pointed out in the comment:

    BOOTLOADER_UNIFLASH_BUF_SIZE_BYTES                    = CONST_MB # This has to be a 256 KB aligned value, because flash writes will be block oriented

    For the issue you are reporting, could you please share the flashing logs to confirm if the flashing is at least happening successfully. The issue then could be related to booting only possibly because of the incorrect flash read.

    Please share the boot logs as well.

    Regards,

    Prashant

  • Hello Prashant, 

    We have used only 256 KB and 1024 KB size of BOOTLOADER_UNIFLASH_BUF_SIZE_BYTES, and we have seen different failure cases for each size (256KB and 1024 KB).

    For the latest test case, we set 256 KB as buffer size, and our image size is slightly larger than 400 KB, when it failed. The uart_uniflash.py reported successfully.  But at next reboot, our sbl reported hash mismatch.  For this failure case, we increase the buffer to be 1024 KB, which will send the app image in one shot, and we don't see the same issue again.  

    I am not sure what boot log info that can help to us to understand better about the situation. I can prepare the logs for the debug meeting, if that can help. 

    Thanks, 
    Hong  

  • Hi Hong,

    Whenever you get the chance to work on this one, please share the results of verifying if the image is written correctly using "operation=flash-verify".

    Regards,

    Prashant

  • Hello Prashant, 

    Could TI please try to reproduce the same issue on TI EVM as well?   


    Steps to repro from SDK 9.0 release:
    1) Use SBL_UART_UNIFLASH 
    2) Use SBL_OSPI 
    3) for hello_world app image => create the size to be about 409,608 bytes 

    At uart_uniflash.py, update the BOOTLOADER_UNIFLASH_BUF_SIZE to be 256 KB instead of 1024 KB default. 



    Thanks, 

    Hong 

  • Hi Hong,

    I had already tried reproducing the issue on TI EVM but could not. Then only asked for verifications on your end.

    If it matters, I integrated the listed steps with the following patch and still did not see the issue on TI EVM.

    diff --git a/examples/hello_world/am243x-evm/r5fss0-0_nortos/ti-arm-clang/linker.cmd b/examples/hello_world/am243x-evm/r5fss0-0_nortos/ti-arm-clang/linker.cmd
    index 69640f4..dad5934 100644
    --- a/examples/hello_world/am243x-evm/r5fss0-0_nortos/ti-arm-clang/linker.cmd
    +++ b/examples/hello_world/am243x-evm/r5fss0-0_nortos/ti-arm-clang/linker.cmd
    @@ -131,7 +131,7 @@ MEMORY
         /* when using multi-core application's i.e more than one R5F/M4F active, make sure
          * this memory does not overlap with other R5F's
          */
    -    MSRAM     : ORIGIN = 0x70080000 , LENGTH = 0x40000
    +    MSRAM     : ORIGIN = 0x70080000 , LENGTH = 0x80000
     
         /* This section can be used to put XIP section of the application in flash, make sure this does not overlap with
          * other CPUs. Also make sure to add a MPU entry for this section and mark it as cached and code executable
    diff --git a/examples/hello_world/hello_world.c b/examples/hello_world/hello_world.c
    index 276caaf..a39d6ab 100644
    --- a/examples/hello_world/hello_world.c
    +++ b/examples/hello_world/hello_world.c
    @@ -37,6 +37,8 @@
     #include "ti_drivers_open_close.h"
     #include "ti_board_open_close.h"
     
    +uint8_t garr[0x60000] = {5};
    +
     void hello_world_main(void *args)
     {
         /* Open drivers to open the UART driver for console */
    @@ -44,6 +46,7 @@ void hello_world_main(void *args)
         Board_driversOpen();
     
         DebugP_log("Hello World!\r\n");
    +    DebugP_log("garr[0]: %d\r\n", garr[0]);
     
         Board_driversClose();
         Drivers_close();
    diff --git a/tools/boot/uart_uniflash.py b/tools/boot/uart_uniflash.py
    index 1b89644..d8a16d7 100644
    --- a/tools/boot/uart_uniflash.py
    +++ b/tools/boot/uart_uniflash.py
    @@ -363,7 +363,8 @@ def main(argv):
         args = my_parser.parse_args()
         
         global BOOTLOADER_UNIFLASH_BUF_SIZE_BYTES
    -    BOOTLOADER_UNIFLASH_BUF_SIZE_BYTES = CONST_KB * int(args.chunk_size_kb)
    +    # BOOTLOADER_UNIFLASH_BUF_SIZE_BYTES = CONST_KB * int(args.chunk_size_kb)
    +    BOOTLOADER_UNIFLASH_BUF_SIZE_BYTES = 256 * 1024
     
         serialport = args.serial_port
         config_file = args.cfg
    

    Let me know if I missed something in the patch.

    Regards,

    Prashant

  • Hello Prashant, 

    Could you please let me know the image size of your hello_world_am243x-evm_r5fss0-0_freertos_ti-arm-clang.appimage.hs_fs? 

    What I suggested as below: 
     for hello_world app image => create the size to be about 409,608 bytes 

    Thanks, 
    Hong 

  • Hello,

    3) for hello_world app image => create the size to be about 409,608 bytes 

    This was indeed followed.

    In the patch, the hello world example is modified to include the following array of size 384KB

    uint8_t garr[0x60000] = {5};

    and with other code and data, the size eventually gets around ~430KB as shown

    ❯ /usr/bin/ls -l ./examples/hello_world/am243x-evm/r5fss0-0_nortos/ti-arm-clang/hello_world.debug.appimage.hs_fs
    -rw-r--r-- 1 p-shivhare p-shivhare 433551 Feb 14 17:38 ./examples/hello_world/am243x-evm/r5fss0-0_nortos/ti-arm-clang/hello_world.debug
    .appimage.hs_fs

    Regards,

    Prashant

  • Hello Prashant, 

    This size should be similar to what we have. 

    I am not sure why this doesn't fail on TI's EVM board here. 

    Thanks, 
    Hong