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.

Flashing standalone app into nand using u-boot

Other Parts Discussed in Thread: AM3517

Hi,

I started using LogicPDs BSL to write a small test application for accessing GPIOs und SPI directly via their registers on the AM3517 Experimenter Kit. I went this way to load the application into DDR and execute it:

Steps to setup CodeSourcery G++ for ARM EABI

  1. Verify that CodeSourcery G++ for ARM EABI is in your path (part of the CodeSourcery install process)
    • Example: "C:/Program Files/CodeSourcery/Sourcery G++/bin"

Steps to build and execute CodeSourcery RAW binary in DDR

  1. Rebuild the BSL library if changes have been made.
    1. Navigate to the bsl/cs directory.
      1. cs-make clean
      2. cs-make
  2. Build the test that you want to run.
    1. Navigate to the test-specific cs directory (example: tests/experimenter/nand/cs).
      1. cs-make clean
      2. cs-make
  3. Connect the debug serial port to your PC and open using TeraTerm.
  4. Boot into U-Boot and stop the autoboot process by pressing any key when directed.
  5. Use the following U-Boot command to load the RAW file
    • loadb
  6. Use TeraTerm to send the RAW file
    1. File >> Transfer >> Kermit >> Send...
    2. Select the .raw file in the same cs directory as the test makefile.
  7. Use the following U-Boot command to jump to the previously loaded binary.
    • go 0x82000000

This works quite well except the register accessing time is quite long and the application has to be uploaded after every reboot. I have to program a control loop for a fast industrial control, so I don't really need an OS.

I wonder how to start the standalone app directly from flash. I think the way to go should be to modify some environment variables and overwrite sectors in nand. I would prefer to start the app instead of booting the linux kernel and still have the possibility to update the app using an u-boot upload.

I'd be grateful for a description of the procedure or may a different way to reach my aim!

Regards,

Oli

 

  • Oli, i think this would be just a matter of replacing the Linux kernel with the application you want to run.  You would probably still want to load x-loader and u-boot to properly initialize the system, but when u-boot goes to download and decompress the linux kernel, you can just replace that with whatever you want to execute. 

    Regards,

    James

  • Hello Oli,

    here is a link to the PSP User's guide.  In this guide, you will find info on how to flash the NAND.

    http://processors.wiki.ti.com/index.php/AM35x-OMAP35x-PSP_03.00.00.05_UserGuide

  • Hi Oli,

    As mentioned above by JJD and Jeff, its u-boot application you can replace very well with one of yours. There are different ways of downloading it to memory and execute,

     - Via Serial (as you rightly pointed out)

     - Via NAND Flash (mentioned by Jeff), you have to flash it first before executing.

     - Via Ethernet, you can use TFTP protocol here

     - OR via USB, MMC/SD

     

    Thanks,

    Vaibhav

  • Hi James, Jeff and Vaibhav,

    thanks for your first suggestions.

    I'm able to write my BSL application to the nand sector of the kernel, but get the error message:

        Wrong Image Format for bootm command

        ERROR: can't get kernel image!

    When I write the kernel uImage back to this nand sector everything works fine again. I've seen that uImage is an u-boot wrapped image of the kernel and the BSL uses the eabi compiler whereas the kernel has to be compiled with the gnueabi version.

    What will I have to do to get my application "booted" from nand without error?

    Regards,

    Oli

  • OK, I got one way that my app starts. I modifiedthe environment variable nandboot of my u-boot on the AM35x experimenter kit:

    nandboot=echo Booting from nand ...; run nandargs; nand read ${loadaddr} 280000 400000; bootm ${loadaddr}

    with

    nandboot=echo Start my app ...; run nandargs; nand read ${loadaddr} 280000 400000; go ${loadaddr}

    The app is read and copied from nand to DDR and excecuted from DDR.

    Now my problem is that I access the GPIO registers directly via OUT_REGL(addr,mask);. The accessing time for one register write or read operation ist about 800ns for the GPIO1 bank and 230ns for the GPIO2 bank. Is there a possibility to decrease this time?

    Thanks,

    Oli

  • Oli, i'm not sure if this is typical for this macro.  You may want to try to the same experiment with the original linux kernel.  I know that GPIO1 module is clocked differently from GPIO2-6, but these both should be sourced from 32KHz input.  You may want to check the macro, probably there are several operations to enable the GPIO, change it to an output, etc.  You can probably change these so that you initialize it first, and then just toggle it by accessing just one register to decrease the access time.

    Regards,

    James

  • James,

    the GPIOs are initialized seperately. The macro does nothing else than writing to the memory addres of the GPIO. I've measured the time for toggling that pin in a loop. The loop time is negligible, because when I write into another GPIO register in between the toggling of the other pin the time increases by factor 2.

    It's may due to the way the data goes? MPU-L3-DDR-L3-MPU-L3-L4-GPIO

    Would it be different if I do it within linux with the memory device driver, mmap and a pointer to the register?

    Oli

  • Hi Oli,

    Personnely I have never tried to measure the time/cycle required for GPIO read/write, but definitely the timings would be different in Linux. There are lot of differences between 2 use-cases -

     - Cache (both I & D)

     - MPU/CORE clock configuration (Are you using PSP u-boot OR some other version?)

    - MMU

    - Context switch (Linux scheduler)

    You can use devmem utility from Linux to directly configure/access hardware registers (Google should point you to devmem application).

     

    Thanks,

    Vaibhav