Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions examples/fbcon/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# ##############################################################################
# apps/examples/fbcon/CMakeLists.txt
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. The ASF licenses this
# file to you under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
#
# ##############################################################################

if(CONFIG_EXAMPLES_FBCON)
nuttx_add_application(
NAME
fbcon
STACKSIZE
${CONFIG_EXAMPLES_FBCON_STACKSIZE}
MODULE
${CONFIG_EXAMPLES_FBCON}
SRCS
fbcon_main.c)
target_sources(apps PRIVATE fbcon_main.c)
endif()
205 changes: 205 additions & 0 deletions examples/fbcon/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

config EXAMPLES_FBCON
tristate "Framebuffer console example"
default n
---help---
Enable the Framebuffer console example.
This example allows STDOUT and/or STDERR to be redirected and displayed
on a framebuffer character device.

A chosen builtin app can be spawned - such as "nsh" - to create a
console and, if required, STDIN can be intercepted to allow input
characters to be interpreted and pre-processed before passing them
on to the spawned app.

Relies on and uses NX and NXFONTS

if EXAMPLES_FBCON

comment "Console STDIN and/or STDOUT setup"

config EXAMPLES_FBCON_PIPE_STDOUT
bool "Pipe stdout to this console"
default y

config EXAMPLES_FBCON_PIPE_STDERR
bool "Pipe stderr to this console"
default y

config EXAMPLES_FBCON_PIPE_STDIN
bool "Pipe stdin via this console"
default y
---help---
This is usually needed if the spawned App is "nsh" as we need to
intercept input characters in some cases

comment "Console Framebuffer setup"

config EXAMPLES_FBCON_DEF_FB
string "Default framebuffer driver"
default "/dev/fb0"
---help---
Default framebuffer drivers. This selection can be overridden from
the command line.

comment "BPP setup"

choice EXAMPLES_FBCON_BPP_SELECTION
prompt "BPP Configuration"
default EXAMPLES_FBCON_BPP_NX_DEFAULT
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

depends on?


config EXAMPLES_FBCON_BPP_NX_DEFAULT
bool "Use smallest BPP as enabled via NXFONTS setup"

config EXAMPLES_FBCON_CUSTOM_BPP
bool "Choose custom BPP (must not be disabled in NX)"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are missing endchoice here. This causes the build to break with errors like:

mkkconfig in /NuttX/apps
/NuttX/apps/examples/fbcon/Kconfig:62: syntax error
/NuttX/apps/examples/fbcon/Kconfig:51: missing end statement for this entry
/NuttX/apps/examples/fbcon/Kconfig:23: missing end statement for this entry
/NuttX/apps/examples/Kconfig:8: missing end statement for this entry
Kconfig:2785: missing end statement for this entry
/NuttX/apps/examples/fbcon/Kconfig:61: invalid statement
/NuttX/apps/examples/fbcon/Kconfig:62: unexpected option "prompt"
/NuttX/apps/examples/fbcon/Kconfig:63: unexpected option "depends"
/NuttX/apps/examples/fbcon/Kconfig:64: invalid statement
/NuttX/apps/examples/fbcon/Kconfig:65:warning: ignoring unsupported character ':'
/NuttX/apps/examples/fbcon/Kconfig:65: unknown statement "Note"
/NuttX/apps/examples/fbcon/Kconfig:95: unexpected end statement
/NuttX/apps/examples/fbcon/Kconfig:96: unexpected end statement
/NuttX/apps/examples/fbcon/Kconfig:173: syntax error
/NuttX/apps/examples/fbcon/Kconfig:172: unknown option "---help--"
/NuttX/apps/examples/fbcon/Kconfig:173: unknown option "Decode"
/NuttX/apps/examples/fbcon/Kconfig:205: unexpected end statement
/NuttX/apps/examples/Kconfig:211: unexpected end statement
Kconfig:2787: unexpected end statement
make: *** [tools/Unix.mk:726: olddefconfig] Error 1
ERROR: failed to refresh

Unfortunately I didn't catch it until after merged...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm...how come I didn't see this? Any suggestions on how I could have caught it when check patch and CI didn't?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TimJTi I'm not sure, could it be that the line was there during checks but got deleted somehow at the last second?

Copy link
Copy Markdown
Member

@lupyuen lupyuen Mar 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some RISC-V Builds are failing, I submitted the patch here:

Screenshot 2025-03-21 at 9 40 36 AM

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any suggestions on how I could have caught it when check patch and CI didn't?

If I remember correctly: Our CI Check uses kconfiglib but our Local Builds use kconfig-frontends. That's why Kconfigs are checked differently:

Hi @simbit18: Am I correct?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lupyuen the use of two tools can have different behaviors. Then you also need a style control tool for the kconfig file. There is no shortage of fun in NuttXland !!! :)

choice EXAMPLES_FBCON_CUSTOM_BPP
prompt "Custom Font pixel depth (BPP - Bits Per Pixel)"
depends on EXAMPLES_FBCON_CUSTOM_BPP
---help---
Note: The required BPP must not be disabled via the NXFONT setup

