13 Commits

Author SHA1 Message Date
f4ac7db357 [修改] Keil工程支持MDK5
[详细说明]
    1. 兼容MDK4、MDK5编译;
    2. NSPE 增加自定义内容
        2.1. 增加开关宏: CONFIG_GY3513;
        2.2. 增加EVAL板定义集;
2023-06-15 16:26:54 +00:00
6503e589b4 [修改] bat脚本与exe工具增加可执行权限 2023-06-15 16:13:40 +00:00
58a63c59fb [修改] 忽略Keil工程中间产物 2023-06-15 16:11:08 +00:00
ada62165a6 [修改] 更新Readme说明 2023-06-14 16:03:01 +00:00
853a9461a0 [修改] 增加CONFIG_GY3513定制内容
[详细说明]
    1. 增加LED任务;
    2. 修复LED3配置错误问题;
2023-06-14 16:01:34 +00:00
242a8865ae [修改] VSCode工程 clang插件相关配置 2023-06-14 16:00:40 +00:00
3ca2c491d5 [Mod] 修改目标单板 EVAL 2023-06-13 16:38:23 +00:00
a389b906af [修改] 支持clangd插件 2023-06-13 16:37:59 +00:00
cc9e198164 [修改] MBL、NSPE支持Linux下make编译
[详细说明]
    1. 增加build_date.sh支持编译时间生成;
    2. 增加xxx_afterbuild.sh脚本,支持elf文件生成;
    3. MBL修改Project目录大小写错误导致的编译失败问题;
    4. 修改头文件目录分隔符心解决编译失败问题;
2023-06-13 15:53:18 +00:00
a38081a71d [修改] .gitignore更新 2023-06-13 15:52:54 +00:00
a37460118b [修改] 临时将工具链以软链形式关联 2023-06-13 15:51:47 +00:00
caa30d12e9 [修改] 输出目录修改为output 2023-06-13 15:49:21 +00:00
04ef4ce611 [修改] 增加Linux环境支持
[详细说明]
    1. Cmake兼容Linux环境;
    2.解决MBL工程目录错误导致的编译失败问题;
2023-06-05 15:36:05 +00:00
41 changed files with 7428 additions and 7003 deletions

192
.clang-format Normal file
View File

@ -0,0 +1,192 @@
---
Language: Cpp
# BasedOnStyle: WebKit
AccessModifierOffset: -4
AlignAfterOpenBracket: DontAlign
AlignArrayOfStructures: None
AlignConsecutiveMacros: None
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: None
AlignConsecutiveDeclarations: None
AlignEscapedNewlines: Right
AlignOperands: DontAlign
AlignTrailingComments: false
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortEnumsOnASingleLine: true
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
AttributeMacros:
- __capability
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: All
BreakBeforeConceptDeclarations: true
BreakBeforeBraces: WebKit
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeComma
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 0
CommentPragmas: '^ IWYU pragma:'
QualifierAlignment: Leave
CompactNamespaces: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: false
DeriveLineEnding: true
DerivePointerAlignment: false
DisableFormat: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
PackConstructorInitializers: BinPack
BasedOnStyle: ''
ConstructorInitializerAllOnOneLineOrOnePerLine: false
AllowAllConstructorInitializersOnNextLine: true
FixNamespaceComments: false
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IfMacros:
- KJ_IF_MAYBE
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
SortPriority: 0
CaseSensitive: false
- Regex: '.*'
Priority: 1
SortPriority: 0
CaseSensitive: false
IncludeIsMainRegex: '(Test)?$'
IncludeIsMainSourceRegex: ''
IndentAccessModifiers: false
IndentCaseLabels: false
IndentCaseBlocks: false
IndentGotoLabels: true
IndentPPDirectives: None
IndentExternBlock: AfterExternBlock
IndentRequires: false
IndentWidth: 4
IndentWrappedFunctionNames: false
InsertTrailingCommas: None
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
LambdaBodyIndentation: Signature
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: Inner
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 4
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakOpenParenthesis: 0
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PenaltyIndentedWhitespace: 0
PointerAlignment: Left
PPIndentWidth: -1
ReferenceAlignment: Pointer
ReflowComments: true
RemoveBracesLLVM: false
SeparateDefinitionBlocks: Leave
ShortNamespaceLines: 1
SortIncludes: CaseSensitive
SortJavaStaticImport: Before
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterForeachMacros: true
AfterFunctionDefinitionName: false
AfterFunctionDeclarationName: false
AfterIfMacros: true
AfterOverloadedOperator: false
BeforeNonEmptyParentheses: false
SpaceAroundPointerQualifiers: Default
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: Never
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
BitFieldColonSpacing: Both
Standard: Latest
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseCRLF: false
UseTab: Never
WhitespaceSensitiveMacros:
- STRINGIZE
- PP_STRINGIZE
- BOOST_PP_STRINGIZE
- NS_SWIFT_NAME
- CF_SWIFT_NAME
...

17
.gitignore vendored
View File

