[U-Boot] [Question] Driver-Model UART on NOR-boot ? Work?

Masahiro Yamada yamada.m at jp.panasonic.com
Wed Oct 1 13:23:08 CEST 2014


Hi Simon,



I am looking at the driver-model serial code.


I notice driver-model serial code uses ".data" section
for storing the current device even before relocation.


This code in drivers/serial/serial-uclass.c:

  /* The currently-selected console serial device */
  struct udevice *cur_dev __attribute__ ((section(".data")));



In my understanding, we should not write any data to
.data section before relocation.


Let's say we are booting U-Boot from NOR flash.

Before relocation, everything (including .data section)
is placed on NOR flash which is read-only.
(Please point out if I am wrong.)

We are only allowed to write data to the stack, gd_t, bd_t
and malloc area (if CONFIG_SYS_MALLOC_F_LEN is defined)
before relocation, I think.



I think that is why pre-driver-model serial uses a hard-coded
default serial port before relocation.


  This code in driver/serial/serial.c:

     if (!(gd->flags & GD_FLG_RELOC))
                dev = default_serial_console();
     else if (!serial_current)
                dev = default_serial_console();
     else
                dev = serial_current;




My question is,  does printf() work
with driver-model UART and XIP device such NOR flash?




Best Regards
Masahiro Yamada



More information about the U-Boot mailing list