Skip to content

Commit

Permalink
Visual Studio 2022 Community Project Solution for emWin
Browse files Browse the repository at this point in the history
Build emWin through Visual Studio 2022 Community (Visual C++) and GNU Arm Embedded Toolchain (msys2)
  • Loading branch information
symfund committed Jan 11, 2022
1 parent 4a77b42 commit 2a2a1d9
Show file tree
Hide file tree
Showing 22 changed files with 1,357 additions and 12 deletions.
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

*.obj
*.ipch
*.tlog
*.pdb
*.idb
*.ilk
*.log
*.exp
*.db
BSP/SampleCode/emWin/GUIDemo/VC2022/ARM/Debug/.map
BSP/SampleCode/emWin/GUIDemo/VC2022/.vs/NuDemo/v17/.suo
BSP/SampleCode/emWin/GUIDemo/VC2022/ARM/Debug/emWin_GUIDemo.bin
*.o
*.d
8 changes: 4 additions & 4 deletions BSP/Driver/Include/N9H26_USBD.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ typedef void (*PFN_USBD_CALLBACK)(void);
typedef BOOL (PFN_USBD_EXIT_CALLBACK)(void);
typedef void (*PFN_USBD_EP_CALLBACK)(UINT32 u32IntEn,UINT32 u32IntStatus);

