Skip to content

Commit

Permalink
Merge pull request #1 from OSVR/alternate-libhdk20
Browse files Browse the repository at this point in the history
Alternate libhdk20
  • Loading branch information
rpavlik authored Aug 12, 2016
2 parents 4ac4200 + fde2a1e commit 39bcc90
Show file tree
Hide file tree
Showing 17 changed files with 61 additions and 6 deletions.
2 changes: 2 additions & 0 deletions Source code/Embedded/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ dSight_Sharp_LCD*/
HDK_OLED*/
HDK_Sharp_LCD*/
HDK_20*/
HDK_20_SVR*/
!/src/Variants/dSight_Sharp_LCD/
!/src/Variants/HDK_OLED/
!/src/Variants/HDK_Sharp_LCD/
!/src/Variants/HDK_20/
!/src/Variants/HDK_20_SVR/
2 changes: 1 addition & 1 deletion Source code/Embedded/HMD-MCU.cproj
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@
<avrgcc.linker.libraries.Libraries>
<ListValues>
<Value>libm</Value>
<Value>libhdk20</Value>
<Value>libhdk20.1.01</Value>
</ListValues>
</avrgcc.linker.libraries.Libraries>
<avrgcc.linker.libraries.LibrarySearchPaths>
Expand Down
19 changes: 18 additions & 1 deletion Source code/Embedded/makefile-build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ OPTIMIZATION := 3
ASFLAGS :=
EXTRA_ASFLAGS :=

LIBHDK20_VER := 1.01

# Other useful things you could define on the command line:
# ATMEL_STUDIO_ROOT
# NO_ATMEL_STUDIO (for a Windows avrgcc toolchain without atmel studio - any value is true)
Expand Down Expand Up @@ -239,10 +241,25 @@ SHORT_NAME := hdk2
VARIANT_NAME := HDK_20

# Per-variant libs and includes
LIBS_HDK_20 := $(REL_ROOT)/vendor/libhdk20/libhdk20.a
LIBS_HDK_20 := $(REL_ROOT)/vendor/libhdk20/libhdk20.$(strip $(LIBHDK20_VER)).a
INCLUDE_DIRS_HDK_20 := $(REL_ROOT)/vendor/libhdk20/
include add_variant.mk


SHORT_NAME := hdk2svr
VARIANT_NAME := HDK_20_SVR
EDID_BIN := $(REL_ROOT)/src/Variants/HDK_20_SVR/svr1020.edid.bin
LIBS_HDK_20_SVR := $(REL_ROOT)/vendor/libhdk20/libhdk20.$(strip $(LIBHDK20_VER)).svr1020.a
INCLUDE_DIRS_HDK_20_SVR := $(REL_ROOT)/vendor/libhdk20/
EXTRA_C_SRCS := src/Variants/$(VARIANT_NAME)/svr1020.edid_info.c

# Rule to build the custom modified libhdk20, if we need to.
$(LIBS_HDK_20_SVR): $(LIBS_HDK_20) $(EDID_BIN)
@echo [HDK_20_SVR] Generating $@ by injecting EDID from $(EDID_BIN)
$(QUIETRULE)$(OBJCOPY) "$<" --update-section .rodata.EDID_LUT=$(EDID_BIN) "$@"

include add_variant.mk

SHORT_NAME := hdk_oled
VARIANT_NAME := HDK_OLED
include add_variant.mk
Expand Down
9 changes: 6 additions & 3 deletions Source code/Embedded/makefile-build/add_variant.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# All rights reserved.

# Helper makefile:
# Set SHORT_NAME, VARIANT_NAME, and optionally SKIP_ALL_TARGET
# Set SHORT_NAME, VARIANT_NAME, and optionally SKIP_ALL_TARGET, EXTRA_C_SRCS
# before including this file.
#
# Creates a rule to copy the final hex to a renamed file in the current directory
Expand Down Expand Up @@ -43,7 +43,9 @@ VARIANTS += $(VARIANT_NAME)

CURRENT_OBJS :=

C_OBJS := $(addprefix $(BUILD_DIR)/,$(C_SRCS:%.c=%.o))
ALL_C_SRCS := $(C_SRCS) $(EXTRA_C_SRCS)

