loading u-Boot in memory instead of flashing it
Asked Answered
P

10

7

In my ARM based custom board, I flash u-boot to NAND whenever I do changes on that. (putting some debug statements/modification). Is there any way to directly load the uboot image in RAM memory instead of flashing it every time?

For linux kernel image I do load it in memory and use bootm to boot that image. Similarly for u-boot I am trying out. Kindly provide your suggestions.

Plenipotentiary answered 7/3, 2011 at 10:22 Comment(0)
M
6

Someone at Freescale has done this, for their P1022DS evaluation system (and some others as well). They have provided a somewhat useful document about the process in the file ${UBOOTROOT}/doc/README.ramboot-ppc8500 (in U-Boot V2010.12). This document is pretty terse and leaves many questions unanswered, but I found it a reasonable place to start when I needed to debug U-Boot for a new board, before the flash memory for that board was operating correctly.

In fact, having non-functional flash memory is one reason you might want to debug U-Boot in RAM. (There are a few reasons listed in the README, and they all sound pretty reasonable to me, in contrast to some of the other advice available on this subject)

In our situation, it was found that early prototype target board hardware included an error in the address bus connection to the flash memory that prevented us from using that flash memory. While the hardware was being redesigned and re-fabricated, we wanted to continue testing/debugging those parts of our U-Boot configuration that did not depend on flash memory, for example, I2C, Ethernet, FPGA configuration, PCIe, etc. (there are plenty of things that are independent of where the U-Boot image comes from).

Running U-Boot after loading it into RAM via a JTAG interface (using Codewarrior and the USB TAP) allowed us to continue our U-Boot bring-up tasks, even though we had no functional flash memory. Once we received a newer version of the target board with correctly functioning flash memory, we returned to debugging those parts of U-Boot that we hadn't been able to test earlier. After that, U-Boot was fully functional, and we did not have to wait for a board spin to make any progress.

Manifestative answered 2/8, 2011 at 16:59 Comment(2)
This post was made in error, I apologize. I was not ultimately successful in using the Freescale document to start U-Boot in RAM.Manifestative
I got this to work successfully for the P1010 without much trouble, so other readers shouldn't be deterred. It is very useful if you don't have a BDI debugger. link. Note that the "CONFIG_SDCARD" bit is misleading, all you really need to do is set #define CONFIG_SYS_TEXT_BASE 0x11000000 #define CONFIG_RESET_VECTOR_ADDRESS 0x1107fffc #define CONFIG_SYS_RAMBOOTDartboard
F
3

Debugging a bootloader is a bit difficult, but with the right tools it should be relatively painless.

I deal with the PowerPC achitecture and with a BDI-3000 I can load and debug directly to RAM (of course, after initializing the DDR controller).

One option is if you have on-chip SRAM or L2 Cache that can be configured as on-chip SRAM. The BDI can copy to the SRAM area first, u-boot does it's thing (initialize DDR controller for example), then relocates itself to DDR RAM afterwards. Definitely faster that re-writing to slow Flash all the time.

Floatplane answered 25/3, 2011 at 2:39 Comment(0)
C
2

It wasn't possible in 2004, at least.

Companionable answered 7/3, 2011 at 11:8 Comment(0)
P
2

It should be possible, if the U-Boot image you want to run has startup code that allows running it from arbitrary addresses. Whether or not that is the case for your board I can't tell.

If the startup code begins by copying the code section from the current (PC-relative) address to the final execution address (usually this is preceded by a check that these areas don't overlap), then you can load the .bin file to any address in RAM, and invoke it using go.

The second obstacle I could see would be unconditional RAM setup code at the beginning, which a number of boards have.

Purple answered 7/3, 2011 at 11:51 Comment(1)
I am going to say that it should be possible - it is certainly common with a number of version of u-boot. Even if the processor wants to monkey with ram, refresh settings, etc in a destructive way on boot, with proper design it should not even be necessary to reset the processor to start a new version of u-boot from the old version.Commonplace
L
1

This is what can be read on the u-boot documentation FAQ:

Question: I don't want to erase my flash memory because I'm not sure if my new U-Boot image will work. Is it possible to configure U-Boot such that I can load it into RAM instead of flash, and start it from my old boot loader?

Answer: No. (Unless you're using a Blackfin processor, or Socfpga board, but you probably aren't.)

Question: But I've been told it is possible??

Answer: Well, yes. Of course this is possible. This is software, so everything is possible. But it is difficult, unsupported, and fraught with peril. You are on your own if you choose to do it. And it will not help you to solve your problem.

source:http://www.denx.de/wiki/view/DULG/CanUBootBeConfiguredSuchThatItCanBeStartedInRAM

Lagging answered 25/12, 2016 at 15:51 Comment(0)
T
0

The problem here is that what you are trying to do goes against the philosophy of what a bootloader is. Most processors require that code starts from Flash. That code is called a bootloader. That is what U-boot is.

However, if you want to modify U-boot so that it is not a true bootloader, then you can do whatever you want. It's just software. But don't expect any mainline support for the above reasons.

Tommy answered 10/3, 2011 at 16:59 Comment(1)
That's not necessarily true. There are targets where loading a trial u-boot from a flashed u-boot is supported and considered entirely normal. And it can be a handy way to test!Commonplace
M
0

Just take in mind (be care of) the hardware that you are configuring in your modified U-Boot. U Boot is intended to initialize critical modules, some of them are not able to be re-configured on the fly or they may not performe as if they were initialized/configured at startup.

Meadowsweet answered 20/3, 2011 at 22:17 Comment(0)
H
0

If your Target board support network booting, you can load uboot image from host machine to RAM through network.

Homegrown answered 19/4, 2013 at 10:57 Comment(0)
C
0

You can use usb boot. TI and Freescale provides their usb boot utilities. I don't know about other vendors.

Crux answered 27/10, 2015 at 9:9 Comment(0)
I
0

Yes, It is possible most of the compilation structure at the end U-Boot provides a u-boot.bin file which is a flattened binary, if your target supports USB/TFTP or any other medium which current U-boot can detect on you target environment then we can load the u-boot.bin file to the static memory address area. This address is the entry point of U-Boot Code and U-boot can execute the flattened binaries by go 0x<memory_address>. The static memory address area can be deduced form u-boot.map file, This entry point is basically address to the .text area of compiled program usually can we searched in the .map file with string "Address of section .text set to 0x." Below is the example of doing it from USB.

usb start
load usb 0x<memory_address> u-boot.bin
go 0x<memory_address>

This should run you U-Boot from usb with out disturbing current code.

Intravenous answered 8/1, 2019 at 9:14 Comment(1)
'load usb 0x<memory_address> u-boot.bin' Above command should include the usb device that you need to write to load USB <device:id> 0x<memory_address> u-boot.bin eg: load usb <0:1> 0x<memory_address> u-boot.binFarron

© 2022 - 2024 — McMap. All rights reserved.