Commit graph

89379 commits

Author SHA1 Message Date
Simon Glass
7e5b637483 expo: Update documentation to include textline
Update the expo documentation to include mention of this new object
type.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11 15:43:56 -04:00
Simon Glass
c2bd2d33d9 expo: Update tests to include textline
Provide test coverage for the new expo object type, including building
and reading/writing settings.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11 15:43:55 -04:00
Simon Glass
7318e0eff2 expo: Support building an expo with a textline
Add textline to the list of objects which tthe expo builder can build.
This allows them to be provided in the description.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11 15:43:55 -04:00
Simon Glass
fe55366047 expo: Plumb in textline to cedit
Support textlines in the configuration editor.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11 15:43:55 -04:00
Simon Glass
8579cb010d expo: Support handling any key in cedit
At present cedit only supports menu keys. For textline objects we need
to insert normal ASCII characters.

We also need to handle backspace, which is ASCII 9.

In fact, expo does not make use of all the menu keys, so partition
them accordingly and update the logic to support normal ASCII
characters, too.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11 15:43:55 -04:00
Simon Glass
6d225ec0cc video: Mark truetype_measure() static
This function is not used outside this file, so mark it static.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11 15:43:55 -04:00
Simon Glass
c4fea34fd0 expo: Plumb in textlines to a scene
Provide an implementation for textlines in the scene code, so that they
are displayed correctly. Provide a way to have a border around the
textline, with the internal part being the same colour as the
background. This looks more natural.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11 15:43:55 -04:00
Simon Glass
93c901bc7d expo: Support opening a textline
This object needs special handling when it is opened, to set up the CLI
and the vidconsole context. Add special support for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11 15:43:55 -04:00
Simon Glass
4db7519032 expo: Add basic support for textline objects
A textline is a line of text which can be edited by the user. It has a
maximum length (in chracters) but otherwise there are no restrictions.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11 15:43:55 -04:00
Simon Glass
93f99b35ec expo: Add some scene fields needed for text entry
Add the CLI state, a buffer to hold the old value of the text being
edited and a place to save vidconsole entry context. These will be use
by the textline object.

Set an upper limit on the maximum number of characters in a textline
object supported by expo, at least for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11 15:43:55 -04:00
Simon Glass
94598d5b0a expo: Allow rendering the background of any object
So far only menus have a background. When other object types are
rendered, they may have a background too. Make this code more generic
so it will be usable by new object types.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11 15:43:55 -04:00
Simon Glass
8bc69b4b24 expo: Make calculation of an object bounding box generic
We want to support this for any object, not just menus. Move the code
around to allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11 15:43:55 -04:00
Simon Glass
117617c7c1 expo: Add a function to write a property to a devicetree
When the devicetree is too small for the property being written, we need
to expand the devicetree and retry the write.

Put this logic into a function so it can be reused.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11 15:43:55 -04:00
Simon Glass
d88edd2bda expo: Allow highlighting other scene-object types
So far only menus can be highlighted. With the coming addition of
text lines we need to be able to highlight other objects. Add a function
to determine whether an object can be highlighted.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11 15:43:55 -04:00
Simon Glass
408011c2a4 expo: Correct the logic for duplicate-ID detection
Update scene_txt_str() to account for the possibility that the passed-in
str_id may be 0

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11 15:43:55 -04:00
Simon Glass
9767de7b46 expo: Correct some swallowed errors in scene
Return the reported error, rather than assuming it is -ENOMEM

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11 15:43:55 -04:00
Simon Glass
fd6073ac9f expo: Use switch statements more for object types
In a lot of cases menus are the only objects which are have their own
behaviour in the cedit, e.g. to move between menus. With expo expanding
to support text, this is no-longer true.

Use a switch() statement so that we can simply insert a new 'case' for
the new object types.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11 15:43:55 -04:00
Simon Glass
909c486d7c expo: Fix up comments for get_cur_menuitem_text() et al
This internal function could use a comment. Add one.

Also tidy up a few other comments.

Signed-off-by: Simon Glass <sjg@chromium.org>

fixup: comments
2023-10-11 15:43:55 -04:00
Simon Glass
5fb9e2aab5 expo: Add better error reporting
When building an expo fails, show some information about which node
caused the problem. Use -ENOENT consistently when the ID is missing.
This makes it easier for the user to debug things.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11 15:43:55 -04:00
Simon Glass
37db20d0a6 video: Support showing a cursor
Add rudimentary support for displaying a cursor on a vidconsole. This
helps the user to see where text is being entered.

The implementation so far is very simple: the cursor is just a vertical
bar of fixed width and cannot be erased. To erase the cursor, the text
must be redrawn over it.

This is good enough for expo but will need enhancement to be useful for
the command-line console. For example, it could save and restore the
area behind the cursor.

For now, enable this only for expo, to reduce code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11 15:43:55 -04:00
Simon Glass
617d7b545b video: Export vidconsole_entry_start()
At present this is called only when a newline is detected, since this
indicates the start of a line of text being entered.

