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.

Boot sequence for DM814x

Hi,

   I'd posted an earlier question around a consumer device, based on the DM814x, and the boot sequence.  It is configured to boot from NOR (XIP) initially, and I was trying to determine if I could alter the sequence to boot from the available SD cage.  There was no good way to do this other than to stop the NOR from booting so that the sequence would continue on to the SD card.  Well, I managed to do that, but not on purpose.  So now I've got a brick, but I still have hope that I can restore the original NOR image (I was smart enough to copy that first).  The obvious device to try is the SD card.  I don't know that I have any available UART connections, so that is not a consideration yet.

   I've spent a few weeks reading TRMs, looking at EZSDK and CCS, and I've reached a point where I still have a few questions that would help me to know if I'm on the right track, or if my current approach is a waste of time.

   So what I am attempting to do first, is just verify that the SD card is, in fact, a device the unit is trying to boot from (I wish they had little activity LEDs!).  I'd like to assume it's attached to SD/MMC1, which is on the boot list, but not sure if that is the case.  The display on my unit is blank, so I have no immediately obvious visual signs of life.  What I do have, is every 3 minutes, consistent with the watchdog timer, the display cycles through what appears to be a reset (grey/black/grey).  So, if I can simply alter the behavior of the the WDT (turn off using the sequence from the manual, or change the interval), or reset the device myself, via the SD card, then I know the SD is a valid boot device and I can proceed with a more complete fix.

   So my questions are:

At a high level, how does the processor know that it is successfully booted?  Ie.  how does it decide that it needs to try the next device?  Is there a register which holds a value when booting is successfully completed?  Is this separate from the WDT?  The reason for asking is I am wondering if it is trying anything in the boot list beyond the NOR, or if it may think the NOR has "booted".

I am trying to keep the SD approach simple by using raw mode.  I am getting a better understanding of the TOC, etc. from several examples online.  Is anything beyond a null CHSETTINGS element required?

From older documentation of other processors, the understanding I get is that the TOC can be used to configure other elements, such as RAM.  Does anything need to be done to configure memory to load the raw startup image?

Building on the previous question, are any memory locations valid without additional configuration?  0x402F0400 - 0x402FFFFF and 0x40300000 - 0x4031FFFF seem to be viable memory locations.  Are they working and available, or are they in use by the ARM ROM?

I'm trying a couple of short programs in CCS to either disable the WDT or invoke an early system reset to see if I can have an impact on the unit's display.  Any other suggestions to check for proof of life on the SD front?  I imagine writing some bytes back to the SD (a la "hello world") might require too extensive of a program.  I'm just trying to check for signs of life.

All help and suggestions are appreciated.  Thanks.