@ -1,3 +1,20 @@
_build_date.h
.cache/
.cmake/ .cmake/
output/ output/
scripts/images/
# MBL
## Keil Project
MBL/Project/KEIL/*.ini
*.uvgui*
MBL/Project/KEIL/RTE/
MBL/Project/KEIL/mbl_ns/
NSPE/Project/WIFI_IOT/KEIL/RTE/
NSPE/Project/WIFI_IOT/KEIL/wifi_iot/
# Clang
compile_commands.json

View File

@ -4,7 +4,8 @@ project(GD32W51X LANGUAGES C ASM)
set(CONFIG_TZ_ENABLED OFF CACHE BOOL "Whether to enable trustzone") set(CONFIG_TZ_ENABLED OFF CACHE BOOL "Whether to enable trustzone")
set(CONFIG_OS "FREERTOS" CACHE STRING "Select which OS") set(CONFIG_OS "FREERTOS" CACHE STRING "Select which OS")
set(CONFIG_STATIC_LIB_BUILDED ON CACHE BOOL "Whether static lib builded, like wlan, iperf3 lib") set(CONFIG_STATIC_LIB_BUILDED ON CACHE BOOL "Whether static lib builded, like wlan, iperf3 lib")
set(CONFIG_GY3513 ON CACHE BOOL "Whether to allow gaoyang3513's modification or not.")
include(${CMAKE_TOOLCHAIN_FILE}) include(${CMAKE_TOOLCHAIN_FILE})
toolchain_reload_compiler() toolchain_reload_compiler()
@ -23,6 +24,14 @@ include_directories(
ROM-EXPORT/mbedtls-2.17.0-rom/include ROM-EXPORT/mbedtls-2.17.0-rom/include
) )
if(CONFIG_GY3513)
add_definitions(-DCONFIG_GY3513)
include_directories(
NSPE/Utilities
)
endif(CONFIG_GY3513)
if (CONFIG_TZ_ENABLED) if (CONFIG_TZ_ENABLED)
add_subdirectory(MBL/source) add_subdirectory(MBL/source)
include_directories(MBL/source) include_directories(MBL/source)
@ -31,5 +40,4 @@ else()
add_subdirectory(MBL/source_ns) add_subdirectory(MBL/source_ns)
endif() endif()
add_subdirectory(NSPE) add_subdirectory(NSPE)

View File

@ -10,7 +10,7 @@
<aExt>*.s*; *.src; *.a*</aExt> <aExt>*.s*; *.src; *.a*</aExt>
<oExt>*.obj; *.o</oExt> <oExt>*.obj; *.o</oExt>
<lExt>*.lib</lExt> <lExt>*.lib</lExt>
<tExt>*.txt; *.h; *.inc</tExt> <tExt>*.txt; *.h; *.inc; *.md</tExt>
<pExt>*.plm</pExt> <pExt>*.plm</pExt>
<CppX>*.cpp</CppX> <CppX>*.cpp</CppX>
<nMigrate>0</nMigrate> <nMigrate>0</nMigrate>
@ -103,7 +103,7 @@
<bEvRecOn>1</bEvRecOn> <bEvRecOn>1</bEvRecOn>
<bSchkAxf>0</bSchkAxf> <bSchkAxf>0</bSchkAxf>
<bTchkAxf>0</bTchkAxf> <bTchkAxf>0</bTchkAxf>
<nTsel>15</nTsel> <nTsel>14</nTsel>
<sDll></sDll> <sDll></sDll>
<sDllPa></sDllPa> <sDllPa></sDllPa>
<sDlgDll></sDlgDll> <sDlgDll></sDlgDll>
@ -212,7 +212,7 @@
<Group> <Group>
<GroupName>bootloader</GroupName> <GroupName>bootloader</GroupName>
<tvExp>0</tvExp> <tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel> <cbSel>0</cbSel>
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>

View File

@ -10,14 +10,14 @@
<TargetName>Target_GDM32</TargetName> <TargetName>Target_GDM32</TargetName>
<ToolsetNumber>0x4</ToolsetNumber> <ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName> <ToolsetName>ARM-ADS</ToolsetName>
<pCCUsed>6090000::V6.9::.\ARMCLANG</pCCUsed> <pCCUsed>6190000::V6.19::ARMCLANG</pCCUsed>
<uAC6>1</uAC6> <uAC6>1</uAC6>
<TargetOption> <TargetOption>
<TargetCommonOption> <TargetCommonOption>
<Device>GD32W515PIQ6</Device> <Device>GD32W515PIQ6</Device>
<Vendor>GigaDevice</Vendor> <Vendor>GigaDevice</Vendor>
<PackID>GigaDevice.GD32W51x_DFP.1.0.2</PackID> <PackID>GigaDevice.GD32W51x_DFP.1.0.3</PackID>
<PackURL>http://gd32mcu.com/data/documents/pack/</PackURL> <PackURL>https://gd32mcu.com/data/documents/pack/</PackURL>
<Cpu>IRAM(0x20000000,0x70000) IRAM2(0x30000000,0x70000) IROM(0x08000000,0x0200000) IROM2(0x0C000000,0x0200000) CPUTYPE("Cortex-M33") FPU3(SFPU) DSP TZ CLOCK(12000000) ELITTLE</Cpu> <Cpu>IRAM(0x20000000,0x70000) IRAM2(0x30000000,0x70000) IROM(0x08000000,0x0200000) IROM2(0x0C000000,0x0200000) CPUTYPE("Cortex-M33") FPU3(SFPU) DSP TZ CLOCK(12000000) ELITTLE</Cpu>
<FlashUtilSpec></FlashUtilSpec> <FlashUtilSpec></FlashUtilSpec>
<StartupFile></StartupFile> <StartupFile></StartupFile>
@ -184,6 +184,9 @@
<hadXRAM>0</hadXRAM> <hadXRAM>0</hadXRAM>
<uocXRam>0</uocXRam> <uocXRam>0</uocXRam>
<RvdsVP>2</RvdsVP> <RvdsVP>2</RvdsVP>
<RvdsMve>0</RvdsMve>
<RvdsCdeCp>0</RvdsCdeCp>
<nBranchProt>0</nBranchProt>
<hadIRAM2>1</hadIRAM2> <hadIRAM2>1</hadIRAM2>
<hadIROM2>1</hadIROM2> <hadIROM2>1</hadIROM2>
<StupSel>8</StupSel> <StupSel>8</StupSel>
@ -350,7 +353,7 @@
<NoWarn>0</NoWarn> <NoWarn>0</NoWarn>
<uSurpInc>0</uSurpInc> <uSurpInc>0</uSurpInc>
<useXO>0</useXO> <useXO>0</useXO>
<uClangAs>0</uClangAs> <ClangAsOpt>4</ClangAsOpt>
<VariousControls> <VariousControls>
<MiscControls></MiscControls> <MiscControls></MiscControls>
<Define></Define> <Define></Define>

View File

@ -10,14 +10,22 @@ set ROOT=%OUTPUT_PATH%\..\..\..\..\..
set SREC_CAT=%ROOT%\scripts\imgtool\srec_cat.exe set SREC_CAT=%ROOT%\scripts\imgtool\srec_cat.exe
set OUTPUT_IMAGE_PATH=%ROOT%\scripts\images set OUTPUT_IMAGE_PATH=%ROOT%\scripts\images
for /f "tokens=1,2 delims=\" %%a in ("%TOOLKIT_PATH%") do set driver=%%a &set version=%%b
if "%TOOLKIT%" == "KEIL" ( if "%TOOLKIT%" == "KEIL" (
:: Generate txt for debug if "%version%" == "Keil_v5" (
%TOOLKIT_PATH%\ARM\ARMCC\bin\fromelf.exe --text -c -d --output=%OUTPUT_PATH%\..\%OUTPUT_NAME%.txt %OUTPUT_PATH%\%OUTPUT_NAME%.axf :: Generate txt for debug
%TOOLKIT_PATH%\ARM\ARMCLANG\bin\fromelf.exe --text -c -d --output=%OUTPUT_PATH%\..\%OUTPUT_NAME%.txt %OUTPUT_PATH%\%OUTPUT_NAME%.axf
:: Generate binary image :: Generate binary image
%TOOLKIT_PATH%\ARM\ARMCC\bin\fromelf.exe --bin --8x1 --bincombined --output=%OUTPUT_PATH%\..\%OUTPUT_NAME%.bin %OUTPUT_PATH%\%OUTPUT_NAME%.axf %TOOLKIT_PATH%\ARM\ARMCLANG\bin\fromelf.exe --bin --8x1 --bincombined --output=%OUTPUT_PATH%\..\%OUTPUT_NAME%.bin %OUTPUT_PATH%\%OUTPUT_NAME%.axf
) else (
:: Generate txt for debug
%TOOLKIT_PATH%\ARM\ARMCC\bin\fromelf.exe --text -c -d --output=%OUTPUT_PATH%\..\%OUTPUT_NAME%.txt %OUTPUT_PATH%\%OUTPUT_NAME%.axf
:: Generate binary image
%TOOLKIT_PATH%\ARM\ARMCC\bin\fromelf.exe --bin --8x1 --bincombined --output=%OUTPUT_PATH%\..\%OUTPUT_NAME%.bin %OUTPUT_PATH%\%OUTPUT_NAME%.axf
)
) )
if "%TOOLKIT%" == "IAR" ( if "%TOOLKIT%" == "IAR" (
:: Generate ASM file :: Generate ASM file

40
MBL/Project/mbl_afterbuild.sh Executable file
View File

@ -0,0 +1,40 @@
#!/bin/bash
#set -x
#echo "Args: $@"
OUTPUT_PATH=$1
OUTPUT_NAME=$2
TOOLKIT=$3
TOOLKIT_PATH=$4
OUTPUT_PATH=${OUTPUT_PATH%/}
ROOT=$(realpath ${OUTPUT_PATH}/../../../../..)
SREC_CAT=/usr/bin/srec_cat
OUTPUT_IMAGE_PATH=${ROOT}/scripts/images
if [ "${TOOLKIT}" == "KEIL" ]; then
# Generate txt for debug
${TOOLKIT_PATH}/ARM/ARMCC/bin/fromelf.exe --text -c -d --output=${OUTPUT_PATH}/../${OUTPUT_NAME}.txt ${OUTPUT_PATH}/${OUTPUT_NAME}.axf
# Generate binary image
%TOOLKIT_PATH%/ARM/ARMCC/bin/fromelf.exe --bin --8x1 --bincombined --output=${OUTPUT_PATH}/../${OUTPUT_NAME}.bin ${OUTPUT_PATH}/${OUTPUT_NAME}.axf
elif [ "${TOOLKIT}" == "IAR" ]; then
# Generate ASM file
%TOOLKIT_PATH%/bin/ielfdumparm.exe ${OUTPUT_PATH}/${OUTPUT_NAME}.axf --output ${OUTPUT_PATH}/../${OUTPUT_NAME}.asm --code
# Generate binary image
%TOOLKIT_PATH%/bin/ielftool.exe ${OUTPUT_PATH}/${OUTPUT_NAME}.axf --bin ${OUTPUT_PATH}/../${OUTPUT_NAME}.bin
elif [ "${TOOLKIT}" == "GCC" ]; then
arm-none-eabi-objdump -xS ${OUTPUT_PATH}/${OUTPUT_NAME}.axf > ${OUTPUT_PATH}/../${OUTPUT_NAME}.txt
arm-none-eabi-objcopy -Obinary ${OUTPUT_PATH}/${OUTPUT_NAME}.axf ${OUTPUT_PATH}/../${OUTPUT_NAME}.bin
fi
mkdir -p ${OUTPUT_IMAGE_PATH}
if [ -n "$(ls ${OUTPUT_IMAGE_PATH}/${OUTPUT_NAME}*)" ]; then
rm -rf ${OUTPUT_IMAGE_PATH}/${OUTPUT_NAME}*
fi
# Copy to output image path
cp ${OUTPUT_PATH}/../${OUTPUT_NAME}.bin ${OUTPUT_IMAGE_PATH}
# Generate Hex file
${SREC_CAT} ${OUTPUT_IMAGE_PATH}/${OUTPUT_NAME}.bin -Binary -offset 0x0C000000 -o ${OUTPUT_IMAGE_PATH}/${OUTPUT_NAME}.hex -Intel

View File

@ -1,6 +0,0 @@
//LOAD "..\\..\\..\\ROM-EXPORT\\symbol\\rom.axf" incremental
LOAD "..\\..\\..\\MBL\\project\\KEIL\\mbl\\Objects\\mbl.axf" incremental
LOAD "..\\..\\..\\PROT\\project\\KEIL\\secure_main\\Gdm32\\Objects\\prot.axf" incremental
LOAD "..\\..\\..\\NSPE\\Project\\WIFI_IOT\\KEIL\\nspe\\output\\nspe.axf" incremental
RESET

View File

@ -1,4 +0,0 @@
LOAD "mbl_ns\\Objects\\mbl-ns.axf" incremental
LOAD "..\\..\\..\\NSPE\\Project\\WIFI_IOT\\KEIL\\wifi_iot\\output\\nspe.axf" incremental
RESET

View File

@ -58,10 +58,17 @@ target_add_scatter_file(${TARGET_EXE}
target_link_options(${TARGET_EXE} target_link_options(${TARGET_EXE}
PUBLIC PUBLIC
-Wl,--just-symbols=${PROJECT_SOURCE_DIR}/ROM-EXPORT/symbol/rom_symbol.gcc -Wl,--just-symbols=${PROJECT_SOURCE_DIR}/ROM-EXPORT/symbol/rom_symbol.gcc
-Wl,-Map=${RUNTIME_OUTPUT_DIRECTORY}/${TARGET_EXE}.map -Wl,-Map=${TAGET_PROJECT_DIR}/GCC/output/bin/${TARGET_EXE}.map
) )
add_custom_command(TARGET ${TARGET_EXE} POST_BUILD if(CMAKE_HOST_UNIX)
COMMAND ${TAGET_PROJECT_DIR}/mbl_afterbuild.bat ${TAGET_PROJECT_DIR}/GCC/output/bin ${TARGET_EXE} GCC \"\" add_custom_command(TARGET ${TARGET_EXE} POST_BUILD
COMMENT "Building ${TARGET_EXE}" COMMAND ${TAGET_PROJECT_DIR}/mbl_afterbuild.sh ${TAGET_PROJECT_DIR}/GCC/output/bin ${TARGET_EXE} GCC \"\"
) COMMENT "Building ${TARGET_EXE}"
)
elseif(CMAKE_HOST_WIN32)
add_custom_command(TARGET ${TARGET_EXE} POST_BUILD
COMMAND ${TAGET_PROJECT_DIR}/mbl_afterbuild.bat ${TAGET_PROJECT_DIR}/GCC/output/bin ${TARGET_EXE} GCC \"\"
COMMENT "Building ${TARGET_EXE}"
)
endif()

View File

@ -23,18 +23,25 @@ CLEAN_ALL :=
#==============================================================================# #==============================================================================#
# Compile configure # Compile configure
#==============================================================================# #==============================================================================#
CROSS_COMPILE ?=
#==============================================================================# #==============================================================================#
# Target # Target
#==============================================================================# #==============================================================================#
.PHONY: all $(BUILD_ALL) $(CLEAN_ALL) .PHONY: all $(BUILD_ALL) $(CLEAN_ALL)
all: check_env $(BUILD_ALL) all: check_env $(BUILD_ALL)
$(MAKE) -C $(CMAKE_DIR) -j$(MULTI_CORES) @$(MAKE) -C $(CMAKE_DIR) -j$(MULTI_CORES)
check_env: check_env:
if [ ! -e $(CMAKE_DIR) ]; then \ @if [ ! -e $(OUTPUT_DIR) ]; then mkdir -p $(OUTPUT_DIR); fi;
@if [ ! -e $(CMAKE_DIR) ]; then \
mkdir -p $(CMAKE_DIR); \ mkdir -p $(CMAKE_DIR); \
cmake -G "Unix Makefiles" \ cmake -G "Unix Makefiles" \
-DCMAKE_TOOLCHAIN_FILE:PATH=$(SDK_TOP)/scripts/cmake/toolchain.cmake \ -S $(LOCAL_DIR) -B $(CMAKE_DIR) \
-S $(LOCAL_DIR) -B $(CMAKE_DIR); \ -DCMAKE_TOOLCHAIN_FILE:PATH=$(SDK_TOP)/scripts/cmake/toolchain.cmake; \
fi; fi;
clean: check_env $(CLEAN_ALL)
@rm -rf $(CMAKE_DIR) $(OUTPUT_DIR)

View File

@ -1,15 +1,20 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?> <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<ProjectWorkspace xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_mpw.xsd"> <ProjectWorkspace xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_mpw.xsd">
<SchemaVersion>1.0</SchemaVersion>
<Header>### uVision Project, (C) Keil Software</Header> <SchemaVersion>1.0</SchemaVersion>
<WorkspaceName>WorkSpace</WorkspaceName>
<project> <Header>### uVision Project, (C) Keil Software</Header>
<PathAndName>.\MBL\project\KEIL\Project_MBL_NS.uvprojx</PathAndName>
<NodeIsActive>1</NodeIsActive> <WorkspaceName>WorkSpace</WorkspaceName>
<NodeIsExpanded>1</NodeIsExpanded>
</project> <project>
<project> <PathAndName>.\MBL\project\KEIL\Project_MBL_NS.uvprojx</PathAndName>
<PathAndName>.\NSPE\Project\WIFI_IOT\KEIL\Project_WIFI_IOT.uvprojx</PathAndName> </project>
<NodeIsExpanded>1</NodeIsExpanded>
</project> <project>
<PathAndName>.\NSPE\Project\WIFI_IOT\KEIL\Project_WIFI_IOT.uvprojx</PathAndName>
<NodeIsActive>1</NodeIsActive>
<NodeIsExpanded>1</NodeIsExpanded>
</project>
</ProjectWorkspace> </ProjectWorkspace>

View File

@ -10,7 +10,7 @@
<aExt>*.s*; *.src; *.a*</aExt> <aExt>*.s*; *.src; *.a*</aExt>
<oExt>*.obj; *.o</oExt> <oExt>*.obj; *.o</oExt>
<lExt>*.lib</lExt> <lExt>*.lib</lExt>
<tExt>*.txt; *.h; *.inc</tExt> <tExt>*.txt; *.h; *.inc; *.md</tExt>
<pExt>*.plm</pExt> <pExt>*.plm</pExt>
<CppX>*.cpp</CppX> <CppX>*.cpp</CppX>
<nMigrate>0</nMigrate> <nMigrate>0</nMigrate>
@ -103,7 +103,7 @@
<bEvRecOn>1</bEvRecOn> <bEvRecOn>1</bEvRecOn>
<bSchkAxf>0</bSchkAxf> <bSchkAxf>0</bSchkAxf>
<bTchkAxf>0</bTchkAxf> <bTchkAxf>0</bTchkAxf>
<nTsel>15</nTsel> <nTsel>14</nTsel>
<sDll></sDll> <sDll></sDll>
<sDllPa></sDllPa> <sDllPa></sDllPa>
<sDlgDll></sDlgDll> <sDlgDll></sDlgDll>
@ -120,7 +120,7 @@
<SetRegEntry> <SetRegEntry>
<Number>0</Number> <Number>0</Number>
<Key>CMSIS_AGDI_V8M</Key> <Key>CMSIS_AGDI_V8M</Key>
<Name>-X"Any" -UAny -O206 -S0 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(0BE12477) -L00(0) -TO18 -TC10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC2000 -FN1 -FF0GD32W515_NS -FS08000000 -FL0200000 -FP0($$Device:GD32W515PIQ6$Flash\GD32W515_NS.FLM)</Name> <Name>-X"Any" -UAny -O206 -S0 -C0 -P00000000 -N00("ARM CoreSight SW-DP") -D00(0BE12477) -L00(0) -TO65554 -TC10000000 -TT10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC2000 -FN1 -FF0GD32W515_NS.FLM -FS08000000 -FL0200000 -FP0($$Device:GD32W515PIQ6$Flash\GD32W515_NS.FLM)</Name>
</SetRegEntry> </SetRegEntry>
<SetRegEntry> <SetRegEntry>
<Number>0</Number> <Number>0</Number>
@ -2787,6 +2787,26 @@
</File> </File>
</Group> </Group>
<Group>
<GroupName>Utilities</GroupName>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
<File>
<GroupNumber>15</GroupNumber>
<FileNumber>195</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\Utilities\gd32w515p_eval.c</PathWithFileName>
<FilenameWithoutPath>gd32w515p_eval.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
<Group> <Group>
<GroupName>::CMSIS</GroupName> <GroupName>::CMSIS</GroupName>
<tvExp>0</tvExp> <tvExp>0</tvExp>

View File

@ -10,14 +10,14 @@
<TargetName>Project_Freertos</TargetName> <TargetName>Project_Freertos</TargetName>
<ToolsetNumber>0x4</ToolsetNumber> <ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName> <ToolsetName>ARM-ADS</ToolsetName>
<pCCUsed>6090000::V6.9::.\ARMCLANG</pCCUsed> <pCCUsed>6190000::V6.19::ARMCLANG</pCCUsed>
<uAC6>1</uAC6> <uAC6>1</uAC6>
<TargetOption> <TargetOption>
<TargetCommonOption> <TargetCommonOption>
<Device>GD32W515PIQ6</Device> <Device>GD32W515PIQ6</Device>
<Vendor>GigaDevice</Vendor> <Vendor>GigaDevice</Vendor>
<PackID>GigaDevice.GD32W51x_DFP.1.0.2</PackID> <PackID>GigaDevice.GD32W51x_DFP.1.0.3</PackID>
<PackURL>http://gd32mcu.com/data/documents/pack/</PackURL> <PackURL>https://gd32mcu.com/data/documents/pack/</PackURL>
<Cpu>IRAM(0x20000000,0x70000) IRAM2(0x30000000,0x70000) IROM(0x08000000,0x0200000) IROM2(0x0C000000,0x0200000) CPUTYPE("Cortex-M33") FPU3(SFPU) DSP TZ CLOCK(12000000) ELITTLE</Cpu> <Cpu>IRAM(0x20000000,0x70000) IRAM2(0x30000000,0x70000) IROM(0x08000000,0x0200000) IROM2(0x0C000000,0x0200000) CPUTYPE("Cortex-M33") FPU3(SFPU) DSP TZ CLOCK(12000000) ELITTLE</Cpu>
<FlashUtilSpec></FlashUtilSpec> <FlashUtilSpec></FlashUtilSpec>
<StartupFile></StartupFile> <StartupFile></StartupFile>
@ -184,6 +184,9 @@
<hadXRAM>0</hadXRAM> <hadXRAM>0</hadXRAM>
<uocXRam>0</uocXRam> <uocXRam>0</uocXRam>
<RvdsVP>2</RvdsVP> <RvdsVP>2</RvdsVP>
<RvdsMve>0</RvdsMve>
<RvdsCdeCp>0</RvdsCdeCp>
<nBranchProt>0</nBranchProt>
<hadIRAM2>1</hadIRAM2> <hadIRAM2>1</hadIRAM2>
<hadIROM2>1</hadIROM2> <hadIROM2>1</hadIROM2>
<StupSel>8</StupSel> <StupSel>8</StupSel>
@ -335,9 +338,9 @@
<v6Rtti>0</v6Rtti> <v6Rtti>0</v6Rtti>
<VariousControls> <VariousControls>
<MiscControls>-fshort-wchar</MiscControls> <MiscControls>-fshort-wchar</MiscControls>
<Define>PLATFORM_OS_FREERTOS</Define> <Define>PLATFORM_OS_FREERTOS CONFIG_GY3513</Define>
<Undefine></Undefine> <Undefine></Undefine>
<IncludePath>..\..\..\Firmware\CMSIS\DSP_Lib_v1.6.0\include;..\..\..\Firmware\CMSIS\GD\GD32W51x\Include;..\..\..\Firmware\GD32W51x_standard_peripheral\Include;..\..\..\Firmware\GD32W51x_wifi_driver\inc;..\..\..\Firmware\GD32W51x_wifi_driver\osal;..\..\..\Firmware\GD32W51x_wifi_driver\cmn;..\..\..\Firmware\GD32W51x_wifi_driver\soc;..\..\..\WIFI_IOT\app;..\..\..\WIFI_IOT\bsp;..\..\..\WIFI_IOT\wifi;..\..\..\WIFI_IOT\os;..\..\..\WIFI_IOT\os\FreeRTOSv10.3.1\Source\include;..\..\..\WIFI_IOT\os\FreeRTOSv10.3.1\Source\portable\Keil\ARM_CM33_NTZ;..\..\..\WIFI_IOT\network\lwip-2.1.2\apps;..\..\..\WIFI_IOT\network\lwip-2.1.2\port;..\..\..\WIFI_IOT\network\lwip-2.1.2\src\include;..\..\..\WIFI_IOT\network\lwip-2.1.2\src\include\lwip;..\..\..\WIFI_IOT\network\lwip-2.1.2\port\arch;..\..\..\WIFI_IOT\network\mbedtls-2.17.0-ssl\include;..\..\..\WIFI_IOT\network\mbedtls-2.17.0-ssl\ns_interface;..\..\..\WIFI_IOT\network\iperf3;..\..\..\WIFI_IOT\cloud\alicloud;..\..\..\WIFI_IOT\cloud\alicloud\iotkit-embedded-3.2.0\lib_iot_sdk_src\eng\infra;..\..\..\WIFI_IOT\cloud\alicloud\iotkit-embedded-3.2.0\lib_iot_sdk_src\eng\dev_model;..\..\..\WIFI_IOT\cloud\alicloud\iotkit-embedded-3.2.0\lib_iot_sdk_src\eng\wrappers;..\..\..\WIFI_IOT\cloud\alicloud\iotkit-embedded-3.2.0\lib_iot_sdk_src\eng;..\..\..\WIFI_IOT\cloud\alicloud\iotkit-embedded-3.2.0\lib_iot_sdk_src;..\..\..\WIFI_IOT\cloud\alicloud\iotkit-embedded-3.2.0\lib_iot_sdk_src\eng\wifi_provision;..\..\..\WIFI_IOT\FatFS;..\..\..\WIFI_IOT\FatFS\src;..\..\..\..\config;..\..\..\..\ROM-EXPORT\source;..\..\..\..\ROM-EXPORT\platform;..\..\..\..\ROM-EXPORT\mbedtls-2.17.0-rom\include;..\..\..\..\ROM-EXPORT\mbedtls-2.17.0-rom\include\mbedtls;..\..\..\..\MBL\platform;..\..\..\..\MBL\source;..\..\..\..\MBL\source_ns;..\..\..\..\PROT\trusted-firmware-m\interface\include;..\..\..\..\PROT\mbedtls_ns_callable;..\..\..\WIFI_IOT\demo;..\..\..\WIFI_IOT\common;..\..\..\WIFI_IOT\os\FreeRTOSv10.3.1\CMSIS\RTOS2\FreeRTOS\Include;..\..\..\WIFI_IOT\os\FreeRTOSv10.3.1\CMSIS\RTOS2\FreeRTOS\Source</IncludePath> <IncludePath>..\..\..\Firmware\CMSIS\DSP_Lib_v1.6.0\include;..\..\..\Firmware\CMSIS\GD\GD32W51x\Include;..\..\..\Firmware\GD32W51x_standard_peripheral\Include;..\..\..\Firmware\GD32W51x_wifi_driver\inc;..\..\..\Firmware\GD32W51x_wifi_driver\osal;..\..\..\Firmware\GD32W51x_wifi_driver\cmn;..\..\..\Firmware\GD32W51x_wifi_driver\soc;..\..\..\WIFI_IOT\app;..\..\..\WIFI_IOT\bsp;..\..\..\WIFI_IOT\wifi;..\..\..\WIFI_IOT\os;..\..\..\WIFI_IOT\os\FreeRTOSv10.3.1\Source\include;..\..\..\WIFI_IOT\os\FreeRTOSv10.3.1\Source\portable\Keil\ARM_CM33_NTZ;..\..\..\WIFI_IOT\network\lwip-2.1.2\apps;..\..\..\WIFI_IOT\network\lwip-2.1.2\port;..\..\..\WIFI_IOT\network\lwip-2.1.2\src\include;..\..\..\WIFI_IOT\network\lwip-2.1.2\src\include\lwip;..\..\..\WIFI_IOT\network\lwip-2.1.2\port\arch;..\..\..\WIFI_IOT\network\mbedtls-2.17.0-ssl\include;..\..\..\WIFI_IOT\network\mbedtls-2.17.0-ssl\ns_interface;..\..\..\WIFI_IOT\network\iperf3;..\..\..\WIFI_IOT\cloud\alicloud;..\..\..\WIFI_IOT\cloud\alicloud\iotkit-embedded-3.2.0\lib_iot_sdk_src\eng\infra;..\..\..\WIFI_IOT\cloud\alicloud\iotkit-embedded-3.2.0\lib_iot_sdk_src\eng\dev_model;..\..\..\WIFI_IOT\cloud\alicloud\iotkit-embedded-3.2.0\lib_iot_sdk_src\eng\wrappers;..\..\..\WIFI_IOT\cloud\alicloud\iotkit-embedded-3.2.0\lib_iot_sdk_src\eng;..\..\..\WIFI_IOT\cloud\alicloud\iotkit-embedded-3.2.0\lib_iot_sdk_src;..\..\..\WIFI_IOT\cloud\alicloud\iotkit-embedded-3.2.0\lib_iot_sdk_src\eng\wifi_provision;..\..\..\WIFI_IOT\FatFS;..\..\..\WIFI_IOT\FatFS\src;..\..\..\..\config;..\..\..\..\ROM-EXPORT\source;..\..\..\..\ROM-EXPORT\platform;..\..\..\..\ROM-EXPORT\mbedtls-2.17.0-rom\include;..\..\..\..\ROM-EXPORT\mbedtls-2.17.0-rom\include\mbedtls;..\..\..\..\MBL\platform;..\..\..\..\MBL\source;..\..\..\..\MBL\source_ns;..\..\..\..\PROT\trusted-firmware-m\interface\include;..\..\..\..\PROT\mbedtls_ns_callable;..\..\..\WIFI_IOT\demo;..\..\..\WIFI_IOT\common;..\..\..\WIFI_IOT\os\FreeRTOSv10.3.1\CMSIS\RTOS2\FreeRTOS\Include;..\..\..\WIFI_IOT\os\FreeRTOSv10.3.1\CMSIS\RTOS2\FreeRTOS\Source;..\..\..\Utilities</IncludePath>
</VariousControls> </VariousControls>
</Cads> </Cads>
<Aads> <Aads>
@ -350,7 +353,7 @@
<NoWarn>0</NoWarn> <NoWarn>0</NoWarn>
<uSurpInc>0</uSurpInc> <uSurpInc>0</uSurpInc>
<useXO>0</useXO> <useXO>0</useXO>
<uClangAs>0</uClangAs> <ClangAsOpt>4</ClangAsOpt>
<VariousControls> <VariousControls>
<MiscControls></MiscControls> <MiscControls></MiscControls>
<Define></Define> <Define></Define>
@ -508,7 +511,7 @@
<NoWarn>2</NoWarn> <NoWarn>2</NoWarn>
<uSurpInc>2</uSurpInc> <uSurpInc>2</uSurpInc>
<useXO>2</useXO> <useXO>2</useXO>
<uClangAs>2</uClangAs> <ClangAsOpt>0</ClangAsOpt>
<VariousControls> <VariousControls>
<MiscControls>--cpreproc</MiscControls> <MiscControls>--cpreproc</MiscControls>
<Define></Define> <Define></Define>
@ -1392,7 +1395,7 @@
<NoWarn>2</NoWarn> <NoWarn>2</NoWarn>
<uSurpInc>2</uSurpInc> <uSurpInc>2</uSurpInc>
<useXO>2</useXO> <useXO>2</useXO>
<uClangAs>2</uClangAs> <ClangAsOpt>0</ClangAsOpt>
<VariousControls> <VariousControls>
<MiscControls></MiscControls> <MiscControls></MiscControls>
<Define></Define> <Define></Define>
@ -1525,6 +1528,16 @@
</File> </File>
</Files> </Files>
</Group> </Group>
<Group>
<GroupName>Utilities</GroupName>
<Files>
<File>
<FileName>gd32w515p_eval.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\Utilities\gd32w515p_eval.c</FilePath>
</File>
</Files>
</Group>
<Group> <Group>
<GroupName>::CMSIS</GroupName> <GroupName>::CMSIS</GroupName>
</Group> </Group>
@ -1540,7 +1553,7 @@
<TargetCommonOption> <TargetCommonOption>
<Device>ARMCM33_DSP_FP_TZ</Device> <Device>ARMCM33_DSP_FP_TZ</Device>
<Vendor>ARM</Vendor> <Vendor>ARM</Vendor>
<PackID>ARM.CMSIS.5.8.0</PackID> <PackID>ARM.CMSIS.5.9.0</PackID>
<PackURL>http://www.keil.com/pack/</PackURL> <PackURL>http://www.keil.com/pack/</PackURL>
<Cpu>IRAM(0x20000000,0x00020000) IRAM2(0x20200000,0x00020000) IROM(0x00000000,0x00200000) IROM2(0x00200000,0x00200000) CPUTYPE("Cortex-M33") FPU3(SFPU) DSP TZ CLOCK(12000000) ESEL ELITTLE</Cpu> <Cpu>IRAM(0x20000000,0x00020000) IRAM2(0x20200000,0x00020000) IROM(0x00000000,0x00200000) IROM2(0x00200000,0x00200000) CPUTYPE("Cortex-M33") FPU3(SFPU) DSP TZ CLOCK(12000000) ESEL ELITTLE</Cpu>
<FlashUtilSpec></FlashUtilSpec> <FlashUtilSpec></FlashUtilSpec>
@ -1708,6 +1721,9 @@
<hadXRAM>0</hadXRAM> <hadXRAM>0</hadXRAM>
<uocXRam>0</uocXRam> <uocXRam>0</uocXRam>
<RvdsVP>2</RvdsVP> <RvdsVP>2</RvdsVP>
<RvdsMve>0</RvdsMve>
<RvdsCdeCp>0</RvdsCdeCp>
<nBranchProt>0</nBranchProt>
<hadIRAM2>1</hadIRAM2> <hadIRAM2>1</hadIRAM2>
<hadIROM2>1</hadIROM2> <hadIROM2>1</hadIROM2>
<StupSel>8</StupSel> <StupSel>8</StupSel>
@ -1874,7 +1890,7 @@
<NoWarn>0</NoWarn> <NoWarn>0</NoWarn>
<uSurpInc>0</uSurpInc> <uSurpInc>0</uSurpInc>
<useXO>0</useXO> <useXO>0</useXO>
<uClangAs>0</uClangAs> <ClangAsOpt>4</ClangAsOpt>
<VariousControls> <VariousControls>
<MiscControls></MiscControls> <MiscControls></MiscControls>
<Define></Define> <Define></Define>
@ -2032,7 +2048,7 @@
<NoWarn>2</NoWarn> <NoWarn>2</NoWarn>
<uSurpInc>2</uSurpInc> <uSurpInc>2</uSurpInc>
<useXO>2</useXO> <useXO>2</useXO>
<uClangAs>2</uClangAs> <ClangAsOpt>0</ClangAsOpt>
<VariousControls> <VariousControls>
<MiscControls>--cpreproc</MiscControls> <MiscControls>--cpreproc</MiscControls>
<Define></Define> <Define></Define>
@ -2317,7 +2333,7 @@
<NoWarn>2</NoWarn> <NoWarn>2</NoWarn>
<uSurpInc>2</uSurpInc> <uSurpInc>2</uSurpInc>
<useXO>2</useXO> <useXO>2</useXO>
<uClangAs>2</uClangAs> <ClangAsOpt>0</ClangAsOpt>
<VariousControls> <VariousControls>
<MiscControls></MiscControls> <MiscControls></MiscControls>
<Define></Define> <Define></Define>
@ -3100,6 +3116,16 @@
</File> </File>
</Files> </Files>
</Group> </Group>
<Group>
<GroupName>Utilities</GroupName>
<Files>
<File>
<FileName>gd32w515p_eval.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\Utilities\gd32w515p_eval.c</FilePath>
</File>
</Files>
</Group>
<Group> <Group>
<GroupName>::CMSIS</GroupName> <GroupName>::CMSIS</GroupName>
</Group> </Group>
@ -3121,4 +3147,13 @@
<files/> <files/>
</RTE> </RTE>
<LayerInfo>
<Layers>
<Layer>
<LayName>Project_WIFI_IOT</LayName>
<LayPrjMark>1</LayPrjMark>
</Layer>
</Layers>
</LayerInfo>
</Project> </Project>

0
NSPE/Project/WIFI_IOT/build_date.bat Normal file → Executable file
View File

View File

@ -0,0 +1,7 @@
#!/bin/bash
DIR=$1
echo "/* Do not change the content here, it's auto generated */" > ${DIR}/WIFI_IOT/common/_build_date.h
echo "#define BUILD_DATE \"$(date +"%Y/%m/%d %H:%M")\"" >> ${DIR}/WIFI_IOT/common/_build_date.h
echo "#define DATE_GENERATED" >> ${DIR}/WIFI_IOT/common/_build_date.h

