Add KBOOT.

This commit is contained in:
László Monda
2016-08-10 01:45:15 +02:00
commit e6c1fce5b4
9392 changed files with 3751375 additions and 0 deletions

View File

@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 2013 for Windows Desktop
VisualStudioVersion = 12.0.30723.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "blhost", "src\blhost.vcxproj", "{A498A89A-E965-4B36-B926-850AABF31939}"
ProjectSection(ProjectDependencies) = postProject
{DE64A8C3-695A-491F-B3E3-24D6A3057A40} = {DE64A8C3-695A-491F-B3E3-24D6A3057A40}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "blfwk", "..\..\apps\common\blfwk\blfwk.vcxproj", "{DE64A8C3-695A-491F-B3E3-24D6A3057A40}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A498A89A-E965-4B36-B926-850AABF31939}.Debug|Win32.ActiveCfg = Debug|Win32
{A498A89A-E965-4B36-B926-850AABF31939}.Debug|Win32.Build.0 = Debug|Win32
{A498A89A-E965-4B36-B926-850AABF31939}.Release|Win32.ActiveCfg = Release|Win32
{A498A89A-E965-4B36-B926-850AABF31939}.Release|Win32.Build.0 = Release|Win32
{DE64A8C3-695A-491F-B3E3-24D6A3057A40}.Debug|Win32.ActiveCfg = Debug|Win32
{DE64A8C3-695A-491F-B3E3-24D6A3057A40}.Debug|Win32.Build.0 = Debug|Win32
{DE64A8C3-695A-491F-B3E3-24D6A3057A40}.Release|Win32.ActiveCfg = Release|Win32
{DE64A8C3-695A-491F-B3E3-24D6A3057A40}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,216 @@
#-----------------------------------------------
# Make command:
# make build=<build> all
# <build>: debug or release, release by default.
#-----------------------------------------------
#-----------------------------------------------
# setup variables
# ----------------------------------------------
BOOT_ROOT := $(abspath ../../..)
OUTPUT_ROOT := $(abspath ./)
APP_NAME = blhost
#-----------------------------------------------
# Debug or Release
# Release by default
#-----------------------------------------------
build ?= release
include $(BOOT_ROOT)/mk/common.mk
#-----------------------------------------------
# Include path. Add the include paths like this:
# INCLUDES += ./include/
#-----------------------------------------------
INCLUDES += $(BOOT_ROOT)/validation/blhost/src \
$(BOOT_ROOT)/src \
$(BOOT_ROOT)/src/include \
$(BOOT_ROOT)/src/blfwk \
$(BOOT_ROOT)/src/sbloader \
$(BOOT_ROOT)/src/bootloader \
$(BOOT_ROOT)/src/crc \
$(BOOT_ROOT)/src/packet \
$(BOOT_ROOT)/src/property \
$(BOOT_ROOT)/src/drivers/common \
$(BOOT_ROOT)/src/bm_usb
CXXFLAGS := -D LINUX -D BOOTLOADER_HOST -std=c++11
CFLAGS := -std=c99 -D LINUX -D BOOTLOADER_HOST -D _GNU_SOURCE
LD := g++
SOURCES := $(BOOT_ROOT)/validation/blhost/src/blhost.cpp \
$(BOOT_ROOT)/src/blfwk/src/Blob.cpp \
$(BOOT_ROOT)/src/blfwk/src/Bootloader.cpp \
$(BOOT_ROOT)/src/blfwk/src/BusPal.cpp \
$(BOOT_ROOT)/src/blfwk/src/BusPalPeripheral.cpp \
$(BOOT_ROOT)/src/blfwk/src/Command.cpp \
$(BOOT_ROOT)/src/blfwk/src/DataSource.cpp \
$(BOOT_ROOT)/src/blfwk/src/DataSourceImager.cpp \
$(BOOT_ROOT)/src/blfwk/src/DataTarget.cpp \
$(BOOT_ROOT)/src/blfwk/src/ELFSourceFile.cpp \
$(BOOT_ROOT)/src/blfwk/src/ExcludesListMatcher.cpp \
$(BOOT_ROOT)/src/blfwk/src/format_string.cpp \
$(BOOT_ROOT)/src/blfwk/src/GHSSecInfo.cpp \
$(BOOT_ROOT)/src/blfwk/src/GlobMatcher.cpp \
$(BOOT_ROOT)/src/blfwk/src/hid-linux.c \
$(BOOT_ROOT)/src/blfwk/src/jsoncpp.cpp \
$(BOOT_ROOT)/src/blfwk/src/Logging.cpp \
$(BOOT_ROOT)/src/blfwk/src/options.cpp \
$(BOOT_ROOT)/src/blfwk/src/SBSourceFile.cpp \
$(BOOT_ROOT)/src/blfwk/src/SearchPath.cpp \
$(BOOT_ROOT)/src/blfwk/src/serial.c \
$(BOOT_ROOT)/src/blfwk/src/SerialPacketizer.cpp \
$(BOOT_ROOT)/src/blfwk/src/SourceFile.cpp \
$(BOOT_ROOT)/src/blfwk/src/SRecordSourceFile.cpp \
$(BOOT_ROOT)/src/blfwk/src/IntelHexSourceFile.cpp \
$(BOOT_ROOT)/src/blfwk/src/StELFFile.cpp \
$(BOOT_ROOT)/src/blfwk/src/StExecutableImage.cpp \
$(BOOT_ROOT)/src/blfwk/src/StSRecordFile.cpp \
$(BOOT_ROOT)/src/blfwk/src/StIntelHexFile.cpp \
$(BOOT_ROOT)/src/blfwk/src/Updater.cpp \
$(BOOT_ROOT)/src/blfwk/src/UartPeripheral.cpp \
$(BOOT_ROOT)/src/blfwk/src/UsbHidPacketizer.cpp \
$(BOOT_ROOT)/src/blfwk/src/UsbHidPeripheral.cpp \
$(BOOT_ROOT)/src/blfwk/src/utils.cpp \
$(BOOT_ROOT)/src/blfwk/src/Value.cpp \
$(BOOT_ROOT)/src/crc/src/crc16.c \
$(BOOT_ROOT)/src/crc/src/crc32.c \
#$(BOOT_ROOT)/src/blfwk/src/Simulator.cpp
#$(BOOT_ROOT)/src/blfwk/src/SimulatorMemory.cpp
#$(BOOT_ROOT)/src/blfwk/src/SimPacketizer.cpp
#$(BOOT_ROOT)/src/blfwk/src/SimPeripheral.cpp
#$(BOOT_ROOT)/src/bootloader/src/command.cpp
#$(BOOT_ROOT)/src/sbloader/src/sbloader.c
#$(BOOT_ROOT)/src/property/src/property.c
#$(BOOT_ROOT)/src/memory/src/memory.c
#$(BOOT_ROOT)/src/bootloader/src/bootloader_context.cpp
INCLUDES := $(foreach includes, $(INCLUDES), -I $(includes))
ifeq "$(build)" "debug"
DEBUG_OR_RELEASE := Debug
CFLAGS += -g
CXXFLAGS += -g
LDFLAGS += -g
else
DEBUG_OR_RELEASE := Release
endif
TARGET_OUTPUT_ROOT := $(OUTPUT_ROOT)/$(DEBUG_OR_RELEASE)
MAKE_TARGET := $(TARGET_OUTPUT_ROOT)/$(APP_NAME)
OBJS_ROOT = $(TARGET_OUTPUT_ROOT)/obj
# Strip sources.
SOURCES := $(strip $(SOURCES))
# Convert sources list to absolute paths and root-relative paths.
SOURCES_ABS := $(foreach s,$(SOURCES),$(abspath $(s)))
SOURCES_REL := $(subst $(BOOT_ROOT)/,,$(SOURCES_ABS))
# Get a list of unique directories containing the source files.
SOURCE_DIRS_ABS := $(sort $(foreach f,$(SOURCES_ABS),$(dir $(f))))
SOURCE_DIRS_REL := $(subst $(BOOT_ROOT)/,,$(SOURCE_DIRS_ABS))
OBJECTS_DIRS := $(addprefix $(OBJS_ROOT)/,$(SOURCE_DIRS_REL))
# Filter source files list into separate source types.
C_SOURCES = $(filter %.c,$(SOURCES_REL))
CXX_SOURCES = $(filter %.cpp,$(SOURCES_REL))
ASM_s_SOURCES = $(filter %.s,$(SOURCES_REL))
ASM_S_SOURCES = $(filter %.S,$(SOURCES_REL))
# Convert sources to objects.
OBJECTS_C := $(addprefix $(OBJS_ROOT)/,$(C_SOURCES:.c=.o))
OBJECTS_CXX := $(addprefix $(OBJS_ROOT)/,$(CXX_SOURCES:.cpp=.o))
OBJECTS_ASM := $(addprefix $(OBJS_ROOT)/,$(ASM_s_SOURCES:.s=.o))
OBJECTS_ASM_S := $(addprefix $(OBJS_ROOT)/,$(ASM_S_SOURCES:.S=.o))
# Complete list of all object files.
OBJECTS_ALL := $(sort $(OBJECTS_C) $(OBJECTS_CXX) $(OBJECTS_ASM) $(OBJECTS_ASM_S))
#-------------------------------------------------------------------------------
# Default target
#-------------------------------------------------------------------------------
# Note that prerequisite order is important here. The subdirectories must be built first, or you
# may end up with files in the current directory not getting added to libraries. This would happen
# if subdirs modified the library file after local files were compiled but before they were added
# to the library.
.PHONY: all
all: $(MAKE_TARGET)
## Recipe to create the output object file directories.
$(OBJECTS_DIRS) :
$(at)mkdir -p $@
# Object files depend on the directories where they will be created.
#
# The dirs are made order-only prerequisites (by being listed after the '|') so they won't cause
# the objects to be rebuilt, as the modification date on a directory changes whenver its contents
# change. This would cause the objects to always be rebuilt if the dirs were normal prerequisites.
$(OBJECTS_ALL): | $(OBJECTS_DIRS)
#-------------------------------------------------------------------------------
# Pattern rules for compilation
#-------------------------------------------------------------------------------
# We cd into the source directory before calling the appropriate compiler. This must be done
# on a single command line since make calls individual recipe lines in separate shells, so
# '&&' is used to chain the commands.
#
# Generate make dependencies while compiling using the -MMD option, which excludes system headers.
# If system headers are included, there are path problems on cygwin. The -MP option creates empty
# targets for each header file so that a rebuild will be forced if the file goes missing, but
# no error will occur.
# Compile C sources.
$(OBJS_ROOT)/%.o: $(BOOT_ROOT)/%.c
@$(call printmessage,c,Compiling, $(subst $(BOOT_ROOT)/,,$<))
$(at)$(CC) $(CFLAGS) $(SYSTEM_INC) $(INCLUDES) $(DEFINES) -MMD -MF $(basename $@).d -MP -o $@ -c $<
# Compile C++ sources.
$(OBJS_ROOT)/%.o: $(BOOT_ROOT)/%.cpp
@$(call printmessage,cxx,Compiling, $(subst $(BOOT_ROOT)/,,$<))
$(at)$(CXX) $(CXXFLAGS) $(SYSTEM_INC) $(INCLUDES) $(DEFINES) -MMD -MF $(basename $@).d -MP -o $@ -c $<
# For .S assembly files, first run through the C preprocessor then assemble.
$(OBJS_ROOT)/%.o: $(BOOT_ROOT)/%.S
@$(call printmessage,asm,Assembling, $(subst $(BOOT_ROOT)/,,$<))
$(at)$(CPP) -D__LANGUAGE_ASM__ $(INCLUDES) $(DEFINES) -o $(basename $@).s $< \
&& $(AS) $(ASFLAGS) $(INCLUDES) -MD $(OBJS_ROOT)/$*.d -o $@ $(basename $@).s
# Assembler sources.
$(OBJS_ROOT)/%.o: $(BOOT_ROOT)/%.s
@$(call printmessage,asm,Assembling, $(subst $(BOOT_ROOT)/,,$<))
$(at)$(AS) $(ASFLAGS) $(INCLUDES) -MD $(basename $@).d -o $@ $<
#------------------------------------------------------------------------
# Build the tagrget
#------------------------------------------------------------------------
# Wrap the link objects in start/end group so that ld re-checks each
# file for dependencies. Otherwise linking static libs can be a pain
# since order matters.
$(MAKE_TARGET): $(OBJECTS_ALL)
@$(call printmessage,link,Linking, $(APP_NAME))
$(at)$(LD) $(LDFLAGS) \
$(OBJECTS_ALL) \
-lc -lstdc++ -lm -ludev \
-o $@
@echo "Output binary:" ; echo " $(APP_NAME)"
#-------------------------------------------------------------------------------
# Clean
#-------------------------------------------------------------------------------
.PHONY: clean cleanall
cleanall: clean
clean:
$(at)rm -rf $(OBJECTS_ALL) $(OBJECTS_DIRS) $(MAKE_TARGET) $(APP_NAME)
# Include dependency files.
-include $(OBJECTS_ALL:.o=.d)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{A498A89A-E965-4B36-B926-850AABF31939}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>blhost</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140_xp</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>BOOTLOADER_HOST;WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<CompileAs>CompileAsCpp</CompileAs>
<AdditionalIncludeDirectories>$(ProjectDir)..\..\..\src\drivers\common;$(ProjectDir)..\..;$(ProjectDir)..\..\..\src;$(ProjectDir)..\..\..\src\bm_usb;$(ProjectDir)..\..\..\src\include;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>../../../apps/common/blfwk/$(Configuration)</AdditionalLibraryDirectories>
<AdditionalDependencies>blfwk.lib</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>BOOTLOADER_HOST;WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>$(ProjectDir)..\..\..\src\drivers\common;$(ProjectDir)..\..;$(ProjectDir)..\..\..\src;$(ProjectDir)..\..\..\src\bm_usb;$(ProjectDir)..\..\..\src\include;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>blfwk.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>../../../apps/common/blfwk/$(Configuration)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="targetver.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="blhost.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClInclude Include="targetver.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="blhost.cpp" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerCommandArguments>-u -b i2c,0x10,100 -- get-property 1</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LocalDebuggerCommandArguments>-p COM1 -b can -- get-property 1</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,37 @@
/*
* Copyright (c) 2013-14, Freescale Semiconductor, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* o Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* o Neither the name of Freescale Semiconductor, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
// Including SDKDDKVer.h defines the highest available Windows platform.
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
#include <SDKDDKVer.h>