typedef struct __attribute__((__packed__)) {
typedef PACK(struct {
/* Descriptor pointer */
PUINT32 pu32DevDescriptor;
PUINT32 pu32QulDescriptor;
Expand Down Expand Up @@ -257,13 +257,13 @@ typedef struct __attribute__((__packed__)) {
UINT32 u32UVC;
UINT32 USBStartFlag;

}USBD_INFO_T;
})USBD_INFO_T;

typedef struct __attribute__((__packed__)) {
typedef PACK(struct {
UINT32 appConnected;
UINT32 usbConnected;
UINT32 appConnected_Audio;
}USBD_STATUS_T;
})USBD_STATUS_T;


typedef struct
Expand Down
20 changes: 20 additions & 0 deletions BSP/Driver/Include/port.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,25 @@ typedef unsigned short Uint16;
#define M_DEBUG sysprintf
#define printk sysprintf

#if defined(__GNUC__)
#define PACK(__Declaration__) __Declaration__ __attribute__((__packed__))
#elif defined(__CC_ARM)
#define PACK(__Declaration__) __Declaration__ __attribute__((packed))
#elif defined(_MSC_VER)
#define PACK(__Declaration__) __pragma(pack(push, 1)) __Declaration__ __pragma(pack(pop))
#endif

#if defined(_MSC_VER)
#define ALIGNED_(x) __declspec(align(x))
#elif defined(__GNUC__) || defined(__CC_ARM)
#define ALIGNED_(x) __attribute__ ((aligned(x)))
#endif

#define ALIGNED_TYPE_(t,x) typedef t ALIGNED_(x)

#if defined (_MSC_VER)
#define __weak
#endif

#endif

32 changes: 32 additions & 0 deletions BSP/SampleCode/emWin/GUIDemo/VC2022/BuildCmd.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

REM make tool path
REM set make_tool_provided_by=C:\Program Files (x86)\GNU ARM Eclipse\Build Tools\2.8-201611221915\bin
set make_tool_provided_by=C:\msys64\usr\bin
set MAKE_PATH=%make_tool_provided_by%

REM gcc tool path
set GNU_TOOLS_ARM_EMBEDDED_PATH="C:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2021.10\bin"

set PATH=%MAKE_PATH%;%GNU_TOOLS_ARM_EMBEDDED_PATH%;%PATH%
echo %PATH%

REM Cross Compiler
SET CROSS_COMPILE=arm-none-eabi-

SET CC=arm-none-eabi-gcc
SET LD=arm-none-eabi-ld
SET AS=arm-none-eabi-as
SET OBJCOPY=arm-none-eabi-objcopy
SET SIZE=arm-none-eabi-size

SET CXX=
SET RM=rm -rf

echo ----------------------------------------------------------------------
echo Current directory is %~dp0
echo ----------------------------------------------------------------------
echo Change directory to %2
REM 'make -C' will change to directory %2
echo ----------------------------------------------------------------------

make -C %2 -f ../../Makefile.mak %1
189 changes: 189 additions & 0 deletions BSP/SampleCode/emWin/GUIDemo/VC2022/Makefile.mak
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@

# Make phony targets .PHONY
# There isn't really an all file created and there really isn't clean file.
# There are actually just tags that identify a target whose rules should
# always be run.
.PHONY: all clean target

# [SD]
# 1: enable SD 0: disable
SD = STORAGE_SD=1

# [LCD Resolution]
# __800x480__ __320x240__
LCD_RESOLUTION = __800x480__

# The Preprocessor Macros
DEFS = \
-DN9H26K6=1 \
-D$(SD) \
-D$(LCD_RESOLUTION) \

# [Include files]
INCLUDES = \
-I../../../../../../../BSP/Driver/Include \
-I../../../../../../../BSP/SampleCode/emWin/GUIDemo/Application \
-I../../../../../../../BSP/SampleCode/emWin/GUIDemo/tslib \
-I../../../../../../../BSP/ThirdParty/emWin/Config \
-I../../../../../../../BSP/ThirdParty/emWin/Include \

GFLAGS = \
-mcpu=arm926ej-s \
-marm \
-mlittle-endian \
-Os \
-fmessage-length=0 \
-fsigned-char \
-ffunction-sections \
-fdata-sections \
-g \

CFLAGS = $(DEFS) $(INCLUDES) -std=gnu11

CPPFLAGS =
CXXFLAGS =

ASFLAG = -g
TEMPLTFILE = ../../../../../../../BSP/Driver/Source/gcc_arm_SRAM.ld
LINKFILE = ../../../../../../../BSP/Driver/Source/gcc_arm_SRAM_N9H26K6_64MB.ld
LDFLAGS =

# [LIBS]
LIBS = \
-lN9H26_SYS \
-lN9H26_VPOST_FW050TFT_800x480 \
-lN9H26_ADC \
-lN9H26_SIC \
-lN9H26_GNAND \
-lN9H26_NVTFAT \
-lNUemWin_ARM9_GNU \
-lN9H26_BLT \
-lN9H26_JPEG \
-lm \
-L"../../../../../../../BSP/Library_GCC/IPLib" \
-L"../../../../../../../BSP/Library_GCC/GNANDLib" \
-L"../../../../../../../BSP/Library_GCC/NVTFATLib" \
-L"../../../../../../../BSP/ThirdParty/emWin/Lib" \


# define the C source files
# Don't include paths in filenames
# Inerting and maintaining paths everywhere is tedious and error prone. Better is to use
# VPATH within the Makefile like this:
# VPATH=../src
SRCS_C = \
../../../../../../../BSP/SampleCode/emWin/GUIDemo/main.c \
\
../../../../../../../BSP/SampleCode/emWin/GUIDemo/tslib/N9H26TouchPanel.c \
../../../../../../../BSP/SampleCode/emWin/GUIDemo/tslib/fbutils.c \
../../../../../../../BSP/SampleCode/emWin/GUIDemo/tslib/testutils.c \
../../../../../../../BSP/SampleCode/emWin/GUIDemo/tslib/ts_calibrate.c \
\
../../../../../../../BSP/ThirdParty/emWin/Config/GUI_X.c \
../../../../../../../BSP/ThirdParty/emWin/Config/LCDConf.c \
\
../../../../../../../BSP/SampleCode/emWin/GUIDemo/Application/GUIConf.c \
../../../../../../../BSP/SampleCode/emWin/GUIDemo/Application/GUIDEMO.c \
../../../../../../../BSP/SampleCode/emWin/GUIDemo/Application/GUIDEMO_AntialiasedText.c \
../../../../../../../BSP/SampleCode/emWin/GUIDemo/Application/GUIDEMO_Automotive.c \
../../../../../../../BSP/SampleCode/emWin/GUIDemo/Application/GUIDEMO_BarGraph.c \
../../../../../../../BSP/SampleCode/emWin/GUIDemo/Application/GUIDEMO_Bitmap.c \
../../../../../../../BSP/SampleCode/emWin/GUIDemo/Application/GUIDEMO_ColorBar.c \
../../../../../../../BSP/SampleCode/emWin/GUIDemo/Application/GUIDEMO_Conf.c \
../../../../../../../BSP/SampleCode/emWin/GUIDemo/Application/GUIDEMO_Cursor.c \
../../../../../../../BSP/SampleCode/emWin/GUIDemo/Application/GUIDEMO_Fading.c \
../../../../../../../BSP/SampleCode/emWin/GUIDemo/Application/GUIDEMO_Graph.c \
../../../../../../../BSP/SampleCode/emWin/GUIDemo/Application/GUIDEMO_IconView.c \
../../../../../../../BSP/SampleCode/emWin/GUIDemo/Application/GUIDEMO_ImageFlow.c \
../../../../../../../BSP/SampleCode/emWin/GUIDemo/Application/GUIDEMO_Intro.c \
../../../../../../../BSP/SampleCode/emWin/GUIDemo/Application/GUIDEMO_Listview.c \
../../../../../../../BSP/SampleCode/emWin/GUIDemo/Application/GUIDEMO_RadialMenu.c \
../../../../../../../BSP/SampleCode/emWin/GUIDemo/Application/GUIDEMO_Resource.c\
../../../../../../../BSP/SampleCode/emWin/GUIDemo/Application/GUIDEMO_Skinning.c \
../../../../../../../BSP/SampleCode/emWin/GUIDemo/Application/GUIDEMO_Speed.c \
../../../../../../../BSP/SampleCode/emWin/GUIDemo/Application/GUIDEMO_Speedometer.c \
../../../../../../../BSP/SampleCode/emWin/GUIDemo/Application/GUIDEMO_Start.c \
../../../../../../../BSP/SampleCode/emWin/GUIDemo/Application/GUIDEMO_TransparentDialog.c \
../../../../../../../BSP/SampleCode/emWin/GUIDemo/Application/GUIDEMO_Treeview.c \
../../../../../../../BSP/SampleCode/emWin/GUIDemo/Application/GUIDEMO_VScreen.c \
../../../../../../../BSP/SampleCode/emWin/GUIDemo/Application/GUIDEMO_WashingMachine.c \
../../../../../../../BSP/SampleCode/emWin/GUIDemo/Application/GUIDEMO_ZoomAndRotate.c \


# [Assembly Files]
SRCS_S = ../../../../../../../BSP/Driver/Source/Startup_GCC.S


# Explicitly name sources
# Lines like this one should be avoided.
# OS_C_SRCS := $(wildcard *.c)


# define the C object files
#
# This uses Suffix Replacement within a macro:
# $(name:string1=string2)
# For each word in 'name' replace 'string1' with 'string2'
# Below we are replacing the suffix .c of all words in the macros SRCS_C
# with the .o suffix
OBJS = $(SRCS_C:.c=.o) $(SRCS_S:.S=.o)

C_DEPS = $(OBJS:.o=.d)


MAIN = emWin_GUIDemo.elf

prebuild:
-arm-none-eabi-cpp -E -DN9H26K6_64MB=1 -P $(TEMPLTFILE) -o $(LINKFILE)

$(MAIN): $(OBJS)
@echo 'Building target: $@'
@echo 'Invoking: GNU ARM Cross C Linker'
$(CC) $(GFLAGS) -T "$(LINKFILE)" -Xlinker --gc-sections $(LIBDIR) -Wl,-Map,"$*.map" --specs=rdimon.specs -Wl,--start-group $(LIBS) -Wl,--end-group -o "$@" $(OBJS) $(USER_OBJS) $(LIBS)
@echo 'Finished building target: $@'
@echo ' '


TARGET = emWin_GUIDemo.bin

$(TARGET): $(MAIN)
@echo 'Invoking: GNU ARM Cross Create Flash Image'
$(OBJCOPY) -O binary "$<" "$@"
@echo 'Finished building: $@'
@echo ' '


# This is a suffix replacement rule for building .o's from .c's
# it uses automatic variables $< the name of the prerequisite of
# the rule (a .c file) and $@ the name of the target of the rule (a .o file)
# (see the GNU make manual section about automatic variables)
#
# Define an implicit rule
#
.c.o:
$(CC) $(GFLAGS) $(CFLAGS) -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c "$<" -o "$@"


.S.o:
$(CC) $(GFLAGS) -x assembler-with-cpp $(INCLUDES) -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"


# Define an implicit rule other than above
# The following means to build the target foo.S make should build foo.c

pre-build:
-arm-none-eabi-cpp -E -DN9H26K6_64MB=1 -P ../../../../../../../BSP/Driver/Source/gcc_arm_SRAM.ld -o $(LINKFILE)

all: pre-build $(TARGET) finalization

finalization: $(MAIN)
@echo 'Invoking: GNU ARM Cross Print Size'
arm-none-eabi-size --format=berkeley "$<"
@echo ' '

rebuild: all
@echo "rebuild done"

clean:
-$(RM) $(OBJS) $(LINKFILE) $(ASM_DEPS) $(S_UPPER_DEPS) $(C_DEPS) emWin_GUIDemo.elf
-@echo ' '
31 changes: 31 additions & 0 deletions BSP/SampleCode/emWin/GUIDemo/VC2022/NuDemo.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.32014.148
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "emWin_GUIDemo", "emWin_GUIDemo.vcxproj", "{0DC02475-37AE-4ED0-BAEC-532E3BE13D2C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM = Debug|ARM
Debug|x86 = Debug|x86
Release|ARM = Release|ARM
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0DC02475-37AE-4ED0-BAEC-532E3BE13D2C}.Debug|ARM.ActiveCfg = Debug|ARM
{0DC02475-37AE-4ED0-BAEC-532E3BE13D2C}.Debug|ARM.Build.0 = Debug|ARM
{0DC02475-37AE-4ED0-BAEC-532E3BE13D2C}.Debug|x86.ActiveCfg = Debug|Win32
{0DC02475-37AE-4ED0-BAEC-532E3BE13D2C}.Debug|x86.Build.0 = Debug|Win32
{0DC02475-37AE-4ED0-BAEC-532E3BE13D2C}.Release|ARM.ActiveCfg = Release|ARM
{0DC02475-37AE-4ED0-BAEC-532E3BE13D2C}.Release|ARM.Build.0 = Release|ARM
{0DC02475-37AE-4ED0-BAEC-532E3BE13D2C}.Release|x86.ActiveCfg = Release|Win32
{0DC02475-37AE-4ED0-BAEC-532E3BE13D2C}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4F0D58D6-EC3A-401E-B3FE-32073F27C5DA}
EndGlobalSection
EndGlobal
Binary file added BSP/SampleCode/emWin/GUIDemo/VC2022/NuSIM.dll
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 2a2a1d9

Please sign in to comment.