Export this function so it can be used by expo, which may start a new
text line itself, without first writing out a newline.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11 15:43:55 -04:00
Simon Glass
9899eef2cb video: Allow saving and restoring text-entry state
Text entry operates within a context which includes quite a bit of
information. For example, with Truetype fonts, each character in the
text string has a position stored, so that it is possible to
backspace to that character. This information is built up as strings
are drawn on the display.

For the command line, there is just a single context. It is created
when command-line entry starts and it is destroyed (or at least not
needed anymore) when the user presses <enter> to enter the command.

By contrast, expo needs to be able to switch in and out of a text-entry
context, since it is also displaying other objects in the scene.

Add a way to save and restore the entry context for a vidconsole. This
is only needed for the truetype vidconsole, so add a method for that,
storing the information in an abuf struct.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11 15:43:55 -04:00
Simon Glass
9e55d09596 video: Allow obtaining the nominal size of a string size
At present there is a method for measuring text, but if the actual text
string is not known, it cannot be used.

For text editor we want to set the size of the entry box to cover the
expected text size. Add the concept of a 'norminal' size with a method
to calculate that for the vidconsole.

If the method is not implemented, fall back to using the font size,
which is sufficient for fixed-width fonts.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11 15:43:55 -04:00
Simon Glass
39ee32166f cli: Add a function to set up a new cread
Create a init function so that it is easy to use command-line reading.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11 15:43:54 -04:00
Simon Glass
3b487bf511 cli: Allow command completion to be disabled
When inputting text outside the command line we don't want to use tab
for command completion. Add an option to control this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11 15:43:54 -04:00
Simon Glass
8fc041fe4c cli: Allow history to be disabled
When inputting text outside the command line we don't want history to be
accessible. Add an option to control this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11 15:43:54 -04:00
Simon Glass
657e14da83 cli: Terminate the string in cread_line_process_ch()
Rather than relying on the caller, terminate the string inside this
function. Do this each time we return, whether input is finished or
not. It is not needed when the input is aborted, since the string will
be discarded in that case.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11 15:43:54 -04:00
Simon Glass
e5509ce87b cli: Create a function to process characters
Move most of the inner loop from cread_line() into a new function. This
will allow using it from other code.

This involves adding a few more members to the state struct.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11 15:43:54 -04:00
Simon Glass
8d997aab6e cli: Unindent some code in cread_line()
Reduce the indentation level of this code so it is easier to review the
next patch, which moves it into a function.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11 15:43:54 -04:00
Simon Glass
be5c2edd10 cli: Convert cread_line() to use a struct for the main vars
We want to reuse the editing code elsewhere. As a first step, move the
common variables into a struct. This will allow us to eventually put the
contents of the inner loop in a function, so it can be called from
elsewhere.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11 15:43:54 -04:00
Simon Glass
fedd372976 cli: Use unsigned int instead of unsigned long
The index values are not very large so it makes no sense to use a long
integer. Change these to uint instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11 15:43:54 -04:00
Simon Glass
dcc18ce0db cli: Implement delete-word in cread_line()
The Ctrl-W option is implemented in the cread_line_simple() but not in
the full version. This seems odd, so add an implementation.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11 15:43:54 -04:00
Simon Glass
6321391ac3 cli: Drop #ifdefs for CONFIG_AUTO_COMPLETE in cli_readline
Use a static inline and adjust the logic to avoid the need for #ifdefs in
cli_readline_into_buffer()

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11 15:43:54 -04:00
Simon Glass
039f8cc375 cli: Drop some #ifdefs in cli_readline
Add a few static inlines to avoid the need for #ifdefs in
cli_readline_into_buffer()

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11 15:43:54 -04:00
Simon Glass
33eb0b9eef cli: Add a command to show cmdline history
There is a function for this but it is never used. Showing the history is
a useful feature, so add a new 'history' command.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11 15:43:54 -04:00
Simon Glass
0f97e944b2 cli: Move simple readline into a function
Move this code into its own function since it is a separate
implementation from the full version.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11 15:43:54 -04:00
Tom Rini
429d59c3e5 Revert "mkimage: update man page and -h output"
This is part of a longer series, which isn't quite ready.  Revert this
for now at least.

This reverts commit 4cb6c8e5f0.

Signed-off-by: Tom Rini <trini@konsulko.com>
2023-10-11 15:32:39 -04:00
Tom Rini
997bef3c6d Merge branch '2023-10-11-port-gen_compile_commands_py'
To quote the author:
I'm submitting a patch series that ports the gen_compile_commands.py
script from the Linux kernel's sources to U-Boot. This script,
originally located in scripts/clang-tools/gen_compile_commands.py,
enables the generation of compile_commands.json file for improved code
navigation and analysis. The series consists of the initial script
import, the necessary modifications for U-Boot compatibility, and
finally some documentation.
2023-10-11 13:25:01 -04:00
Joao Marcos Costa
311df90b3e scripts/gen_compile_commands: fix usage message
Replace mentions to 'kernel' by 'U-Boot' to avoid confusion.