20
NSPE/Project/WIFI_IOT/nspe_afterbuild.bat Normal file → Executable file
View File

@ -15,12 +15,22 @@ set OUTPUT_FILE=nspe
IF EXIST %OUTPUT_PATH%\..\nspe* del %OUTPUT_PATH%\..\nspe* IF EXIST %OUTPUT_PATH%\..\nspe* del %OUTPUT_PATH%\..\nspe*
if "%TOOLKIT%" == "KEIL" ( for /f "tokens=1,2 delims=\" %%a in ("%TOOLKIT_PATH%") do set driver=%%a &set version=%%b
:: Generate txt for debug
%TOOLKIT_PATH%\ARM\ARMCC\bin\fromelf.exe --text -c -d --output=%OUTPUT_PATH%\..\%OUTPUT_FILE%.txt %OUTPUT_PATH%\%OUTPUT_FILE%.axf
:: Generate binary image if "%TOOLKIT%" == "KEIL" (
%TOOLKIT_PATH%\ARM\ARMCC\bin\fromelf.exe --bin --8x1 --bincombined --output=%OUTPUT_PATH%\..\nspe.bin %OUTPUT_PATH%\%OUTPUT_FILE%.axf if "%version%" == "Keil_v5" (
:: Generate txt for debug
%TOOLKIT_PATH%\ARM\ARMCLANG\bin\fromelf.exe --text -c -d --output=%OUTPUT_PATH%\..\%OUTPUT_FILE%.txt %OUTPUT_PATH%\%OUTPUT_FILE%.axf
:: Generate binary image
%TOOLKIT_PATH%\ARM\ARMCLANG\bin\fromelf.exe --bin --8x1 --bincombined --output=%OUTPUT_PATH%\..\%OUTPUT_FILE%.bin %OUTPUT_PATH%\%OUTPUT_FILE%.axf
) else (
:: Generate txt for debug
%TOOLKIT_PATH%\ARM\ARMCC\bin\fromelf.exe --text -c -d --output=%OUTPUT_PATH%\..\%OUTPUT_FILE%.txt %OUTPUT_PATH%\%OUTPUT_FILE%.axf
:: Generate binary image
%TOOLKIT_PATH%\ARM\ARMCC\bin\fromelf.exe --bin --8x1 --bincombined --output=%OUTPUT_PATH%\..\%OUTPUT_FILE%.bin %OUTPUT_PATH%\%OUTPUT_FILE%.axf
)
) )
if "%TOOLKIT%" == "IAR" ( if "%TOOLKIT%" == "IAR" (
:: Generate ASM file :: Generate ASM file

61
NSPE/Project/WIFI_IOT/nspe_afterbuild.sh Normal file → Executable file
View File

@ -1,44 +1,53 @@
#!/bin/bash
#set -x
#echo "Args: $@"
OUTPUT_PATH=$1 OUTPUT_PATH=$1
TOOLKIT=$2 TOOLKIT=$2
TOOLKIT_PATH=$3 TOOLKIT_PATH=$3
"OUTPUT_PATH=%OUTPUT_PATH:/=\%" OUTPUT_PATH=${OUTPUT_PATH%/}
ROOT=$(realpath ${OUTPUT_PATH}/../../../../../..)
echo TOOLKIT=%TOOLKIT% TOOLKIT=${TOOLKIT}
echo TOOLKIT_PATH=%TOOLKIT_PATH% TOOLKIT_PATH=${TOOLKIT_PATH}
set ROOT=%OUTPUT_PATH%\..\..\..\..\..\.. INDEX=0
set INDEX=0 SREC_CAT=/usr/bin/srec_cat
set OUTPUT_IMAGE_PATH=%ROOT%\scripts\images
set SREC_CAT=%ROOT%\scripts\imgtool\srec_cat.exe
set OUTPUT_FILE=nspe
IF EXIST %OUTPUT_PATH%\..\nspe* del %OUTPUT_PATH%\..\nspe* OUTPUT_FILE=nspe
OUTPUT_IMAGE_PATH=${ROOT}/scripts/images
if "%TOOLKIT%" == "KEIL" ( mkdir -p ${OUTPUT_PATH}
if [ -n "$(ls ${OUTPUT_PATH}/../nspe*)" ]; then
rm -rf ${OUTPUT_PATH}/../nspe*
fi
if [ "${TOOLKIT}" == "KEIL" ]; then
# Generate txt for debug # Generate txt for debug
%TOOLKIT_PATH%\ARM\ARMCC\bin\fromelf.exe --text -c -d --output=%OUTPUT_PATH%\..\%OUTPUT_FILE%.txt %OUTPUT_PATH%\%OUTPUT_FILE%.axf ${TOOLKIT_PATH}/ARM/ARMCC/bin/fromelf.exe --text -c -d --output=${OUTPUT_PATH}/../${OUTPUT_FILE}.txt ${OUTPUT_PATH}/${OUTPUT_FILE}.axf
# Generate binary image # Generate binary image
%TOOLKIT_PATH%\ARM\ARMCC\bin\fromelf.exe --bin --8x1 --bincombined --output=%OUTPUT_PATH%\..\nspe.bin %OUTPUT_PATH%\%OUTPUT_FILE%.axf ${TOOLKIT_PATH}/ARM/ARMCC/bin/fromelf.exe --bin --8x1 --bincombined --output=${OUTPUT_PATH}/../nspe.bin ${OUTPUT_PATH}/${OUTPUT_FILE}.axf
) elif [ "${TOOLKIT}" == "IAR" ]; then
if "%TOOLKIT%" == "IAR" (
# Generate ASM file # Generate ASM file
%TOOLKIT_PATH%\bin\ielfdumparm.exe %OUTPUT_PATH%\%OUTPUT_FILE%.axf --output %OUTPUT_PATH%\..\%OUTPUT_FILE%.asm --code ${TOOLKIT_PATH}/bin/ielfdumparm.exe ${OUTPUT_PATH}/${OUTPUT_FILE}.axf --output ${OUTPUT_PATH}/../${OUTPUT_FILE}.asm --code
# Generate binary image # Generate binary image
%TOOLKIT_PATH%\bin\ielftool.exe %OUTPUT_PATH%\%OUTPUT_FILE%.axf --bin %OUTPUT_PATH%\..\%OUTPUT_FILE%.bin ${TOOLKIT_PATH}/bin/ielftool.exe ${OUTPUT_PATH}/${OUTPUT_FILE}.axf --bin ${OUTPUT_PATH}/../${OUTPUT_FILE}.bin
) elif [ "${TOOLKIT}" == "GCC" ]; then
arm-none-eabi-objdump -xS ${OUTPUT_PATH}/${OUTPUT_FILE}.axf > ${OUTPUT_PATH}/../${OUTPUT_FILE}.txt
if "%TOOLKIT%" == "GCC" ( arm-none-eabi-objcopy -Obinary ${OUTPUT_PATH}/${OUTPUT_FILE}.axf ${OUTPUT_PATH}/../${OUTPUT_FILE}.bin
arm-none-eabi-objdump -xS %OUTPUT_PATH%\%OUTPUT_FILE%.axf > %OUTPUT_PATH%\..\%OUTPUT_FILE%.txt fi
arm-none-eabi-objcopy -Obinary %OUTPUT_PATH%\%OUTPUT_FILE%.axf %OUTPUT_PATH%\..\%OUTPUT_FILE%.bin
)
mkdir -p ${OUTPUT_IMAGE_PATH}
# Copy nspe.bin to the image path as ota image # Copy nspe.bin to the image path as ota image
copy %OUTPUT_PATH%\..\nspe.bin %OUTPUT_IMAGE_PATH%\image-ota.bin cp -rf ${OUTPUT_PATH}/../nspe.bin ${OUTPUT_IMAGE_PATH}/image-ota.bin
# concatenate mbl-ns.bin and nspe.bin # concatenate mbl-ns.bin and nspe.bin
%SREC_CAT% %OUTPUT_IMAGE_PATH%\mbl-ns.bin -Binary -offset 0 %OUTPUT_PATH%\..\nspe.bin -Binary -offset 0xa000 -fill 0xFF 0x7FFC 0xA000 -o %OUTPUT_IMAGE_PATH%\image-all.bin -Binary ${SREC_CAT} ${OUTPUT_IMAGE_PATH}/mbl-ns.bin -Binary -offset 0 ${OUTPUT_PATH}/../nspe.bin -Binary -offset 0xa000 -fill 0xFF 0x7FFC 0xA000 -o ${OUTPUT_IMAGE_PATH}/image-all.bin -Binary
# Convert to HEX file
if exist %OUTPUT_IMAGE_PATH%\image-all.bin %SREC_CAT% %OUTPUT_IMAGE_PATH%\image-all.bin -Binary -offset 0x0C000000 -o %OUTPUT_IMAGE_PATH%\image-all.hex -Intel
# Convert to HEX file
if [ -e ${OUTPUT_IMAGE_PATH}/image-all.bin ]; then
${SREC_CAT} ${OUTPUT_IMAGE_PATH}/image-all.bin -Binary -offset 0x0C000000 -o ${OUTPUT_IMAGE_PATH}/image-all.hex -Intel
fi

0
NSPE/Project/WIFI_IOT/wifi_version.bat Normal file → Executable file
View File

View File

@ -71,9 +71,9 @@ typedef enum
#define LED2_GPIO_PORT GPIOA #define LED2_GPIO_PORT GPIOA
#define LED2_GPIO_CLK RCU_GPIOA #define LED2_GPIO_CLK RCU_GPIOA
#define LED3_PIN GPIO_PIN_8 #define LED3_PIN GPIO_PIN_6
#define LED3_GPIO_PORT GPIOB #define LED3_GPIO_PORT GPIOA
#define LED3_GPIO_CLK RCU_GPIOB #define LED3_GPIO_CLK RCU_GPIOA
#define COMn 1U #define COMn 1U
#define EVAL_COM0 USART2 #define EVAL_COM0 USART2

View File

@ -32,6 +32,13 @@ target_sources(app
../demo/cmsis_os_demo.c ../demo/cmsis_os_demo.c
) )
if(CONFIG_GY3513)
target_sources(app
PRIVATE
../../Utilities/gd32w515p_eval.c
)
endif(CONFIG_GY3513)
target_link_libraries(app target_link_libraries(app
gd32w51x_peripheral_api gd32w51x_peripheral_api
gd32w51x_wifi_api gd32w51x_wifi_api
@ -53,6 +60,13 @@ target_sources(app
_build_date.h _build_date.h
) )
if(CMAKE_HOST_UNIX)
set(BUILD_DATE_SCRIPT ${TAGET_PROJECT_DIR}/build_date.sh)
elseif(CMAKE_HOST_WIN32)
set(BUILD_DATE_SCRIPT ${TAGET_PROJECT_DIR}/build_date.bat)
endif()
message("Build script: ${BUILD_DATE_SCRIPT}")
add_custom_command(OUTPUT _build_date.h add_custom_command(OUTPUT _build_date.h
COMMAND ${TAGET_PROJECT_DIR}/build_date.bat ${PROJECT_SOURCE_DIR}/NSPE COMMAND ${BUILD_DATE_SCRIPT} ${PROJECT_SOURCE_DIR}/NSPE
) )

View File

@ -33,6 +33,7 @@ OF SUCH DAMAGE.
*/ */
/*============================ INCLUDES ======================================*/ /*============================ INCLUDES ======================================*/
#include "wrapper_freertos.h"
#include "wrapper_os.h" #include "wrapper_os.h"
#include "debug_print.h" #include "debug_print.h"
#include "bsp_inc.h" #include "bsp_inc.h"
@ -48,6 +49,10 @@ OF SUCH DAMAGE.
#ifdef CONFIG_FATFS_SUPPORT #ifdef CONFIG_FATFS_SUPPORT
#include "fatfs.h" #include "fatfs.h"
#endif #endif
#if defined (CONFIG_GY3513)
#include <gd32w515p_eval.h>
#endif // CONFIG_GY3513
/*============================ MACROS ========================================*/ /*============================ MACROS ========================================*/
/*============================ MACRO FUNCTIONS ===============================*/ /*============================ MACRO FUNCTIONS ===============================*/
/*============================ TYPES =========================================*/ /*============================ TYPES =========================================*/
@ -74,6 +79,31 @@ void do_ram_code_copy(void)
} }
#endif #endif
#if defined (CONFIG_GY3513)
static int32_t led_init(void)
{
gd_eval_led_init(LED1);
gd_eval_led_init(LED2);
gd_eval_led_init(LED3);
return 0;
}
void led_task(void *p_arg)
{
while (1) {
gd_eval_led_toggle(LED1);
sys_ms_sleep(200);
gd_eval_led_toggle(LED2);
sys_ms_sleep(200);
gd_eval_led_toggle(LED3);
sys_ms_sleep(200);
}
sys_task_delete(NULL);
}
#endif // CONFIG_GY3513
/*! /*!
\brief initialize application \brief initialize application
\param[in] none \param[in] none
@ -121,7 +151,14 @@ void start_task(void *p_arg)
*/ */
int main(void) int main(void)
{ {
#if defined (CONFIG_GY3513)
TaskHandle_t *stTaskHndl_led = NULL;
#endif // CONFIG_GY3513
platform_init(); platform_init();
#if defined (CONFIG_GY3513)
led_init();
#endif // CONFIG_GY3513
DEBUGPRINT("SDK git revision: "WIFI_GIT_REVISION" \r\n"); DEBUGPRINT("SDK git revision: "WIFI_GIT_REVISION" \r\n");
DEBUGPRINT("SDK version: V%d.%d.%d\r\n", (RE_NSPE_VERSION >> 24), ((RE_NSPE_VERSION & 0xFF0000) >> 16), (RE_NSPE_VERSION & 0xFFFF)); DEBUGPRINT("SDK version: V%d.%d.%d\r\n", (RE_NSPE_VERSION >> 24), ((RE_NSPE_VERSION & 0xFF0000) >> 16), (RE_NSPE_VERSION & 0xFFFF));
@ -129,8 +166,17 @@ int main(void)
sys_os_init(); sys_os_init();
if (NULL == sys_task_create(NULL, (const uint8_t *)"start_task", NULL, START_TASK_STK_SIZE, 0, #if defined (CONFIG_GY3513)
START_TASK_PRIO, start_task, NULL)) { #define LED_TASK_STK_SIZE 256
#define LED_TASK_PRIO (TASK_PRIO_APP_BASE + TASK_PRIO_HIGHER(1))
stTaskHndl_led = sys_task_create(NULL, (const uint8_t *)"led_task", NULL, LED_TASK_STK_SIZE, 0, LED_TASK_PRIO, led_task, NULL);
if (stTaskHndl_led == NULL) {
DEBUG_ERROR("Error, task create failed.\r\n");
}
#endif // CONFIG_GY3513
if (NULL == sys_task_create(NULL, (const uint8_t *)"start_task", NULL, START_TASK_STK_SIZE, 0, START_TASK_PRIO, start_task, NULL)) {
DEBUGPRINT("ERROR: create start task failed\r\n"); DEBUGPRINT("ERROR: create start task failed\r\n");
} }

View File

@ -735,5 +735,6 @@ void platform_init(void)
gdm3210x_fpga_init(); gdm3210x_fpga_init();
#elif CONFIG_PLATFORM == PLATFORM_ASIC_32W51X #elif CONFIG_PLATFORM == PLATFORM_ASIC_32W51X
gd32w51x_asic_init(); gd32w51x_asic_init();
#endif #endif
} }