config EXAMPLES_FBCON_1BPP
bool "1 BPP"
depends on !NX_DISABLE_1BPP

config EXAMPLES_FBCON_2BPP
bool "2 BPP"
depends on !NX_DISABLE_2BPP

config EXAMPLES_FBCON_4BPP
bool "4 BPP"
depends on !NX_DISABLE_4BPP

config EXAMPLES_FBCON_8BPP
bool "8 BPP"
depends on !NX_DISABLE_8BPP

config EXAMPLES_FBCON_16BPP
bool "16 BPP"
depends on !NX_DISABLE_16BPP

config EXAMPLES_FBCON_24BPP
bool "24 BPP"
depends on !NX_DISABLE_24BPP

config EXAMPLES_FBCON_32BPP
bool "32 BPP"
depends on !NX_DISABLE_32BPP

endchoice # EXAMPLES_FBCON_CUSTOM_BPP
endchoice # EXAMPLES_FBCON_BPP_SELECTION

comment "Console appearance"

config EXAMPLES_FBCON_SHOW_WELCOME
bool "Display welcome messages on stdout and/or stdin"
default y

config EXAMPLES_FBCON_DEFAULT_COLORS
bool "Use Default Colors (white characters on black background)"
default y

if !EXAMPLES_FBCON_DEFAULT_COLORS

config EXAMPLES_FBCON_BGCOLOR
hex "Background color"
default 0x0
---help---
The color of the background. Default depends on config
EXAMPLES_FBCON_BPP.

config EXAMPLES_FBCON_FCOLOR
hex "Console font color"
default 0x0
---help---
The color of the fonts used by the console.
endif # !EXAMPLES_FBCON_DEFAULT_COLORS

config EXAMPLES_FBCON_LINESPACING
int "Line spacing"
default 0
range 0 4
---help---
The vertical distance between lines is the sum of (1) the vertical
bounding box dimension of the font, and (2) this additional line
space. This value may be zero, but not negative.

config EXAMPLES_FBCON_NOWRAP
bool "No wrap"
default n
---help---
By default, lines will wrap when the test reaches the right hand side
of the window. This setting can be defining to change this behavior so
that the text is simply truncated until a new line is encountered.

choice EXAMPLES_FBCON_FONT
prompt "Font Configuration"
default EXAMPLES_FBCON_DEFAULT_FONT

config EXAMPLES_FBCON_DEFAULT_FONT
bool "Use Default Font"

config EXAMPLES_FBCON_CUSTOM_FONTID
bool "Use Custom Font ID"

config EXAMPLES_FBCON_FONTID
int "Custom font ID"
depends on EXAMPLES_FBCON_CUSTOM_FONTID
default 0
---help---
Selects the font used by the console (see font ID numbers
in include/nuttx/nx/nxfonts.h)

endchoice # EXAMPLES_FBCON_FONT

config EXAMPLES_FBCON_CURSORCHAR
int "Character code to use as the cursor"
default 95
---help---
The bitmap code to use as the cursor. Default '_' (95)

comment "FB Console App Escape code decoding"

config EXAMPLES_FBCON_VT100_DECODE
bool "Decode VT100 Escape Codes"
default y
---help--
Decode VT100 ESC codes - only minimal supporting functions

comment "FB Console spawn task configuration"

config EXAMPLES_FBCON_SPAWN_TASK
string "Built-in application, or task, to spawn after console setup"
default "nsh"
---help---
The required App must be enabled via Kconfig, of course. Its
priority and stack size will be determined by this example and passed
on during the spawn of the chosen app.

comment "FB Console App stack and priority options and glyph cache size"

config EXAMPLES_FBCON_STACKSIZE
int "Stack Size"
default DEFAULT_TASK_STACKSIZE
---help---
The stacksize to use when starting the example.

config EXAMPLES_FBCON_PRIORITY
int "Task Priority"
default 100
---help---
The priority of the example.

config EXAMPLES_FBCON_GLCACHE
int "Glyph cache size"
default 94
---help---
Size of the glyph cache. Default allows all usual ASCII characters to be cached

endif # EXAMPLES_FBCON
25 changes: 25 additions & 0 deletions examples/fbcon/Make.defs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
############################################################################
# apps/examples/fbcon/Make.defs
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################

ifneq ($(CONFIG_EXAMPLES_FBCON),)
CONFIGURED_APPS += $(APPDIR)/examples/fbcon
endif
36 changes: 36 additions & 0 deletions examples/fbcon/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
############################################################################
# apps/examples/fbcon/Makefile
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################

include $(APPDIR)/Make.defs

# NuttX NX Framebuffer Console Example.

MAINSRC = fbcon_main.c

# NXTEXT built-in application info

PROGNAME = fbcon
PRIORITY = $(CONFIG_EXAMPLES_FBCON_PRIORITY)
STACKSIZE = $(CONFIG_EXAMPLES_FBCON_STACKSIZE)
MODULE = $(CONFIG_EXAMPLES_FBCON)

include $(APPDIR)/Application.mk
Loading