Tiny210 (s5pv210) Port U-boot (based on version 2014.4) -- Port u-boot.bin (print serial console)

Source: Internet
Author: User
Tags spl

We didn't see any obvious effect in the code we transplanted before. In this section, we can print information on the console.

In the previous section, we can see that relocate_code redirection is called. In the help document DOC/readme. Arm-relocation of U-boot, we will describe the relocation. U-boot specifies the-pie option when linking to generate location-independent codes, which is specified in the u-boot-2014.04/ARCH/ARM/config. mk:


When the-pie option is used, the linker generates a correction table (fixup tables) that represents two segments in the final binary u-boot.bin. rel. dyn and. dynsym, also need to add these 2 segments in the Link script file, the u-boot.bin link script file for the u-boot-2014.04/ARCH/ARM/CPU/u-boot.lds, with these 2 segments, u-boot can modify the link address of the relocated code to its running address based on the information of the two segments, so that U-boot can be relocated to any address. Call relocate_code in crt0.s to complete the relocation, modify the address, return the result, clear the BSS, and jump to the board. the board_init_r function in C performs further initialization, such as the NIC, and then enters the main_loop loop. The relocated U-boot memory layout is as follows:


Now execute make all to compile the u-boot.bin and u-boot-spl.bin, but compilation error:


In clock. the s5pv210_get_arm-clk of C uses the macro samsung_get_base_clock and the related registers, because our clock code was previously implemented using assembly, so we have the arch-s5pc1xx in arch/ARM/include/ASM/clock. h to define these registers:


Finally the u-boot.bin and SPL/tiny210-spl.bin are generated. Check the size of the u-boot.bin:


There is 201588b, replace block size 201588/512 = 393 we need to modify the bl2 copy function copy_bl2_to_ram in the u-boot-spl.bin, which is defined in the u-boot-2014.04/board/Samsung/tiny210/tiny210.c to change the copy size to 400, copy 400 blocks, save them, and execute make all again. run the DD command to burn the data to the SD card:


Open the serial port terminal and choose to start from the SD card. An exciting thing happened:


However, it stops here. We can trace the code and find that the board_init_r function in board. c calls enable_caches. Now we can use puts, printf, and other functions. We can print information to determine where the program is stuck. Debug all the way and finally find the program stuck in
In onenand_init:


This macro config_cmd_onenand is defined in tiny210.h. Our tiny210 Development Board does not have onenand, so we can block this macro:


In addition, there are some information related to the board. We can modify it to tiny210.h.



Onenand related, we view u-boot-2014.04/common/makefile, see how env_onenand.c is compiled into the u-boot.bin is because of the definition of the config_env_is_in_onenand macro, defined in tiny210.h, we shielded it:


But the compilation still has an error:

We view u-boot-2014.04/common/cmd_nvedit.c description must specify the location where the environment variables are saved. We can save the environment variables to the SD card or nand, but it hasn't been ported yet, so temporarily open the config_assist_onenand and config_env_is_in_onenand macros, and then on the board. block onenand initialization code in C.


Compilation successful again.
Since this modification only for the u-boot.bin, there is no impact on the u-boot-spl.bin, so you can just burn the u-boot.bin to the SD card fan
Area 32.


Well, after transplantation for so long, the console can finally see the effect. Try the basic U-boot command:


After so many days, the results have finally been achieved, and the subsequent things have been improved on this basis. I put this version of the code here: tiny210_u-boot_201404_v1.1.tar.bz2 Interested friends can look at, help improve together.

Tiny210 (s5pv210) Port U-boot (based on version 2014.4) -- Port u-boot.bin (print serial console)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.