SlideShare ist ein Scribd-Unternehmen logo
1 von 31
Embedded Linux BSP
U-Boot Porting
Organised & Supported by RuggedBOARD
Agenda
• U-BOOT Architecture
• U-BOOT Code Flow
• U-BOOT Porting on new Hardware
• U-BOOT Compilation & Flashing on RB-A5D2x (P)
• U-BOOT Commands (P)
• Adding new commands in U-BOOT (P)
• Custom Driver in U-BOOT (P)
Embedded Systems Classification
MCU Based
Very Low Power
Small Code (KB’s)
Baremetal
Small RTOS
MPU Based
High Speed (200MHz till 1GHz)
OS + Application Code
MPU+ Based
Special Co-Processors
Very High Computation Power
Special Hardware Accelerator
Engines like TPU, VPU, GPU’s
S1.0 S2.0 S3.0
Mostly uses Cortex-M4
having BLE comm and few
sensors need companion
mobile
Mostly uses Cortex-A7, 4G
comm friendly UI, make
calls, check emails etc …
Mostly uses Cortex-53, 4G
and advance AI/ML
capabilities to process the
data on-device and generate
analytics & feedback
RootFS
Toolchain
eLinux System ARCH
System Hardware
Processor Blueprint, defines IS & other hardware blocks of Processor
Processor design in VHDL / Verilog having ALU, Registors, TCU, Buses …
Product = SBC + Software + Housing/Mechanicals
Silicon with Processor & peripherals like GPIO, UART, I2C, SPI, USB,
Ethernet …
SOM = SOC+ RAM + Flash + PMIC, SBC = Board with SOM & interfacing
devices like LCD, Connectors, Sensors & Communication modules
Gateway RuggedBOARD
phyCORE-
A5D2x
ATMEL
SAMA5D7
ARM CORTEX-
A5
armV7a
RuggedBOARD
Industrial Grade Hardware for IIoT
https://Community.ruggedboard.com
Bootloader
Boot Process
ON PC:
Power On-> BIOS (POST, Bootstraploader) -> MBR -> Bootloader -> Kernel -> RFS
ON RuggedBOARD:
1. Power On SBC
2. SOC BootROM Code will exec
3. BootCFG Pins will define the bootdevice ( NAND, NOR, SDCARD ..... )
4. From Bootdevice first piece of code (PBL) loaded in SRAM and executed
5. PBL responsible for External RAM Init and loads the BL to External RAM and execute.
6. BL will load the kernel and executes
7. Kernel boots and mounts the RootFS and finally executes the init binary
8. Init will follow init rc scripts to start services and applications
Boot Process
Flash Memory
Main Memory / DDR
SOC (SAMA5D27)
AT91 Bootstrap
U-Boot
Kernel
Mounts on
/
Kernel
U-Boot
AT91 Bootstrap
Device Tree Bin(DTB)Device Tree Bin(DTB)
Root FS
SRAM
BOOTROM
U-BOOT Source
Browse Source: https://github.com/rugged-board/uboot-rba5d2x
Download U-Boot for RuggedBOARD
$ wget https://github.com/rugged-board/uboot-rba5d2x/archive/uboot-rba5d2x.zip
Or
$ git clone https://github.com/rugged-board/uboot-rba5d2x.git
U-BOOT Dir Structure
uboot/board/atmel/rugged_board_a5d2x Board directory contains board files with syntax <vendor>/<boardname>
boardname.c called board file.
uboot/arch/arm/dts device tree directory consists of device tree files for SOC, SOM, SBC
sama5d2.dsi , rb_a5d2x.dtsi, rugged_board_a5d2x.dts
uboot/arch/arm/mach-at91 SOC specific code, armv7/sama5d2_devices.c
uboot/arch/arm/cpu Arch & Core specific code, u-boot.lds armv7/start.S, cpu.c
uboot/configs Contains board default configuration file used to configure uboot for a
specific board. <boardname_defconfig> for ruggedboard we have two
files for NOR: rugged_board_a5d2x_qspiflash_defconfig & for
SDCARD: rugged_board_a5d2x_mmc1_defconfig
uboot/drivers Contains bus drivers & device drivers (gpio, serial, i2c, spi, mmc, usb, net)
at91_gpio.c, atmel_usart.c, at91_i2c.c, atmel_sdhci.c, atmel_spi/qspi.c,
at91_emac.c
Device Driver: rtc/ds1307.c, misc/i2c_eeprom.c …
U-BOOT Code Flow
board_init_f()
- initf_bootstage /* uses its own timer,so doesn’t need DM */
- arch_cpu_init /* basic arch cpu dependent setup */
- mach_cpu_init /* SoC/machine dependent CPU setup */
- get_clocks /* get CPU and bus clocks (etc.) */
- timer_init /* initialize timer */
- env_init /* initialize environment */
- init_baud_rate /* initialze baudrate settings */
- serial_init /* serial communications setup */
- console_init_f /* stage 1 init of console */
- dram_init /* configure available RAM banks */
U-BOOT Code Flow
board_init_r()
- board_init /* Setup chipselects */
- set_cpu_clk_info /* Setup clock information */
- initr_nand /* initialize flash */
- initr_mmc /* initialize fmmc */
- console_init_r /* fully init console as a device */
- arch_misc_init /* miscellaneous arch-dependent init */
- misc_init_r /* misc platform-dependent init */
- interrupt_init /*set up exceptions */
- initr_enable_interrupts /* enable exceptions */
- initr_ethaddr /* setup ethernet */
- board_late_init /* board late initialization */
- run_main_loop /* jump to main loop & waiting for commands from console */
U-BOOT Code Flow
U-BOOT Porting
1. Identify the ARCH, CORE & SOC used in your board
2. Check the ARCH & Core support in u-boot location /arch/arm/cpu
3. Check the SOC support location uboot/arch/arm/mach-<soc_family>
4. Create new board folder in u-boot/boards/<board_name>
5. Take ref of existing boards in uboot and develop the code for your board
Add board.c, modify Kconfig & Makefile
6. Create a default configuration file for your board in u-boot/configs
7. Driver level modification if required u-boot/drivers/
8. Make sure you did modified Makfiles corresponding to your code/file changes.
U-boot Compilation
Browse Source: https://github.com/rugged-board/uboot-rba5d2x
Compiling U-Boot for RuggedBOARD
#Set the toolchain path first
$ . env_setup.sh
# Download uboot Source
$ git clone https://github.com/rugged-board/uboot-rba5d2x.git
$ cd uboot-rba5d2x
$ git checkout origin/uboot-rba5d2x
# Compile u-boot bootloader
make
# Configure u-boot bootloader for RB-A5D2x
$ make rugged_board_a5d2x_mmc1_defconfig # For SD Card
Or
$ make rugged_board_a5d2x_qspiflash_defconfig # For NOR Boot
#Configure for RuggedBOARD-A5D2x
$ source sources/poky/oe-init-build-env
$ vi conf/local.conf
# Edit MACHINE ?= "rugged-board-a5d2x-sd1“
U-boot compiling using Yocto
#Compile
$ bitbake u-boot
#Images for NOR
$ cd tmp/deploy/images/rugged-board-a5d2x/
#Follow NOR Flashing Tutorial..
U-boot Flashing on RB-A5D2x (SDCARD)
# Power on board and stop at bootlaoder prompt
#check mmc card info
u-boot$ mmcinfo
# init serial flash
u-boot$ sf probe
#copy uboot image from mmc to RAM
u-boot$ fatload mmc 1 0x21FF0000 NOR/u-boot.bin
#erase serial flash(NOR) u-boot partition
u-boot$ sf erase 0x20000 0x80000
# copy from uboot image from RAM to NOR Flash
u-boot$ sf write 0x21FF0000 0x20000 0x80000.
U-boot Flashing on RB-A5D2x (TFTP)
# Power on board and stop at bootlaoder prompt
#check network connection by pining host PC
u-boot$ ping <serverip>
# Download uboot image from PC to Board RAM
u-boot$ tftp 0x21FF0000 u-boot.bin
#erase serial flash(NOR) u-boot partition
u-boot$ sf erase 0x20000 0x80000
# copy from uboot image from RAM to NOR Flash
u-boot$ sf write 0x21FF0000 0x20000 0x80000
U-boot Flashing on RB-A5D2x (Serial)
# Power on board in serial download mode by pressing the boot switch
U-Boot Commands
Information Commands
help print online help
bdinfo print Board Info structure
coninfo print console devices and information
flinfo print FLASH memory information
Environment Variables Commands
env environment handling commands
printenv print environment variables
setenv set environment variables
editenv edit environment variable
saveenv save environment variables to persistent storage
Basic Commands
version print monitor version
echo echo arguments to console
reset perform RESET of the CPU
sleep delay execution for some time
cls Clear screen
Memory Commands
mtest simple RAM test
md echo arguments to console
mm memory modify (auto incrementing)
mw memory write (fill)
nm memory modify (constant address)
base print or set address offset
crc32 checksum calculation
cp memory copy
Download & BOOT Commands
loadb load binary file over serial line (kermit mode)
loady load binary file over serial line (ymodem mode)
loads load S-Record file over serial line
Ping send ICMP ECHO REQUEST to network host
bootp boot image via network using BOOTP/TFTP
protocol
dhcp invoke DHCP client to obtain IP/boot params
tftpboot boot image via network using TFTP protocol
nfs boot image via network using NFS protocol
boot boot default, i.e., run 'bootcmd'
bootm boot application image from memory
Nboot boot from NAND device
go start application at address 'addr'
fatload load binary file from a FAT file system
Ext2load load binary file from a Ext2 filesystem
HW Subsytem
gpio manipulate gpios
i2c I2C sub-system control
mmc MMC sub system
usb USB sub-system control
ftd flattened device tree utility commands
mtdparts define flash/nand partitions
eeprom EEPROM sub-system control
nand NAND sub-system control
flinfo print FLASH memory information
erase erase FLASH memory
sf Serial Flash sub-system
U-Boot Commands
Adding new command in U-Boot
U_BOOT_CMD() is the Macro used to add new command in u-boot.
name: is the name of the command. THIS IS NOT a string.
maxargs: the maximum numbers of arguments this function takes
command: Command implementation Function pointer (*cmd)(struct cmd_tbl_s *, int, int, char *[]);
Usage: Short description. This is a string
help: long description. This is a string
U_BOOT_CMD(name, maxargs, repeatable, command, "usage", "help")
Command Function Prototype:
cmdtp – Command table pointer (function vector table)
flag -- Unused
argc -- Argument count, including command name itself
argv[] -- Array of arguments (string).
int do_funcname (cmd_tbl_t *cmdtp, int flag, int argc, char *const Argv[] )
Step-2: Modify Kconfig file under command folder
$vim Kconfig
Step-1 : create demo.c in u-boot/command folder
$ cd <uboot_path>/command
$ vim dummy.c
Adding new command in U-Boot
#include<common.h>
#include<command.h>
static int do_dummy(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[])
{
printf("Hello Rugged Board A5d2xn");
printf("This is dummy command implementationn");
return 0;
}
U_BOOT_CMD(dummy, 2, 1, do_dummy, "testing
hello","arg1 not needed");
config CMD_DUMMY
bool “Dummy Command"
default y
help
This is testing the new command in rugged board..
Step-4: Compile & Flash
Step-5: Test the command on Target Bootloader prompt
=> hello
Hello Rugged Board A5d2x
This is dummy command implementation
Step-3: Modify Makefile
$vim Makefile // bootloader/uboot-rba5d2x/cmd
obj-$(CONFIG_CMD_DUMMY) += dummy.o
Adding new Driver in U-Boot
#Step-1: Define your device in dts file
$ vim <uboot_path>/arch/arm/dts/rugged_board_a5d2x.dts
leds {
compatible = "sled-testing";
status = "okay";
UserLed {
label = "UserLed";
sled-default-state = "blink";
};
};
# Step-2: Define your driver sled.c in uboot/driver folder
$ vim <uboot_path>/driver/led/sled.c
# copy the sled.c code
# Step-3: Add sled configuration in Kconfig file
$ vim <uboot_path>/driver/led/Kconfig
config SLED
bool "SLED support for LEDs"
depends on LED
help
Sled driver on RuggedBOARD-A5D2x
# Step-4: Add sled configuration in Kconfig file
$ vim <uboot_path>/driver/led/Makefile
obj-$(CONFIG_SLED) += sled.o
# Step-5: Write a test code cmd_sled.c under
command folder and which calls the driver functions
$ vim <uboot_path>/command/cmd_sled.c
#implement do_sled() & register using U_BOOT_CMD
Driver Code Flow
File Description
u-boot/driver/gpio/at91_gpio.c Atmel GPIO Driver core bus driver
u-boot/driver/gpio/gpio-uclass.c U-Boot GPIO Subsystem HAL
u-boot/driver/led/sled.c Sled device driver which used gpio bus driver
u-boot/command/sled_cmd.c Test app / command implemented to test sled driver
Demo’s
Next Sessions
1. Linux Kernel Porting using RuggedBOARD-A5D2x
a. Source Code walkthrough & Code flow
b. Kconfig Kernel Configuration System
c. Adding Custom driver
2. Yocto BSP using RuggedBOARD-A5D2x
3. Design your own Single Board Computer using phyCORE-A5D2x. [HW Design]
4. Building Gateway Hardware and Open Source Linux Stacks for Gateway. [HW Design]
To get update’s follow RuggedBOARD on LinkedIn, Youtube, Twitter, Facebook &
Instagram links are on next slide …
Connect-us
Open Discussions
B Vasu Dev
ABOUT Vasu
Vasu has 15+ Years of industry experience in Embedded Technologies mainly on ARM & Linux, he
has worked at major MNC’s like LG, Wipro, MIC Electronics and is currently heading PHYTEC INDA,
a subsidiary of PHYTEC Messtechnik GmbH GERMANY as Managing Director. PHYTEC serves as
OEM for many electronic and embedded companies to develop and deploy their products at the
lowest possible time with high reliability and quality using ARM based SOMs (System On Modules )
& SBCs (Single Board Computers). The industry verticals he was engaged are Industrial
Automation, Mobility & Energy, Medical/Healthcare, Retail market.
Apart from his technical work, he is an active coach & guide for Embedded developers and actively
spend his time to train the developers on Embedded Linux, Yocto, IoT, Android System
Development. He is the master mind behind RuggedBOARD Open Source Hardware Platform. Vasu
as a mentor helped many start-ups to build their products and position them in market.
Managing Director
PHYTEC Embedded Pvt Ltd
vasu.b@phytec.in
+91-9535504414
Presenter Profile
U-Boot Porting on New Hardware

Weitere ähnliche Inhalte

Was ist angesagt?

Jagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratchJagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratchlinuxlab_conf
 
U Boot or Universal Bootloader
U Boot or Universal BootloaderU Boot or Universal Bootloader
U Boot or Universal BootloaderSatpal Parmar
 
Arm device tree and linux device drivers
Arm device tree and linux device driversArm device tree and linux device drivers
Arm device tree and linux device driversHoucheng Lin
 
Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)RuggedBoardGroup
 
