ARM/MSVC Build Environment Script

I added a Perl script to the repository Build/CopyBuildToolset.cmd at  More details on the repo is here.

The script documentation is lacking and I’ll add more in the next few days.

The script populates the Build directory with a toolset from the Windows 7 DDK/SDK and Visual Studio 11 for the ARM installations and copies minimal Windows SDK headers to build the supporting Windows based tools for PE image conversion and ROM image signature for the BeagleBoard as part of the build toolset.

The script uses the MSVCToolChainForARM.INI file which describes the source locations and target layout for the tool chain.  A few sample snippets from the .INI are below.   The first column describes the file source which is one of ddk, sdk or msvc.

ddk,    bin\x86\amd64\build.exe,                        amd64
ddk,    bin\x86\build.exe,                              x86
ddk,    bin\x86\binplace.exe,                           x86
sdk,    Bin\rc.exe,                                     x86
sdk,    Bin\RcDll.Dll,                                  x86
sdk,    Bin\x64\rc.exe,                                 amd64
sdk,    Bin\x64\RcDll.Dll,                              amd64
sdk,    Include\BaseTsd.h,                              sdk\inc
msvc,   VC\bin\x86_arm\armasm.exe,                      vc\x86_arm
msvc,   VC\bin\x86_arm\c1.dll,                          vc\x86_arm
msvc,   VC\bin\x86_arm\c1ast.dll,                       vc\x86_arm

The first column describes the file source which is one of ddk, sdk or msvc.  These are currently defined in the script as below and can be configured with command line options –ddk, –msvc, –sdk respectively.   The script currently assumes it is running under the beagle.cmd environment and that BEAGLE_BUILD_PATH has been set to the Build directory of the enlistment.

