System version: Ubuntu18.04-64
Compiler version: gcc version 7.4.0 (Ubuntu/Linaro 7.4.0-1ubuntu1~18.04.1)
uboot version: 2018.07-linux4sam_6.0
Board model: at91sama5d3x-xplained
MCU model: sama5d36
1. The uboot directory is as follows:
2. There is an official default configuration under the configs/ folder
# To put environment variables in nandflash (default):
sama5d3_xplained_nandflash_defconfig
# To put environment variables in SD/MMC card:
sama5d3_xplained_mmc_defconfig
Compile for SAMA5D3-Xplained board:
Select nandflash boot
make sama5d3_xplained_nandflash_defconfig
make
3. The uboot downloaded from the official website can basically run, and the printed information can be seen through the serial port. There may be no problem with the DDR2 and NAND Flash drivers and they can be used normally. The network driver and LED driver designed by the manufacturer are adapted and cut according to the model;
Burn the compiled file u-boot.bin into it, and you can see the information printed by the serial port
U-Boot 2018.07-linux4sam_6.0 (Oct 11 2019 - 23:57:20 -0700)
CPU: SAMA5D36
Crystal frequency: 12 MHz
CPU clock : 528 MHz
Master clock : 132 MHz
DRAM: 256 MiB
NAND: 256 MiB
MMC: Atmel mci: 0, Atmel mci: 1
Loading Environment from NAND... OK
In: serial@ffffee00
Out: serial@ffffee00
Err: serial@ffffee00
Netjack: macb_eth_probe phy-mode=mii,devname=ethernet@f0028000
eth0: ethernet@f0028000 [PRIME]macb_eth_probe phy-mode=rmii,devname=ethernet@f802c000
, eth1: ethernet@f802c000
Hit any key to stop autoboot: 0
=> at
arch=arm
baudrate=115200
board=sama5d3_xplained
board_name=sama5d3_xplained
bootargs=console=ttyS0,115200 earlyprintk mtdparts=atmel_nand:256k(bootstrap)ro,768k(uboot)ro,256K(env_redundant),256k(env),512k(dtb),6M(kernel)ro,-(rootfs) rootfstype=ubifs ubi.mtd=6 root=ubi0:rootfs
bootcmd=tftp 0x21000000 at91-sama5d3_xplained.dtb;tftp 0x22000000 zImage;bootz 0x22000000 - 0x21000000
bootdelay=3
cpu=armv7
eth1addr=AA:AB:C1:D2:E6:C6
ethact=ethernet@f0028000
ethaddr=EE:AB:C1:D2:E6:C6
ethprime=ethernet@f0028000
fdtcontroladdr=2fb16b08
gatewayip=192.168.1.1
ipaddr=192.168.1.100
ipaddr1=192.168.2.100
netmask=255.255.255.0
serverip=192.168.1.108
soc=at91
stderr=serial@ffffee00
stdin=serial@ffffee00
stdout=serial@ffffee00
vendor=atmel
Environment size: 778/131067 bytes
=>
4. Key Document Description
scripts/config_whitelist.txt List of all macro definitions
SAMA5D3_XPLAINED BOARD
M: Bo Shen S: Maintained F: board/atmel/sama5d3_xplained/sama5d3_xplained.c F: include/configs/sama5d3_xplained.h F: configs/sama5d3_xplained_mmc_defconfig F: configs/sama5d3_xplained_nandflash_defconfig arch/arm/mach-at91/spl_at91.c arch/arm/mach-at91/include/mach/at91_common.h //public function declaration header file sama5d3.h //CPU base address sama5_boot.h //Boot mode include/configs at91-sama5_common.h //CPU series common configuration 5. Cropped file list //============================================ Determine the file of uboot compilation configuration, and the compilation option macro definition is found in these files include/configs/at91-sama5_common.h include/configs/sama5d3_xplained.h configs/sama5d3_xplained_nandflash_defconfig // CONFIG_DM_ETH //Support device tree, network configuration is read from the device tree This version of uboot supports the device tree function, making uboot lighter and no longer bloated and clumsy. 6. Modify the device tree and change the MAC interface mode of the network arch/arm/dts Makefile dtb-$(CONFIG_TARGET_SAMA5D3_XPLAINED) += at91-sama5d3_xplained.dtb macb0: ethernet@f0028000 { phy-mode = "mii"; //Change the PHY interface mode #address-cells = <1>; #size-cells = <0>; status = "okay"; ethernet-phy@7 { reg = <0x7>; }; }; 7. Since uboot is a naked running program, it must have a main function. Start with the main function to see how to initialize peripherals, GPIO, network card, etc. void board_init_r(gd_t *new_gd, ulong dest_addr) { /* * Set up the new global data pointer. So far only x86 does this * here. * TODO(sjg@chromium.org): Consider doing this for all archs, or * dropping the new_gd parameter. */ #if CONFIG_IS_ENABLED(X86_64) arch_setup_gd(new_gd); #endif #ifdef CONFIG_NEEDS_MANUAL_RELOC int i; #endif #if !defined(CONFIG_X86) && !defined(CONFIG_ARM) && !defined(CONFIG_ARM64) gd = new_gd; #endif gd->flags &= ~GD_FLG_LOG_READY; #ifdef CONFIG_NEEDS_MANUAL_RELOC for (i = 0; i < ARRAY_SIZE(init_sequence_r); i++) init_sequence_r[i] += gd->reloc_off; #endif //All initialization depends on this array if (initcall_run_list(init_sequence_r)) hang(); /* NOTREACHED - run_main_loop() does not return */ hang(); } //Execute functions sequentially in the structure //Execute functions sequentially in the structure //Excerpt part of the code, there are many devices in the array, initialize static init_fnc_t init_sequence_r[] = { /* PPC has a udelay(20) here dating from 2002. Why? */ #ifdef CONFIG_CMD_NET initr_ethaddr, // Network device information initialization #endif #ifdef CONFIG_CMD_NET INIT_FUNC_WATCHDOG_RESET initr_net, //Initialize network devices, uboot prints the read network card information #endif PHY initialization process eth_initialize(); //First level initialization of network equipment eth_common_init(); //Second level initialization of network equipment miiphy_init(); //Network device third level initialization phy_init();// phy_davicom_init(); //Network device fourth level initialization phy_micrel_ksz8xxx_init();// MDIO mii MAC+PHY=network card chip, the first 5 registers are the same for all PHY chips; 8. Set the board-level hardware clock configuration arch/arm/mach-at91/spl_atmel.c void board_init_f(head dummy) { int ret; switch_to_main_crystal_osc(); #ifdef CONFIG_SAMA5D2 configure_2nd_sram_as_l2_cache(); #endif #if !defined(CONFIG_AT91SAM9_WATCHDOG) /* disable watchdog */ at91_disable_wdt(); #endif /* PMC configuration */ at91_pmc_init(); at91_clock_init(CONFIG_SYS_AT91_MAIN_CLOCK); matrix_init(); redirect_int_from_saic_to_aic(); timer_init(); board_early_init_f(); mem_init(); ret = spl_init(); if (ret) { debug("spl_init() failed: %dn", ret); hang(); } preloader_console_init(); 9. CPU related settings arch/arm/cpu/armv7 10. Board level information board/atmel/sama5d3_xplained/sama5d3_xplained.c int board_init(void) { /* adress of boot parameters */ gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100; #ifdef CONFIG_NAND_ATMEL sama5d3_xplained_nand_hw_init(); //Nand Flash initialization #endif #ifdef CONFIG_CMD_USB sama5d3_xplained_usb_hw_init(); //USB initialization #endif #ifdef CONFIG_GENERIC_ATMEL_MCI sama5d3_xplained_mci0_hw_init(); //EMMC initialization #endif return 0; } 11. The RESET pin of PHY 9031 is controlled by the CPU, and the power supply and RESET of PHY 8081 are controlled by the CPU. To ensure the timing, after the system is powered on, the RST pin of the PHY chip is pulled high first; Control GPIO operation under uboot board/atmel/sama5d3_xplained/sama5d3_xplained.c Add code tatic void sama5d3_xplained_phy_hw_init(void) { //GPIO register configuration, output internal pull-up function; at91_set_pio_periph(AT91_PIO_PORTE, 9, 1); /* GPIO output up*/ at91_set_pio_periph(AT91_PIO_PORTC, 18, 1); /* GPIO output up*/ at91_set_pio_periph(AT91_PIO_PORTC, 31, 1); /* GPIO output up*/ at91_set_pio_periph(AT91_PIO_PORTB, 12, 1); /* LED GPIO output up*/ //Output corresponding level at91_set_pio_output(AT91_PIO_PORTE, 9, 1); //micrel ksz9031 reset gpio at91_set_pio_output(AT91_PIO_PORTC, 18, 0); //micrel ksz8081 power gpio at91_set_pio_output(AT91_PIO_PORTC, 31, 1); //micrel ksz8081 reset gpio at91_set_pio_output(AT91_PIO_PORTB, 12, 0); //Board led on } int board_init(void) { /* adress of boot parameters */ gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100; #ifdef CONFIG_NAND_ATMEL sama5d3_xplained_nand_hw_init(); #endif #ifdef CONFIG_CMD_USB sama5d3_xplained_usb_hw_init(); #endif #ifdef CONFIG_GENERIC_ATMEL_MCI sama5d3_xplained_mci0_hw_init(); #endif // add by for Jack phy init gpio //Add the GPIO initialization function to the initialization function of the development board and call sama5d3_xplained_phy_hw_init(); return 0; } 12. The official website uboot download link is: https://www.linux4sam.org/bin/view/Linux4SAM/U-Boot
Previous article:[Linux bottom layer] U-boot debugging command usage tips
Next article:[Linux bottom layer] bootstrap transplantation, cutting and compilation
Recommended ReadingLatest update time:2024-11-16 15:55
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Various commonly used integrated IC component package libraries, is there any need?
- The most comprehensive list of 5G segment leading concept stocks in history
- HTS221 driver porting for MicroPython
- Isolated ADC Acquisition Solution for Analog Signals
- DSP C6000 keywords Keyword summary
- Problems with ADS1220
- Why do smart water meters use disposable 17450 (or other models) disposable lithium batteries? Why not use rechargeable batteries?
- 【Development and application based on NUCLEO-F746ZG motor】15. Mathematical model - voltage equation and electromagnetic torque equation
- Playing with Zynq Serial 42——[ex61] Image Laplacian Sharpening Processing of OV5640 Camera
- Snake moving in a twisting motion