Embedded_Linux_Booting
Embedded_Linux_BootingEmbedded_Linux_Booting
Embedded_Linux_BootingRashila Rr
 
linux device driver
linux device driverlinux device driver
linux device driverRahul Batra
 
Part 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module ProgrammingPart 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module ProgrammingTushar B Kute
 
HKG15-505: Power Management interactions with OP-TEE and Trusted Firmware
HKG15-505: Power Management interactions with OP-TEE and Trusted FirmwareHKG15-505: Power Management interactions with OP-TEE and Trusted Firmware
HKG15-505: Power Management interactions with OP-TEE and Trusted FirmwareLinaro
 
LCU13: An Introduction to ARM Trusted Firmware
LCU13: An Introduction to ARM Trusted FirmwareLCU13: An Introduction to ARM Trusted Firmware
LCU13: An Introduction to ARM Trusted FirmwareLinaro
 
Booting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot imagesBooting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot imagesChris Simmonds
 

Was ist angesagt? (20)

BusyBox for Embedded Linux
BusyBox for Embedded LinuxBusyBox for Embedded Linux
BusyBox for Embedded Linux
 
Jagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratchJagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratch
 
Embedded Linux on ARM
Embedded Linux on ARMEmbedded Linux on ARM
Embedded Linux on ARM
 
