finished lab 3

This commit is contained in:
Trevor Barnes
2019-10-22 11:34:22 -05:00
parent d038cd8ee3
commit 5723965f38
27 changed files with 7345 additions and 1902 deletions

141
lab4lcd/.cproject Normal file
View File

@@ -0,0 +1,141 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="fr.ac6.managedbuild.config.gnu.cross.exe.debug.427113290">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="fr.ac6.managedbuild.config.gnu.cross.exe.debug.427113290" moduleId="org.eclipse.cdt.core.settings" name="Debug">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactExtension="elf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="rm -rf" description="" id="fr.ac6.managedbuild.config.gnu.cross.exe.debug.427113290" name="Debug" parent="fr.ac6.managedbuild.config.gnu.cross.exe.debug" postannouncebuildStep="Generating binary and Printing size information:" postbuildStep="arm-none-eabi-objcopy -O binary &quot;${BuildArtifactFileBaseName}.elf&quot; &quot;${BuildArtifactFileBaseName}.bin&quot;; arm-none-eabi-size &quot;${BuildArtifactFileName}&quot;">
<folderInfo id="fr.ac6.managedbuild.config.gnu.cross.exe.debug.427113290." name="/" resourcePath="">
<toolChain id="fr.ac6.managedbuild.toolchain.gnu.cross.exe.debug.401106072" name="Ac6 STM32 MCU GCC" superClass="fr.ac6.managedbuild.toolchain.gnu.cross.exe.debug">
<option id="fr.ac6.managedbuild.option.gnu.cross.mcu.59994752" name="Mcu" superClass="fr.ac6.managedbuild.option.gnu.cross.mcu" value="STM32F446RETx" valueType="string"/>
<option id="fr.ac6.managedbuild.option.gnu.cross.fpu.1472760623" name="Floating point hardware" superClass="fr.ac6.managedbuild.option.gnu.cross.fpu" value="fr.ac6.managedbuild.option.gnu.cross.fpu.fpv4-sp-d16" valueType="enumerated"/>
<option id="fr.ac6.managedbuild.option.gnu.cross.floatabi.910002786" name="Floating-point ABI" superClass="fr.ac6.managedbuild.option.gnu.cross.floatabi" value="fr.ac6.managedbuild.option.gnu.cross.floatabi.hard" valueType="enumerated"/>
<option id="fr.ac6.managedbuild.option.gnu.cross.board.1548098211" name="Board" superClass="fr.ac6.managedbuild.option.gnu.cross.board" value="NUCLEO-F446RE" valueType="string"/>
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="fr.ac6.managedbuild.targetPlatform.gnu.cross.1365250152" isAbstract="false" osList="all" superClass="fr.ac6.managedbuild.targetPlatform.gnu.cross"/>
<builder buildPath="${workspace_loc:/lab4lcd}/Debug" id="fr.ac6.managedbuild.builder.gnu.cross.265873198" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="fr.ac6.managedbuild.builder.gnu.cross"/>
<tool id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.370759847" name="MCU GCC Compiler" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler">
<option id="fr.ac6.managedbuild.gnu.c.compiler.option.optimization.level.1247655454" name="Optimization Level" superClass="fr.ac6.managedbuild.gnu.c.compiler.option.optimization.level" useByScannerDiscovery="false"/>
<option id="gnu.c.compiler.option.debugging.level.38046271" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.max" valueType="enumerated"/>
<option id="gnu.c.compiler.option.preprocessor.def.symbols.1161396429" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" useByScannerDiscovery="false" valueType="definedSymbols">
<listOptionValue builtIn="false" value="STM32"/>
<listOptionValue builtIn="false" value="STM32F4"/>
<listOptionValue builtIn="false" value="STM32F446RETx"/>
<listOptionValue builtIn="false" value="NUCLEO_F446RE"/>
<listOptionValue builtIn="false" value="DEBUG"/>
</option>
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c.624169371" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c"/>
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.s.1628787841" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.s"/>
</tool>
<tool id="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.1076599223" name="MCU G++ Compiler" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler">
<option id="fr.ac6.managedbuild.gnu.cpp.compiler.option.optimization.level.1065568709" name="Optimization Level" superClass="fr.ac6.managedbuild.gnu.cpp.compiler.option.optimization.level" useByScannerDiscovery="false"/>
<option id="gnu.cpp.compiler.option.debugging.level.768323977" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
</tool>
<tool id="fr.ac6.managedbuild.tool.gnu.cross.c.linker.711521109" name="MCU GCC Linker" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.linker">
<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.904410208" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="fr.ac6.managedbuild.tool.gnu.cross.cpp.linker.802485294" name="MCU G++ Linker" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.linker"/>
<tool id="fr.ac6.managedbuild.tool.gnu.archiver.1383604369" name="MCU GCC Archiver" superClass="fr.ac6.managedbuild.tool.gnu.archiver"/>
<tool id="fr.ac6.managedbuild.tool.gnu.cross.assembler.1720524332" name="MCU GCC Assembler" superClass="fr.ac6.managedbuild.tool.gnu.cross.assembler">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.516778673" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.assembler.input.1688973995" superClass="fr.ac6.managedbuild.tool.gnu.cross.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
<sourceEntries>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="inc"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="startup"/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
<cconfiguration id="fr.ac6.managedbuild.config.gnu.cross.exe.release.1283274637">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="fr.ac6.managedbuild.config.gnu.cross.exe.release.1283274637" moduleId="org.eclipse.cdt.core.settings" name="Release">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactExtension="elf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" cleanCommand="rm -rf" description="" id="fr.ac6.managedbuild.config.gnu.cross.exe.release.1283274637" name="Release" parent="fr.ac6.managedbuild.config.gnu.cross.exe.release" postannouncebuildStep="Generating binary and Printing size information:" postbuildStep="arm-none-eabi-objcopy -O binary &quot;${BuildArtifactFileBaseName}.elf&quot; &quot;${BuildArtifactFileBaseName}.bin&quot;; arm-none-eabi-size -B &quot;${BuildArtifactFileName}&quot;">
<folderInfo id="fr.ac6.managedbuild.config.gnu.cross.exe.release.1283274637." name="/" resourcePath="">
<toolChain id="fr.ac6.managedbuild.toolchain.gnu.cross.exe.release.432241345" name="Ac6 STM32 MCU GCC" superClass="fr.ac6.managedbuild.toolchain.gnu.cross.exe.release">
<option id="fr.ac6.managedbuild.option.gnu.cross.mcu.1695947931" name="Mcu" superClass="fr.ac6.managedbuild.option.gnu.cross.mcu" value="STM32F446RETx" valueType="string"/>
<option id="fr.ac6.managedbuild.option.gnu.cross.fpu.1401116715" name="Floating point hardware" superClass="fr.ac6.managedbuild.option.gnu.cross.fpu" value="fr.ac6.managedbuild.option.gnu.cross.fpu.fpv4-sp-d16" valueType="enumerated"/>
<option id="fr.ac6.managedbuild.option.gnu.cross.floatabi.729880642" name="Floating-point ABI" superClass="fr.ac6.managedbuild.option.gnu.cross.floatabi" value="fr.ac6.managedbuild.option.gnu.cross.floatabi.hard" valueType="enumerated"/>
<option id="fr.ac6.managedbuild.option.gnu.cross.board.990837461" name="Board" superClass="fr.ac6.managedbuild.option.gnu.cross.board" value="NUCLEO-F446RE" valueType="string"/>
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="fr.ac6.managedbuild.targetPlatform.gnu.cross.1469434754" isAbstract="false" osList="all" superClass="fr.ac6.managedbuild.targetPlatform.gnu.cross"/>
<builder buildPath="${workspace_loc:/lab4lcd}/Release" id="fr.ac6.managedbuild.builder.gnu.cross.855030343" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="fr.ac6.managedbuild.builder.gnu.cross"/>
<tool id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.1453739612" name="MCU GCC Compiler" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler">
<option id="fr.ac6.managedbuild.gnu.c.compiler.option.optimization.level.1233368084" name="Optimization Level" superClass="fr.ac6.managedbuild.gnu.c.compiler.option.optimization.level" useByScannerDiscovery="false" value="fr.ac6.managedbuild.gnu.c.optimization.level.most" valueType="enumerated"/>
<option id="gnu.c.compiler.option.debugging.level.946300555" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.none" valueType="enumerated"/>
<option id="gnu.c.compiler.option.preprocessor.def.symbols.410544593" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" useByScannerDiscovery="false" valueType="definedSymbols">
<listOptionValue builtIn="false" value="STM32"/>
<listOptionValue builtIn="false" value="STM32F4"/>
<listOptionValue builtIn="false" value="STM32F446RETx"/>
<listOptionValue builtIn="false" value="NUCLEO_F446RE"/>
</option>
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c.1744299059" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c"/>
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.s.1882968967" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.s"/>
</tool>
<tool id="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.520125902" name="MCU G++ Compiler" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler">
<option id="fr.ac6.managedbuild.gnu.cpp.compiler.option.optimization.level.1237893176" name="Optimization Level" superClass="fr.ac6.managedbuild.gnu.cpp.compiler.option.optimization.level" useByScannerDiscovery="false" value="fr.ac6.managedbuild.gnu.cpp.optimization.level.most" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.debugging.level.412170432" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
</tool>
<tool id="fr.ac6.managedbuild.tool.gnu.cross.c.linker.406674319" name="MCU GCC Linker" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.linker">
<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1507836944" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="fr.ac6.managedbuild.tool.gnu.cross.cpp.linker.89905495" name="MCU G++ Linker" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.linker"/>
<tool id="fr.ac6.managedbuild.tool.gnu.archiver.1680940795" name="MCU GCC Archiver" superClass="fr.ac6.managedbuild.tool.gnu.archiver"/>
<tool id="fr.ac6.managedbuild.tool.gnu.cross.assembler.782062198" name="MCU GCC Assembler" superClass="fr.ac6.managedbuild.tool.gnu.cross.assembler">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.602168047" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.assembler.input.1117461956" superClass="fr.ac6.managedbuild.tool.gnu.cross.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
<sourceEntries>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="inc"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="startup"/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="lab4lcd.fr.ac6.managedbuild.target.gnu.cross.exe.1712422910" name="Executable" projectType="fr.ac6.managedbuild.target.gnu.cross.exe"/>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
<scannerConfigBuildInfo instanceId="fr.ac6.managedbuild.config.gnu.cross.exe.debug.427113290;fr.ac6.managedbuild.config.gnu.cross.exe.debug.427113290.;fr.ac6.managedbuild.tool.gnu.cross.c.compiler.370759847;fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c.624169371">
<autodiscovery enabled="false" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="fr.ac6.managedbuild.config.gnu.cross.exe.release.1283274637;fr.ac6.managedbuild.config.gnu.cross.exe.release.1283274637.;fr.ac6.managedbuild.tool.gnu.cross.c.compiler.1453739612;fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c.1744299059">
<autodiscovery enabled="false" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
</cproject>

