OK6410A development board (three) 27 u-boot-2021.01 boot analysis U-boot image running part console

Publisher:平安守护Latest update time:2022-09-20 Source: csdnKeywords:OK6410A Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The console has nothing to do with input, only with output


Model

Both the serial port and LCD can be used as output, so it can be used as a console


Output without console mechanism: Serial port

Just use serial_puts to print information to the serial port


Output without console mechanism: lcd

Just use lcd_puts to print information to the LCD


console

Register serial_puts and lcd_puts to the console mechanism


Call console_puts provided by console to print information

Whether to print to the serial port or LCD depends on the configuration of the console.


How does U-boot handle this?

Before board_init_f->console_init_f

gd->have_console is 0

The serial port is also initialized

No output can be done at this time (printf is usually called for output). The information output by printf is in memory.


After board_init_f->console_init_f, before board_init_r->console_init_r

gd->have_console is now 1

gd->flags & GD_FLG_DEVINIT == 0


The serial port has been initialized

The information previously output in the memory has been printed to the serial port

At this time, the information output by printf is on the serial port, and serial_puts is called.


After board_init_r->console_init_r

gd->have_console is now 1

gd->flags & GD_FLG_DEVINIT == 1


The serial port has been initialized and registered (init_sequence_r->stdio_add_devices->drv_system_init->stdio_register) to the console system

The lcd has been initialized and registered (init_sequence_r->stdio_add_devices->drv_lcd_init->stdio_register) to the console system

At this time, the output can be output (the output usually calls printf)

At this time, the information output by printf may be output to the LCD or serial port according to the settings, and console_puts is called

console_puts then calls serial_puts or lcd_puts


Details stage

stdio_register


In fact, it is to mount the struct stdio_dev structure to the end of the global variable static struct stdio_dev devs;


console_init_r

console_init_r has two implementations depending on whether SYS_CONSOLE_IS_IN_ENV is defined


SYS_CONSOLE_IS_IN_ENV // Y if CONSOLE_MUX is Y

This allows multiple input/output devices to be set up at boot time.

For example, if stdout is set to "serial,video" then output will be sent to both the serial and video devices at boot time.

Environment variables can be updated after boot to change input/output devices.


CONSOLE_MUX // VIDEO/DM_VIDEO/LCD is Y, then Y

This allows the use of multiple devices per console "file".

For example, stdout can be set to go to both serial and video.

Similarly, stdin can be set to come from both serial and keyboard.

Input can be provided from any source.

Console multiplexing adds a small amount of size to U-Boot.

Changes to the environment variables stdout, stdin, and stderr take effect immediately.


console_init_r SYS_CONSOLE_IS_IN_ENV when defined

// Problem: outputdev is found, but how to use outputdev in printf

console_init_r


stdinname = env_get("stdin");

stdoutname = env_get("stdout");

// stdoutname can be lcd,serial0@7F005000

// can be lcd

// can be serial0@7F005000

// If there is a comma (,) it means there are two stdout devices

stderrname = env_get("stderr");

iomux_err = iomux_doenv(stdin, stdinname);

iomux_err += iomux_doenv(stdout, stdoutname); 

for_each_consoledevice

console_devices[console] = (struct stdio_dev **)realloc(console_devices[console], cs_idx * sizeof(struct stdio_dev *));

memcpy(console_devices[console], cons_set, cs_idx * sizeof(struct stdio_dev *));

cd_count[console] = cs_idx;

iomux_err += iomux_doenv(stderr, stderrname);

stdio_print_current_devices

gd->flags |= GD_FLG_DEVINIT;

print_pre_console_buffer(flushpoint);


console_init_r SYS_CONSOLE_IS_IN_ENV is not defined

consumer

console_puts

for (i = 0; i < cd_count[file]; i++)

dev = console_devices[file][i];

dev->puts(dev, s);


Console Settings

Correct Setup

Set the environment variables in the u-boot environment to output on the LCD


Only LCD output // When set like this, the serial port also has output, because the program has been modified 8c24d5adfbc43826246716e41f964f0467c1cfd6

// BUG at this time: some miscellaneous data (promot data) will come out on the serial port

env set stdout lcd

s


Only serial output

// No problems at this time

env set stdout serial0@7F005000

s


Both output // When set like this, the serial port prints twice because the program has been modified 8c24d5adfbc43826246716e41f964f0467c1cfd6

