The primary purpose of xyz_earlyserialinit() is to make the serial
console available for low level debug output before the serial driver is
initialized. That happens much later. That is helpful mostly for
debugging. Without early initialization of the serial console, there
will be no output until nx_start() and up_initialize() are called.
By the way, the naming up_earlyserialinit() is incorrect. That should
be called esp32_earlyserialinit() or maybe esp32_early_serialinit().
The up_ prefix is reserved and should be used ONLY for functions called
from the OS. All functions called internally without esp32 logic should
begin with esp32_ (or xtensa or lx6 as appropriate for the scope of the
function). See
https://cwiki.apache.org/confluence/display/NUTTX/Naming+of+Architecture%2C+MCU%2C+and+Board+Interfaces
for a more complete explanation.
up_initialize() is properly named because it is called from the OS.
up_earlyserialinit() is not called from the OS and is not correctly named.
On 2/10/2021 8:35 AM, Sara da Cunha Monteiro de Souza wrote:
Hi all,
I've been working in the serial driver.
And I've got a little confused about what is to be performed in
*up_earlyserialinit. *
I've been looking at other chips and I noticed that the
*<chip>_lowsetup *function performs
almost the same of this function and the latter is called earlier than the
former in* <chip>_start*.*c*.
So, I am not sure what to do in *up_earlyserialinit.*
Besides it*, *I also noticed that the *setup* ioctl seems not to be
performed for the console.
Instead of this function, the console setup is done in the *<chip>_lowsetup
*function.
However, both have the same responsibilities, right?
Thanks in advance,
Sara