Signed-off-by: Joao Marcos Costa <jmcosta944@gmail.com>
Tested-by: Joao Paulo Goncalves <joao.goncalves@toradex.com>
2023-10-11 13:24:55 -04:00
Joao Marcos Costa
33717dbb20 doc: add ide_integration.rst to doc/develop
Add 'Integration with IDEs' chapter.

For now, this chapter is mostly a reference to the documentation of
gen_compile_commands, in doc/build, but it can be futurely used as
a guide for other IDE-friendly features.

Signed-off-by: Joao Marcos Costa <jmcosta944@gmail.com>
Tested-by: Joao Paulo Goncalves <joao.goncalves@toradex.com>
2023-10-11 13:24:55 -04:00
Joao Marcos Costa
3a83960b76 doc: add documentation for gen_compile_commands.py
This documentation briefly explains what is a compilation database,
and how to use the script to generate one.

This is not a portage, as there was no original documentation in the
Linux sources.

Acknowledge the documentation in the script's header and in doc/build
index.

Signed-off-by: Joao Marcos Costa <jmcosta944@gmail.com>
Tested-by: Joao Paulo Goncalves <joao.goncalves@toradex.com>
2023-10-11 13:24:55 -04:00
Joao Marcos Costa
b703bda0be .gitignore: add compile_commands.json
Add Clang's compilation database file (i.e. compile_commands.json) to
.gitignore, at the root of the repository.

Signed-off-by: Joao Marcos Costa <jmcosta944@gmail.com>
Tested-by: Joao Paulo Goncalves <joao.goncalves@toradex.com>
2023-10-11 13:24:55 -04:00
Joao Marcos Costa
6aacad2d53 scripts/gen_compile_commands.py: add acknowledgments
Add acknowledgments for porting and modifying the script. Of course, the
license, author, and copyright notice remain the same as in the original
script.

Signed-off-by: Joao Marcos Costa <jmcosta944@gmail.com>
Tested-by: Joao Paulo Goncalves <joao.goncalves@toradex.com>
2023-10-11 13:24:23 -04:00
Joao Marcos Costa
0972675dfb scripts/gen_compile_commands.py: fix docstring
The referred tool is now in U-Boot. Replace "the Linux kernel" by
"U-Boot" to make the docstring coherent.

Signed-off-by: Joao Marcos Costa <jmcosta944@gmail.com>
Tested-by: Joao Paulo Goncalves <joao.goncalves@toradex.com>
2023-10-11 13:24:23 -04:00
Joao Marcos Costa
97fbb2eb01 scripts/gen_compile_commands.py: adapt _LINE_PATTERN
For U-Boot's context, the regular expression defined by _LINE_PATTERN
should be adapted. Replace 'savedcmd' by 'cmd'.

Signed-off-by: Joao Marcos Costa <jmcosta944@gmail.com>
Tested-by: Joao Paulo Goncalves <joao.goncalves@toradex.com>
2023-10-11 13:24:23 -04:00
Joao Marcos Costa
c852f2e74c scripts: Port Linux's gen_compile_commands.py to U-Boot
This script generates a database of compiler flags, namely
compile_commands.json. It is quite useful for text editors that use
clangd LSP (e.g. Vim, Neovim).

It was ported from Linux's sources:
- tag: v6.4
- revision 6995e2de6891c724bfeb2db33d7b87775f913ad1

Modifications for U-Boot compatibility will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <jmcosta944@gmail.com>
Tested-by: Joao Paulo Goncalves <joao.goncalves@toradex.com>
2023-10-11 13:24:23 -04:00
Tom Rini
6e0a75d316 configs: Resync with savedefconfig
Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
2023-10-11 13:22:32 -04:00
Tom Rini
9598cf43f9 Merge branch '2023-10-11-assorted-fixes-and-updates'
- Assorted TI K3 updates, use ".dtso" for device tree overlays to match
  general usage, mkimage fixes/improvements, assorted platform
  updates/fixes, other assorted driver/platform fixes.
2023-10-11 13:22:32 -04:00
Andrew Davis
1a1d48e36a configs: Make TI_SECURE_DEVICE default for K3
All K3 boards now are secure by default, instead of setting this in each
defconfig, make it implied by the ARCH config.

The only exception is IOT2050, which I do not believe will have any
problems with being a TI_SECURE_DEVICE, but for now turn it off to keep
its config the same.

Signed-off-by: Andrew Davis <afd@ti.com>
Tested-by: Tom Rini <trini@konsulko.com>
2023-10-11 13:22:32 -04:00
Andrew Davis
a5b85ec406 configs: am65x: Merge the HS and non-HS defconfigs
K3 devices have runtime type board detection. Make the default defconfig
include the secure configuration. Then remove the HS specific config.

Non-HS devices will continue to boot due to runtime device type detection.

Signed-off-by: Andrew Davis <afd@ti.com>
Tested-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Manorit Chawdhry <m-chawdhry@ti.com>
2023-10-11 13:22:32 -04:00