U Boot or Universal Bootloader
U Boot or Universal BootloaderU Boot or Universal Bootloader
U Boot or Universal Bootloader
 
Arm device tree and linux device drivers
Arm device tree and linux device driversArm device tree and linux device drivers
Arm device tree and linux device drivers
 
SPI Drivers
SPI DriversSPI Drivers
SPI Drivers
 
U boot-boot-flow
U boot-boot-flowU boot-boot-flow
U boot-boot-flow
 
Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)
 
I2C Drivers
I2C DriversI2C Drivers
I2C Drivers
 
Embedded_Linux_Booting
Embedded_Linux_BootingEmbedded_Linux_Booting
Embedded_Linux_Booting
 
linux device driver
linux device driverlinux device driver
linux device driver
 
Part 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module ProgrammingPart 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module Programming
 
Embedded Linux Kernel - Build your custom kernel
Embedded Linux Kernel - Build your custom kernelEmbedded Linux Kernel - Build your custom kernel
Embedded Linux Kernel - Build your custom kernel
 
HKG15-505: Power Management interactions with OP-TEE and Trusted Firmware
HKG15-505: Power Management interactions with OP-TEE and Trusted FirmwareHKG15-505: Power Management interactions with OP-TEE and Trusted Firmware
HKG15-505: Power Management interactions with OP-TEE and Trusted Firmware
 
