summaryrefslogtreecommitdiff
path: root/arch/sandbox/cpu/start.c
AgeCommit message (Collapse)Author
2020-05-18common: Drop init.h from common headerSimon Glass
Move this uncommon header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-02-05sandbox: sdl: Add an option to double the screen sizeSimon Glass
On high-DPI displays U-Boot's LCD window can look very small. Add a -K flag to expand it to make things easier to read, while still using the existing resolution internally. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Anatolij Gustschin <agust@denx.de>
2020-02-05sandbox: Add a new header for the system malloc()Simon Glass
Some files use U-Boot headers but still need to access the system malloc(). Allow this by creating a new asm/malloc.h which can be used so long as U-Boot's malloc.h has not been included. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-02-05sandbox: Sort the help optionsSimon Glass
At present options are presented in essentially random order. It is easier to browse them if they are sorted into alphabetical order. Adjust the help function to handle this. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-02-05cli: Make the sandbox board_run_command the defaultSean Anderson
If CONFIG_CMDLINE=n, common/cli.c calls board_run_command. This fails to link on most architectures. However, the sandbox architecture has an implementation which we can use. Signed-off-by: Sean Anderson <seanga2@gmail.com>
2019-12-02common: Move command functions out of common.hSimon Glass
Move these functions into the command.h header file which is a better fit. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2019-10-08sandbox: Add a -T flag to use the test device treeSimon Glass
U-Boot already supports using -D to indicate that it should use the normal device tree. It is sometimes useful to run with the test device tree, e.g. when running a test. Add a -T option for this along with some documentation. It can be used like this: /tmp/b/sandbox/u-boot -T -c "ut dm pci_busdev" (this will use /tmp/b/sandbox/arch/sandbox/dts/test.dtb as the DT) Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com>
2019-04-23sandbox: Drop the printf() in setup_ram_buf()Simon Glass
This was really intended for debugging. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-04-23sandbox: Improve debugging in initcall_run_list()Simon Glass
At present if one of the initcalls fails on sandbox the address printing is not help, e.g.: initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96) This is because U-Boot gets relocated high into memory and the relocation offset (gd->reloc_off) does not work correctly for sandbox. Add support for finding the base address of the text region (at least on Linux) and use that to set the relocation offset. This makes the output better: initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96) Then you use can use grep to see which init call failed, e.g.: $ grep 0000000000048134 u-boot.map stdio_add_devices Of course another option is to run it with a debugger such as gdb: $ gdb u-boot ... (gdb) br initcall.h:41 Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations) Note that two locations are reported, since this function is used in both board_init_f() and board_init_r(). (gdb) r Starting program: /tmp/b/sandbox/u-boot [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600) DRAM: 128 MiB MMC: Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>) at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41 41 printf("initcall sequence %p failed at call %p (err=%d)\n", (gdb) print *init_fnc_ptr $1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices> (gdb) Signed-off-by: Simon Glass <sjg@chromium.org>
2018-12-05sandbox: Zero the ram buffer on startupSimon Glass
At present the RAM buffer is not inited unless it is read from a file, likely produced by an earlier phase of U-Boot. This causes valgrind warnings whenever the RAM buffer is used. Correct this by initing it if needed. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-11-26sandbox: Add a new 'sb' commandSimon Glass
The old 'sb' command was deprecated in 2015 and replaced with 'host'. It is useful to be able to access some internal sandbox state, particularly for testing. Resurrect the old command and provide a way to print some basic state information (currently just the arguments to sandbox). Signed-off-by: Simon Glass <sjg@chromium.org>
2018-11-26sandbox: Add an option to display of-platdata in SPLSimon Glass
At present we don't have a test that of-platdata can be accessed in SPL. Add this in as a command-line option to SPL. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-10-09sandbox: Remove the old memory file laterSimon Glass
When debugging sandbox it is sometimes annoying that the memory file is deleted early on. If sandbox later crashes or we quit (using the debugger), it is not possible to run it again with the same state since the memory file is gone. Remove the old memory file when sandbox exits, instead. Also add debugging showing the memory filename. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-10-09sandbox: Add a flag to set the default log levelSimon Glass
It is useful to be able to set the default log level from the command line when running sandbox. Add a new -L command-line flag for this. The log level is set using the enum log_level_t in log.h. At present a number must be specified, e.g. -L7 for debug. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-05-07SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini
When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
2017-07-27sandbox: use CONFIG_VAL(SYS_MALLOC_F_LEN) to distinguish malloc pool size ↵Andy Yan
before relocation SPL and normal u-boot stage use different malloc pool size configuration before relocation, so use CONFIG_VAL(SYS_MALLOC_F_LEN) to fit different boot stage. Signed-off-by: Andy Yan <andyshrk@gmail.com> Changes in v3: - use CONFIG_VAL(), which suggested by Simon Changes in v2: None arch/sandbox/cpu/start.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
2017-04-05board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()Simon Glass
We don't need a special hook for sandbox as one of the later ones will do just as well. We can print error messages about bad options after we print the banner. In fact, it seems better. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Stefan Roese <sr@denx.de>
2017-04-05board_f: sandbox: Move setup_ram_buf() to private codeSimon Glass
There is no need to have this call in the generic init sequence and no other architecture has needed it in the time it has been there. Move it into sandbox's private code. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Stefan Roese <sr@denx.de> Reviewed-by: Stefan Roese <sr@denx.de>
2016-07-14sandbox: Don't include the main loop in SPLSimon Glass
SPL does not have a command interface so we should not include the main loop code. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-03-22sandbox: Avoid calling commands when not availableSimon Glass
Don't try to run commands when not supported. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2015-11-19test: Record and silence console in testsSimon Glass
When running sandbox tests, silence the console to avoid unwanted output. Also, record the console in case tests want to check it. The -v option can be used to enable stdout during tests. Signed-off-by: Simon Glass <sjg@chromium.org>
2015-05-14sandbox: Add missing errno.h includes in a few filesSimon Glass
These files use error numbering, so add the include. Signed-off-by: Simon Glass <sjg@chromium.org>
2015-05-06sandbox: Don't try distro_bootcmd by defaultSjoerd Simons
For the distro_bootcmds to succeed on the sandbox a bit of setup is required (e.g. network configured or host image bound), so running them by default isn't that useful. Add a -b/--boot command to the sandbox binary, which triggers the distro_bootcmds to run after the other command-line commands. Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk> Acked-by: Simon Glass <sjg@chromium.org>
2015-02-15sandbox: Return '-c command' exit value as sandbox exit codeJoe Hershberger
When a command is passed into sandbox using the '-c' argument the command is run directly. This is most helpful when running tests (such as test-dm.sh). Previously the exit code was an unused enum. Change it to be the actual return code from the command so that the script calling sandbox can know if the command succeeded (tests passed). Also remove the now completely unused "exit_state" in sandbox. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
2015-01-30sandbox: Add a -D option to use a default device treeSimon Glass
It is painful to specify the full path to the device tree with the -d option. It is normally kept in the same directory as U-Boot, so provide an option to use this by default. Signed-off-by: Simon Glass <sjg@chromium.org>
2014-11-26sandbox: Fix warnings in cpu.c and os.cSimon Glass
This fixes the following two problems: cppcheck reports: [arch/sandbox/cpu/start.c:132]: (error) Uninitialized variable: err [arch/sandbox/cpu/os.c:371]: (error) Memory leak: fname Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Wolfgang Denk <wd@denx.de>
2014-11-23linux/kernel.h: sync min, max, min3, max3 macros with LinuxMasahiro Yamada
U-Boot has never cared about the type when we get max/min of two values, but Linux Kernel does. This commit gets min, max, min3, max3 macros synced with the kernel introducing type checks. Many of references of those macros must be fixed to suppress warnings. We have two options: - Use min, max, min3, max3 only when the arguments have the same type (or add casts to the arguments) - Use min_t/max_t instead with the appropriate type for the first argument Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Acked-by: Pavel Machek <pavel@denx.de> Acked-by: Lukasz Majewski <l.majewski@samsung.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com> [trini: Fixup arch/blackfin/lib/string.c] Signed-off-by: Tom Rini <trini@ti.com>
2014-11-07sandbox: init cli for -cRabin Vincent
sandbox crashes if a variable is set in the -c command, because hush's top_vars is not allocated. Call cli_init() from sandbox to ensure this is done before we execute the -c command. $ ./u-boot -c 'a=1' ... Segmentation fault (core dumped) Signed-off-by: Rabin Vincent <rabin@rab.in> Acked-by: Simon Glass <sjg@chromium.org) Tested-by: Simon Glass <sjg@chromium.org)
2014-07-23sandbox: Support pre-relocation malloc()Simon Glass
Set up and zero global data before board_init_f() is called so that we can remove the need for CONFIG_SYS_GENERIC_GLOBAL_DATA. Signed-off-by: Simon Glass <sjg@chromium.org>
2014-07-23sandbox: Set up global data before board_init_f()Simon Glass
At present sandbox defines CONFIG_SYS_GENERIC_GLOBAL_DATA, meaning that the global_data pointer is set up in board_init_f(). If we set up and zero the global data before calling board_init_f() then we don't need to define CONFIG_SYS_GENERIC_GLOBAL_DATA. Make this change to simplify the init process. Signed-off-by: Simon Glass <sjg@chromium.org>
2014-03-17sandbox: Add options to clean up temporary filesSimon Glass
When jumping from one sandbox U-Boot to another in sandbox, the RAM buffer is preserved in the jump by using a temporary file. Add an option to tell the receiving U-Boot to remove this file when it is no longer needed. Similarly the old U-Boot image is left behind in this case. We cannot delete it immediately since gdb cannot then find its debug symbols. Delete it just before exiting. Together these changes ensure that temporary files are removed both for memory and U-Boot. Signed-off-by: Simon Glass <sjg@chromium.org>
2014-03-17sandbox: Allow Ctrl-C to work in sandboxSimon Glass
It is useful for Cltl-C to be handled by U-Boot as it is on other boards. But it is also useful to be able to terminate U-Boot with Ctrl-C. Add an option to enable signals while in raw mode, and make this the default. Add an option to leave the terminal cooked, which is useful for redirecting output. Signed-off-by: Simon Glass <sjg@chromium.org>
2014-03-17sandbox: Add LCD driverSimon Glass
Add a simple LCD driver which uses SDL to display the image. We update the image regularly, while still providing for reasonable performance. Adjust the common lcd code to support sandbox. For command-line runs we do not want the LCD to be displayed, so add a --show_lcd option to enable it. Tested-by: Che-Liang Chiou <clchiou@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
2014-03-17sandbox: Add -j option to indicate a jump from a previous U-BootSimon Glass
In order to support the 'go' command we allow the jumping U-Boot to pass its filename to the new U-Boot image. This can then be used to delete that image if required. Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Che-Liang Chiou <clchiou@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
2014-01-08sandbox: Add facility to save/restore sandbox stateSimon Glass
It is often useful to be able to save out the state from a sandbox test run, for analysis or to restore it later to continue a test. Add generic infrastructure for doing this using a device tree binary file. This is a flexible tagged file format which is already supported by U-Boot, and it supports hierarchy if needed. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Hung-ying Tyan <tyanh@chromium.org>
2014-01-08sandbox: Allow reading/writing of RAM bufferSimon Glass
It is useful to be able to save and restore the RAM contents of sandbox U-Boot either for setting up tests, for later analysys, or for chaining together multiple tests which need to keep the same memory contents. Add a function to provide a memory file for U-Boot. This is read on start-up and written when shutting down. If the file does not exist on start-up, it will be created when shutting down. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
2014-01-08sandbox: Add -i option to enter interactive modeSimon Glass
Normally when U-Boot starts with a command (-c option) it quits when the command completes. Normally this is what is requires, since the test is likely complete. Provide an option to jump into the console instead, so that debugging or other tasks may be performed before quitting. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
2014-01-08sandbox: Allow return from board_init_f()Simon Glass
The execution flow becomes easier if we can return from board_init_f() as ARM does. We can control things from start.c instead of having to call back into that file from other places. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
2014-01-08sandbox: Correct help message <arg> garblingSimon Glass
The <arg> is displayed for options with no argument, and omitted for those with an argument. Swap this around. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
2013-12-09sandbox: Rename sb_cmdline_option to sandbox_cmdline_optionSimon Glass
The new name is longer but more clearly related to sandbox. This is in a separate patch within the same series since some comments on the SPI series rely on it. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Hung-ying Tyan <tyanh@chromium.org>
2013-07-24Add GPL-2.0+ SPDX-License-Identifier to source filesWolfgang Denk
Signed-off-by: Wolfgang Denk <wd@denx.de> [trini: Fixup common/cmd_io.c] Signed-off-by: Tom Rini <trini@ti.com>
2013-05-01sandbox: Allow -c argument to provide a command listSimon Glass
This allows passing of entire scripts to sandbox with the -c argument, which is useful for testing. Commands can be delimited with a newline or semicolon. Signed-off-by: Simon Glass <sjg@chromium.org>
2013-05-01sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host fileSimon Glass
With sandbox it is tricky to add an FDT to the image at build time (or later) since we build an ELF file, not a plain binary, and the address space of the whole U-Boot is not accessible in the emulated memory map of sandbox. Sandbox can read files directly from the host, though, so add an option to read an FDT from a host file on start-up. Signed-off-by: Simon Glass <sjg@chromium.org>
2013-02-28sandbox: fix compiler warningAllen Martin
Add back return statement to fix compiler warning about control flow reaching end of non void function that was introduced with: e05e5de arm: move C runtime setup code in crt0.S Signed-off-by: Allen Martin <amartin@nvidia.com> Acked-by: Simon Glass <sjg@chromium.org>
2012-04-23sandbox: Use the new run_command()Simon Glass
Now that run_command() handles both parsers, clean up sandbox to use it. This fixes a build error. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Mike Frysinger <vapier@gentoo.org>
2012-03-12sandbox: add getopt supportSimon Glass
This adds simple command-line parsing to sandbox. The idea is that it sets up the state with options provided, and this state can then be queried later, as needed. New flags are declared with the SB_CMDLINE_OPT_SHORT helper macro, pointers are automatically gathered up in a special section, and then the core code takes care of gathering them up and processing at runtime. This way there is no central place where we have to store a list of flags with ifdefs. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-03-12sandbox: allow processing before main loopSimon Glass
In order to pass command line arguments to sandbox we need to be able to act on them. So take control back at the end of board_init_r() from where we can call the main loop or do something else. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-03-12sandbox: add concept of sandbox stateSimon Glass
The state exists through the life of U-Boot. It can be adjusted by command line options and perhaps later through a config file. It is available to U-Boot through state_...() calls (within sandbox code). The primary purpose of this is to contain the "hardware" state. It should only be used by sandbox internal code. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-11-03sandbox: drop unused returnMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Acked-by: Simon Glass <sjg@chromium.org>
2011-10-17sandbox: Add main programSimon Glass
Add a main program so that we can run U-Boot. Signed-off-by: Simon Glass <sjg@chromium.org>