// The timing is not satisfied at this time (because the LCD needs to be written immediately after getc from the serial port, and the next character cannot be getc from the serial port at this time)

env set stdout "lcd,serial0@7F005000" // Every time printf/puts is executed, output from lcd first

env set stdout "serial0@7F005000,lcd" // Every time printf/puts is executed, output from serial first

s


Wrong settings

env set stdout bbb

## Error inserting "stdout" variable, errno=22


bbb is not a stdout device and cannot be set like this


env set stdout parsing

It must be something like iomux_doenv

//TODO

Keywords:OK6410A Reference address:OK6410A development board (three) 27 u-boot-2021.01 boot analysis U-boot image running part console

Previous article:OK6410A development board (eight) 4 linux-5.11 OK6410A peripheral driver
Next article:OK6410A development board (eight) 2 linux-5.11 OK6410A linux development environment construction

Recommended ReadingLatest update time:2024-11-15 01:55

uboot-2011.12 ported to S3C2440 (Sequence 2) - binutils binary tool set and u-boot
Overview binutils is a set of binary tools, including addr2line, ar, gprof, nm, objcopy, objdumpr, ranlib, size, strings, strip, etc. ar software ar is used to create, modify, and extract library files. ar requires at least two parameters to run, for example: $ ar rv libtest.a add.o minus.o It means to make add.o an
[Microcontroller]
The basic principle of starting U-BOOT from Nand Flash
If the  S3C2410 is configured to boot from Nand Flash (configuration is set by hardware engineers on the circuit board), the Nand Flash controller of the S3C2410 has a special function. After the S3C2410 is powered on, the Nand Flash controller will automatically move the first 4K data on the Nand Flash to the 4K inte
[Microcontroller]
Friendly Arm's latest mini2440 study notes - u-boot 1.1.6 transplantation (I)
Starting from this article, I will record the problems encountered by the blogger during the u-boot 1.1.6 porting process. This article will cover two issues: 1. Add development board in u-boot 2. u-boot first stage startup code 1. Add development board in u-boot 1.1. Makefile changes 1.1.1. Add disassembly file
[Microcontroller]
Analysis of start.S of ARM920T in u-boot
The cpu/arm920t/start.S program steps are roughly as follows 1. Set the interrupt vector table 2. Set the CPU mode to SVC32 mode and disable IRQ and FIQ interrupts 3. Turn off the watchdog 4. Shield all interrupts 5. Determine whether the program is running in R
[Microcontroller]
Analysis of start.S of ARM920T in u-boot
[Embedded] Porting U-boot to mini2440 from scratch (Part 2) - Burning
Burn Related tools: j-link Software: j-flash ARM V4.70 After successful compilation, u-boot.bin will be generated in the output directory. This binary file can be used directly for burning. How to determine the burning position When burning, I choose to burn directly into NOR, look at the SPEC of S3C2440 and the s
[Microcontroller]
[Embedded] Porting U-boot to mini2440 from scratch (Part 2) - Burning
Analysis of nandflash initialization process in u-boot
The following is an analysis of the nand flash initialization code nand_init(): 1. If (CONFIG_COMMANDS & CFG_CMD_NAND) is defined and (CFG_NAND_LEGACY) is not defined, then start_armboot() calls nand_init() in driver/nand/nand.c, otherwise if (CONFIG_COMMANDS & CFG_CMD_NAND) is defined and CFG_NAND_LEGACY is def
[Microcontroller]
OK6410A Development Board (VIII) 116 linux-5.11 OK6410A User Space Virtual Memory Layout
The user space virtual memory layout of different architectures is different, taking arm as an example The user space actually starts at 0x10 000, and from low to high there are code segment, data segment, heap, and stack User space range is 1000 -beff ffff vdso stack sigpage heap-mmap-ld libc heap-brk Data segmen
[Microcontroller]
mini2440 u-boot linux kernel boot, porting the newer (Linux3.19) kernel to the mini2440 development board (Part 1)
s3c24xx-nand s3c2440-nand: Tacls=1, 9ns Twrph0=3 29ns, Twrph1=2 19ns s3c24xx-nand s3c2440-nand: NAND soft ECC nand: device found, Manufacturer ID: 0xec, Chip ID: 0xda nand: Samsung NAND 256MiB 3,3V 8-bit nand: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64 Creating 5 MTD partitions on "nand": 0x00000
[Microcontroller]
Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号