View File

@ -38,7 +38,7 @@ OF SUCH DAMAGE.
#include "bsp_inc.h" #include "bsp_inc.h"
#include "debug_print.h" #include "debug_print.h"
#include "trng.h" #include "trng.h"
#include "mbedtls\md5.h" #include "mbedtls/md5.h"
unsigned char btrng_seed = 1; unsigned char btrng_seed = 1;
static unsigned int randPool; /* Pool of randomness. */ static unsigned int randPool; /* Pool of randomness. */

View File

@ -1,3 +0,0 @@
/* Do not change the content here, it's auto generated */
#define BUILD_DATE "2022/12/07 16:07:03"
#define DATE_GENERATED

View File

@ -1,8 +1,15 @@
# GD32W51x_WiFi_IOT # GD32W51x_WiFi_IOT
本仓库作为本人学习GD32 + RTOS + cmake知识使用开发环境为是在Linux。 本仓库作为本人学习GD32 + RTOS + Cmake相关知识使用开发环境为Linux(Ubuntu 22.04)
## 说明 ## 说明
1. 基于官网 GD32W51x v1.0.3开发; 1. 基于官网 GD32W51x v1.0.3开发;
2. 加入source + lunch支持 2. 加入source + lunch支持
### 环境配置
1. 临时增加工具链信息
```shell
ln -snf /opt/toolchains/gcc-arm-none-eabi/ prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8
```