C_OBJS := $(addprefix $(BUILD_DIR)/,$(ALL_C_SRCS:%.c=%.o))

# Build .c -> .o
$(BUILD_DIR)/%.o: $(REL_ROOT)/%.c
Expand All @@ -66,7 +68,7 @@ $(BUILD_DIR)/%.o: VARIANT := $(VARIANT)
CURRENT_OBJS := $(C_OBJS) $(S_OBJS)

# Makes the elf file
$(BUILD_DIR)/$(OUTPUT_FILE_PATH): $(CURRENT_OBJS)
$(BUILD_DIR)/$(OUTPUT_FILE_PATH): $(CURRENT_OBJS) $(LIBS) $(LIBS_$(VARIANT))
@echo [$(VARIANT)$(SUFFIX)] Linking $@
$(QUIETRULE)$(CC) -o"$@" $^ $(LIBS) $(LIBS_$(VARIANT)) -Wl,-Map="$(BUILD_DIR)/$(OUTPUT_MAP)" -Wl,--start-group -Wl,-lm -Wl,--end-group -Wl,--gc-sections -mrelax -mmcu=$(MCU) -Wl,--relax -Wl,--section-start=.BOOT=0x40000
$(QUIETRULE)$(AVRSIZE) --mcu=$(MCU) --format=avr "$@"
Expand Down Expand Up @@ -100,6 +102,7 @@ VARIANT :=
# undefine SHORT_NAME
# undefine VARIANT_NAME
# undefine SKIP_ALL_TARGET
EXTRA_C_SRCS :=
SHORT_NAME :=
VARIANT_NAME :=
SKIP_ALL_TARGET :=
5 changes: 5 additions & 0 deletions Source code/Embedded/src/SerialStateMachine.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,11 @@ static void Display_firmware_details(void)
#endif
WriteEndl();

#ifdef SVR_HAVE_EDID_INFO_STRING
Write("EDID Info: ");
WriteLn(svrEdidInfoString);
#endif

Write("Built ");
Write(__DATE__);
Write(" ");
Expand Down
20 changes: 20 additions & 0 deletions Source code/Embedded/src/Variants/HDK_20_SVR/VariantOptions.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* VariantOptions.h
* For the dual-AUO-OLED, single HDMI HDK 2.0 and related HMDs, customized by Sensics.
* Created: 7/20/2016 5:51:12 PM
* Author: Sensics
*/

// Derived from the HDK2
#include "../HDK_20/VariantOptions.h"

#ifndef VARIANTOPTIONS_H_HDK20SVR
#define VARIANTOPTIONS_H_HDK20SVR

#undef SVR_VARIANT_STRING
#define SVR_VARIANT_STRING "HDK_20_SVR"

#define SVR_HAVE_EDID_INFO_STRING
extern const char svrEdidInfoString[];

#endif /* VARIANTOPTIONS_H_HDK20SVR */
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#include "VariantOptions.h"

const char svrEdidInfoString[] = "SVR1019, based on 1.01, all dims 26x15 (r3)";

/* svr1020.edid.bin swapped in as the contents of section .rodata.EDID_LUT in libhdk20.1.01.a to produce libhdk20.1.01.svr1020.a */
2 changes: 1 addition & 1 deletion Source code/Embedded/src/config/GlobalOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "VariantOptions.h"

#define MajorVersion 1
#define MinorVersion 95
#define MinorVersion 96

/// @ingroup Build-time options
/// @{
Expand Down
1 change: 1 addition & 0 deletions Source code/Embedded/vendor/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!*.a
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 2 additions & 0 deletions Source code/Embedded/vendor/libhdk20/weaken-edid-symbol.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
rem Copies the library to a new name, in the process, weakens the EDID_LUT symbol, renames the existing data section for it
avr-objcopy --weaken-symbol .rodata.EDID_LUT --weaken-symbol EDID_LUT --rename-section .rodata.EDID_LUT=.rodata.EDID_LUT_OLD %1 %~n1.weakedid.a

0 comments on commit 39bcc90

Please sign in to comment.