2 * Copyright (c) 2011 The Chromium OS Authors.
4 * SPDX-License-Identifier: GPL-2.0+
7 Native Execution of U-Boot
8 ==========================
10 The 'sandbox' architecture is designed to allow U-Boot to run under Linux on
11 almost any hardware. To achieve this it builds U-Boot (so far as possible)
12 as a normal C application with a main() and normal C libraries.
14 All of U-Boot's architecture-specific code therefore cannot be built as part
15 of the sandbox U-Boot. The purpose of running U-Boot under Linux is to test
16 all the generic code, not specific to any one architecture. The idea is to
17 create unit tests which we can run to test this upper level code.
19 CONFIG_SANDBOX is defined when building a native board.
21 The chosen vendor and board names are also 'sandbox', so there is a single
22 board in board/sandbox/sandbox.
24 CONFIG_SANDBOX_BIG_ENDIAN should be defined when running on big-endian
27 Note that standalone/API support is not available at present.
29 The serial driver is a very simple implementation which reads and writes to
30 the console. It does not set the terminal into raw mode, so cursor keys and
31 history will not work yet.
37 Sandbox supports SPI and SPI flash emulation.
39 This is controlled by the spi_sf argument, the format of which is:
44 cs - SPI chip select number
45 device - SPI device emulation name
46 file - File on disk containing the data
50 dd if=/dev/zero of=spi.bin bs=1M count=4
51 ./u-boot --spi_sf 0:0:M25P16:spi.bin
53 With this setup you can issue SPI flash commands as normal:
56 SF: Detected M25P16 with page size 64 KiB, total 2 MiB
58 SF: 65536 bytes @ 0x0 Read: OK
61 Since this is a full SPI emulation (rather than just flash), you can
62 also use low-level SPI commands:
67 This is issuing a READ_ID command and getting back 20 (ST Micro) part
70 Drivers are connected to a particular bus/cs using sandbox's state
71 structure (see the 'spi' member). A set of operations must be provided
75 Configuration settings for the curious are:
77 CONFIG_SANDBOX_SPI_MAX_BUS
78 The maximum number of SPI buses supported by the driver (default 1).
80 CONFIG_SANDBOX_SPI_MAX_CS
81 The maximum number of chip selects supported by the driver
85 The idle value on the SPI bus
91 So far we have no tests, but when we do these will be documented here.