LCU13: An Introduction to ARM Trusted Firmware
LCU13: An Introduction to ARM Trusted FirmwareLCU13: An Introduction to ARM Trusted Firmware
LCU13: An Introduction to ARM Trusted Firmware
 
Booting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot imagesBooting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot images
 
Linux Porting
Linux PortingLinux Porting
Linux Porting
 
Platform Drivers
Platform DriversPlatform Drivers
Platform Drivers
 
Linux kernel
Linux kernelLinux kernel
Linux kernel
 
Linux booting process
Linux booting processLinux booting process
Linux booting process
 

Ähnlich wie U-Boot Porting on New Hardware

Raspberry Pi tutorial
Raspberry Pi tutorialRaspberry Pi tutorial
Raspberry Pi tutorial艾鍗科技
 
LCU14 302- How to port OP-TEE to another platform
LCU14 302- How to port OP-TEE to another platformLCU14 302- How to port OP-TEE to another platform
LCU14 302- How to port OP-TEE to another platformLinaro
 
Bootstrap process of u boot (NDS32 RISC CPU)
Bootstrap process of u boot (NDS32 RISC CPU)Bootstrap process of u boot (NDS32 RISC CPU)
Bootstrap process of u boot (NDS32 RISC CPU)Macpaul Lin
 