my %srcPathMap = (
  ddk     => 'C:\\WinDDK\\7600.16385.1',
  msvc    => 'C:\\Program Files (x86)\\Microsoft Visual Studio 11.0',
  sdk     => 'C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A'
Given this configuration, the build script copies the files as described in the .INI (second column) to the Build directory and target destination directories (third column).
When completed, a CMD.exe launching beagle.cmd specifying the ARM build type will be ready to build the XLoader image.
c:\windows\System32\cmd.exe /k c:\beagleboard\build\beagle.cmd arm
C:\BeagleBoard>cd OS

C:\BeagleBoard>rem bcz is an alias for build.exe -cZ

BUILD: Compile and Link for ARM
BUILD: Start time: Sat Jan 05 09:58:50 2013
BUILD: Examining c:\beagleboard\os directory tree for files to compile.
BUILD: rmdir /q/s c:\beagleboard.obj.arm\os
1>BUILD: Compiling (NoSync) c:\beagleboard\os\bootloader\board directory
2>BUILD: Compiling (NoSync) c:\beagleboard\os\bootloader\common directory
3>BUILD: Compiling (NoSync) c:\beagleboard\os\bootloader\disk directory
4>BUILD: Compiling (NoSync) c:\beagleboard\os\bootloader\drivers directory
5>BUILD: Compiling (NoSync) c:\beagleboard\os\bootloader\filesystem\fat directory
6>BUILD: Compiling (NoSync) c:\beagleboard\os\bootloader\runtime directory
1>Assembling - bootloader\board\arm\platform.s
6>Assembling - bootloader\runtime\arm\_div10.s
5>Compiling - bootloader\filesystem\fat\fat.c
3>Compiling - bootloader\disk\part.c
2>Compiling - bootloader\common\cmd_load.c
4>Compiling - bootloader\drivers\serial.c
6>Assembling - bootloader\runtime\arm\_delay.s
6>Assembling - bootloader\runtime\arm\_dcc.s
6>Compiling - bootloader\runtime\board.c
1>Compiling - bootloader\board\omap3530beagle.c
4>Compiling - bootloader\drivers\k9f1g08r0a.c
5>Compiling - bootloader\filesystem\fat\file.c
6>Compiling - bootloader\runtime\div0.c
6>Compiling - bootloader\runtime\dcc.c
4>Compiling - bootloader\drivers\ns16550.c
6>Compiling - bootloader\runtime\ecc.c
4>Compiling - bootloader\drivers\omap24xx_i2c.c
5>Compiling - bootloader\filesystem\fat\generating code...
6>Compiling - bootloader\runtime\printf.c
2>Building Library - c:\beagleboard.obj.arm\os\bootloader\common\obj\arm\common.lib
3>Building Library - c:\beagleboard.obj.arm\os\bootloader\disk\obj\arm\disk.lib
1>Building Library - c:\beagleboard.obj.arm\os\bootloader\board\obj\arm\board.lib
6>Compiling - bootloader\runtime\_udiv.c
4>Compiling - bootloader\drivers\generating code...
5>Building Library - c:\beagleboard.obj.arm\os\bootloader\filesystem\fat\obj\arm\fat.lib
6>Compiling - bootloader\runtime\generating code...
4>Building Library - c:\beagleboard.obj.arm\os\bootloader\drivers\obj\arm\drivers.lib
100>BUILD: Compiling c:\beagleboard\os\bootloader\runtime directory
100>Building Library - c:\beagleboard.obj.arm\os\bootloader\runtime\obj\arm\runtime.lib
1>BUILD: Compiling and Linking c:\beagleboard\os\bootloader\cpu directory
1>Assembling - bootloader\cpu\arm\start.s
1>Compiling - bootloader\cpu\cpu.c
1>Compiling - bootloader\cpu\gpio.c
1>Compiling - bootloader\cpu\mmc.c
1>Compiling - bootloader\cpu\sys_info.c
1>Compiling - bootloader\cpu\generating code...
1>Linking Executable - c:\beagleboard.obj.arm\os\bootloader\cpu\obj\arm\x-load.exe
1>MUI_COMMENT: Not Localizeable X-Load.exe
1>Binplacing - c:\beagleboard.obj.arm\os\bootloader\cpu\obj\arm\mlo
BUILD: Finish time: Sat Jan 05 09:58:56 2013

    38 files compiled
    6 libraries built
    1 executable built
    1 file binplaced


ARM Development

My current development environment includes an ARM Cortex-A8 / TI DM3730 based BeagleBoard-xM and the Flyswatter2 JTAG Debugger. As part of my introduction to the environment, I modified the XLoader boot loader and developed a set of tools by borrowing from the Windows 8 DDK/SDK and Visual Studio C++ (MSVC) ARM compiler and assembler.  Using this Microsoft ARM tool chain generates COFF based images rather than ELF as with the GNU toolchain.  To address COFF images, I also created a coff2bin tool to generate the loader image from the linked image.

My plan is to modify the loader to expose a KD interface so that debugging can be performed with WinDBG rather than GDB.

These efforts are really only intended to gain more low-level experience on the ARM hardware, demonstrating how to configure the MSVC tool chain to generate the relevant Thumb-2 code.

My current public GIT repo is at where I will keep a shadow of the MSVC build environment that I’m using and a set of scripts to populate the tools directories based on installed DDK/SDK/MSVC tool chains.

GIT repository for ARM/BeagleBoard-XM development environment

I’ve created a shadow of the base build environment at which will contain the base X-Loader sources and build environment.

This environment uses the makefile.def/build.exe style command line build configured for ARM, below is the output from build as an example:

BUILD: Compile and Link for ARM
BUILD: Start time: Wed Jan 02 19:08:08 2013
BUILD: Examining k:\projects\beagleboard directory tree for files to compile.
BUILD: rmdir /q/s k:\projects\beagleboard.obj.arm
1>BUILD: Compiling (NoSync) k:\projects\beagleboard\os\bootloader\board directory
2>BUILD: Compiling (NoSync) k:\projects\beagleboard\os\bootloader\common directory
3>BUILD: Compiling (NoSync) k:\projects\beagleboard\os\bootloader\disk directory
4>BUILD: Compiling (NoSync) k:\projects\beagleboard\os\bootloader\drivers directory
5>BUILD: Compiling (NoSync) k:\projects\beagleboard\os\bootloader\filesystem\fat directory
6>BUILD: Compiling (NoSync) k:\projects\beagleboard\os\bootloader\runtime directory
1>Assembling - os\bootloader\board\arm\platform.s
2>Compiling - os\bootloader\common\cmd_load.c
6>Assembling - os\bootloader\runtime\arm\_div10.s
3>Compiling - os\bootloader\disk\part.c
4>Compiling - os\bootloader\drivers\serial.c
6>Assembling - os\bootloader\runtime\arm\_delay.s
4>Compiling - os\bootloader\drivers\k9f1g08r0a.c
1>Compiling - os\bootloader\board\omap3530beagle.c
6>Assembling - os\bootloader\runtime\arm\_dcc.s
5>Compiling - os\bootloader\filesystem\fat\fat.c
2>Building Library - k:\projects\beagleboard.obj.arm\os\bootloader\common\obj\arm\common.lib
3>Building Library - k:\projects\beagleboard.obj.arm\os\bootloader\disk\obj\arm\disk.lib
4>Compiling - os\bootloader\drivers\ns16550.c
4>Compiling - os\bootloader\drivers\omap24xx_i2c.c
5>Compiling - os\bootloader\filesystem\fat\file.c
6>Compiling - os\bootloader\runtime\board.c
4>Compiling - os\bootloader\drivers\generating code...
5>Compiling - os\bootloader\filesystem\fat\generating code...
1>Building Library - k:\projects\beagleboard.obj.arm\os\bootloader\board\obj\arm\board.lib
6>Compiling - os\bootloader\runtime\div0.c
6>Compiling - os\bootloader\runtime\dcc.c
6>Compiling - os\bootloader\runtime\ecc.c
5>Building Library - k:\projects\beagleboard.obj.arm\os\bootloader\filesystem\fat\obj\arm\fat.lib
6>Compiling - os\bootloader\runtime\printf.c
4>Building Library - k:\projects\beagleboard.obj.arm\os\bootloader\drivers\obj\arm\drivers.lib
6>Compiling - os\bootloader\runtime\_udiv.c
6>Compiling - os\bootloader\runtime\generating code...
100>BUILD: Compiling k:\projects\beagleboard\os\bootloader\runtime directory
100>Building Library - k:\projects\beagleboard.obj.arm\os\bootloader\runtime\obj\arm\runtime.lib
1>BUILD: Compiling and Linking k:\projects\beagleboard\os\bootloader\cpu directory
1>Assembling - os\bootloader\cpu\arm\start.s
1>Compiling - os\bootloader\cpu\cpu.c
1>Compiling - os\bootloader\cpu\gpio.c
1>Compiling - os\bootloader\cpu\mmc.c
1>Compiling - os\bootloader\cpu\sys_info.c
1>Compiling - os\bootloader\cpu\generating code...
1>Linking Executable - k:\projects\beagleboard.obj.arm\os\bootloader\cpu\obj\arm\x-load.exe
1>MUI_COMMENT: Not Localizeable X-Load.exe
1>Binplacing - k:\projects\beagleboard.obj.arm\os\bootloader\cpu\obj\arm\mlo
BUILD: Finish time: Wed Jan 02 19:08:10 2013

    38 files compiled
    6 libraries built
    1 executable built
    1 file binplaced