View File

@ -35,25 +35,25 @@ OF SUCH DAMAGE.
#ifndef __ROM_EXPORT_MBEDTLS_H__ #ifndef __ROM_EXPORT_MBEDTLS_H__
#define __ROM_EXPORT_MBEDTLS_H__ #define __ROM_EXPORT_MBEDTLS_H__
#include "mbedtls\md5.h" #include "mbedtls/md5.h"
#include "mbedtls\sha1.h" #include "mbedtls/sha1.h"
#include "mbedtls\sha256.h" #include "mbedtls/sha256.h"
#include "mbedtls\sha512.h" #include "mbedtls/sha512.h"
#include "mbedtls\md.h" #include "mbedtls/md.h"
#include "mbedtls\cipher.h" #include "mbedtls/cipher.h"
#include "mbedtls\ssl_ciphersuites.h" #include "mbedtls/ssl_ciphersuites.h"
#include "mbedtls\dhm.h" #include "mbedtls/dhm.h"
#include "mbedtls\ecdh.h" #include "mbedtls/ecdh.h"
#include "mbedtls\ecp.h" #include "mbedtls/ecp.h"
#include "mbedtls\pk.h" #include "mbedtls/pk.h"
#include "mbedtls\ecp.h" #include "mbedtls/ecp.h"
#include "mbedtls\x509_crt.h" #include "mbedtls/x509_crt.h"
#include "mbedtls\bignum.h" #include "mbedtls/bignum.h"
#include "mbedtls\ctr_drbg.h" #include "mbedtls/ctr_drbg.h"
#include "mbedtls\ssl_ticket.h" #include "mbedtls/ssl_ticket.h"
#include "mbedtls\ssl_cookie.h" #include "mbedtls/ssl_cookie.h"
#include "mbedtls\base64.h" #include "mbedtls/base64.h"
#include "mbedtls\platform.h" #include "mbedtls/platform.h"
#include "mbedtls\memory_buffer_alloc.h" #include "mbedtls/memory_buffer_alloc.h"
#endif // __ROM_EXPORT_MBEDTLS_H__ #endif // __ROM_EXPORT_MBEDTLS_H__