1
lab4lcd/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/Debug/

28
lab4lcd/.project Normal file
View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>lab4lcd</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
<nature>fr.ac6.mcu.ide.core.MCUProjectNature</nature>
<nature>fr.ac6.mcu.ide.core.MCUSingleCoreProjectNature</nature>
</natures>
</projectDescription>

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project>
<configuration id="fr.ac6.managedbuild.config.gnu.cross.exe.debug.427113290" name="Debug">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
<provider class="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" console="false" env-hash="-1700254419450938845" id="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="Ac6 SW4 STM32 MCU Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
</extension>
</configuration>
<configuration id="fr.ac6.managedbuild.config.gnu.cross.exe.release.1283274637" name="Release">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
<provider class="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" console="false" env-hash="-1700254419450938845" id="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="Ac6 SW4 STM32 MCU Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
</extension>
</configuration>
</project>

202
lab4lcd/LinkerScript.ld Normal file
View File

@@ -0,0 +1,202 @@
/*
******************************************************************************
**
** File : LinkerScript.ld
**
** Author : Auto-generated by Ac6 System Workbench
**
** Abstract : Linker script for STM32F446RETx Device from STM32F4 series
** 128Kbytes RAM
** 512Kbytes ROM
**
** Set heap size, stack size and stack location according
** to application requirements.
**
** Set memory bank area and size if external memory is used.
**
** Target : STMicroelectronics STM32
**
** Distribution: The file is distributed “as is,” without any warranty
** of any kind.
**
*****************************************************************************
** @attention
**
** <h2><center>&copy; COPYRIGHT(c) 2019 Ac6</center></h2>
**
** Redistribution and use in source and binary forms, with or without modification,
** are permitted provided that the following conditions are met:
** 1. Redistributions of source code must retain the above copyright notice,
** this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright notice,
** this list of conditions and the following disclaimer in the documentation
** and/or other materials provided with the distribution.
** 3. Neither the name of Ac6 nor the names of its contributors
** may be used to endorse or promote products derived from this software
** without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
*****************************************************************************
*/
/* Entry Point */
ENTRY(Reset_Handler)
/* Highest address of the user mode stack */
_estack = 0x20020000; /* end of RAM */
_Min_Heap_Size = 0; /* required amount of heap */
_Min_Stack_Size = 0x400; /* required amount of stack */
/* Memories definition */
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
ROM (rx) : ORIGIN = 0x8000000, LENGTH = 512K
}
/* Sections */
SECTIONS
{
/* The startup code into ROM memory */
.isr_vector :
{
. = ALIGN(4);
KEEP(*(.isr_vector)) /* Startup code */
. = ALIGN(4);
} >ROM
/* The program code and other data into ROM memory */
.text :
{
. = ALIGN(4);
*(.text) /* .text sections (code) */
*(.text*) /* .text* sections (code) */
*(.glue_7) /* glue arm to thumb code */
*(.glue_7t) /* glue thumb to arm code */
*(.eh_frame)
KEEP (*(.init))
KEEP (*(.fini))
. = ALIGN(4);
_etext = .; /* define a global symbols at end of code */
} >ROM
/* Constant data into ROM memory*/
.rodata :
{
. = ALIGN(4);
*(.rodata) /* .rodata sections (constants, strings, etc.) */
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
. = ALIGN(4);
} >ROM
.ARM.extab : {
. = ALIGN(4);
*(.ARM.extab* .gnu.linkonce.armextab.*)
. = ALIGN(4);
} >ROM
.ARM : {
. = ALIGN(4);
__exidx_start = .;
*(.ARM.exidx*)
__exidx_end = .;
. = ALIGN(4);
} >ROM
.preinit_array :
{
. = ALIGN(4);
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP (*(.preinit_array*))
PROVIDE_HIDDEN (__preinit_array_end = .);
. = ALIGN(4);
} >ROM
.init_array :
{
. = ALIGN(4);
PROVIDE_HIDDEN (__init_array_start = .);
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array*))
PROVIDE_HIDDEN (__init_array_end = .);
. = ALIGN(4);
} >ROM
.fini_array :
{
. = ALIGN(4);
PROVIDE_HIDDEN (__fini_array_start = .);
KEEP (*(SORT(.fini_array.*)))
KEEP (*(.fini_array*))
PROVIDE_HIDDEN (__fini_array_end = .);
. = ALIGN(4);
} >ROM
/* Used by the startup to initialize data */
_sidata = LOADADDR(.data);
/* Initialized data sections into RAM memory */
.data :
{
. = ALIGN(4);
_sdata = .; /* create a global symbol at data start */
*(.data) /* .data sections */
*(.data*) /* .data* sections */
. = ALIGN(4);
_edata = .; /* define a global symbol at data end */
} >RAM AT> ROM
/* Uninitialized data section into RAM memory */
. = ALIGN(4);
.bss :
{
/* This is used by the startup in order to initialize the .bss secion */
_sbss = .; /* define a global symbol at bss start */
__bss_start__ = _sbss;
*(.bss)
*(.bss*)
*(COMMON)
. = ALIGN(4);
_ebss = .; /* define a global symbol at bss end */
__bss_end__ = _ebss;
} >RAM
/* User_heap_stack section, used to check that there is enough RAM left */
._user_heap_stack :
{
. = ALIGN(8);
PROVIDE ( end = . );
PROVIDE ( _end = . );
. = . + _Min_Heap_Size;
. = . + _Min_Stack_Size;
. = ALIGN(8);
} >RAM
/* Remove information from the compiler libraries */
/DISCARD/ :
{
libc.a ( * )
libm.a ( * )
libgcc.a ( * )
}
.ARM.attributes 0 : { *(.ARM.attributes) }
}

