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.

66AK2E05: NAND Writer recompilation with Processor SDK Linux 04.02.00.09

Expert 1010 points
Part Number: 66AK2E05


Hi,

Since I have noticed a problem in nandwriter.c (formatting nand flash does not allow bad block) with MCSDK 3.1.4, I wanted to look at the newest code which is compatible with Processor SDK 04.02.00.009 (I am migrating from MCSDK to this version of Processor SDK).

Searching for this topic, I only found information talking about this path: [SDK Install Path]/pdk_<platform>_<version>/packages/ti/boot/writer.

But there is nothing like this in Processor SDK Linux. How to proceed?

  • I downloaded Processor SDK RTOS (5.0 to have the last one) and looked at the nandwriter.c in [SDK Install Path]/pdk_k2e_4_0_10\packages\ti\boot\writer\nand\src (my target platform is k2e).

    Do I really need to download Processor SDK RTOS of the same version when I only want to work with Processor SDK Linux?

    Regarding nandwriter.c, it seems that the code did not change. In nand_erase_all_blks function, there is still:

    static Bool 
    nand_erase_all_blks(PLATFORM_DEVICE_info *p_device)
    {
      uint32_t block;
      uint32_t max_blks;
    
      max_blks = p_device->block_count;
      
      for (block=0; block<max_blks;block++)
      {
          printf (".");
          if (platform_device_erase_block(p_device->handle, block) != Platform_EOK)
            return FALSE;
      }
    
      printf ("\nFormatted %d nand blocks \n", block);
      return (TRUE);
    }

    But from my point of view, it should be something like this:

    static Bool 
    nand_erase_all_blks(PLATFORM_DEVICE_info *p_device)
    {
      uint32_t block;
      uint32_t max_blks;
    
      max_blks = p_device->block_count;
      
      for (block=0; block<max_blks;block++)
      {
          printf (".");
          if (platform_device_erase_block(p_device->handle, block) != Platform_EOK)
       {
        printf ("\nFormatted nand block %d failed \n", block);
       }
      }
    
      printf ("\nFormatted %d nand blocks \n", block);
      return (TRUE);
    }
    

    This is strange since flashing nand afterwards accept bad blocks.

  • Hi, dpa,

    I don't quite follow what you try to do. You have the subject line of Recompilation in Linux Proc SDK, but referring code in RTOS. From the old thread you quoted, it seems that it is about program_evm. Are you try to change NAND writer code in program_EVM? or in Linux u-boot?

    Linux NAND u-boot code is in Linux SDK/u-boot/drivers/mtd/nand, TI specific code is in Davinci_nand.c which initializes the device on the EVM and setup the ECC layouts. The nand erase code is in nand_util.c which is upstream code. In the erase function, I see the following comments which should skip the bad block and continue:

    /* scrub option allows to erase badblock. To prevent internal
    * check from erase() method, set block check method to dummy
    * and disable bad block table while erasing.
    */

    If you have question on upstream code, it should be discussed in Linux Kernel open source forum.

    If you have question on program_evm, or RTOS NAND writer, I'll have a RTOS engineer to work with you.

    Rex
  • Hi Rex Chang,

    Thanks for the complete answer.

    I want to use program_evm to format NAND flash and then flash Default Image on my custom board (based on 66AK2E05 Soc) using Processor SDK Linux.

    program_evm is using nandwriter which source was included in MCSDK (nandwriter.c) but not in Processor SDK Linux anymore. Only binaries of nandwriter are included (together with program_evm).

    Since nandwriter is stopping formatting blocks when one single block is bad (which is not unusual at all), I wanted to change source of nandwriter. In order to get source, the only way I found is to get Processor SDK RTOS (of the same version of Processor SDK Linux) where nandwriter source is included.

    That's why my 2 questions:

    1. Why is source of nandwriter not included in Processor SDK Linux as it was in MCSDK?
    2. Why is formatting of NAND stopped in nandwriter.c when it sees a bad block? It sounds as a not intended feature for me.   

  • Hi, dpa,

    I assume you are not in ARM running Linux environment. If you do, you can try using u-boot script to flash NAND with "run burn_ubi" command.

    we had a change a while back. Muti-Core SDK used to support only multi-core family of products, Keystone and Keystone-2, so MCSDK includes Linux and BIOS packages for ARM and DSP cores. After Migrating to Processor SDK, PSDK supports both multi-core and single-core platforms in the same BU. The SDK hence becomes separate LInux and RTOS SDKs. Linux SDK is for platforms with ARM running Linux. RTOS SDK is for ARM running RTOS. Program_evm belongs to RTOS application, hence, it is in RTOS SDK.

    If you want to use RTOS nandwrite, I'll have to have a RTOS engineer to look into it.

    Rex
  • If you are in Linux environment, you can refer to the Alternative u-boot commands for K2H shown in Section 1.2.4.6 of Getting Started Guide,
    software-dl.ti.com/.../Overview.html

    The following u-boot commands are equivalent to the alternative u-boot command in section 1.2.4.6. You still need to set up tftp server.
    # run get_ubi_net
    # run burn_ubi

    If this resolves your issue, please click "Resolved". If you want to work on nandwrite, I'll assign this thread to a RTOS engineer.

    Thanks!

    Rex