Click “Read the Original” to Access More VxWorks Resources
Free download of VxWorks technical materials, resources sourced from the internet, copyright belongs to the original authors!
1 Introduction
VxWorks is a real-time operating system produced by Wind River, while U-Boot is a widely known general-purpose bootloader that runs as the earliest code after an embedded system powers on. U-Boot is typically used in embedded systems, such as PowerPC or ARM devices, which do not have an X86 BIOS.
Although VxWorks can have its own bootloader (VxWorks Bootrom or Bootapp), U-Boot offers more features. If the hardware board already supports U-Boot, it makes more sense to use it directly.
U-boot : http://www.denx.de/wiki/U-Boot/WebHome
VxWorks : https://www.windriver.com/products/vxworks/
The latest version of VxWorks (VxWorks 7) has integrated with U-Boot more easily than previous versions (I encountered many issues with VxWorks 6.9).
This article discusses the details of our setup for the recent VxWorks 7 BSP. We chose to use a DTB file independent of the VxWorks image file, rather than embedding the DTB file within the VxWorks image. This gives us better flexibility, allowing the boot line to be modified from U-Boot without needing to recompile the DTB.
Specifically, the VxWorks image needs to compile the U-Boot header into it, and then U-Boot needs to configure the command line parameters and MAC address to be passed to VxWorks.
2 Compiling the VxWorks Image File
A VxWorks image file that supports U-Boot needs to be compiled (which will add the U-Boot header to the VxWorks binary).
Compile the uVxWorks target file from Workbench or command line.
Open a DOS command line, configure the compilation environment, and then compile the project.
cd <WIND_HOME> // your installation directory
wrenv -p vxworks-7
cd <YOUR_VIP> // your VxWorks Image Project
vxprj vip build uVxWorks
This will create two files, which will be loaded into memory by U-Boot using TFTP:
Filename | Description |
uVxWorks | VxWorks image with U-Boot header |
[yourboard].dtb | The device tree binary |
3 Configuring U-Boot for VxWorks
U-Boot needs to set some environment variables to load VxWorks, specifically the boot parameters for VxWorks (bootline):
=> setenv bootargs memac(2,0)host:vxWorks h=192.168.1.101 e=192.168.1.50:ffffff00 g=192.168.1.254 u=vxworks pw=gaitpu f=0x0
=> saveenv
=> printenv bootargs bootargs=memac(2,0)host:vxWorks h=192.168.1.101 e=192.168.1.50:ffffff00 g=192.168.1.254 u=vxworks pw=gaitpu f=0x0
You can also change the MAC address of the network device at will:
setenv ethaddr 00:00:13:3a:ad:00
setenv eth1add 00:00:13:3a:ad:01
setenv eth1add 00:00:13:3a:ad:02
setenv eth1add 00:00:13:3a:ad:03
saveenv
4 Loading and Executing the VxWorks Image File
Set up a TFTP server to load the VxWorks image file and DTB file.
You can download a very good Windows TFTP server from the link below:
http://tftpd32.jounin.net/
4.1 Loading the VxWorks Image File
=> tftp 0x100000 uVxWorks
Using FM1@DTSEC3 device
TFTP from server 192.168.1.101; our IP address is 192.168.1.50
Filename 'uVxWorks'.
Load address: 0x100000
Loading: ###################################################################################################################################################################################################
1.5 MiB/s
done
Bytes transferred = 2861632 (2baa40 hex)
4.2 Loading the DTB Blob
=> tftp 0xe00000 t4240qds.dtb
Using FM1@DTSEC3 device
TFTP from server 192.168.1.101; our IP address is 192.168.1.50
Filename 't4240qds.dtb'.
Load address: 0xe00000
Loading: ##1.4 MiB/s
4.3 Booting the VxWorks Image File
=> bootm 0x100000 - 0xe00000
WARNING: adjusting available memory to 30000000
## Booting kernel from Legacy Image at 00100000 ... Image Name: vxWorks Image Type: PowerPC VxWorks Kernel Image (uncompressed) Data Size: 2861568 Bytes = 2.7 MiB
4.4 Creating U-Boot Command
Create a new U-Boot command using the following steps:
setenv vxboot 'tftp 0x100000 uVxWorks; tftp 0xe00000 t4240qds.dtb; bootm 0x100000 - 0xe00000'
saveenv
Run this command:
run vxboot
5 Configuring U-Boot to Pass MAC Address
This is crucial for hardware developers, as the MAC address is usually assigned in the factory and will be used by the VxWorks image file. Otherwise, each board would need to compile and load a separate VxWorks before shipping, which would be a nightmare.
Fortunately, we found a way, because we use a standalone DTB file rather than compiling the DTB file into VxWorks, U-Boot will override the MAC address in the DTS file with the MAC address from the network environment variables.
Not only can U-Boot override the local MAC address, but if you store additional network address variables in the U-Boot environment and add aliases for network interfaces in your device tree, U-Boot can pass these MAC addresses to VxWorks through the device tree. So theoretically, all network devices’ MAC addresses can be overridden.
For example, for a T4240 PowerPC board:
/** U-boot only fixes up MAC Address (ethernet0 - n) if * environment variable is set.* aliases simplifies the path to the property i.e by using a * label <&enet0> to assign a path to a particular node*/
aliases{ethernet0 = &enet0; ethernet1 = &enet1;ethernet2 = &enet2;ethernet3 = &enet3;};
....
fman0: fman@400000 { #address-cells = ; #size-cells = ;cell-index = ;compatible = "fsl,fman";ranges = ;reg = ;interrupts = <96 2 0 016 2 1 1>;
clocks = <&hwac1>;clock-names = "fman0-clk";
/* FDT dummyMdio driver : memac0*/enet0: ethernet@e0000 {compatible = "fsl,fman-memac";reg = ;phy-handle = <&dummy_phy0>;phy-connection-type = "sgmii";cell-index = ;local-mac-address = [ 00 04 9F 03 0A 5C ];};
/* FDT dummyMdio driver : memac1*/enet1: ethernet@e2000 {....};....};