20
lab4lcd/NUCLEO-F446RE.xml Normal file
View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE targetDefinitions [
<!ELEMENT targetDefinitions (board)>
<!ELEMENT board (name, dbgIF+, dbgDEV, mcuId)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT dbgIF (#PCDATA)>
<!ELEMENT dbgDEV (#PCDATA)>
<!ELEMENT mcuId (#PCDATA)>
<!ATTLIST board id CDATA #REQUIRED>
]>
<targetDefinitions>
<board id="nucleo-f446re">
<name>NUCLEO-F446RE</name>
<dbgIF>SWD</dbgIF>
<dbgIF>JTAG</dbgIF>
<dbgDEV>ST-Link</dbgDEV>
<mcuId>stm32f446retx</mcuId>
</board>
</targetDefinitions>

28
lab4lcd/lab4lcd Debug.cfg Normal file
View File

@@ -0,0 +1,28 @@
# This is an NUCLEO-F446RE board with a single STM32F446RETx chip
#
# Generated by System Workbench for STM32
# Take care that such file, as generated, may be overridden without any early notice. Please have a look to debug launch configuration setup(s)
source [find interface/stlink.cfg]
set WORKAREASIZE 0x8000
transport select "hla_swd"
set CHIPNAME STM32F446RETx
# Enable debug when in low power modes
set ENABLE_LOW_POWER 1
# Stop Watchdog counters when halt
set STOP_WATCHDOG 1
# STlink Debug clock frequency
set CLOCK_FREQ 4000
# use hardware reset, connect under reset
# connect_assert_srst needed if low power mode application running (WFI...)
reset_config srst_only srst_nogate connect_assert_srst
set CONNECT_UNDER_RESET 1
source [find target/stm32f4x.cfg]

59
lab4lcd/src/delay.s Normal file
View File

@@ -0,0 +1,59 @@
# delay.s
# Trevor Barnes
# CE2801-031
# Description: A file for handling delay routines
.syntax unified
.cpu cortex-m4
.thumb
.section .text
.global delay_ms
# A subroutine to create a delay of a certain number of milliseconds
# Input:
# r0: Length of delay (ms)
delay_ms:
push {r1,r2,r3,lr}
mov r3,r0
ms_delay:
# 250 iterations = 1/16 of a millisecond
mov r2, #0x10
# Loop 16 times
1:
# 250
mov r1, #0xFA
# Loop 250 times
2:
sub r1, #1
cmp r1, #0
bne 2b
sub r2, #1
cmp r2, #0
bne 1b
sub r0, #1
cmp r0, #0
bne ms_delay
mov r0,r3
pop {r1,r2,r3,pc}
.global lcd_delay
# about r1 mircoseonds
lcd_delay:
# stack
push {lr}
lsl r1, r1, #3
1:
sub r1, r1, #1
cmp r1, #0
bne 1b
# return
pop {pc}

464
lab4lcd/src/lcd.s Normal file
View File

@@ -0,0 +1,464 @@
# lcd.s
# Trevor Barnes
# CE2801-031
# Description:
.syntax unified
.cpu cortex-m4
.thumb
.section .text
#Fill in addresses
.equ RCC_BASE, 0x40023800
.equ RCC_AHB1ENR, 0x30
.equ RCC_GPIOAEN, 1<<0
.equ RCC_GPIOCEN, 1<<2
.equ GPIOA_BASE, 0x40020000
.equ GPIOC_BASE, 0x40020800
.equ GPIO_MODER, 0x00
.equ GPIO_ODR, 0x14
.equ GPIO_IDR, 0x10
.equ GPIO_BSRR, 0x18
#What pin is each of these?
.equ RS, 8 // PC8
.equ RW, 9 // PC9
.equ E, 10 // PC10
#Commands for BSRR
.equ RS_SET, 1<<RS
.equ RS_CLR, 1<<(RS+16)
.equ RW_SET, 1<<RW
.equ RW_CLR, 1<<(RW+16)
.equ E_SET, 1<<E
.equ E_CLR, 1<<(E+16)
#Globally exposed functions
.global lcdInit
#Local helper function
PortSetup:
push {r1,r2,r3}
#Turn on Ports in RCC
ldr r1, =RCC_BASE
ldr r2, [r1, #RCC_AHB1ENR]
orr r2, r2, #RCC_GPIOAEN
str r2, [r1, #RCC_AHB1ENR]
ldr r2, [r1, #RCC_AHB1ENR]
orr r2, r2, #RCC_GPIOCEN
str r2, [r1, #RCC_AHB1ENR]
#Set DB Pins to Outputs
ldr r1, =GPIOA_BASE
ldr r2, [r1, #GPIO_MODER]
movw r3, 0x5500
movt r3, 0x0055
orr r2,r2, r3
movw r3, 0xAA00
movt r3, 0x00AA
bic r2, r2, r3
str r2, [r1, #GPIO_MODER]
#Set RS RW E Pins to Outputs
ldr r1, =GPIOC_BASE
ldr r2, [r1, #GPIO_MODER]
movw r3, 0x0000
movt r3, 0x0015
orr r2,r2, r3
movw r3, 0x0000
movt r3, 0x00EA
bic r2, r2, r3
str r2, [r1, #GPIO_MODER]
pop {r1,r2,r3}
bx lr
#Writes instruction
#RS=0 RW=0 R1-Arg
#No returns
WriteInstruction:
push {r2,r3,lr}
#Set RS=0,RW=0,E=0
ldr r2, =GPIOC_BASE
mov r3, RS_CLR
str r3, [r2, #GPIO_BSRR]
mov r3, RW_CLR
str r3, [r2, #GPIO_BSRR]
mov r3, E_CLR
str r3, [r2, #GPIO_BSRR]
#Set E=1
mov r3, E_SET
str r3, [r2, #GPIO_BSRR]
#Set R1 -> DataBus
lsl r1, #4
ldr r3, =GPIOA_BASE
ldr r2, [r3, #GPIO_ODR]
bfc r2, #4, #8
orr r2, r2, r1
str r2, [r3, #GPIO_ODR ]
#Set E=0
ldr r2, =GPIOC_BASE
mov r3, E_CLR
str r3, [r2, #GPIO_BSRR]
#Wait for appropriate delay
mov r1, #37
bl lcd_delay
pop {r2,r3,pc}
#Writes data
#RS=0 RW=0 R1-Arg
#No returns
WriteData:
push {r1,r2,r3,r4,lr}
#Set RS=1,RW=0,E=0
ldr r2, =GPIOC_BASE
mov r3, #RS_SET
str r3, [r2, #GPIO_BSRR]
mov r3, #RW_CLR
str r3, [r2, #GPIO_BSRR]
mov r3, #E_CLR
str r3, [r2, #GPIO_BSRR]
#Set E=1
mov r3, #E_SET
str r3, [r2, #GPIO_BSRR]
#Set R1 -> DataBus
lsl r1, #4
ldr r3, =GPIOA_BASE
ldr r2, [r3, #GPIO_ODR]
bfc r2, #4, #8
orr r2, r2, r1
str r2, [r3, #GPIO_ODR ]
#Set E=0
ldr r2, =GPIOC_BASE
mov r3, #E_CLR
str r3, [r2, #GPIO_BSRR]
#Wait for appropriate delay
mov r1, #37
bl lcd_delay
pop {r1,r2,r3,r4,pc}
#Code to intialize the lcd
lcdInit:
push {r0,r1,lr}
#Set up Ports
bl PortSetup
#Wait 40ms
mov r0, #40
bl delay_ms
#Write Function Set (0x38)
mov r1, 0x38
bl WriteInstruction
mov r1, #37
bl lcd_delay
#Write Function Set (0x38)
mov r1, 0x38
bl WriteInstruction
mov r1, #37
bl lcd_delay
#Write Display On/Off(0x0F)
mov r1, 0x0F
bl WriteInstruction
mov r1, #37
bl lcd_delay
#Write Display Clear (0x01)
mov r1, 0x01
bl WriteInstruction
mov r1, #2
bl delay_ms
#Write Entry Mode Set (0x06)
mov r1, 0x06
bl WriteInstruction
mov r1, #37
bl lcd_delay
pop {r0,r1,pc}
.global lcdClear
# clears the display
# no arguments or return
# includes necessary delay
lcdClear:
push {r0,lr}
mov r1, 0x01
bl WriteInstruction
# Delay for at least 1.52ms
mov r0, #2
bl delay_ms
pop {r0,pc}
.global lcdHome
# moves cursor to the home position
# no arguments or return
# includes necessary delay
lcdHome:
push {r1,lr}
mov r1, #0x02
bl WriteInstruction
mov r0, #2
bl delay_ms
pop {r1,pc}
.global lcdSetPosition
# moves cursor to the position indicated
# r0 is the zero-based row and r1 is the zero-based column, no return value
# includes necessary delay
lcdSetPosition:
push {r0,r1,lr}
# Sub values to "actual" positions
sub r0, r0, #1
sub r1, r1, #1
# Shift row to actual
lsl r0, r0, #6
orr r0, r0, r1
mov r1, #0x80
orr r1, r1, r0
bl WriteInstruction
pop {r0,r1,pc}
.global lcdPrintString
# prints a null terminated string to the display
# r0 contains the address of the null terminated string (usually located in .data or .rodata), returns the number of characters written to display in r0
# includes necessary delay
lcdPrintString:
push {r0,r1,r2,r3,lr}
mov r2, #0
loop:
ldrb r1, [r0, r2]
cmp r1, #0x00
beq done
bl WriteData
add r2, r2, #1
b loop
done:
mov r0, r1
pop {r0,r1,r2,r3,pc}
.global lcdPrintNum
# prints a (decimal) number to the display
# the number to be printed is in r0, values of 0 to 9999 will print, anything above 9999 should print Err.
# includes necessary delay
lcdPrintNum:
push {r0,r1,r2,r3,r4,lr}
bl num_to_ASCII
# Store num in memory
ldr r2, =numToPrint
str r0, [r2]
# Move cursor to right-most position
mov r1, #16
writeByte:
mov r0, #1
bl lcdSetPosition
mov r4, r0
mov r0, #1
bl delay_ms
mov r0, r4
mov r0, r1
ldrb r1, [r2, r3]
bl WriteData
mov r4, r0
mov r0, #1
bl delay_ms
mov r0, r4
add r3, r3, #1
cmp r3, #4
sub r1, r0, #1
cmp r3, #4
bne writeByte
pop {r0,r1,r2,r3,r4,pc}
# Takes in a value from 0-9999 and converts it to ASCII
# Input:
# r0: Input binary value
num_to_ASCII:
# If outside of range, return ASCII "Err."
push {r1,r2,r3,lr}
cmp r0,#0
blt out_of_range
# cmp r0,#9999
# bgt out_of_range
# Normal conversion behavior
mov r1, #16
lsl r0, #3
sub r1, #3
shift_cycle:
lsl r0, #1
sub r1, #1
cmp r1, #0
# Branch to encode section if shifted 16 times
beq encode
# Verify Each Nibble is less than or equal to 4
ubfx r2, r0, #16, #4
# If value is less than or equal to 4, then skip to next nibble
cmp r2, #4
ble 2f
add r2, #3
bfi r0, r2, #16, #4
2: ubfx r2, r0, #20, #4
# If value is less than or equal to 4, then skip to next nibble
cmp r2, #4
ble 3f
add r2, #3
bfi r0, r2, #20, #4
3: ubfx r2, r0, #24, #4
# If value is less than or equal to 4, then skip to next nibble
cmp r2, #4
ble 4f
add r2, #3
bfi r0, r2, #24, #4
4: ubfx r2, r0, #28, #4
# If value is less than or equal to 4 skip to end
cmp r2, #4
ble end_verify_nibbles
add r2, #3
bfi r0, r2, #28, #4
end_verify_nibbles:
b shift_cycle
encode:
mov r3, #3
# Encode BCD numbers to ASCII
# Extract ones nibble
ubfx r2, r0, #16, #4
# Insert ones nibble
bfi r1, r2, #0, #4
# Insert 3 in front of nibble for ASCII encoding
bfi r1, r3, #4, #4
# Extract tens nibble
ubfx r2, r0, #20, #4
# Insert tens nibble
bfi r1, r2, #8, #4
# Insert 3 in front of nibble for ASCII encoding
bfi r1, r3, #12, #4
# Extract hundreds nibble
ubfx r2, r0, #24, #4
# Insert hundreds nibble
bfi r1, r2, #16, #4
# Insert 3 in front of nibble for ASCII encoding
bfi r1, r3, #20, #4
# Extract thousands nibble
ubfx r2, r0, #28, #4
# Insert thousands nibble
bfi r1, r2, #24, #4
# Insert 3 in front of nibble for ASCII encoding
bfi r1, r3, #28, #4
b end_ASCII
out_of_range:
# Insert ASCII "Err."
movw r1, #0x722E
movt r1, #0x4572
end_ASCII:
# Return value in r0
mov r0, r1
pop {r1,r2,r3,pc}
.global lcdBusyWait
# Loops until the busy flag is 0
lcdBusyWait:
push {r0,r1,r2,r3,lr}
ldr r1, =GPIOA_BASE
ldr r2, [r1, #GPIO_MODER]
mov r3, #0
orr r2, r2, r3
movw r3, 0xFF00
movt r3, 0x00FF
bic r2, r2, r3
str r2, [r1, #GPIO_MODER]
#Set RS=0, RW=1, E=1
ldr r2, =GPIOC_BASE
mov r3, #RS_CLR
str r3, [r2, #GPIO_BSRR]
mov r3, #RW_SET
str r3, [r2, #GPIO_BSRR]
mov r3, #E_SET
str r3, [r2, #GPIO_BSRR]
busy:
#Set E=
mov r3, #E_SET
str r3, [r2, #GPIO_BSRR]
#Set Databus -> R1
ldr r3, =GPIOA_BASE
ldr r1, [r3, #GPIO_IDR]
#Set E=0
ldr r2, =GPIOC_BASE
mov r3, #E_CLR
str r3, [r2, #GPIO_BSRR]
mov r2, #0x0010
and r1, r2
lsr r1, #4
# Are we still busy?
cmp r1, #1
beq busy
# Return DB port to original mode
ldr r1, =GPIOA_BASE
ldr r2, [r1, #GPIO_MODER]
movw r3, 0x5500
movt r3, 0x0055
orr r2,r2, r3
movw r3, 0xAA00
movt r3, 0x00AA
bic r2, r2, r3
str r2, [r1, #GPIO_MODER]
pop {r0,r1,r2,r3,pc}
.section .data
numToPrint:
.word 0

57
lab4lcd/src/main.s Normal file
View File

@@ -0,0 +1,57 @@
# main.s
# Trevor Barnes
# CE2801-031
# Lab 3: LCD API
# Description: The driver for Lab 4. Displays the ASCII
# values from the previous lab.
.syntax unified
.cpu cortex-m4
.thumb
.section .text
.global main
main:
bl lcdInit
mov r0, #10
bl countDown
bl lcdClear
ldr r0, =msg
bl lcdPrintString
end:
b end
# r0 - value to be counted down from (0-9999)
countDown:
push {r0,r1,lr}
loop:
# Print number
bl lcdPrintNum
mov r1, r0
mov r0, #1
# Save current value before delay subroutine
bl lcdHome
mov r0, #1000
bl delay_ms
mov r0, r1
cmp r0, #0
beq done
sub r0, r0, #1
b loop
done:
pop {r0,r1,pc}
.section .rodata
msg:
.asciz "Hello World!"

View File

@@ -0,0 +1,246 @@
/**
******************************************************************************
* @file startup_stm32.s
* @author Ac6
* @version V1.0.0
* @date 12-June-2014
******************************************************************************
*/
.syntax unified
.cpu cortex-m4
.thumb
.global g_pfnVectors
.global Default_Handler
/* start address for the initialization values of the .data section.
defined in linker script */
.word _sidata
/* start address for the .data section. defined in linker script */
.word _sdata
/* end address for the .data section. defined in linker script */
.word _edata
/* start address for the .bss section. defined in linker script */
.word _sbss
/* end address for the .bss section. defined in linker script */
.word _ebss
.equ BootRAM, 0xF1E0F85F
/**
* @brief This is the code that gets called when the processor first
* starts execution following a reset event. Only the absolutely
* necessary set is performed, after which the application
* supplied main() routine is called.
* @param None
* @retval : None
*/
.section .text.Reset_Handler
.weak Reset_Handler
.type Reset_Handler, %function
Reset_Handler:
/* Copy the data segment initializers from flash to SRAM */
movs r1, #0
b LoopCopyDataInit
CopyDataInit:
ldr r3, =_sidata
ldr r3, [r3, r1]
str r3, [r0, r1]
adds r1, r1, #4
LoopCopyDataInit:
ldr r0, =_sdata
ldr r3, =_edata
adds r2, r0, r1
cmp r2, r3
bcc CopyDataInit
ldr r2, =_sbss
b LoopFillZerobss
/* Zero fill the bss segment. */
FillZerobss:
movs r3, #0
str r3, [r2]
adds r2, r2, #4
LoopFillZerobss:
ldr r3, = _ebss
cmp r2, r3
bcc FillZerobss
/* Call the clock system intitialization function.*/
bl SystemInit
/* Call static constructors */
bl __libc_init_array
/* Call the application's entry point.*/
bl main
LoopForever:
b LoopForever
.size Reset_Handler, .-Reset_Handler
/**
* @brief This is the code that gets called when the processor receives an
* unexpected interrupt. This simply enters an infinite loop, preserving
* the system state for examination by a debugger.
*
* @param None
* @retval : None
*/
.section .text.Default_Handler,"ax",%progbits
Default_Handler:
Infinite_Loop:
b Infinite_Loop
.size Default_Handler, .-Default_Handler
/******************************************************************************
*
* The minimal vector table for a Cortex-M. Note that the proper constructs
* must be placed on this to ensure that it ends up at physical address
* 0x0000.0000.
*
******************************************************************************/
.section .isr_vector,"a",%progbits
.type g_pfnVectors, %object
.size g_pfnVectors, .-g_pfnVectors
g_pfnVectors:
.word _estack
.word Reset_Handler
.word NMI_Handler
.word HardFault_Handler
.word MemManage_Handler
.word BusFault_Handler
.word UsageFault_Handler
.word 0
.word 0
.word 0
.word 0
.word SVC_Handler
.word DebugMon_Handler
.word 0
.word PendSV_Handler
.word SysTick_Handler
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
/*******************************************************************************
*
* Provide weak aliases for each Exception handler to the Default_Handler.
* As they are weak aliases, any function with the same name will override
* this definition.
*
*******************************************************************************/
.weak NMI_Handler
.thumb_set NMI_Handler,Default_Handler
.weak HardFault_Handler
.thumb_set HardFault_Handler,Default_Handler
.weak MemManage_Handler
.thumb_set MemManage_Handler,Default_Handler
.weak BusFault_Handler
.thumb_set BusFault_Handler,Default_Handler
.weak UsageFault_Handler
.thumb_set UsageFault_Handler,Default_Handler
.weak SVC_Handler
.thumb_set SVC_Handler,Default_Handler
.weak DebugMon_Handler
.thumb_set DebugMon_Handler,Default_Handler
.weak PendSV_Handler
.thumb_set PendSV_Handler,Default_Handler
.weak SysTick_Handler
.thumb_set SysTick_Handler,Default_Handler
.weak SystemInit
/************************ (C) COPYRIGHT Ac6 *****END OF FILE****/

82
lab4lcd/startup/sysmem.c Normal file
View File

@@ -0,0 +1,82 @@
/**
*****************************************************************************
**
** File : sysmem.c
**
** Author : Ac6
**
** Abstract : System Workbench Minimal System Memory calls file
**
** For more information about which c-functions
** need which of these lowlevel functions
** please consult the Newlib libc-manual
**
** Environment : System Workbench for MCU
**
** Distribution: The file is distributed “as is,” without any warranty
** of any kind.
**
*****************************************************************************
**
** <h2><center>&copy; COPYRIGHT(c) 2014 Ac6</center></h2>
**
** Redistribution and use in source and binary forms, with or without modification,
** are permitted provided that the following conditions are met:
** 1. Redistributions of source code must retain the above copyright notice,
** this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright notice,
** this list of conditions and the following disclaimer in the documentation
** and/or other materials provided with the distribution.
** 3. Neither the name of Ac6 nor the names of its contributors
** may be used to endorse or promote products derived from this software
** without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
*****************************************************************************
*/
/* Includes */
#include <errno.h>
#include <stdio.h>
/* Variables */
extern int errno;
register char * stack_ptr asm("sp");
/* Functions */
/**
_sbrk
Increase program data space. Malloc and related functions depend on this
**/
caddr_t _sbrk(int incr)
{
extern char end asm("end");
static char *heap_end;
char *prev_heap_end;
if (heap_end == 0)
heap_end = &end;
prev_heap_end = heap_end;
if (heap_end + incr > stack_ptr)
{
errno = ENOMEM;
return (caddr_t) -1;
}
heap_end += incr;
return (caddr_t) prev_heap_end;
}