View File

@ -51,7 +51,7 @@ OF SUCH DAMAGE.
#define PLATFORM_BOARD_32W515T_START 0 #define PLATFORM_BOARD_32W515T_START 0
#define PLATFORM_BOARD_32W515P_EVAL 1 #define PLATFORM_BOARD_32W515P_EVAL 1
#ifdef CONFIG_PLATFORM_ASIC #ifdef CONFIG_PLATFORM_ASIC
#define CONFIG_BOARD PLATFORM_BOARD_32W515T_START #define CONFIG_BOARD PLATFORM_BOARD_32W515P_EVAL
#endif #endif
#define XIP_FLASH_SIP 0 #define XIP_FLASH_SIP 0

View File

@ -21,3 +21,4 @@ LOCAL_KERNEL := prebuilts/qemu-kernel/mips/kernel-qemu
PRODUCT_COPY_FILES += \ PRODUCT_COPY_FILES += \
$(LOCAL_KERNEL):kernel $(LOCAL_KERNEL):kernel
OUT_DIR := $(TOPDIR)output

View File

@ -0,0 +1 @@
/opt/toolchains/gcc-arm-none-eabi/

View File

@ -1,8 +1,8 @@
set(CMAKE_SYSTEM_NAME Generic) set(CMAKE_SYSTEM_NAME Generic)
set(CROSS_COMPILE arm-none-eabi) set(CROSS_COMPILE arm-none-eabi-)
find_program(CMAKE_C_COMPILER ${CROSS_COMPILE}-gcc) find_program(CMAKE_C_COMPILER ${CROSS_COMPILE}gcc)
find_program(CMAKE_CXX_COMPILER ${CROSS_COMPILE}-g++) find_program(CMAKE_CXX_COMPILER ${CROSS_COMPILE}g++)
set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER}) set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER})

0
scripts/imgtool/srec_cat.exe Normal file → Executable file
View File