]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - board/sandbox/sandbox/README.sandbox
Merge branch 'u-boot-imx/master' into 'u-boot-arm/master'
[karo-tx-uboot.git] / board / sandbox / sandbox / README.sandbox
1 /*
2  * Copyright (c) 2011 The Chromium OS Authors.
3  *
4  * SPDX-License-Identifier:     GPL-2.0+
5  */
6
7 Native Execution of U-Boot
8 ==========================
9
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.
13
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.
18
19 CONFIG_SANDBOX is defined when building a native board.
20
21 The chosen vendor and board names are also 'sandbox', so there is a single
22 board in board/sandbox/sandbox.
23
24 CONFIG_SANDBOX_BIG_ENDIAN should be defined when running on big-endian
25 machines.
26
27 Note that standalone/API support is not available at present.
28
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.
32
33
34 SPI Emulation
35 -------------
36
37 Sandbox supports SPI and SPI flash emulation.
38
39 This is controlled by the spi_sf argument, the format of which is:
40
41    bus:cs:device:file
42
43    bus    - SPI bus number
44    cs     - SPI chip select number
45    device - SPI device emulation name
46    file   - File on disk containing the data
47
48 For example:
49
50  dd if=/dev/zero of=spi.bin bs=1M count=4
51  ./u-boot --spi_sf 0:0:M25P16:spi.bin
52
53 With this setup you can issue SPI flash commands as normal:
54
55 =>sf probe
56 SF: Detected M25P16 with page size 64 KiB, total 2 MiB
57 =>sf read 0 0 10000
58 SF: 65536 bytes @ 0x0 Read: OK
59 =>
60
61 Since this is a full SPI emulation (rather than just flash), you can
62 also use low-level SPI commands:
63
64 =>sspi 0:0 32 9f
65 FF202015
66
67 This is issuing a READ_ID command and getting back 20 (ST Micro) part
68 0x2015 (the M25P16).
69
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
72 for each driver.
73
74
75 Configuration settings for the curious are:
76
77 CONFIG_SANDBOX_SPI_MAX_BUS
78         The maximum number of SPI buses supported by the driver (default 1).
79
80 CONFIG_SANDBOX_SPI_MAX_CS
81         The maximum number of chip selects supported by the driver
82         (default 10).
83
84 CONFIG_SPI_IDLE_VAL
85         The idle value on the SPI bus
86
87
88 Tests
89 -----
90
91 So far we have no tests, but when we do these will be documented here.