If semihosting is disabled, then the user has no debugger attached, and
will not see any messages. Don't create a serial device in this
instance, to (hopefully) fall back on another working serial device.
Signed-off-by: Sean Anderson <sean.anderson@seco.com>
.getc = smh_serial_getc,
};
.getc = smh_serial_getc,
};
+static int smh_serial_bind(struct udevice *dev)
+{
+ if (semihosting_enabled())
+ return 0;
+ return -ENOENT;
+}
+
static int smh_serial_probe(struct udevice *dev)
{
struct smh_serial_priv *priv = dev_get_priv(dev);
static int smh_serial_probe(struct udevice *dev)
{
struct smh_serial_priv *priv = dev_get_priv(dev);
U_BOOT_DRIVER(smh_serial) = {
.name = "serial_semihosting",
.id = UCLASS_SERIAL,
U_BOOT_DRIVER(smh_serial) = {
.name = "serial_semihosting",
.id = UCLASS_SERIAL,
+ .bind = smh_serial_bind,
.probe = smh_serial_probe,
.priv_auto = sizeof(struct smh_serial_priv),
.ops = &smh_serial_ops,
.probe = smh_serial_probe,
.priv_auto = sizeof(struct smh_serial_priv),
.ops = &smh_serial_ops,
void smh_serial_initialize(void)
{
void smh_serial_initialize(void)
{
- serial_register(&serial_smh_device);
+ if (semihosting_enabled())
+ serial_register(&serial_smh_device);
}
__weak struct serial_device *default_serial_console(void)
}
__weak struct serial_device *default_serial_console(void)