diff --git a/Examples/MAX32655/SDHC_FTHR/.cproject b/Examples/MAX32655/SDHC_FTHR/.cproject new file mode 100644 index 00000000000..207fc85f00a --- /dev/null +++ b/Examples/MAX32655/SDHC_FTHR/.cproject @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Examples/MAX32655/SDHC_FTHR/.project b/Examples/MAX32655/SDHC_FTHR/.project new file mode 100644 index 00000000000..af3e20d2563 --- /dev/null +++ b/Examples/MAX32655/SDHC_FTHR/.project @@ -0,0 +1,26 @@ + + + SDHC_FTHR + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + diff --git a/Examples/MAX32655/SDHC_FTHR/.settings/language.settings.xml b/Examples/MAX32655/SDHC_FTHR/.settings/language.settings.xml new file mode 100644 index 00000000000..7e2d73134e3 --- /dev/null +++ b/Examples/MAX32655/SDHC_FTHR/.settings/language.settings.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Examples/MAX32655/SDHC_FTHR/.settings/org.eclipse.cdt.codan.core.prefs b/Examples/MAX32655/SDHC_FTHR/.settings/org.eclipse.cdt.codan.core.prefs new file mode 100644 index 00000000000..59c0b37ba75 --- /dev/null +++ b/Examples/MAX32655/SDHC_FTHR/.settings/org.eclipse.cdt.codan.core.prefs @@ -0,0 +1,93 @@ +eclipse.preferences.version=1 +org.eclipse.cdt.codan.checkers.errnoreturn=Warning +org.eclipse.cdt.codan.checkers.errnoreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"No return\\")",implicit\=>false} +org.eclipse.cdt.codan.checkers.errreturnvalue=Error +org.eclipse.cdt.codan.checkers.errreturnvalue.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused return value\\")"} +org.eclipse.cdt.codan.checkers.nocommentinside=-Error +org.eclipse.cdt.codan.checkers.nocommentinside.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Nesting comments\\")"} +org.eclipse.cdt.codan.checkers.nolinecomment=-Error +org.eclipse.cdt.codan.checkers.nolinecomment.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Line comments\\")"} +org.eclipse.cdt.codan.checkers.noreturn=Error +org.eclipse.cdt.codan.checkers.noreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"No return value\\")",implicit\=>false} +org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation=Error +org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Abstract class cannot be instantiated\\")"} +org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem=Error +org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Ambiguous problem\\")"} +org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem=Warning +org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Assignment in condition\\")"} +org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem=Error +org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Assignment to itself\\")"} +org.eclipse.cdt.codan.internal.checkers.CStyleCastProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.CStyleCastProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"C-Style cast instead of C++ cast\\")"} +org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem=Warning +org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"No break at end of case\\")",no_break_comment\=>"no break",last_case_param\=>false,empty_case_param\=>false,enable_fallthrough_quickfix_param\=>false} +org.eclipse.cdt.codan.internal.checkers.CatchByReference=Warning +org.eclipse.cdt.codan.internal.checkers.CatchByReference.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Catching by reference is recommended\\")",unknown\=>false,exceptions\=>()} +org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem=Error +org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Circular inheritance\\")"} +org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization=Warning +org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Class members should be properly initialized\\")",skip\=>true} +org.eclipse.cdt.codan.internal.checkers.CopyrightProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.CopyrightProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Lack of copyright information\\")",regex\=>".*Copyright.*"} +org.eclipse.cdt.codan.internal.checkers.DecltypeAutoProblem=Error +org.eclipse.cdt.codan.internal.checkers.DecltypeAutoProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid 'decltype(auto)' specifier\\")"} +org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem=Error +org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Field cannot be resolved\\")"} +org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem=Error +org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Function cannot be resolved\\")"} +org.eclipse.cdt.codan.internal.checkers.GotoStatementProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.GotoStatementProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Goto statement used\\")"} +org.eclipse.cdt.codan.internal.checkers.InvalidArguments=Error +org.eclipse.cdt.codan.internal.checkers.InvalidArguments.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid arguments\\")"} +org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem=Error +org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid template argument\\")"} +org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem=Error +org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Label statement not found\\")"} +org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem=Error +org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Member declaration not found\\")"} +org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem=Error +org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Method cannot be resolved\\")"} +org.eclipse.cdt.codan.internal.checkers.MissCaseProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.MissCaseProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Missing cases in switch\\")"} +org.eclipse.cdt.codan.internal.checkers.MissDefaultProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.MissDefaultProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Missing default in switch\\")",defaultWithAllEnums\=>false} +org.eclipse.cdt.codan.internal.checkers.MissReferenceProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.MissReferenceProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Missing reference return value in assignment operator\\")"} +org.eclipse.cdt.codan.internal.checkers.MissSelfCheckProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.MissSelfCheckProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Missing self check in assignment operator\\")"} +org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker=-Info +org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Name convention for function\\")",pattern\=>"^[a-z]",macro\=>true,exceptions\=>()} +org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem=Warning +org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Class has a virtual method and non-virtual destructor\\")"} +org.eclipse.cdt.codan.internal.checkers.OverloadProblem=Error +org.eclipse.cdt.codan.internal.checkers.OverloadProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid overload\\")"} +org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem=Error +org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid redeclaration\\")"} +org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem=Error +org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid redefinition\\")"} +org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Return with parenthesis\\")"} +org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Format String Vulnerability\\")"} +org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem=Warning +org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Statement has no effect\\")",macro\=>true,exceptions\=>()} +org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem=Warning +org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Suggested parenthesis around expression\\")",paramNot\=>false} +org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem=Warning +org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Suspicious semicolon\\")",else\=>false,afterelse\=>false} +org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem=Error +org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Type cannot be resolved\\")"} +org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem=Warning +org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused function declaration\\")",macro\=>true} +org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem=Warning +org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused static function\\")",macro\=>true} +org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem=Warning +org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused variable declaration in file scope\\")",macro\=>true,exceptions\=>("@(\#)","$Id")} +org.eclipse.cdt.codan.internal.checkers.UsingInHeaderProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.UsingInHeaderProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Using directive in header\\")"} +org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem=Error +org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Symbol is not resolved\\")"} +org.eclipse.cdt.codan.internal.checkers.VirtualMethodCallProblem=-Error +org.eclipse.cdt.codan.internal.checkers.VirtualMethodCallProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Virtual method call in constructor/destructor\\")"} +org.eclipse.cdt.qt.core.qtproblem=Warning +org.eclipse.cdt.qt.core.qtproblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_ON_FILE_OPEN\=>true,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>null} diff --git a/Examples/MAX32655/SDHC_FTHR/.settings/org.eclipse.cdt.core.prefs b/Examples/MAX32655/SDHC_FTHR/.settings/org.eclipse.cdt.core.prefs new file mode 100644 index 00000000000..a06f3380cc9 --- /dev/null +++ b/Examples/MAX32655/SDHC_FTHR/.settings/org.eclipse.cdt.core.prefs @@ -0,0 +1,20 @@ +doxygen/doxygen_new_line_after_brief=true +doxygen/doxygen_use_brief_tag=false +doxygen/doxygen_use_javadoc_tags=true +doxygen/doxygen_use_pre_tag=false +doxygen/doxygen_use_structural_commands=false +eclipse.preferences.version=1 +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/BOARD/delimiter=; +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/BOARD/operation=replace +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/BOARD/value=FTHR_Apps_P1 +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/GCC_PREFIX/delimiter=; +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/GCC_PREFIX/operation=replace +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/GCC_PREFIX/value=arm-none-eabi- +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/PROJECT/delimiter=; +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/PROJECT/operation=replace +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/PROJECT/value=SDHC_FTHR +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/TARGET/delimiter=; +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/TARGET/operation=replace +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/TARGET/value=MAX32655 +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/append=true +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/appendContributed=true diff --git a/Examples/MAX32655/SDHC_FTHR/.settings/org.eclipse.core.resources.prefs b/Examples/MAX32655/SDHC_FTHR/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 00000000000..99f26c0203a --- /dev/null +++ b/Examples/MAX32655/SDHC_FTHR/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/Examples/MAX32655/SDHC_FTHR/.vscode/README.md b/Examples/MAX32655/SDHC_FTHR/.vscode/README.md new file mode 100644 index 00000000000..90fbcefc65d --- /dev/null +++ b/Examples/MAX32655/SDHC_FTHR/.vscode/README.md @@ -0,0 +1,47 @@ +# VSCode-Maxim + +_(If you're viewing this document from within Visual Studio Code you can press `CTRL+SHIFT+V` to open a Markdown preview window.)_ + +## Quick Links + +* [MSDK User Guide](https://analogdevicesinc.github.io/msdk/USERGUIDE/) +* [VSCode-Maxim Github](https://github.com/Analog-Devices-MSDK/VSCode-Maxim) + +## Introduction + +VSCode-Maxim is a set of [Visual Studio Code](https://code.visualstudio.com/) project configurations and utilities for enabling embedded development for [Analog Device's MSDK](https://github.com/Analog-Devices-MSDK/msdk) and the [MAX32xxx/MAX78xxx microcontrollers](https://www.analog.com/en/product-category/microcontrollers.html). + +The following features are supported: + +* Code editing with intellisense down to the register level +* Code compilation with the ability to easily re-target a project for different microcontrollers and boards +* Flashing programs +* GUI and command-line debugging + +## Dependencies + +* [Visual Studio Code](https://code.visualstudio.com/) + * [C/C++ VSCode Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) + * [Cortex-Debug Extension](https://marketplace.visualstudio.com/items?itemName=marus25.cortex-debug) +* [Analog Devices MSDK](https://analogdevicesinc.github.io/msdk/) + +## Installation + +Install the MSDK, then set `"MAXIM_PATH"` in your _user_ VS Code settings. + +See [Getting Started with Visual Studio Code](https://analogdevicesinc.github.io/msdk/USERGUIDE/#getting-started-with-visual-studio-code) in the MSDK User Guide for detailed instructions. + +## Usage + +See the [MSDK User Guide](https://analogdevicesinc.github.io/msdk/USERGUIDE/#visual-studio-code) for detailed usage info. + +## Issue Tracker + +Bug reports, feature requests, and contributions are welcome via the [issues](https://github.com/Analog-Devices-MSDK/VSCode-Maxim/issues) tracker on Github. + +New issues should contain _at minimum_ the following information: + +* Visual Studio Code version #s (see `Help -> About`) +* C/C++ Extension version # +* Target microcontroller and evaluation platform +* The projects `.vscode` folder and `Makefile` (where applicable). Standard compression formats such as `.zip`, `.rar`, `.tar.gz`, etc. are all acceptable. diff --git a/Examples/MAX32655/SDHC_FTHR/.vscode/c_cpp_properties.json b/Examples/MAX32655/SDHC_FTHR/.vscode/c_cpp_properties.json new file mode 100644 index 00000000000..dfbed47b581 --- /dev/null +++ b/Examples/MAX32655/SDHC_FTHR/.vscode/c_cpp_properties.json @@ -0,0 +1,53 @@ +{ + "configurations": [ + { + "name": "Win32", + "includePath": [ + "${default}" + ], + "defines": [ + "${default}" + ], + "intelliSenseMode": "gcc-arm", + "compilerPath": "${config:ARM_GCC_path}/bin/arm-none-eabi-gcc.exe", + "browse": { + "path": [ + "${default}" + ] + } + }, + { + "name": "Linux", + "includePath": [ + "${default}" + ], + "defines": [ + "${default}" + ], + "intelliSenseMode": "gcc-arm", + "compilerPath": "${config:ARM_GCC_path}/bin/arm-none-eabi-gcc", + "browse": { + "path": [ + "${default}" + ] + } + }, + { + "name": "Mac", + "includePath": [ + "${default}" + ], + "defines": [ + "${default}" + ], + "intelliSenseMode": "gcc-arm", + "compilerPath": "${config:ARM_GCC_path}/bin/arm-none-eabi-gcc", + "browse": { + "path": [ + "${default}" + ] + } + } + ], + "version": 4 +} \ No newline at end of file diff --git a/Examples/MAX32655/SDHC_FTHR/.vscode/flash.gdb b/Examples/MAX32655/SDHC_FTHR/.vscode/flash.gdb new file mode 100644 index 00000000000..8f22801a47d --- /dev/null +++ b/Examples/MAX32655/SDHC_FTHR/.vscode/flash.gdb @@ -0,0 +1,17 @@ +define flash_m4 + set architecture armv7e-m + set remotetimeout 10 + target remote | openocd -c "gdb_port pipe;log_output flash.log" -s $arg0/scripts -f interface/$arg1 -f target/$arg2 -c "init; reset halt" + load + compare-sections + monitor reset halt +end + +define flash_m4_run + set architecture armv7e-m + set remotetimeout 10 + target remote | openocd -c "gdb_port pipe;log_output flash.log" -s $arg0/scripts -f interface/$arg1 -f target/$arg2 -c "init; reset halt" + load + compare-sections + monitor resume +end diff --git a/Examples/MAX32655/SDHC_FTHR/.vscode/launch.json b/Examples/MAX32655/SDHC_FTHR/.vscode/launch.json new file mode 100644 index 00000000000..01fe5199048 --- /dev/null +++ b/Examples/MAX32655/SDHC_FTHR/.vscode/launch.json @@ -0,0 +1,133 @@ +{ + "configurations": [ + { + "name": "Debug Arm (Cortex-debug)", + "cwd":"${workspaceRoot}", + "executable": "${workspaceFolder}/build/${config:program_file}", + "loadFiles": ["${workspaceFolder}/build/${config:program_file}"], + "symbolFiles": [{ + "file": "${workspaceFolder}/build/${config:symbol_file}" + }], + "request": "launch", + "type": "cortex-debug", + "servertype": "openocd", + "linux": { + "gdbPath": "${config:ARM_GCC_path}/bin/arm-none-eabi-gdb", + "serverpath": "${config:OCD_path}/openocd", + }, + "windows": { + "gdbPath": "${config:ARM_GCC_path}/bin/arm-none-eabi-gdb.exe", + "serverpath": "${config:OCD_path}/openocd.exe", + }, + "osx": { + "gdbPath": "${config:ARM_GCC_path}/bin/arm-none-eabi-gdb", + "serverpath": "${config:OCD_path}/openocd", + }, + "searchDir": ["${config:OCD_path}/scripts"], + "configFiles": ["interface/${config:M4_OCD_interface_file}", "target/${config:M4_OCD_target_file}"], + "interface": "swd", + "runToEntryPoint": "main", + "svdFile": "${config:MAXIM_PATH}/Libraries/CMSIS/Device/Maxim/${config:target}/Include/${config:target}.svd" + }, + { + "name": "GDB (Arm M4)", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/build/${config:program_file}", + "args": [], + "stopAtEntry": true, + "cwd": "${workspaceFolder}", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "linux": { + "miDebuggerPath": "${config:ARM_GCC_path}/bin/arm-none-eabi-gdb", + "debugServerPath": "${config:OCD_path}/openocd", + }, + "windows": { + "miDebuggerPath": "${config:ARM_GCC_path}/bin/arm-none-eabi-gdb.exe", + "debugServerPath": "${config:OCD_path}/openocd.exe", + }, + "osx": { + "miDebuggerPath": "${config:ARM_GCC_path}/bin/arm-none-eabi-gdb", + "debugServerPath": "${config:OCD_path}/bin/openocd", + }, + "logging": { + "exceptions": true, + "trace": false, + "traceResponse": false, + "engineLogging": false + }, + "miDebuggerServerAddress": "localhost:3333", + "debugServerArgs": "-s ${config:OCD_path}/scripts -f interface/${config:M4_OCD_interface_file} -f target/${config:M4_OCD_target_file} -c \"init; reset halt\"", + "serverStarted": "Info : Listening on port 3333 for gdb connections", + "filterStderr": true, + "targetArchitecture": "arm", + "customLaunchSetupCommands": [ + {"text":"-list-features"} + ], + "setupCommands": [ + { "text":"set logging overwrite on"}, + { "text":"set logging file debug-arm.log"}, + { "text":"set logging on"}, + { "text":"cd ${workspaceFolder}" }, + { "text":"exec-file build/${config:program_file}" }, + { "text":"symbol-file build/${config:symbol_file}" }, + { "text":"target remote localhost:3333" }, + { "text":"monitor reset halt" }, + { "text":"set $pc=Reset_Handler"}, + { "text":"b main" } + ] + }, + { + "name": "GDB (RISC-V)", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/buildrv/${config:program_file}", + "args": [], + "stopAtEntry": false, + "cwd": "${workspaceFolder}", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "linux": { + "miDebuggerPath": "${config:xPack_GCC_path}/bin/riscv-none-elf-gdb", + "debugServerPath": "${config:OCD_path}/openocd", + }, + "windows": { + "miDebuggerPath": "${config:xPack_GCC_path}/bin/riscv-none-elf-gdb.exe", + "debugServerPath": "${config:OCD_path}/openocd.exe", + }, + "osx": { + "miDebuggerPath": "${config:xPack_GCC_path}/bin/riscv-none-elf-gdb", + "debugServerPath": "${config:OCD_path}/bin/openocd", + }, + "logging": { + "exceptions": true, + "trace": false, + "traceResponse": false, + "engineLogging": false + }, + "miDebuggerServerAddress": "localhost:3334", + "debugServerArgs": "-c \"gdb_port 3334\" -s ${config:OCD_path}/scripts -f interface/${config:RV_OCD_interface_file} -f target/${config:RV_OCD_target_file}", + "serverStarted": "Info : Listening on port 3334 for gdb connections", + "filterStderr": true, + "customLaunchSetupCommands": [ + {"text":"-list-features"} + ], + "targetArchitecture": "arm", + "setupCommands": [ + { "text":"set logging overwrite on"}, + { "text":"set logging file debug-riscv.log"}, + { "text":"set logging on"}, + { "text":"cd ${workspaceFolder}" }, + { "text": "set architecture riscv:rv32", "ignoreFailures": false }, + { "text":"exec-file build/${config:program_file}", "ignoreFailures": false }, + { "text":"symbol-file buildrv/${config:symbol_file}", "ignoreFailures": false }, + { "text":"target remote localhost:3334" }, + { "text":"b main" }, + { "text": "set $pc=Reset_Handler","ignoreFailures": false } + ] + } + ] +} diff --git a/Examples/MAX32655/SDHC_FTHR/.vscode/settings.json b/Examples/MAX32655/SDHC_FTHR/.vscode/settings.json new file mode 100644 index 00000000000..59e88f5ddcc --- /dev/null +++ b/Examples/MAX32655/SDHC_FTHR/.vscode/settings.json @@ -0,0 +1,81 @@ +{ + "terminal.integrated.env.windows": { + "Path":"${config:OCD_path};${config:ARM_GCC_path}/bin;${config:xPack_GCC_path}/bin;${config:MSYS_path}/usr/bin;${config:Make_path};${env:PATH}", + "MAXIM_PATH":"${config:MAXIM_PATH}" + }, + "terminal.integrated.defaultProfile.windows": "Command Prompt", + + "terminal.integrated.env.linux": { + "PATH":"${config:OCD_path}:${config:ARM_GCC_path}/bin:${config:xPack_GCC_path}/bin:${config:Make_path}:${env:PATH}", + "MAXIM_PATH":"${config:MAXIM_PATH}" + }, + "terminal.integrated.env.osx": { + "PATH":"${config:OCD_path}/bin:${config:ARM_GCC_path}/bin:${config:xPack_GCC_path}/bin:${config:Make_path}:{env:PATH}", + "MAXIM_PATH":"${config:MAXIM_PATH}" + }, + + "target":"MAX78000", + "board":"FTHR_RevA", + + "project_name":"${workspaceFolderBasename}", + + "program_file":"${config:project_name}.elf", + "symbol_file":"${config:program_file}", + + "M4_OCD_interface_file":"cmsis-dap.cfg", + "M4_OCD_target_file":"max78000.cfg", + "RV_OCD_interface_file":"ftdi/olimex-arm-usb-ocd-h.cfg", + "RV_OCD_target_file":"${config:target}_riscv.cfg", + + "v_Arm_GCC":"10.3", + "v_xPack_GCC":"12.2.0-3.1", + + "OCD_path":"${config:MAXIM_PATH}/Tools/OpenOCD", + "ARM_GCC_path":"${config:MAXIM_PATH}/Tools/GNUTools/${config:v_Arm_GCC}", + "xPack_GCC_path":"${config:MAXIM_PATH}/Tools/xPack/riscv-none-elf-gcc/${config:v_xPack_GCC}", + "Make_path":"${config:MAXIM_PATH}/Tools/GNUTools/Make", + "MSYS_path":"${config:MAXIM_PATH}/Tools/MSYS2", + + "C_Cpp.default.includePath": [ + "${workspaceFolder}", + "${workspaceFolder}/**", + "${config:MAXIM_PATH}/Libraries/Boards/${config:target}/Include", + "${config:MAXIM_PATH}/Libraries/Boards/${config:target}/${config:board}/Include", + "${config:MAXIM_PATH}/Libraries/CMSIS/Device/Maxim/${config:target}/Include", + "${config:MAXIM_PATH}/Libraries/CMSIS/Include", + "${config:ARM_GCC_path}/arm-none-eabi/include", + "${config:ARM_GCC_path}/lib/gcc/arm-none-eabi/${config:v_Arm_GCC}/include", + "${config:MAXIM_PATH}/Libraries/PeriphDrivers/Include/${config:target}", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/Camera", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/Display", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/Display/fonts", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/ExtMemory", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/LED", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/PMIC", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/PushButton", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/Touchscreen", + "${config:MAXIM_PATH}/Libraries/CLI/inc" + ], + "C_Cpp.default.browse.path": [ + "${workspaceFolder}", + "${config:MAXIM_PATH}/Libraries/Boards/${config:target}/Source", + "${config:MAXIM_PATH}/Libraries/Boards/${config:target}/${config:board}/Source", + "${config:MAXIM_PATH}/Libraries/PeriphDrivers/Source", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/Camera", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/Display", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/Display/fonts", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/LED", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/PMIC", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/PushButton", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/Touchscreen", + "${config:MAXIM_PATH}/Libraries/MiscDrivers", + "${config:MAXIM_PATH}/Libraries/CLI/src" + ], + "C_Cpp.default.defines": [ + + ], + "C_Cpp.default.forcedInclude": [ + "${workspaceFolder}/build/project_defines.h" + ] +} + diff --git a/Examples/MAX32655/SDHC_FTHR/.vscode/tasks.json b/Examples/MAX32655/SDHC_FTHR/.vscode/tasks.json new file mode 100644 index 00000000000..e95445e2b3e --- /dev/null +++ b/Examples/MAX32655/SDHC_FTHR/.vscode/tasks.json @@ -0,0 +1,115 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "type": "shell", + "command": "make -r -j 8 --output-sync=target --no-print-directory TARGET=${config:target} BOARD=${config:board} MAXIM_PATH=${config:MAXIM_PATH} MAKE=make PROJECT=${config:project_name}", + "osx":{ + "command": "source ~/.zshrc && make -r -j 8 --output-sync=target --no-print-directory TARGET=${config:target} BOARD=${config:board} MAXIM_PATH=${config:MAXIM_PATH} MAKE=make PROJECT=${config:project_name}" + }, + "group": "build", + "problemMatcher": [] + }, + { + "label": "clean", + "type": "shell", + "command": "make -j 8 clean --output-sync=target --no-print-directory TARGET=${config:target} BOARD=${config:board} MAXIM_PATH=${config:MAXIM_PATH} MAKE=make PROJECT=${config:project_name}", + "osx":{ + "command": "source ~/.zshrc && make -j 8 clean --output-sync=target --no-print-directory TARGET=${config:target} BOARD=${config:board} MAXIM_PATH=${config:MAXIM_PATH} MAKE=make PROJECT=${config:project_name}" + }, + "group": "build", + "problemMatcher": [] + }, + { + "label": "clean-periph", + "type": "shell", + "command": "make -j 8 distclean --output-sync=target --no-print-directory TARGET=${config:target} BOARD=${config:board} MAXIM_PATH=${config:MAXIM_PATH} MAKE=make PROJECT=${config:project_name}", + "osx":{ + "command": "source ~/.zshrc && make -j 8 distclean --output-sync=target --no-print-directory TARGET=${config:target} BOARD=${config:board} MAXIM_PATH=${config:MAXIM_PATH} MAKE=make PROJECT=${config:project_name}" + }, + "group": "build", + "problemMatcher": [] + }, + { + "label": "flash", + "type": "shell", + "command": "arm-none-eabi-gdb", + "args": [ + "--cd=\"${workspaceFolder}\"", + "--se=\"build/${config:program_file}\"", + "--symbols=build/${config:symbol_file}", + "-x=\"${workspaceFolder}/.vscode/flash.gdb\"", + "--ex=\"flash_m4 ${config:OCD_path} ${config:M4_OCD_interface_file} ${config:M4_OCD_target_file}\"", + "--batch" + ], + "group": "build", + "problemMatcher": [], + "dependsOn":["build"] + }, + { + "label": "flash & run", + "type": "shell", + "command": "arm-none-eabi-gdb", + "args": [ + "--cd=\"${workspaceFolder}\"", + "--se=\"build/${config:program_file}\"", + "--symbols=build/${config:symbol_file}", + "-x=\"${workspaceFolder}/.vscode/flash.gdb\"", + "--ex=\"flash_m4_run ${config:OCD_path} ${config:M4_OCD_interface_file} ${config:M4_OCD_target_file}\"", + "--batch" + ], + "group": "build", + "problemMatcher": [], + "dependsOn":["build"] + }, + { + "label": "erase flash", + "type": "shell", + "command": "openocd", + "args": [ + "-s", "${config:OCD_path}/scripts", + "-f", "interface/${config:M4_OCD_interface_file}", + "-f", "target/${config:M4_OCD_target_file}", + "-c", "\"init; reset halt; max32xxx mass_erase 0;\"", + "-c", "exit" + ], + "group":"build", + "problemMatcher": [], + "dependsOn":[] + }, + { + "label": "openocd (m4)", + "type": "shell", + "command": "openocd", + "args": [ + "-s", + "${config:OCD_path}/scripts", + "-f", + "interface/${config:M4_OCD_interface_file}", + "-f", + "target/${config:M4_OCD_target_file}", + "-c", + "\"init; reset halt\"" + ], + "problemMatcher": [], + "dependsOn":[] + }, + { + "label": "gdb (m4)", + "type": "shell", + "command": "arm-none-eabi-gdb", + "args": [ + "--ex=\"cd ${workspaceFolder}\"", + "--se=\"build/${config:program_file}\"", + "--symbols=build/${config:symbol_file}", + "--ex=\"target remote localhost:3333\"", + "--ex=\"monitor reset halt\"", + "--ex=\"b main\"", + "--ex=\"c\"" + ], + "problemMatcher": [], + "dependsOn":[] + }, + ] +} \ No newline at end of file diff --git a/Examples/MAX32655/SDHC_FTHR/MAX32655_SDHC_FAT.launch b/Examples/MAX32655/SDHC_FTHR/MAX32655_SDHC_FAT.launch new file mode 100644 index 00000000000..39d45f4e5e8 --- /dev/null +++ b/Examples/MAX32655/SDHC_FTHR/MAX32655_SDHC_FAT.launch @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Examples/MAX32655/SDHC_FTHR/Makefile b/Examples/MAX32655/SDHC_FTHR/Makefile new file mode 100644 index 00000000000..0c21ba1313d --- /dev/null +++ b/Examples/MAX32655/SDHC_FTHR/Makefile @@ -0,0 +1,381 @@ +############################################################################### + # + # Copyright (C) 2022-2023 Maxim Integrated Products, Inc. All Rights Reserved. + # (now owned by Analog Devices, Inc.), + # Copyright (C) 2023 Analog Devices, Inc. All Rights Reserved. This software + # is proprietary to Analog Devices, Inc. and its licensors. + # + # Licensed under the Apache License, Version 2.0 (the "License"); + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. + # + ############################################################################## + +# ** Readme! ** +# Don't edit this file! This is the core Makefile for a MaximSDK +# project. The available configuration options can be overridden +# in "project.mk", on the command-line, or with system environment +# variables. + +# See https://analogdevicesinc.github.io/msdk/USERGUIDE/#build-system +# for more detailed instructions on how to use this system. + +# The detailed instructions mentioned above are easier to read than +# this file, but the comments found in this file also outline the +# available configuration variables. This file is organized into +# sub-sections, some of which expose config variables. + + +# ******************************************************************************* +# Set the target microcontroller and board to compile for. + +# Every TARGET microcontroller has some Board Support Packages (BSPs) that are +# available for it under the MaximSDK/Libraries/Boards/TARGET folder. The BSP +# that gets selected is MaximSDK/Libraries/Boards/TARGET/BOARD. + +# Configuration Variables: +# - TARGET : Override the default target microcontroller. Ex: TARGET=MAX78000 +# - BOARD : Override the default BSP (case sensitive). Ex: BOARD=EvKit_V1, BOARD=FTHR_RevA +ifeq "$(TARGET)" "" +# Default target microcontroller +TARGET := MAX32655 +TARGET_UC := MAX32655 +TARGET_LC := max32655 +else +# "TARGET" has been overridden in the environment or on the command-line. +# We need to calculate an upper and lowercase version of the part number, +# because paths on Linux and MacOS are case-sensitive. +TARGET_UC := $(subst m,M,$(subst a,A,$(subst x,X,$(TARGET)))) +TARGET_LC := $(subst M,m,$(subst A,a,$(subst X,x,$(TARGET)))) +endif + +# Default board. +BOARD ?= FTHR_Apps_P1 + +# ******************************************************************************* +# Locate the MaximSDK + +# This Makefile needs to know where to find the MaximSDK, and the MAXIM_PATH variable +# should point to the root directory of the MaximSDK installation. Setting this manually +# is usually only required if you're working on the command-line. + +# If MAXIM_PATH is not specified, we assume the project still lives inside of the MaximSDK +# and move up from this project's original location. + +# Configuration Variables: +# - MAXIM_PATH : Tell this Makefile where to find the MaximSDK. Ex: MAXIM_PATH=C:/MaximSDK + + +ifneq "$(MAXIM_PATH)" "" +# Sanitize MAXIM_PATH for backslashes +MAXIM_PATH := $(subst \,/,$(MAXIM_PATH)) +# Locate some other useful paths... +LIBS_DIR := $(abspath $(MAXIM_PATH)/Libraries) +CMSIS_ROOT := $(LIBS_DIR)/CMSIS +endif + +# ******************************************************************************* +# Include project Makefile. We do this after formulating TARGET, BOARD, and MAXIM_PATH +# in case project.mk needs to reference those values. However, we also include +# this as early as possible in the Makefile so that it can append to or override +# the variables below. + + +PROJECTMK ?= $(abspath ./project.mk) +include $(PROJECTMK) +$(info Loaded project.mk) +# PROJECTMK is also used by implicit rules and other libraries to add project.mk as a watch file + +# ******************************************************************************* +# Final path sanitization and re-calculation. No options here. + +ifeq "$(MAXIM_PATH)" "" +# MAXIM_PATH is still not defined... +DEPTH := ../../../ +MAXIM_PATH := $(abspath $(DEPTH)) +$(warning Warning: MAXIM_PATH is not set! Set MAXIM_PATH in your environment or in project.mk to clear this warning.) +$(warning Warning: Attempting to use $(MAXIM_PATH) calculated from relative path) +else +# Sanitize MAXIM_PATH for backslashes +MAXIM_PATH := $(subst \,/,$(MAXIM_PATH)) +endif + +# Final recalculation of LIBS_DIR/CMSIS_ROOT +LIBS_DIR := $(abspath $(MAXIM_PATH)/Libraries) +CMSIS_ROOT := $(LIBS_DIR)/CMSIS + +# One final UC/LC check in case user set TARGET in project.mk +TARGET_UC := $(subst m,M,$(subst a,A,$(subst x,X,$(TARGET)))) +TARGET_LC := $(subst M,m,$(subst A,a,$(subst X,x,$(TARGET)))) + +export TARGET +export TARGET_UC +export TARGET_LC +export CMSIS_ROOT +# TODO: Remove dependency on exports for these variables. + +# ******************************************************************************* +# Set up search paths, and auto-detect all source code on those paths. + +# The following paths are searched by default, where "./" is the project directory. +# ./ +# |- *.h +# |- *.c +# |-include (optional) +# |- *.h +# |-src (optional) +# |- *.c + +# Configuration Variables: +# - VPATH : Tell this Makefile to search additional locations for source (.c) files. +# You should use the "+=" operator with this option. +# Ex: VPATH += your/new/path +# - IPATH : Tell this Makefile to search additional locations for header (.h) files. +# You should use the "+=" operator with this option. +# Ex: VPATH += your/new/path +# - SRCS : Tell this Makefile to explicitly add a source (.c) file to the build. +# This is really only useful if you want to add a source file that isn't +# on any VPATH, in which case you can add the full path to the file here. +# You should use the "+=" operator with this option. +# Ex: SRCS += your/specific/source/file.c +# - AUTOSEARCH : Set whether this Makefile should automatically detect .c files on +# VPATH and add them to the build. This is enabled by default. Set +# to 0 to disable. If autosearch is disabled, source files must be +# manually added to SRCS. +# Ex: AUTOSEARCH = 0 + + +# Where to find source files for this project. +VPATH += . +VPATH += src +VPATH := $(VPATH) + +# Where to find header files for this project +IPATH += . +IPATH += include +IPATH := $(IPATH) + +AUTOSEARCH ?= 1 +ifeq ($(AUTOSEARCH), 1) +# Auto-detect all C/C++ source files on VPATH +SRCS += $(wildcard $(addsuffix /*.c, $(VPATH))) +SRCS += $(wildcard $(addsuffix /*.cpp, $(VPATH))) +endif + +# Collapse SRCS before passing them on to the next stage +SRCS := $(SRCS) + +# ******************************************************************************* +# Set the output filename + +# Configuration Variables: +# - PROJECT : Override the default output filename. Ex: PROJECT=MyProject + + +# The default value creates a file named after the target micro. Ex: MAX78000.elf +PROJECT ?= $(TARGET_LC) + +# ******************************************************************************* +# Compiler options + +# Configuration Variables: +# - DEBUG : Set DEBUG=1 to build explicitly for debugging. This adds some additional +# symbols and sets -Og as the default optimization level. +# - MXC_OPTIMIZE_CFLAGS : Override the default compiler optimization level. +# Ex: MXC_OPTIMIZE_CFLAGS = -O2 +# - PROJ_CFLAGS : Add additional compiler flags to the build. +# You should use the "+=" operator with this option. +# Ex: PROJ_CFLAGS += -Wextra +# - MFLOAT_ABI : Set the floating point acceleration level. +# The only options are "hard", "soft", or "softfp". +# Ex: MFLOAT_ABI = hard +# - LINKERFILE : Override the default linkerfile. +# Ex: LINKERFILE = customlinkerfile.ld +# - LINKERPATH : Override the default search location for $(LINKERFILE) +# The default search location is $(CMSIS_ROOT)/Device/Maxim/$(TARGET_UC)/Source/GCC +# If $(LINKERFILE) cannot be found at this path, then the root project +# directory will be used as a fallback. + +# Select 'GCC' or 'IAR' compiler +ifeq "$(COMPILER)" "" +COMPILER := GCC +endif + +# Set default compiler optimization levels +ifeq "$(MAKECMDGOALS)" "release" +# Default optimization level for "release" builds (make release) +MXC_OPTIMIZE_CFLAGS ?= -O2 +DEBUG = 0 +endif + +ifeq ($(DEBUG),1) +# Optimizes for debugging as recommended +# by GNU for code-edit-debug cycles +# https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#Optimize-Options +MXC_OPTIMIZE_CFLAGS := -Og +endif + +# Default level if not building for release or explicitly for debug +MXC_OPTIMIZE_CFLAGS ?= -O2 + +# Set compiler flags +PROJ_CFLAGS += -Wall # Enable warnings +PROJ_CFLAGS += -DMXC_ASSERT_ENABLE + +# Set hardware floating point acceleration. +# Options are: +# - hard +# - soft +# - softfp (default if MFLOAT_ABI is not set) +MFLOAT_ABI ?= softfp +# MFLOAT_ABI must be exported to other Makefiles +export MFLOAT_ABI + +# This path contains system-level intialization files for the target micro. Add to the build. +VPATH += $(CMSIS_ROOT)/Device/Maxim/$(TARGET_UC)/Source + +# ******************************************************************************* +# Secure Boot Tools (SBT) + +# This section integrates the Secure Boot Tools. It's intended for use with +# microcontrollers that have a secure bootloader. + +# Enabling SBT integration will add some special rules, such as "make sla", "make scpa", etc. + +# Configuration variables: +# SBT : Toggle SBT integration. Set to 1 to enable, or 0 +# to disable +# MAXIM_SBT_DIR : Specify the location of the SBT tool binaries. This defaults to +# Tools/SBT in the MaximSDK. The standalone SBT installer will override +# this via an environment variable. +# TARGET_SEC : Specify the part number to be passed into the SBT. This should match +# the secure variant part #. The default value will depend on TARGET. +# For example, TARGET=MAX32650 will result in TARGET_SEC=MAX32651, and +# the default selection happens in Tools/SBT/SBT-config. +# However, if there are multiple secure part #s for the target +# microcontroller this variable may need to be changed. + +SBT ?= 0 +ifeq ($(SBT), 1) +MAXIM_SBT_DIR ?= $(MAXIM_PATH)/Tools/SBT +MAXIM_SBT_DIR := $(subst \,/,$(MAXIM_SBT_DIR)) +# ^ Must sanitize path for \ on Windows, since this may come from an environment +# variable. + +export MAXIM_SBT_DIR # SBTs must have this environment variable defined to work + +# SBT-config.mk and SBT-rules.mk are included further down this Makefile. + +endif # SBT + +# ******************************************************************************* +# Default goal selection. This section allows you to override the default goal +# that will run if no targets are specified on the command-line. +# (ie. just running 'make' instead of 'make all') + +# Configuration variables: +# .DEFAULT_GOAL : Set the default goal if no targets were specified on the +# command-line +# ** "override" must be used with this variable. ** +# Ex: "override .DEFAULT_GOAL = mygoal" + +ifeq "$(.DEFAULT_GOAL)" "" +ifeq ($(SBT),1) +override .DEFAULT_GOAL := sla +else +override .DEFAULT_GOAL := all +endif +endif + +# Developer note: 'override' is used above for legacy Makefile compatibility. +# gcc.mk/gcc_riscv.mk need to hard-set 'all' internally, so this new system +# uses 'override' to come in over the top without breaking old projects. + +# It's also necessary to explicitly set MAKECMDGOALS... +ifeq "$(MAKECMDGOALS)" "" +MAKECMDGOALS:=$(.DEFAULT_GOAL) +endif + +# Enable colors when --sync-output is used. +# See https://www.gnu.org/software/make/manual/make.html#Terminal-Output (section 13.2) +ifneq ($(MAKE_TERMOUT),) +PROJ_CFLAGS += -fdiagnostics-color=always +endif + +ifneq ($(FORCE_COLOR),) +PROJ_CFLAGS += -fdiagnostics-color=always +endif + +# ******************************************************************************* +# Include SBT config. We need to do this here because it needs to know +# the current MAKECMDGOAL. +ifeq ($(SBT),1) +include $(MAXIM_PATH)/Tools/SBT/SBT-config.mk +endif + +# ******************************************************************************* +# Libraries + +# This section offers "toggle switches" to include or exclude the libraries that +# are available in the MaximSDK. Set a configuration variable to 1 to include the +# library in the build, or 0 to exclude. + +# Each library may also have its own library specific configuration variables. See +# Libraries/libs.mk for more details. + +# Configuration variables: +# - LIB_BOARD : Include the Board-Support Package (BSP) library. (Enabled by default) +# - LIB_PERIPHDRIVERS : Include the peripheral driver library. (Enabled by default) +# - LIB_CMSIS_DSP : Include the CMSIS-DSP library. +# - LIB_CORDIO : Include the Cordio BLE library +# - LIB_FCL : Include the Free Cryptographic Library (FCL) +# - LIB_FREERTOS : Include the FreeRTOS and FreeRTOS-Plus-CLI libraries +# - LIB_LC3 : Include the Low Complexity Communication Codec (LC3) library +# - LIB_LITTLEFS : Include the "little file system" (littleFS) library +# - LIB_LWIP : Include the lwIP library +# - LIB_MAXUSB : Include the MAXUSB library +# - LIB_SDHC : Include the SDHC library +include $(LIBS_DIR)/libs.mk + + +# ******************************************************************************* +# Rules + +# Include the rules for building for this target. All other makefiles should be +# included before this one. +include $(CMSIS_ROOT)/Device/Maxim/$(TARGET_UC)/Source/$(COMPILER)/$(TARGET_LC).mk + +# Include the rules that integrate the SBTs. SBTs are a special case that must be +# include after the core gcc rules to extend them. +ifeq ($(SBT), 1) +include $(MAXIM_PATH)/Tools/SBT/SBT-rules.mk +endif + + +# Get .DEFAULT_GOAL working. +ifeq "$(MAKECMDGOALS)" "" +MAKECMDGOALS:=$(.DEFAULT_GOAL) +endif + +$(info ---INFO: TARGET --> $(TARGET) BOARD --> $(BOARD) BOARD_DIR --> $(BOARD_DIR)) + +all: +# Extend the functionality of the "all" recipe here + arm-none-eabi-size --format=berkeley $(BUILD_DIR)/$(PROJECT).elf + +libclean: + $(MAKE) -f ${PERIPH_DRIVER_DIR}/periphdriver.mk clean.periph + +clean: +# Extend the functionality of the "clean" recipe here + +# The rule to clean out all the build products. +distclean: clean libclean diff --git a/Examples/MAX32655/SDHC_FTHR/README.md b/Examples/MAX32655/SDHC_FTHR/README.md new file mode 100644 index 00000000000..151090be095 --- /dev/null +++ b/Examples/MAX32655/SDHC_FTHR/README.md @@ -0,0 +1,158 @@ +## Description + +This example demonstrates the SDHC FAT Filesystem. The terminal prompts with a list of user-selectable tasks to run on the inserted Micro SD Card. + +## Software + +### Project Usage + +Universal instructions on building, flashing, and debugging this project can be found in the **[MSDK User Guide](https://analogdevicesinc.github.io/msdk/USERGUIDE/)**. + +### Project-Specific Build Notes + +* This project comes pre-configured for the MAX78000FTHR. See [Board Support Packages](https://analogdevicesinc.github.io/msdk/USERGUIDE/#board-support-packages) in the UG for instructions on changing the target board. + +## Required Connections + +- Connect a USB cable between the PC and the CN1 (USB/PWR) connector. +- Open a terminal application on the PC and connect to the EV kit's console UART at 115200, 8-N-1. +- Insert the SD card into the Micro SD Card Connector. + +## Expected Output + +``` +***** MAX78000 SDHC FAT Filesystem Example ***** +Card inserted. +CLI Initialized! Enter 'help' to see a list of available commands. + +$ help +help + +size: + Usage: size + Description: Find the Size of the SD Card and Free Space + +format: + Usage: format + Description: Format the Card + +mount: + Usage: mount + Description: Manually Mount Card + +ls: + Usage: ls + Description: list the contents of the current directory + +mkdir: + Usage: mkdir + Description: Create a directory + +file_create: + Usage: file_create + Description: Create a file of random data + +cd: + Usage: cd + Description: Move into a directory + +add_data: + Usage: add_data + Description: Add random Data to an Existing File + +del: + Usage: del + Description: Delete a file + +fatfs: + Usage: fatfs + Description: Format Card and Run Example of FatFS Operations + +unmount: + Usage: unmount + Description: Unmount card + + +$ format +format + + +*****THE DRIVE WILL BE FORMATTED IN 5 SECONDS***** +**************PRESS ANY KEY TO ABORT************** + +FORMATTING DRIVE +Drive formatted. +SD card mounted. +SD card unmounted. + +$ size +size +SD card mounted. +Disk Size: 7760896 bytes +Available: 7760864 bytes + +$ mount +mount +SD card mounted. + +$ mkdir Analog_Devices +mkdir Analog_Devices +Creating directory... +Directory Analog_Devices created. + +$ cd Analog_Devices +cd Analog_Devices +Changed to Analog_Devices + +$ file_create ADI 30 +file_create ADI 30 +Creating file ADI with length 30 +File opened! +30 bytes written to file! +File Closed! + +$ add_data ADI 25 +add_data ADI 25 +File opened! +25 bytes written to file +File closed. + +$ ls +ls +Listing Contents of 0:/Analog_Devices - +0:/Analog_Devices/ADI + +Finished listing contents + +$ del ADI +del ADI +Deleted file ADI + +$ fatfs +fatfs + + +*****THE DRIVE WILL BE FORMATTED IN 5 SECONDS***** +**************PRESS ANY KEY TO ABORT************** + +FORMATTING DRIVE +Drive formatted. +SD card mounted. +SD card unmounted. +SD card mounted. +SD Card Opened! +File opened! +256 bytes written to file! +File Closed! +Creating Directory... +Renaming File... +Attempting to read back file... +Read Back 256 bytes +Message: sjVNXdwfl-owoXGcTZ,5z,Sy8lfsNqDGrzio'O6vntRMoWODcIKP!C'y7tF.'W88ZjR81BpiibPhokQfa3w'cvmnr0EgE1MNDIhXKfBJGP6b?0tvHEPK-WNc7yuPdFNL6FPq10',Q,GSf3jSyY?MU0wv'FToTI!ct.E6Q4nbVuavg6h'48D5sR5mcepxf1l!MesddI7aZ9s?KIVnybRwZ.UBJpX1b?5oXP9wLKZcgW-k,gZ5HMIMwAcy!n9S?E57Analog_Devices +File Closed! + +$ unmount +unmount +SD card unmounted. +``` + diff --git a/Examples/MAX32655/SDHC_FTHR/include/sdhc.h b/Examples/MAX32655/SDHC_FTHR/include/sdhc.h new file mode 100644 index 00000000000..8325fd9c728 --- /dev/null +++ b/Examples/MAX32655/SDHC_FTHR/include/sdhc.h @@ -0,0 +1,71 @@ +/****************************************************************************** + * + * Copyright (C) 2022-2023 Maxim Integrated Products, Inc. All Rights Reserved. + * (now owned by Analog Devices, Inc.), + * Copyright (C) 2023 Analog Devices, Inc. All Rights Reserved. This software + * is proprietary to Analog Devices, Inc. and its licensors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + ******************************************************************************/ +#ifndef EXAMPLES_MAX32655_SDHC_FTHR_INCLUDE_SDHC_H_ +#define EXAMPLES_MAX32655_SDHC_FTHR_INCLUDE_SDHC_H_ + +/***** Includes *****/ +#include +#include +#include +#include + +#include "board.h" +#include "mxc_delay.h" +#include "mxc_device.h" +#include "gpio.h" +#include "uart.h" +#include "ff.h" + +/***** Definitions *****/ + +#define STRINGIFY(x) #x +#define TOSTRING(x) STRINGIFY(x) +#define MAXLEN 256 + +/***** FUNCTION PROTOTYPES *****/ + +void generateMessage(unsigned length); + +int mount(); + +int umount(); + +int formatSDHC(); + +int getSize(); + +int ls(); + +int createFile(char *file_name, unsigned int length); + +int appendFile(char *file_name, unsigned int length); + +int mkdir(char *dir_name); + +int cd(char *dir_name); + +int deleteFile(char *file_name); + +int example(); + +void waitCardInserted(); + +#endif // EXAMPLES_MAX32655_SDHC_FTHR_INCLUDE_SDHC_H_ diff --git a/Examples/MAX32655/SDHC_FTHR/include/user-cli.h b/Examples/MAX32655/SDHC_FTHR/include/user-cli.h new file mode 100644 index 00000000000..a8167668a8f --- /dev/null +++ b/Examples/MAX32655/SDHC_FTHR/include/user-cli.h @@ -0,0 +1,55 @@ +/****************************************************************************** + * + * Copyright (C) 2022-2023 Maxim Integrated Products, Inc. All Rights Reserved. + * (now owned by Analog Devices, Inc.), + * Copyright (C) 2023 Analog Devices, Inc. All Rights Reserved. This software + * is proprietary to Analog Devices, Inc. and its licensors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + ******************************************************************************/ +#ifndef EXAMPLES_MAX32655_SDHC_FTHR_INCLUDE_USER_CLI_H_ +#define EXAMPLES_MAX32655_SDHC_FTHR_INCLUDE_USER_CLI_H_ + +/* -------------------------------------------------- */ +// GLOBAL VARIABLE +/* -------------------------------------------------- */ +extern const command_t user_commands[]; +extern const unsigned int num_user_commands; + +/* -------------------------------------------------- */ +// FUNCTION PROTOTYPES +/* -------------------------------------------------- */ +int handle_size(int argc, char *argv[]); + +int handle_format(int argc, char *argv[]); + +int handle_mount(int argc, char *argv[]); + +int handle_ls(int argc, char *argv[]); + +int handle_mkdir(int argc, char *argv[]); + +int handle_createfile(int argc, char *argv[]); + +int handle_cd(int argc, char *argv[]); + +int handle_add_data(int argc, char *argv[]); + +int handle_del(int argc, char *argv[]); + +int handle_fatfs(int argc, char *argv[]); + +int handle_unmount(int argc, char *argv[]); + +#endif // EXAMPLES_MAX32655_SDHC_FTHR_INCLUDE_USER_CLI_H_ diff --git a/Examples/MAX32655/SDHC_FTHR/main.c b/Examples/MAX32655/SDHC_FTHR/main.c new file mode 100644 index 00000000000..99225475a2d --- /dev/null +++ b/Examples/MAX32655/SDHC_FTHR/main.c @@ -0,0 +1,61 @@ +/****************************************************************************** + * + * Copyright (C) 2022-2023 Maxim Integrated Products, Inc. All Rights Reserved. + * (now owned by Analog Devices, Inc.), + * Copyright (C) 2023 Analog Devices, Inc. All Rights Reserved. This software + * is proprietary to Analog Devices, Inc. and its licensors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + ******************************************************************************/ + +/** + * @file main.c + * @brief read and write sdhc + * @details This example uses the sdhc and ffat to read/write the file system on + * an SD card. The Fat library used supports long filenames (see ffconf.h) + * the max length is 256 characters. It uses the CLI library for taking user + * user commands. + * + * You must connect an sd card to the sd card slot. + */ + +/***** Includes *****/ +#include "board.h" +#include "cli.h" +#include "nvic_table.h" +#include "sdhc.h" +#include "uart.h" +#include "user-cli.h" + +/******************************************************************************/ +int main(void) +{ + int err; + printf("\n\n***** MAX32655 SDHC FAT Filesystem Example *****\n"); + + // Wait for SD Card to be inserted + waitCardInserted(); + + printf("Card inserted.\n"); + while (MXC_UART_GetActive(MXC_UART_GET_UART(CONSOLE_UART))) {} + + // Initialize CLI + if ((err = MXC_CLI_Init(MXC_UART_GET_UART(CONSOLE_UART), user_commands, num_user_commands)) != + E_NO_ERROR) { + return err; + } + + // Run CLI + while (1) {} +} diff --git a/Examples/MAX32655/SDHC_FTHR/project.mk b/Examples/MAX32655/SDHC_FTHR/project.mk new file mode 100644 index 00000000000..0b4f7e97ac5 --- /dev/null +++ b/Examples/MAX32655/SDHC_FTHR/project.mk @@ -0,0 +1,25 @@ +# This file can be used to set build configuration +# variables. These variables are defined in a file called +# "Makefile" that is located next to this one. + +# For instructions on how to use this system, see +# https://analogdevicesinc.github.io/msdk/USERGUIDE/#build-system + +#MXC_OPTIMIZE_CFLAGS = -Og +# ^ For example, you can uncomment this line to +# optimize the project for debugging + +# ********************************************************** + +# Add your config here! +ifneq ($(BOARD),FTHR_Apps_P1) +$(error ERR_NOTSUPPORTED: This project requires an SD card slot and is only supported for the MAX32655FTHR) +endif + +# Enable SDHC library +LIB_SDHC = 1 +# Use FatFS version R0.15 +FATFS_VERSION = ff15 + +# Enable CLI library +LIB_CLI = 1 diff --git a/Examples/MAX32655/SDHC_FTHR/src/sdhc.c b/Examples/MAX32655/SDHC_FTHR/src/sdhc.c new file mode 100644 index 00000000000..84cb9305965 --- /dev/null +++ b/Examples/MAX32655/SDHC_FTHR/src/sdhc.c @@ -0,0 +1,489 @@ +/****************************************************************************** + * + * Copyright (C) 2022-2023 Maxim Integrated Products, Inc. All Rights Reserved. + * (now owned by Analog Devices, Inc.), + * Copyright (C) 2023 Analog Devices, Inc. All Rights Reserved. This software + * is proprietary to Analog Devices, Inc. and its licensors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + ******************************************************************************/ + +#include "sdhc.h" + +/***** Globals *****/ +FATFS *fs; //FFat Filesystem Object +FATFS fs_obj; +FIL file; //FFat File Object +FRESULT err; //FFat Result (Struct) +FILINFO fno; //FFat File Information Object +DIR dir; //FFat Directory Object +TCHAR *FF_ERRORS[20]; +BYTE work[4096]; + +DWORD clusters_free = 0, sectors_free = 0, sectors_total = 0, volume_sn = 0; +UINT bytes_written = 0, bytes_read = 0, mounted = 0; + +static char charset[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789,.-#'?!"; +TCHAR message[MAXLEN], directory[MAXLEN], cwd[MAXLEN], filename[MAXLEN], volume_label[24], + volume = '0'; +mxc_gpio_cfg_t SDPowerEnablePin = { MXC_GPIO1, MXC_GPIO_PIN_12, MXC_GPIO_FUNC_OUT, + MXC_GPIO_PAD_NONE, MXC_GPIO_VSSEL_VDDIO }; + +// /***** FUNCTIONS *****/ + +void generateMessage(unsigned length) +{ + for (int i = 0; i < length; i++) { + /*Generate some random data to put in file*/ + message[i] = charset[rand() % (sizeof(charset) - 1)]; + } +} + +int mount() +{ + fs = &fs_obj; + + if ((err = f_mount(fs, "", 1)) != FR_OK) { //Mount the default drive to fs now + printf("Error opening SD card: %s\n", FF_ERRORS[err]); + f_mount(NULL, "", 0); + } else { + printf("SD card mounted.\n"); + mounted = 1; + } + + f_getcwd(cwd, sizeof(cwd)); //Set the Current working directory + + return err; +} + +int umount() +{ + if ((err = f_mount(NULL, "", 0)) != FR_OK) { //Unmount the default drive from its mount point + printf("Error unmounting volume: %s\n", FF_ERRORS[err]); + } else { + printf("SD card unmounted.\n"); + mounted = 0; + } + + return err; +} + +int formatSDHC() +{ + printf("\n\n*****THE DRIVE WILL BE FORMATTED IN 5 SECONDS*****\n"); + printf("**************PRESS ANY KEY TO ABORT**************\n\n"); + MXC_UART_ClearRXFIFO(MXC_UART0); + MXC_Delay(MSEC(5000)); + + if (MXC_UART_GetRXFIFOAvailable(MXC_UART0) > 0) { + return E_ABORT; + } + + printf("FORMATTING DRIVE\n"); + + MKFS_PARM format_options = { .fmt = FM_ANY }; + + if ((err = f_mkfs("", &format_options, work, sizeof(work))) != FR_OK) { + printf("Error formatting SD card: %s\n", FF_ERRORS[err]); + } else { + printf("Drive formatted.\n"); + } + + mount(); + + if ((err = f_setlabel("MAXIM")) != FR_OK) { + printf("Error setting drive label: %s\n", FF_ERRORS[err]); + f_mount(NULL, "", 0); + } + + umount(); + + return err; +} + +int getSize() +{ + if (!mounted) { + mount(); + } + + if ((err = f_getfree(&volume, &clusters_free, &fs)) != FR_OK) { + printf("Error finding free size of card: %s\n", FF_ERRORS[err]); + f_mount(NULL, "", 0); + } + + sectors_total = (fs->n_fatent - 2) * fs->csize; + sectors_free = clusters_free * fs->csize; + + printf("Disk Size: %u bytes\n", sectors_total / 2); + printf("Available: %u bytes\n", sectors_free / 2); + + return err; +} + +int ls() +{ + if (!mounted) { + mount(); + } + + printf("Listing Contents of %s - \n", cwd); + + if ((err = f_opendir(&dir, cwd)) == FR_OK) { + while (1) { + err = f_readdir(&dir, &fno); + + if (err != FR_OK || fno.fname[0] == 0) { + break; + } + + printf("%s/%s", cwd, fno.fname); + + if (fno.fattrib & AM_DIR) { + printf("/"); + } + + printf("\n"); + } + + f_closedir(&dir); + } else { + printf("Error opening directory!\n"); + return err; + } + + printf("\nFinished listing contents\n"); + + return err; +} + +int createFile(char *file_name, unsigned int length) +{ + // unsigned int length = 128; + + if (!mounted) { + mount(); + } + + snprintf(filename, MAXLEN, "%s", file_name); + + if (length > MAXLEN) { + printf("Error. File size limit for this example is %d bytes.\n", MAXLEN); + return FR_INVALID_PARAMETER; + } + + printf("Creating file %s with length %d\n", filename, length); + + if ((err = f_open(&file, (const TCHAR *)filename, FA_CREATE_ALWAYS | FA_WRITE)) != FR_OK) { + printf("Error opening file: %s\n", FF_ERRORS[err]); + f_mount(NULL, "", 0); + return err; + } + + printf("File opened!\n"); + + generateMessage(length); + + if ((err = f_write(&file, &message, length, &bytes_written)) != FR_OK) { + printf("Error writing file: %s\n", FF_ERRORS[err]); + f_mount(NULL, "", 0); + return err; + } + + printf("%d bytes written to file!\n", bytes_written); + + if ((err = f_close(&file)) != FR_OK) { + printf("Error closing file: %s\n", FF_ERRORS[err]); + f_mount(NULL, "", 0); + return err; + } + + printf("File Closed!\n"); + return err; +} + +int appendFile(char *file_name, unsigned int length) +{ + if (!mounted) { + mount(); + } + + snprintf(filename, MAXLEN, "%s", file_name); + + if ((err = f_stat((const TCHAR *)filename, &fno)) == FR_NO_FILE) { + printf("File %s doesn't exist!\n", (const TCHAR *)filename); + return err; + } + + if (length > MAXLEN) { + printf("Error. Size limit for this example is %d bytes.\n", MAXLEN); + return FR_INVALID_PARAMETER; + } + + if ((err = f_open(&file, (const TCHAR *)filename, FA_OPEN_APPEND | FA_WRITE)) != FR_OK) { + printf("Error opening file %s\n", FF_ERRORS[err]); + return err; + } + + printf("File opened!\n"); + + generateMessage(length); + + if ((err = f_write(&file, &message, length, &bytes_written)) != FR_OK) { + printf("Error writing file: %s\n", FF_ERRORS[err]); + return err; + } + + printf("%d bytes written to file\n", bytes_written); + + if ((err = f_close(&file)) != FR_OK) { + printf("Error closing file: %s\n", FF_ERRORS[err]); + return err; + } + + printf("File closed.\n"); + return err; +} + +int mkdir(char *dir_name) +{ + if (!mounted) { + mount(); + } + + snprintf(directory, MAXLEN, "%s", dir_name); + + err = f_stat((const TCHAR *)directory, &fno); + + if (err == FR_NO_FILE) { + printf("Creating directory...\n"); + + if ((err = f_mkdir((const TCHAR *)directory)) != FR_OK) { + printf("Error creating directory: %s\n", FF_ERRORS[err]); + f_mount(NULL, "", 0); + return err; + } else { + printf("Directory %s created.\n", directory); + } + + } else { + printf("Directory already exists.\n"); + } + + return err; +} + +int cd(char *dir_name) +{ + if (!mounted) { + mount(); + } + + snprintf(directory, MAXLEN, "%s", dir_name); + + if ((err = f_stat((const TCHAR *)directory, &fno)) == FR_NO_FILE) { + printf("Directory doesn't exist (Did you mean mkdir?)\n"); + return err; + } + + if ((err = f_chdir((const TCHAR *)directory)) != FR_OK) { + printf("Error in chdir: %s\n", FF_ERRORS[err]); + f_mount(NULL, "", 0); + return err; + } + + printf("Changed to %s\n", directory); + f_getcwd(cwd, sizeof(cwd)); + + return err; +} + +int deleteFile(char *file_name) +{ + if (!mounted) { + mount(); + } + + snprintf(filename, MAXLEN, "%s", file_name); + + if ((err = f_stat((const TCHAR *)filename, &fno)) == FR_NO_FILE) { + printf("File or directory doesn't exist\n"); + return err; + } + + if ((err = f_unlink(filename)) != FR_OK) { + printf("Error deleting file\n"); + return err; + } + + printf("Deleted file %s\n", filename); + return err; +} + +int example() +{ + unsigned int length = 256; + + if ((err = formatSDHC()) != FR_OK) { + printf("Error Formatting SD Card: %s\n", FF_ERRORS[err]); + return err; + } + + //open SD Card + if ((err = mount()) != FR_OK) { + printf("Error opening SD Card: %s\n", FF_ERRORS[err]); + return err; + } + + printf("SD Card Opened!\n"); + + if ((err = f_setlabel("MAXIM")) != FR_OK) { + printf("Error setting drive label: %s\n", FF_ERRORS[err]); + f_mount(NULL, "", 0); + return err; + } + + if ((err = f_getfree(&volume, &clusters_free, &fs)) != FR_OK) { + printf("Error finding free size of card: %s\n", FF_ERRORS[err]); + f_mount(NULL, "", 0); + return err; + } + + if ((err = f_getlabel(&volume, volume_label, &volume_sn)) != FR_OK) { + printf("Error reading drive label: %s\n", FF_ERRORS[err]); + f_mount(NULL, "", 0); + return err; + } + + if ((err = f_open(&file, "0:HelloWorld.txt", FA_CREATE_ALWAYS | FA_WRITE)) != FR_OK) { + printf("Error opening file: %s\n", FF_ERRORS[err]); + f_mount(NULL, "", 0); + return err; + } + + printf("File opened!\n"); + + generateMessage(length); + + if ((err = f_write(&file, &message, length, &bytes_written)) != FR_OK) { + printf("Error writing file: %s\n", FF_ERRORS[err]); + f_mount(NULL, "", 0); + return err; + } + + printf("%d bytes written to file!\n", bytes_written); + + if ((err = f_close(&file)) != FR_OK) { + printf("Error closing file: %s\n", FF_ERRORS[err]); + f_mount(NULL, "", 0); + return err; + } + + printf("File Closed!\n"); + + if ((err = f_chmod("HelloWorld.txt", 0, AM_RDO | AM_ARC | AM_SYS | AM_HID)) != FR_OK) { + printf("Error in chmod: %s\n", FF_ERRORS[err]); + f_mount(NULL, "", 0); + return err; + } + + err = f_stat("MaximSDHC", &fno); + + if (err == FR_NO_FILE) { + printf("Creating Directory...\n"); + + if ((err = f_mkdir("MaximSDHC")) != FR_OK) { + printf("Error creating directory: %s\n", FF_ERRORS[err]); + f_mount(NULL, "", 0); + return err; + } + } + + printf("Renaming File...\n"); + + if ((err = f_rename("0:HelloWorld.txt", "0:MaximSDHC/HelloMaxim.txt")) != + FR_OK) { //cr: clearify 0:file notation + printf("Error moving file: %s\n", FF_ERRORS[err]); + f_mount(NULL, "", 0); + return err; + } + + if ((err = f_chdir("/MaximSDHC")) != FR_OK) { + printf("Error in chdir: %s\n", FF_ERRORS[err]); + f_mount(NULL, "", 0); + return err; + } + + printf("Attempting to read back file...\n"); + + if ((err = f_open(&file, "HelloMaxim.txt", FA_READ)) != FR_OK) { + printf("Error opening file: %s\n", FF_ERRORS[err]); + f_mount(NULL, "", 0); + return err; + } + + if ((err = f_read(&file, &message, bytes_written, &bytes_read)) != FR_OK) { + printf("Error reading file: %s\n", FF_ERRORS[err]); + f_mount(NULL, "", 0); + return err; + } + + printf("Read Back %d bytes\n", bytes_read); + printf("Message: "); + printf("%s", message); + printf("\n"); + + if ((err = f_close(&file)) != FR_OK) { + printf("Error closing file: %s\n", FF_ERRORS[err]); + f_mount(NULL, "", 0); + return err; + } + + printf("File Closed!\n"); + + //unmount SD Card + //f_mount(fs, "", 0); + if ((err = f_mount(NULL, "", 0)) != FR_OK) { + printf("Error unmounting volume: %s\n", FF_ERRORS[err]); + return err; + } + + return 0; +} + +void waitCardInserted() +{ + // On the MAX78000FTHR board, P0.12 will be pulled low when a card is inserted. + mxc_gpio_cfg_t cardDetect; + cardDetect.port = MXC_GPIO0; + cardDetect.mask = MXC_GPIO_PIN_12; + cardDetect.func = MXC_GPIO_FUNC_IN; + cardDetect.pad = MXC_GPIO_PAD_NONE; + cardDetect.vssel = MXC_GPIO_VSSEL_VDDIOH; + + MXC_GPIO_Config(&cardDetect); + + // Exit function if card is already inserted + if (MXC_GPIO_InGet(MXC_GPIO0, MXC_GPIO_PIN_12) == 0) { + return; + } + + printf("Insert SD card to continue.\n"); + + while (MXC_GPIO_InGet(MXC_GPIO0, MXC_GPIO_PIN_12) != 0) { + // Spin waiting for card to be inserted. + } + + // Card has been detected, exit the function. +} diff --git a/Examples/MAX32655/SDHC_FTHR/src/user-cli.c b/Examples/MAX32655/SDHC_FTHR/src/user-cli.c new file mode 100644 index 00000000000..f0ba36207ed --- /dev/null +++ b/Examples/MAX32655/SDHC_FTHR/src/user-cli.c @@ -0,0 +1,155 @@ +/****************************************************************************** + * + * Copyright (C) 2022-2023 Maxim Integrated Products, Inc. All Rights Reserved. + * (now owned by Analog Devices, Inc.), + * Copyright (C) 2023 Analog Devices, Inc. All Rights Reserved. This software + * is proprietary to Analog Devices, Inc. and its licensors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + ******************************************************************************/ + +#include +#include "cli.h" +#include "sdhc.h" +#include "user-cli.h" + +const command_t user_commands[] = { + { "size", "size", "Find the Size of the SD Card and Free Space", handle_size }, + { "format", "format", "Format the Card", handle_format }, + { "mount", "mount", "Manually Mount Card", handle_mount }, + { "ls", "ls", "list the contents of the current directory", handle_ls }, + { "mkdir", "mkdir ", "Create a directory", handle_mkdir }, + { "file_create", "file_create ", + "Create a file of random data", handle_createfile }, + { "cd", "cd ", "Move into a directory", handle_cd }, + { "add_data", "add_data ", + "Add random Data to an Existing File", handle_add_data }, + { "del", "del ", "Delete a file", handle_del }, + { "fatfs", "fatfs", "Format Card and Run Example of FatFS Operations", handle_fatfs }, + { "unmount", "unmount", "Unmount card", handle_unmount }, +}; + +const unsigned int num_user_commands = sizeof(user_commands) / sizeof(command_t); + +int handle_size(int argc, char *argv[]) +{ + if (argc != 1) { + printf("Incorrect usage. Too many parameters.\n"); + return E_INVALID; + } + + return getSize(); +} + +int handle_format(int argc, char *argv[]) +{ + if (argc != 1) { + printf("Incorrect usage. Too many parameters.\n"); + return E_INVALID; + } + + return formatSDHC(); +} + +int handle_mount(int argc, char *argv[]) +{ + if (argc != 1) { + printf("Incorrect usage. Too many parameters.\n"); + return E_INVALID; + } + + return mount(); +} + +int handle_ls(int argc, char *argv[]) +{ + if (argc != 1) { + printf("Incorrect usage. Too many parameters.\n"); + return E_INVALID; + } + + return ls(); +} + +int handle_mkdir(int argc, char *argv[]) +{ + if (argc != 2) { + printf("Incorrect usage. Please provide directory name.\n"); + return E_INVALID; + } + + return mkdir(argv[1]); +} + +int handle_createfile(int argc, char *argv[]) +{ + if (argc != 3) { + printf("Incorrect usage. Please provide filename and length.\n"); + return E_INVALID; + } + + unsigned int length = atoi(argv[2]); + return createFile(argv[1], length); +} + +int handle_cd(int argc, char *argv[]) +{ + if (argc != 2) { + printf("Incorrect usage. Please provide directory name.\n"); + return E_INVALID; + } + + return cd(argv[1]); +} + +int handle_add_data(int argc, char *argv[]) +{ + if (argc != 3) { + printf("Incorrect usage. Please provide filename and length.\n"); + return E_INVALID; + } + + unsigned int length = atoi(argv[2]); + return appendFile(argv[1], length); +} + +int handle_del(int argc, char *argv[]) +{ + if (argc != 2) { + printf("Incorrect usage. Please provide filename.\n"); + return E_INVALID; + } + + return deleteFile(argv[1]); +} + +int handle_fatfs(int argc, char *argv[]) +{ + if (argc != 1) { + printf("Incorrect usage. Too many parameters.\n"); + return E_INVALID; + } + + return example(); +} + +int handle_unmount(int argc, char *argv[]) +{ + if (argc != 1) { + printf("Incorrect usage. Too many parameters.\n"); + return E_INVALID; + } + + return umount(); +} diff --git a/Libraries/Boards/MAX32655/FTHR_Apps_P1/Include/board.h b/Libraries/Boards/MAX32655/FTHR_Apps_P1/Include/board.h index a9771eff55c..dc299188c89 100644 --- a/Libraries/Boards/MAX32655/FTHR_Apps_P1/Include/board.h +++ b/Libraries/Boards/MAX32655/FTHR_Apps_P1/Include/board.h @@ -27,6 +27,8 @@ #define LIBRARIES_BOARDS_MAX32655_FTHR_APPS_P1_INCLUDE_BOARD_H_ #include +#include +#include #include "led.h" #include "pb.h" @@ -165,6 +167,25 @@ int Microphone_Power(int on); * \return Success/Fail, see \ref MXC_Error_Codes for a list of return codes. */ int Camera_Power(int on); +/** + * \brief SD card power control. + * + * \param on 1 for ON, 0 for OFF + * + * \return Success/Fail, see \ref MXC_Error_Codes for a list of return codes. + */ +int SD_Power(int on); + +/** + * \brief Informs the caller which SPI connections are used for SD card communication + * + * \param spi The SPI instance used + * \param ssPort The GPIO port used for the SD card's SSEL pin + * \param ssPin The GPIO pin number used for the SD card's SSEL pin + * + * \return Success/Fail, see \ref MXC_Error_Codes for a list of return codes. + */ +void SD_Get_Connections(mxc_spi_regs_t **spi, mxc_gpio_regs_t **ssPort, int *ssPin); #ifdef __cplusplus } diff --git a/Libraries/Boards/MAX32655/FTHR_Apps_P1/Source/board.c b/Libraries/Boards/MAX32655/FTHR_Apps_P1/Source/board.c index 2e5c3bb38f5..cec61648dec 100644 --- a/Libraries/Boards/MAX32655/FTHR_Apps_P1/Source/board.c +++ b/Libraries/Boards/MAX32655/FTHR_Apps_P1/Source/board.c @@ -411,3 +411,38 @@ int Microphone_Power(int on) return max20303_mic_power(on); } + +/******************************************************************************/ +int SD_Power(int on) +{ + mxc_gpio_cfg_t sd_power_pin; + int err; + + sd_power_pin.port = MXC_GPIO0; + sd_power_pin.mask = MXC_GPIO_PIN_15; + sd_power_pin.func = MXC_GPIO_FUNC_OUT; + sd_power_pin.pad = MXC_GPIO_PAD_NONE; + sd_power_pin.vssel = MXC_GPIO_VSSEL_VDDIO; + + if ((err = MXC_GPIO_Config(&sd_power_pin)) != E_NO_ERROR) { + return err; + } + + if (on) { + MXC_GPIO_OutSet(sd_power_pin.port, sd_power_pin.mask); + } else { + MXC_GPIO_OutClr(sd_power_pin.port, sd_power_pin.mask); + } + + return E_NO_ERROR; +} + +/******************************************************************************/ +#ifdef MXC_SPI0 +void SD_Get_Connections(mxc_spi_regs_t **spi, mxc_gpio_regs_t **ssPort, int *ssPin) +{ + *spi = MXC_SPI0; + *ssPort = MXC_GPIO0; + *ssPin = 4; +} +#endif diff --git a/Libraries/Boards/MAX32655/FTHR_Apps_P1/examples.txt b/Libraries/Boards/MAX32655/FTHR_Apps_P1/examples.txt index ed2d9df06da..02562494b84 100644 --- a/Libraries/Boards/MAX32655/FTHR_Apps_P1/examples.txt +++ b/Libraries/Boards/MAX32655/FTHR_Apps_P1/examples.txt @@ -45,6 +45,7 @@ LPCMP Pulse_Train RTC RTC_Backup +SDHC_FTHR SPI TMR TRNG