Study on Android Emulator
Study on Android EmulatorStudy on Android Emulator
Study on Android EmulatorSamael Wang
 
ChromePad - Chromium OS ThinkPad X220
ChromePad - Chromium OS ThinkPad X220ChromePad - Chromium OS ThinkPad X220
ChromePad - Chromium OS ThinkPad X220AndrewWright224
 
ChromePad - Chromium OS for ThinkPad
ChromePad - Chromium OS for ThinkPadChromePad - Chromium OS for ThinkPad
ChromePad - Chromium OS for ThinkPadAndrewWright224
 
Armboot process zeelogic
Armboot process zeelogicArmboot process zeelogic
Armboot process zeelogicAleem Shariff
 
建構嵌入式Linux系統於SD Card
建構嵌入式Linux系統於SD Card建構嵌入式Linux系統於SD Card
建構嵌入式Linux系統於SD Card艾鍗科技
 
Getting started with LinuxBoot Firmware on AArch64 Server
Getting started with LinuxBoot Firmware on AArch64 Server Getting started with LinuxBoot Firmware on AArch64 Server
Getting started with LinuxBoot Firmware on AArch64 Server Naohiro Tamura
 
Open Enea Linux workshop at the Embedded Conference Scandinavia 2014
Open Enea Linux workshop at the Embedded Conference Scandinavia 2014Open Enea Linux workshop at the Embedded Conference Scandinavia 2014
Open Enea Linux workshop at the Embedded Conference Scandinavia 2014EneaSoftware
 

Ähnlich wie U-Boot Porting on New Hardware (20)

How to build and load linux to embedded system
How to build and load linux to embedded systemHow to build and load linux to embedded system
How to build and load linux to embedded system
 
Raspberry Pi tutorial
Raspberry Pi tutorialRaspberry Pi tutorial
Raspberry Pi tutorial
 
BeagleBoard-xM Booting Process
BeagleBoard-xM Booting ProcessBeagleBoard-xM Booting Process
BeagleBoard-xM Booting Process
 
LCU14 302- How to port OP-TEE to another platform
LCU14 302- How to port OP-TEE to another platformLCU14 302- How to port OP-TEE to another platform
LCU14 302- How to port OP-TEE to another platform
 
Bootstrap process of u boot (NDS32 RISC CPU)
Bootstrap process of u boot (NDS32 RISC CPU)Bootstrap process of u boot (NDS32 RISC CPU)
Bootstrap process of u boot (NDS32 RISC CPU)
 
Study on Android Emulator
Study on Android EmulatorStudy on Android Emulator
Study on Android Emulator
 
BeagleBone Black Booting Process
BeagleBone Black Booting ProcessBeagleBone Black Booting Process
BeagleBone Black Booting Process
 
C C N A Day2
C C N A  Day2C C N A  Day2
C C N A Day2
 
Beagleboard xm-setup
Beagleboard xm-setupBeagleboard xm-setup
Beagleboard xm-setup
 
ChromePad - Chromium OS ThinkPad X220
ChromePad - Chromium OS ThinkPad X220ChromePad - Chromium OS ThinkPad X220
ChromePad - Chromium OS ThinkPad X220
 
ChromePad - Chromium OS for ThinkPad
ChromePad - Chromium OS for ThinkPadChromePad - Chromium OS for ThinkPad
ChromePad - Chromium OS for ThinkPad
 
Armboot process zeelogic
Armboot process zeelogicArmboot process zeelogic
Armboot process zeelogic
 
BeagleBone Black Bootloaders
BeagleBone Black BootloadersBeagleBone Black Bootloaders
BeagleBone Black Bootloaders
 
建構嵌入式Linux系統於SD Card
建構嵌入式Linux系統於SD Card建構嵌入式Linux系統於SD Card
建構嵌入式Linux系統於SD Card
 
CCNA complete.ppt
CCNA complete.pptCCNA complete.ppt
CCNA complete.ppt
 
Linux Booting Process
Linux Booting ProcessLinux Booting Process
Linux Booting Process
 
5. boot process
5. boot process5. boot process
5. boot process
 
Getting started with LinuxBoot Firmware on AArch64 Server
Getting started with LinuxBoot Firmware on AArch64 Server Getting started with LinuxBoot Firmware on AArch64 Server
Getting started with LinuxBoot Firmware on AArch64 Server
 
Open Enea Linux workshop at the Embedded Conference Scandinavia 2014
Open Enea Linux workshop at the Embedded Conference Scandinavia 2014Open Enea Linux workshop at the Embedded Conference Scandinavia 2014
Open Enea Linux workshop at the Embedded Conference Scandinavia 2014
 
101 1.1 hardware settings
101 1.1 hardware settings101 1.1 hardware settings
101 1.1 hardware settings
 