Chris

  • So I think I may have found the answer to my first question regarding what is considered a "successful" boot, and if I'm right it makes everything else I'm trying useless.  In Section 4.7.1 of the TRM (SPRUGZ8G):

    "A sector is a logical unit of 512 bytes.
    A valid image is considered to be present when the first 4 bytes word of the sector is not equal to 0000 0000h or FFFF FFFFh."

    Well, for whatever the reason, the start of my NOR memory looks like (it's a long story, but my script did image the NOR after my update attempt, and before it reboot the system, possibly for the last time):

    00000000  ee ee ee ee ee ee ee ee  ee ee ee ee ff ff ff ff  |................|
    00000010  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
    00000020  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
    00000030  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
    00000040  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
    00000050  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
    00000060  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
    00000070  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
    00000080  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
    00000090  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|

    So, to me, it looks like the system sees the start of the NOR, and considers that a "successful" boot since it's not entirely "ff".  Hence, it won't continue looking for other boot methods.  Is this correct?

    Short of removing the NOR chip, trying to reconfigure the BTMODE pins seems the most plausible option to get it to look at the SD card (which I still think would work, given the chance).  There are some unused pads that I am currently trying to trace to see if I can rig something up to put SD ahead of XIP.  Some of them approach the processor around the correct physical location of the BTMODE pins.  Does anyone have any other suggestions?  Thanks.

    Chris

  • Hi Chris M33,

    As you have already observed, Boot logic reads the data from the memory or peripheral based on the bootmode configuration. There is no special register available to determine the bootmode success. Instead software takes care of reading 2nd stage boot loader and jumping to it if any images are found.

    If boot mode switches are easily accessible you can definitely change bootmode. But in case if it invloves change in your board/HW  you can try to erase the flash and make sure it is all FF.
    Is there any issue in erasing nor memory?

    Thanks

  • Chris,

    You can check if the trace vector registers will be in help. See the below pointers for more info:

    processors.wiki.ti.com/.../Debug_Tips_for_DM81xx_Boot_Fail
    processors.wiki.ti.com/.../AM335x_board_bringup_tips
    DM814x TRM, section 4.3.2.4 Tracing Data, 4.12 Tracing

    Regards,
    Pavel
  • Thanks for the links Pavel. The debug tips will be particularly useful. In reviewing my situation, I've realized that the image that I took of the NOR was only the portion I intended to rewrite (sometimes I lose sight of important things when I get too focused). So I now believe that at least the first 16K of NOR is "FF". With that being the case, I am turning back to trying the raw SD boot method since the NOR should be skipped during booting.

    Since I doubt my SDRAM will be initialized, my question about available memory to load the software image returns. From the memory map, 0x402F0400 - 0x402FFFFF and 0x40300000 - 0x4031FFFF seem to be viable memory locations. Are either of these locations valid or preferred this early in the boot? Is anything already reserved by the code in the boot ROM?

    I think I have most of what I need to attempt the SD card image again. I am going to attempt to invoke either a warm or cold reset via the PRM_RSTCTRL register. This should require minimal bare metal code to test. I want to confirm my understanding of the memory map, so that I am sure I am writing to the correct register. From my documents, the base address for the PRCM register should be 0x48180000. If this is correct, PRM_RSTCTRL offset is 0xA0, making the reset register 0x481800A0. The descriptions between the 2 documents (SPRS647E & SPRUGZ8G) I am using are slightly different, so I just wanted to confirm that my base address was correct.
  • Thanks for the response Ravikiran. In my reply to Pavel, I have indicated where I believe I made another error in my assessment. I believe enough of the NOR has been properly erased to consider it a failed boot device. I am now going to try the SD card image again. I need to make sure the little endian doesn't trip me up when I create my software image though (doing this part by hand). I will let you know if I succeed.
  • Chris M33 said:
    Since I doubt my SDRAM will be initialized, my question about available memory to load the software image returns. From the memory map, 0x402F0400 - 0x402FFFFF and 0x40300000 - 0x4031FFFF seem to be viable memory locations. Are either of these locations valid or preferred this early in the boot? Is anything already reserved by the code in the boot ROM?

    These locations are available.

    0x402F0400 - 0x402FFFFF is Cortex-A8 RAM

    0x40300000 - 0x4031FFFF is L3 OCMC RAM

    For more info see the below pointers:

    DM814x TRM, section 4.3.2 RAM Memory Map

    Regards,
    Pavel

  • Chris M33 said:
    I think I have most of what I need to attempt the SD card image again. I am going to attempt to invoke either a warm or cold reset via the PRM_RSTCTRL register. This should require minimal bare metal code to test. I want to confirm my understanding of the memory map, so that I am sure I am writing to the correct register. From my documents, the base address for the PRCM register should be 0x48180000. If this is correct, PRM_RSTCTRL offset is 0xA0, making the reset register 0x481800A0. The descriptions between the 2 documents (SPRS647E & SPRUGZ8G) I am using are slightly different, so I just wanted to confirm that my base address was correct.

    Yes, PRM_RSTCTRL register is at address 0x481800A0. PRCM base (0x48180000) + PRM_DEVICE base (0x0000) +  PRM_RSTCTRL offset (0xA0).


    Regards,
    Pavel

  • Thanks for verifying my memory and register questions.  I did give these a try last night, and have not yet been successful with my raw image.  I have tried several memory address, and also tried 1 versus 2 (warm versus cold) variations to try and reset the device, but have not seen any impact yet.  I only have a blank display to give me signs this is working.  No other debug ports seem to be exposed.

    MOVW R3, #0xA0

    MOVT R3, #0x4818

    MOVW R4, #2

    STR R4, [R3]

    00000000  40 00 00 00 0c 00 00 00  00 00 00 00 00 00 00 00  |@...............|

    00000010  00 00 00 00 43 48 53 45  54 54 49 4e 47 53 00 00  |....CHSETTINGS..|

    00000020  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|

    *

    00000040  c1 c0 c0 c0 00 01 00 00  00 00 00 00 00 00 00 00  |................|

    00000050  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|

    *

    00000200  10 00 00 00 00 04 2f 40  a0 30 00 e3 18 38 44 e3  |....../@.0...8D.|

    00000210  02 40 00 e3 00 40 83 e5                           |.@...@..|

    I have also tried placing this image at the 4 sectors listed in the TRM.  I believe this is all correctly little endian.  Does anyone see anything obvious with this attempt?  Thanks.

    Chris

  • Chris,

    Beside DM814x TRM, chapter 4 ROM Code, for MMC/SD raw mode you can also search in e2e for hints. Below you can find some e2e threads that might be in help:

    e2e.ti.com/.../552069
    e2e.ti.com/.../429565
    e2e.ti.com/.../526438
    e2e.ti.com/.../526898
    e2e.ti.com/.../190080
    e2e.ti.com/.../392074

    Regards,
    Pavel
  • Thanks again for all of the effort Pavel.  I hadn't seen most of those, but I had previously seen the fourth one.  It seems most similar to my problem.  I had asked RY9983 if he could share what changed that solved his problem, since it seemed very similar to mine.  I have attempted to connect with him once again in the hopes that there is something simple that I am missing. 

    I also considered last night that there may be an issue with the SD card that I am using.  I am currently using a 32GB microSD in an adapter, simply because that's what I had available.  I will try with the 4GB SD that came with the unit on the chance that that makes a difference.  Otherwise, I will keep reading and testing.  I don't want to occupy too much of anyone's time for a problem of my own creation.

    Chris