Kürzlich hochgeladen

Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 

Kürzlich hochgeladen (20)

Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 

U-Boot Porting on New Hardware

  • 1. Embedded Linux BSP U-Boot Porting Organised & Supported by RuggedBOARD
  • 2. Agenda • U-BOOT Architecture • U-BOOT Code Flow • U-BOOT Porting on new Hardware • U-BOOT Compilation & Flashing on RB-A5D2x (P) • U-BOOT Commands (P) • Adding new commands in U-BOOT (P) • Custom Driver in U-BOOT (P)
  • 3. Embedded Systems Classification MCU Based Very Low Power Small Code (KB’s) Baremetal Small RTOS MPU Based High Speed (200MHz till 1GHz) OS + Application Code MPU+ Based Special Co-Processors Very High Computation Power Special Hardware Accelerator Engines like TPU, VPU, GPU’s S1.0 S2.0 S3.0 Mostly uses Cortex-M4 having BLE comm and few sensors need companion mobile Mostly uses Cortex-A7, 4G comm friendly UI, make calls, check emails etc … Mostly uses Cortex-53, 4G and advance AI/ML capabilities to process the data on-device and generate analytics & feedback
  • 5. System Hardware Processor Blueprint, defines IS & other hardware blocks of Processor Processor design in VHDL / Verilog having ALU, Registors, TCU, Buses … Product = SBC + Software + Housing/Mechanicals Silicon with Processor & peripherals like GPIO, UART, I2C, SPI, USB, Ethernet … SOM = SOC+ RAM + Flash + PMIC, SBC = Board with SOM & interfacing devices like LCD, Connectors, Sensors & Communication modules Gateway RuggedBOARD phyCORE- A5D2x ATMEL SAMA5D7 ARM CORTEX- A5 armV7a
  • 6. RuggedBOARD Industrial Grade Hardware for IIoT https://Community.ruggedboard.com
  • 7. Bootloader Boot Process ON PC: Power On-> BIOS (POST, Bootstraploader) -> MBR -> Bootloader -> Kernel -> RFS ON RuggedBOARD: 1. Power On SBC 2. SOC BootROM Code will exec 3. BootCFG Pins will define the bootdevice ( NAND, NOR, SDCARD ..... ) 4. From Bootdevice first piece of code (PBL) loaded in SRAM and executed 5. PBL responsible for External RAM Init and loads the BL to External RAM and execute. 6. BL will load the kernel and executes 7. Kernel boots and mounts the RootFS and finally executes the init binary 8. Init will follow init rc scripts to start services and applications
  • 8. Boot Process Flash Memory Main Memory / DDR SOC (SAMA5D27) AT91 Bootstrap U-Boot Kernel Mounts on / Kernel U-Boot AT91 Bootstrap Device Tree Bin(DTB)Device Tree Bin(DTB) Root FS SRAM BOOTROM
  • 9. U-BOOT Source Browse Source: https://github.com/rugged-board/uboot-rba5d2x Download U-Boot for RuggedBOARD $ wget https://github.com/rugged-board/uboot-rba5d2x/archive/uboot-rba5d2x.zip Or $ git clone https://github.com/rugged-board/uboot-rba5d2x.git
  • 10. U-BOOT Dir Structure uboot/board/atmel/rugged_board_a5d2x Board directory contains board files with syntax <vendor>/<boardname> boardname.c called board file. uboot/arch/arm/dts device tree directory consists of device tree files for SOC, SOM, SBC sama5d2.dsi , rb_a5d2x.dtsi, rugged_board_a5d2x.dts uboot/arch/arm/mach-at91 SOC specific code, armv7/sama5d2_devices.c uboot/arch/arm/cpu Arch & Core specific code, u-boot.lds armv7/start.S, cpu.c uboot/configs Contains board default configuration file used to configure uboot for a specific board. <boardname_defconfig> for ruggedboard we have two files for NOR: rugged_board_a5d2x_qspiflash_defconfig & for SDCARD: rugged_board_a5d2x_mmc1_defconfig uboot/drivers Contains bus drivers & device drivers (gpio, serial, i2c, spi, mmc, usb, net) at91_gpio.c, atmel_usart.c, at91_i2c.c, atmel_sdhci.c, atmel_spi/qspi.c, at91_emac.c Device Driver: rtc/ds1307.c, misc/i2c_eeprom.c …
  • 12. board_init_f() - initf_bootstage /* uses its own timer,so doesn’t need DM */ - arch_cpu_init /* basic arch cpu dependent setup */ - mach_cpu_init /* SoC/machine dependent CPU setup */ - get_clocks /* get CPU and bus clocks (etc.) */ - timer_init /* initialize timer */ - env_init /* initialize environment */ - init_baud_rate /* initialze baudrate settings */ - serial_init /* serial communications setup */ - console_init_f /* stage 1 init of console */ - dram_init /* configure available RAM banks */ U-BOOT Code Flow
  • 13. board_init_r() - board_init /* Setup chipselects */ - set_cpu_clk_info /* Setup clock information */ - initr_nand /* initialize flash */ - initr_mmc /* initialize fmmc */ - console_init_r /* fully init console as a device */ - arch_misc_init /* miscellaneous arch-dependent init */ - misc_init_r /* misc platform-dependent init */ - interrupt_init /*set up exceptions */ - initr_enable_interrupts /* enable exceptions */ - initr_ethaddr /* setup ethernet */ - board_late_init /* board late initialization */ - run_main_loop /* jump to main loop & waiting for commands from console */ U-BOOT Code Flow
  • 14. U-BOOT Porting 1. Identify the ARCH, CORE & SOC used in your board 2. Check the ARCH & Core support in u-boot location /arch/arm/cpu 3. Check the SOC support location uboot/arch/arm/mach-<soc_family> 4. Create new board folder in u-boot/boards/<board_name> 5. Take ref of existing boards in uboot and develop the code for your board Add board.c, modify Kconfig & Makefile 6. Create a default configuration file for your board in u-boot/configs 7. Driver level modification if required u-boot/drivers/ 8. Make sure you did modified Makfiles corresponding to your code/file changes.
  • 15. U-boot Compilation Browse Source: https://github.com/rugged-board/uboot-rba5d2x Compiling U-Boot for RuggedBOARD #Set the toolchain path first $ . env_setup.sh # Download uboot Source $ git clone https://github.com/rugged-board/uboot-rba5d2x.git $ cd uboot-rba5d2x $ git checkout origin/uboot-rba5d2x # Compile u-boot bootloader make # Configure u-boot bootloader for RB-A5D2x $ make rugged_board_a5d2x_mmc1_defconfig # For SD Card Or $ make rugged_board_a5d2x_qspiflash_defconfig # For NOR Boot
  • 16. #Configure for RuggedBOARD-A5D2x $ source sources/poky/oe-init-build-env $ vi conf/local.conf # Edit MACHINE ?= "rugged-board-a5d2x-sd1“ U-boot compiling using Yocto #Compile $ bitbake u-boot #Images for NOR $ cd tmp/deploy/images/rugged-board-a5d2x/ #Follow NOR Flashing Tutorial..
  • 17. U-boot Flashing on RB-A5D2x (SDCARD) # Power on board and stop at bootlaoder prompt #check mmc card info u-boot$ mmcinfo # init serial flash u-boot$ sf probe #copy uboot image from mmc to RAM u-boot$ fatload mmc 1 0x21FF0000 NOR/u-boot.bin #erase serial flash(NOR) u-boot partition u-boot$ sf erase 0x20000 0x80000 # copy from uboot image from RAM to NOR Flash u-boot$ sf write 0x21FF0000 0x20000 0x80000.
  • 18. U-boot Flashing on RB-A5D2x (TFTP) # Power on board and stop at bootlaoder prompt #check network connection by pining host PC u-boot$ ping <serverip> # Download uboot image from PC to Board RAM u-boot$ tftp 0x21FF0000 u-boot.bin #erase serial flash(NOR) u-boot partition u-boot$ sf erase 0x20000 0x80000 # copy from uboot image from RAM to NOR Flash u-boot$ sf write 0x21FF0000 0x20000 0x80000
  • 19. U-boot Flashing on RB-A5D2x (Serial) # Power on board in serial download mode by pressing the boot switch
  • 20. U-Boot Commands Information Commands help print online help bdinfo print Board Info structure coninfo print console devices and information flinfo print FLASH memory information Environment Variables Commands env environment handling commands printenv print environment variables setenv set environment variables editenv edit environment variable saveenv save environment variables to persistent storage Basic Commands version print monitor version echo echo arguments to console reset perform RESET of the CPU sleep delay execution for some time cls Clear screen Memory Commands mtest simple RAM test md echo arguments to console mm memory modify (auto incrementing) mw memory write (fill) nm memory modify (constant address) base print or set address offset crc32 checksum calculation cp memory copy
  • 21. Download & BOOT Commands loadb load binary file over serial line (kermit mode) loady load binary file over serial line (ymodem mode) loads load S-Record file over serial line Ping send ICMP ECHO REQUEST to network host bootp boot image via network using BOOTP/TFTP protocol dhcp invoke DHCP client to obtain IP/boot params tftpboot boot image via network using TFTP protocol nfs boot image via network using NFS protocol boot boot default, i.e., run 'bootcmd' bootm boot application image from memory Nboot boot from NAND device go start application at address 'addr' fatload load binary file from a FAT file system Ext2load load binary file from a Ext2 filesystem HW Subsytem gpio manipulate gpios i2c I2C sub-system control mmc MMC sub system usb USB sub-system control ftd flattened device tree utility commands mtdparts define flash/nand partitions eeprom EEPROM sub-system control nand NAND sub-system control flinfo print FLASH memory information erase erase FLASH memory sf Serial Flash sub-system U-Boot Commands
  • 22. Adding new command in U-Boot U_BOOT_CMD() is the Macro used to add new command in u-boot. name: is the name of the command. THIS IS NOT a string. maxargs: the maximum numbers of arguments this function takes command: Command implementation Function pointer (*cmd)(struct cmd_tbl_s *, int, int, char *[]); Usage: Short description. This is a string help: long description. This is a string U_BOOT_CMD(name, maxargs, repeatable, command, "usage", "help") Command Function Prototype: cmdtp – Command table pointer (function vector table) flag -- Unused argc -- Argument count, including command name itself argv[] -- Array of arguments (string). int do_funcname (cmd_tbl_t *cmdtp, int flag, int argc, char *const Argv[] )
  • 23. Step-2: Modify Kconfig file under command folder $vim Kconfig Step-1 : create demo.c in u-boot/command folder $ cd <uboot_path>/command $ vim dummy.c Adding new command in U-Boot #include<common.h> #include<command.h> static int do_dummy(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { printf("Hello Rugged Board A5d2xn"); printf("This is dummy command implementationn"); return 0; } U_BOOT_CMD(dummy, 2, 1, do_dummy, "testing hello","arg1 not needed"); config CMD_DUMMY bool “Dummy Command" default y help This is testing the new command in rugged board.. Step-4: Compile & Flash Step-5: Test the command on Target Bootloader prompt => hello Hello Rugged Board A5d2x This is dummy command implementation Step-3: Modify Makefile $vim Makefile // bootloader/uboot-rba5d2x/cmd obj-$(CONFIG_CMD_DUMMY) += dummy.o
  • 24. Adding new Driver in U-Boot #Step-1: Define your device in dts file $ vim <uboot_path>/arch/arm/dts/rugged_board_a5d2x.dts leds { compatible = "sled-testing"; status = "okay"; UserLed { label = "UserLed"; sled-default-state = "blink"; }; }; # Step-2: Define your driver sled.c in uboot/driver folder $ vim <uboot_path>/driver/led/sled.c # copy the sled.c code # Step-3: Add sled configuration in Kconfig file $ vim <uboot_path>/driver/led/Kconfig config SLED bool "SLED support for LEDs" depends on LED help Sled driver on RuggedBOARD-A5D2x # Step-4: Add sled configuration in Kconfig file $ vim <uboot_path>/driver/led/Makefile obj-$(CONFIG_SLED) += sled.o # Step-5: Write a test code cmd_sled.c under command folder and which calls the driver functions $ vim <uboot_path>/command/cmd_sled.c #implement do_sled() & register using U_BOOT_CMD
  • 25. Driver Code Flow File Description u-boot/driver/gpio/at91_gpio.c Atmel GPIO Driver core bus driver u-boot/driver/gpio/gpio-uclass.c U-Boot GPIO Subsystem HAL u-boot/driver/led/sled.c Sled device driver which used gpio bus driver u-boot/command/sled_cmd.c Test app / command implemented to test sled driver
  • 27. Next Sessions 1. Linux Kernel Porting using RuggedBOARD-A5D2x a. Source Code walkthrough & Code flow b. Kconfig Kernel Configuration System c. Adding Custom driver 2. Yocto BSP using RuggedBOARD-A5D2x 3. Design your own Single Board Computer using phyCORE-A5D2x. [HW Design] 4. Building Gateway Hardware and Open Source Linux Stacks for Gateway. [HW Design] To get update’s follow RuggedBOARD on LinkedIn, Youtube, Twitter, Facebook & Instagram links are on next slide …
  • 30. B Vasu Dev ABOUT Vasu Vasu has 15+ Years of industry experience in Embedded Technologies mainly on ARM & Linux, he has worked at major MNC’s like LG, Wipro, MIC Electronics and is currently heading PHYTEC INDA, a subsidiary of PHYTEC Messtechnik GmbH GERMANY as Managing Director. PHYTEC serves as OEM for many electronic and embedded companies to develop and deploy their products at the lowest possible time with high reliability and quality using ARM based SOMs (System On Modules ) & SBCs (Single Board Computers). The industry verticals he was engaged are Industrial Automation, Mobility & Energy, Medical/Healthcare, Retail market. Apart from his technical work, he is an active coach & guide for Embedded developers and actively spend his time to train the developers on Embedded Linux, Yocto, IoT, Android System Development. He is the master mind behind RuggedBOARD Open Source Hardware Platform. Vasu as a mentor helped many start-ups to build their products and position them in market. Managing Director PHYTEC Embedded Pvt Ltd vasu.b@phytec.in +91-9535504414 Presenter Profile