Add a GCC build to the QEMU/IAR project (#728)

* Rename the CORTEX_MPS2_QEMU_IAR directory to CORTEX_MPS2_QEMU_IAR_GCC

* Add makefile and startup.c.

* GCC build is working, but not yet running.

* Add eclipse project.

* Tidy up the linker file.
Add the debug launch file to the file system.

* Add printf-stdarg.c to the GCC build.

* Increase heap size for the GCC build.

* Copy IAR project files into a dedicated IAR build directory.

* Delete the IAR project from its original location now it is in its own build directory.

* Update headers to correct version number.

* Update lexicon.txt.

* Update core_checker.py.

* Change line endings in lexicon.txt.

* Increase the stack size of the task that prints out strings.

* Update linker script to build with older ld versions.

* Add links to the online documentation page for this demo.

* Fix line endings

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>

* Remove linker and project files from header check

Eclipse project files have names .project and .cproject. Python splitext
will treat these as file names and not as extension and as a result, it
is not enough to just add these to ignored extension list. Instead, we
need to add them to ignored files list.

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>

* Remove startup files from header check

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>

Co-authored-by: RichardBarry <richardbarry.c@gmail.com>
Co-authored-by: none <>
Co-authored-by: Gaurav Aggarwal <aggarg@amazon.com>
pull/748/head
RichardBarry 3 years ago committed by GitHub
parent 21f2799392
commit dc263aa3a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -48,6 +48,7 @@ FREERTOS_IGNORED_EXTENSIONS = [
'.config',
'.cpp',
'.cproj',
'.cproject',
'.crun',
'.css',
'.csv',
@ -120,6 +121,7 @@ FREERTOS_IGNORED_EXTENSIONS = [
'.la',
'.launch',
'.lcf',
'.ld',
'.lds',
'.lib',
'.lk1',
@ -172,6 +174,7 @@ FREERTOS_IGNORED_EXTENSIONS = [
'.pref',
'.prefs',
'.prj',
'.project',
'.properties',
'.ps1',
'.ptf',
@ -254,12 +257,16 @@ FREERTOS_IGNORED_PATTERNS = [
r'.*CMSIS.*',
r'.*/makefile',
r'.*/Makefile',
r'.*/printf-stdarg\.c.*',
r'.*/startup.*',
r'.*/trcConfig\.h.*',
r'.*/trcConfig\.c.*',
r'.*/trcSnapshotConfig\.h.*'
]
FREERTOS_IGNORED_FILES = [
'.cproject',
'.project',
'fyi-another-way-to-ignore-file.txt',
'mbedtls_config.h',
'requirements.txt',

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -45,7 +45,7 @@
#define configCPU_CLOCK_HZ ( ( unsigned long ) 25000000 )
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 80 )
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 50 * 1024 ) )
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 60 * 1024 ) )
#define configMAX_TASK_NAME_LEN ( 12 )
#define configUSE_TRACE_FACILITY 0
#define configUSE_16_BIT_TICKS 0
@ -54,7 +54,7 @@
#define configUSE_MUTEXES 1
#define configUSE_RECURSIVE_MUTEXES 1
#define configCHECK_FOR_STACK_OVERFLOW 2
#define configMALLOC_FAILED_HOOK 1
#define configUSE_MALLOC_FAILED_HOOK 1
#define configUSE_QUEUE_SETS 1
#define configUSE_COUNTING_SEMAPHORES 1
@ -116,7 +116,7 @@ allowable margin of error on slower processors (slower than the Win32
machine on which the test is developed). */
#define configSTREAM_BUFFER_TRIGGER_LEVEL_TEST_MARGIN 4
#ifdef __ICCARM__ /* Prevent C code being included in asm files. */
#ifndef __IASMARM__ /* Prevent C code being included in IAR asm files. */
void vAssertCalled( const char *pcFileName, uint32_t ulLine );
#define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled( __FILE__, __LINE__ );
#endif

@ -0,0 +1,5 @@
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,11
[InternetShortcut]
IDList=
URL=https://www.freertos.org/freertos-on-qemu-mps2-an385-model.html

@ -0,0 +1,61 @@
<?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="cdt.managedbuild.toolchain.gnu.cross.base.330997021">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.cross.base.330997021" moduleId="org.eclipse.cdt.core.settings" name="Default">
<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 buildProperties="" description="" id="cdt.managedbuild.toolchain.gnu.cross.base.330997021" name="Default" optionalBuildProperties="" parent="org.eclipse.cdt.build.core.emptycfg">
<folderInfo id="cdt.managedbuild.toolchain.gnu.cross.base.330997021.1663168963" name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.cross.base.1196792679" name="Cross GCC" superClass="cdt.managedbuild.toolchain.gnu.cross.base">
<option id="cdt.managedbuild.option.gnu.cross.prefix.6922571" name="Prefix" superClass="cdt.managedbuild.option.gnu.cross.prefix"/>
<option id="cdt.managedbuild.option.gnu.cross.path.271060658" name="Path" superClass="cdt.managedbuild.option.gnu.cross.path"/>
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.654185196" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>
<builder id="cdt.managedbuild.builder.gnu.cross.1009432283" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.builder.gnu.cross"/>
<tool id="cdt.managedbuild.tool.gnu.cross.c.compiler.1391085233" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler">
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1754740170" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.compiler.1564031466" name="Cross G++ Compiler" superClass="cdt.managedbuild.tool.gnu.cross.cpp.compiler">
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.799786214" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cross.c.linker.13091740" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker"/>
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.linker.302675999" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker">
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1405236271" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cross.archiver.1465394660" name="Cross GCC Archiver" superClass="cdt.managedbuild.tool.gnu.cross.archiver"/>
<tool id="cdt.managedbuild.tool.gnu.cross.assembler.1569045660" name="Cross GCC Assembler" superClass="cdt.managedbuild.tool.gnu.cross.assembler">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.65276216" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="FreeRTOSDemo.null.149924748" name="FreeRTOSDemo"/>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
<storageModule moduleId="refreshScope" versionNumber="2">
<configuration configurationName="Default">
<resource resourceType="PROJECT" workspacePath="/FreeRTOSDemo"/>
</configuration>
</storageModule>
</cproject>

@ -0,0 +1,109 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>FreeRTOSDemo</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.core.ccnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
<linkedResources>
<link>
<name>CommonDemoSource</name>
<type>2</type>
<locationURI>FREERTOS_ROOT/Demo/Common/Minimal</locationURI>
</link>
<link>
<name>FreeRTOS_kernel</name>
<type>2</type>
<locationURI>FREERTOS_ROOT/Source</locationURI>
</link>
<link>
<name>Source</name>
<type>2</type>
<locationURI>virtual:/virtual</locationURI>
</link>
<link>
<name>Source/FreeRTOSConfig.h</name>
<type>1</type>
<locationURI>FREERTOS_ROOT/Demo/CORTEX_MPS2_QEMU_IAR_GCC/FreeRTOSConfig.h</locationURI>
</link>
<link>
<name>Source/IntQueueTimer.c</name>
<type>1</type>
<locationURI>FREERTOS_ROOT/Demo/CORTEX_MPS2_QEMU_IAR_GCC/IntQueueTimer.c</locationURI>
</link>
<link>
<name>Source/IntQueueTimer.h</name>
<type>1</type>
<locationURI>FREERTOS_ROOT/Demo/CORTEX_MPS2_QEMU_IAR_GCC/IntQueueTimer.h</locationURI>
</link>
<link>
<name>Source/main.c</name>
<type>1</type>
<locationURI>FREERTOS_ROOT/Demo/CORTEX_MPS2_QEMU_IAR_GCC/main.c</locationURI>
</link>
<link>
<name>Source/main_blinky.c</name>
<type>1</type>
<locationURI>FREERTOS_ROOT/Demo/CORTEX_MPS2_QEMU_IAR_GCC/main_blinky.c</locationURI>
</link>
<link>
<name>Source/main_full.c</name>
<type>1</type>
<locationURI>FREERTOS_ROOT/Demo/CORTEX_MPS2_QEMU_IAR_GCC/main_full.c</locationURI>
</link>
</linkedResources>
<filteredResources>
<filter>
<id>1638931119117</id>
<name>FreeRTOS_kernel/portable</name>
<type>9</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-GCC</arguments>
</matcher>
</filter>
<filter>
<id>1638931119125</id>
<name>FreeRTOS_kernel/portable</name>
<type>9</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-MemMang</arguments>
</matcher>
</filter>
<filter>
<id>1638931142581</id>
<name>FreeRTOS_kernel/portable/GCC</name>
<type>9</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-ARM_CM3</arguments>
</matcher>
</filter>
</filteredResources>
<variableList>
<variable>
<name>FREERTOS_ROOT</name>
<value>$%7BPARENT-4-PROJECT_LOC%7D</value>
</variable>
</variableList>
</projectDescription>

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project>
<configuration id="cdt.managedbuild.toolchain.gnu.cross.base.330997021" name="Default">
<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 copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-1494139136553" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC 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>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
</extension>
</configuration>
</project>

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.cdt.debug.gdbjtag.launchConfigurationType">
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.connection" value="gdb:localhost:1234#"/>
<intAttribute key="org.eclipse.cdt.debug.gdbjtag.core.delay" value="0"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doHalt" value="false"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doReset" value="false"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.imageFileName" value=""/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.imageOffset" value=""/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.initCommands" value=""/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.jtagDeviceId" value="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.genericDevice"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.loadImage" value="false"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.loadSymbols" value="true"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.pcRegister" value=""/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.runCommands" value=""/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setPcRegister" value="false"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setResume" value="true"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setStopAt" value="true"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.stopAt" value="main"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.symbolsFileName" value=""/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.symbolsOffset" value=""/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useFileForImage" value="false"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useFileForSymbols" value="false"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useProjBinaryForImage" value="true"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useProjBinaryForSymbols" value="true"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useRemoteTarget" value="true"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="arm-none-eabi-gdb"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.REMOTE_TIMEOUT_ENABLED" value="false"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.REMOTE_TIMEOUT_VALUE" value=""/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="remote"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="output\RTOSDemo.out"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="FreeRTOSDemo"/>
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="true"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="cdt.managedbuild.toolchain.gnu.cross.base.330997021"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/FreeRTOSDemo"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.cdt.debug.core.sourceLocator"/>
<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;sourceLookupDirector&gt;&#13;&#10; &lt;sourceContainers duplicates=&quot;false&quot;&gt;&#13;&#10; &lt;container memento=&quot;AbsolutePath&quot; typeId=&quot;org.eclipse.cdt.debug.core.containerType.absolutePath&quot;/&gt;&#13;&#10; &lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;default/&amp;gt;&amp;#13;&amp;#10;&quot; typeId=&quot;org.eclipse.debug.core.containerType.default&quot;/&gt;&#13;&#10; &lt;/sourceContainers&gt;&#13;&#10;&lt;/sourceLookupDirector&gt;&#13;&#10;"/>
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&lt;memoryBlockExpressionList context=&quot;reserved-for-future-use&quot;/&gt;"/>
<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
</launchConfiguration>

@ -0,0 +1,123 @@
OUTPUT_DIR := ./output
IMAGE := RTOSDemo.out
SUB_MAKEFILE_DIR = ./library-makefiles
# The directory that contains the /source and /demo sub directories.
FREERTOS_ROOT = ./../../../../
CC = arm-none-eabi-gcc
LD = arm-none-eabi-gcc
SIZE = arm-none-eabi-size
MAKE = make
CFLAGS += $(INCLUDE_DIRS) -nostartfiles -ffreestanding -mthumb -mcpu=cortex-m3 \
-Wall -Wextra -g3 -O0 -ffunction-sections -fdata-sections \
-MMD -MP -MF"$(@:%.o=%.d)" -MT $@
#
# Kernel build.
#
KERNEL_DIR = $(FREERTOS_ROOT)/Source
KERNEL_PORT_DIR += $(KERNEL_DIR)/portable/GCC/ARM_CM3
INCLUDE_DIRS += -I$(KERNEL_DIR)/include \
-I$(KERNEL_PORT_DIR)
VPATH += $(KERNEL_DIR) $(KERNEL_PORT_DIR) $(KERNEL_DIR)/portable/MemMang
SOURCE_FILES += $(KERNEL_DIR)/tasks.c
SOURCE_FILES += $(KERNEL_DIR)/list.c
SOURCE_FILES += $(KERNEL_DIR)/queue.c
SOURCE_FILES += $(KERNEL_DIR)/timers.c
SOURCE_FILES += $(KERNEL_DIR)/event_groups.c
SOURCE_FILES += $(KERNEL_DIR)/stream_buffer.c
SOURCE_FILES += $(KERNEL_DIR)/portable/MemMang/heap_4.c
SOURCE_FILES += $(KERNEL_DIR)/portable/GCC/ARM_CM3/port.c
#
# Common demo files for the "full" build, as opposed to the "blinky" build -
# these files are build by all the FreeRTOS kernel demos.
#
DEMO_ROOT = $(FREERTOS_ROOT)/Demo
COMMON_DEMO_FILES = $(DEMO_ROOT)/Common/Minimal
INCLUDE_DIRS += -I$(DEMO_ROOT)/Common/include
VPATH += $(COMMON_DEMO_FILES)
SOURCE_FILES += (COMMON_DEMO_FILES)/AbortDelay.c
SOURCE_FILES += (COMMON_DEMO_FILES)/BlockQ.c
SOURCE_FILES += (COMMON_DEMO_FILES)/blocktim.c
SOURCE_FILES += (COMMON_DEMO_FILES)/countsem.c
SOURCE_FILES += (COMMON_DEMO_FILES)/death.c
SOURCE_FILES += (COMMON_DEMO_FILES)/dynamic.c
SOURCE_FILES += (COMMON_DEMO_FILES)/EventGroupsDemo.c
SOURCE_FILES += (COMMON_DEMO_FILES)/GenQTest.c
SOURCE_FILES += (COMMON_DEMO_FILES)/integer.c
SOURCE_FILES += (COMMON_DEMO_FILES)/IntQueue.c
SOURCE_FILES += (COMMON_DEMO_FILES)/IntQueueTimer.c
SOURCE_FILES += (COMMON_DEMO_FILES)/IntSemTest.c
SOURCE_FILES += (COMMON_DEMO_FILES)/MessageBufferAMP.c
SOURCE_FILES += (COMMON_DEMO_FILES)/MessageBufferDemo.c
SOURCE_FILES += (COMMON_DEMO_FILES)/PollQ.c
SOURCE_FILES += (COMMON_DEMO_FILES)/QPeek.c
SOURCE_FILES += (COMMON_DEMO_FILES)/QueueOverwrite.c
SOURCE_FILES += (COMMON_DEMO_FILES)/QueueSet.c
SOURCE_FILES += (COMMON_DEMO_FILES)/QueueSetPolling.c
SOURCE_FILES += (COMMON_DEMO_FILES)/recmutex.c
SOURCE_FILES += (COMMON_DEMO_FILES)/semtest.c
SOURCE_FILES += (COMMON_DEMO_FILES)/StaticAllocation.c
SOURCE_FILES += (COMMON_DEMO_FILES)/StreamBufferDemo.c
SOURCE_FILES += (COMMON_DEMO_FILES)/StreamBufferInterrupt.c
SOURCE_FILES += (COMMON_DEMO_FILES)/TaskNotify.c
SOURCE_FILES += (COMMON_DEMO_FILES)/TaskNotifyArray.c
SOURCE_FILES += (COMMON_DEMO_FILES)/TimerDemo.c
#
# Application entry point. main_blinky is self contained. main_full builds
# the above common demo (and test) files too.
#
DEMO_PROJECT = $(DEMO_ROOT)/CORTEX_MPS2_QEMU_IAR_GCC
VPATH += $(DEMO_PROJECT)
INCLUDE_DIRS += -I$(DEMO_PROJECT) -I$(DEMO_PROJECT)/CMSIS
SOURCE_FILES += (DEMO_PROJECT)/main.c
SOURCE_FILES += (DEMO_PROJECT)/main_blinky.c
SOURCE_FILES += (DEMO_PROJECT)/main_full.c
SOURCE_FILES += ./startup_gcc.c
# Lightweight print formatting to use in place of the heavier GCC equivalent.
SOURCE_FILES += ./printf-stdarg.c
#Create a list of object files with the desired output directory path.
OBJS = $(SOURCE_FILES:%.c=%.o)
OBJS_NO_PATH = $(notdir $(OBJS))
OBJS_OUTPUT = $(OBJS_NO_PATH:%.o=$(OUTPUT_DIR)/%.o)
#Create a list of dependency files with the desired output directory path.
DEP_FILES := $(SOURCE_FILES:%.c=$(OUTPUT_DIR)/%.d)
DEP_FILES_NO_PATH = $(notdir $(DEP_FILES))
DEP_OUTPUT = $(DEP_FILES_NO_PATH:%.d=$(OUTPUT_DIR)/%.d)
all: $(OUTPUT_DIR)/$(IMAGE)
%.o : %.c
$(OUTPUT_DIR)/%.o : %.c $(OUTPUT_DIR)/%.d Makefile
$(CC) $(CFLAGS) -c $< -o $@
$(OUTPUT_DIR)/$(IMAGE): ./mps2_m3.ld $(OBJS_OUTPUT) Makefile
@echo ""
@echo ""
@echo "--- Final linking ---"
@echo ""
$(LD) $(OBJS_OUTPUT) $(CFLAGS) -Xlinker --gc-sections -Xlinker -T ./mps2_m3.ld \
-Xlinker -Map=$(OUTPUT_DIR)/RTOSDemo.map -specs=nano.specs \
-specs=nosys.specs -specs=rdimon.specs -o $(OUTPUT_DIR)/$(IMAGE)
$(SIZE) $(OUTPUT_DIR)/$(IMAGE)
$(DEP_OUTPUT):
include $(wildcard $(DEP_OUTPUT))
clean:
rm -f $(OUTPUT_DIR)/$(IMAGE) $(OUTPUT_DIR)/*.o $(OUTPUT_DIR)/*.d
#use "make print-[VARIABLE_NAME] to print the value of a variable generated by
#this makefile.
print-% : ; @echo $* = $($*)
.PHONY: all clean

@ -0,0 +1,98 @@
/*
* FreeRTOS V202111.00
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* http://www.FreeRTOS.org
* http://aws.amazon.com/freertos
*
* 1 tab == 4 spaces!
*/
MEMORY
{
FLASH (xr) : ORIGIN = 0x00000000, LENGTH = 4M /* to 0x00003FFF = 0x007FFFFF*/
RAM (rw) : ORIGIN = 0x20000000, LENGTH = 4M /* to 0x21FFFFFF = 0xFFFFFF */
}
ENTRY(Reset_Handler)
_Min_Heap_Size = 0x8 ; /* Not used as building heap_4.c */
_Min_Stack_Size = 0x400 ; /* Required amount of stack. Used by main(), then re-used as the interrupt stack after the kernel starts. */
_estack = ORIGIN(RAM) + LENGTH(RAM);
SECTIONS
{
.isr_vector :
{
__vector_table = .;
KEEP(*(.isr_vector))
. = ALIGN(4);
} > FLASH
.text :
{
*(.text)
*(.rodata*)
*(.constdata*)
_etext = .;
_sidata = .;
} > FLASH
.data :
{
. = ALIGN(8);
_data = .;
_sdata = .;
*(vtable)
*(.data)
_edata = .;
} > RAM
.bss :
{
. = ALIGN(8);
_bss = .;
_sbss = .;
*(.bss)
_ebss = .;
} > RAM
.heap :
{
. = ALIGN(8);
PROVIDE ( end = . );
PROVIDE ( _end = . );
_heap_bottom = .;
. = . + _Min_Heap_Size;
_heap_top = .;
. = . + _Min_Stack_Size;
. = ALIGN(8);
} >RAM
/* Set stack top to end of RAM, and stack limit move down by
* size of stack_dummy section */
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
__StackLimit = __StackTop - _Min_Stack_Size;
PROVIDE(__stack = __StackTop);
/* Check if data + heap + stack exceeds RAM limit */
ASSERT(__StackLimit >= _heap_top, "region RAM overflowed with stack")
}

@ -0,0 +1,3 @@
File included to ensure the "output" directory is not empty, and can therefore
be checked into Git. This prevents the necessity to have a cross platform
method of creating the directory from within the makefile.

@ -0,0 +1,312 @@
/*
Copyright 2001, 2002 Georges Menie (www.menie.org)
stdarg version contributed by Christian Ettinger
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
putchar is the only external dependency for this file,
if you have a working putchar, leave it commented out.
If not, uncomment the define below and
replace outbyte(c) by your own function call.
*/
#include <stdarg.h>
#define UART0_ADDRESS ( 0x40004000UL )
#define UART0_DATA ( * ( ( ( volatile unsigned int * )( UART0_ADDRESS + 0UL ) ) ) )
#define putchar(c) UART0_DATA = c
static int tiny_print( char **out, const char *format, va_list args, unsigned int buflen );
static void printchar(char **str, int c, char *buflimit)
{
if (str) {
if( buflimit == ( char * ) 0 ) {
/* Limit of buffer not known, write charater to buffer. */
**str = (char)c;
++(*str);
}
else if( ( ( unsigned long ) *str ) < ( ( unsigned long ) buflimit ) ) {
/* Within known limit of buffer, write character. */
**str = (char)c;
++(*str);
}
}
else
{
putchar(c);
}
}
#define PAD_RIGHT 1
#define PAD_ZERO 2
static int prints(char **out, const char *string, int width, int pad, char *buflimit)
{
register int pc = 0, padchar = ' ';
if (width > 0) {
register int len = 0;
register const char *ptr;
for (ptr = string; *ptr; ++ptr) ++len;
if (len >= width) width = 0;
else width -= len;
if (pad & PAD_ZERO) padchar = '0';
}
if (!(pad & PAD_RIGHT)) {
for ( ; width > 0; --width) {
printchar (out, padchar, buflimit);
++pc;
}
}
for ( ; *string ; ++string) {
printchar (out, *string, buflimit);
++pc;
}
for ( ; width > 0; --width) {
printchar (out, padchar, buflimit);
++pc;
}
return pc;
}
/* the following should be enough for 32 bit int */
#define PRINT_BUF_LEN 12
static int printi(char **out, int i, int b, int sg, int width, int pad, int letbase, char *buflimit)
{
char print_buf[PRINT_BUF_LEN];
register char *s;
register int t, neg = 0, pc = 0;
register unsigned int u = (unsigned int)i;
if (i == 0) {
print_buf[0] = '0';
print_buf[1] = '\0';
return prints (out, print_buf, width, pad, buflimit);
}
if (sg && b == 10 && i < 0) {
neg = 1;
u = (unsigned int)-i;
}
s = print_buf + PRINT_BUF_LEN-1;
*s = '\0';
while (u) {
t = (unsigned int)u % b;
if( t >= 10 )
t += letbase - '0' - 10;
*--s = (char)(t + '0');
u /= b;
}
if (neg) {
if( width && (pad & PAD_ZERO) ) {
printchar (out, '-', buflimit);
++pc;
--width;
}
else {
*--s = '-';
}
}
return pc + prints (out, s, width, pad, buflimit);
}
static int tiny_print( char **out, const char *format, va_list args, unsigned int buflen )
{
register int width, pad;
register int pc = 0;
char scr[2], *buflimit;
if( buflen == 0 ){
buflimit = ( char * ) 0;
}
else {
/* Calculate the last valid buffer space, leaving space for the NULL
terminator. */
buflimit = ( *out ) + ( buflen - 1 );
}
for (; *format != 0; ++format) {
if (*format == '%') {
++format;
width = pad = 0;
if (*format == '\0') break;
if (*format == '%') goto out;
if (*format == '-') {
++format;
pad = PAD_RIGHT;
}
while (*format == '0') {
++format;
pad |= PAD_ZERO;
}
for ( ; *format >= '0' && *format <= '9'; ++format) {
width *= 10;
width += *format - '0';
}
if( *format == 's' ) {
register char *s = (char *)va_arg( args, int );
pc += prints (out, s?s:"(null)", width, pad, buflimit);
continue;
}
if( *format == 'd' ) {
pc += printi (out, va_arg( args, int ), 10, 1, width, pad, 'a', buflimit);
continue;
}
if( *format == 'x' ) {
pc += printi (out, va_arg( args, int ), 16, 0, width, pad, 'a', buflimit);
continue;
}
if( *format == 'X' ) {
pc += printi (out, va_arg( args, int ), 16, 0, width, pad, 'A', buflimit);
continue;
}
if( *format == 'u' ) {
pc += printi (out, va_arg( args, int ), 10, 0, width, pad, 'a', buflimit);
continue;
}
if( *format == 'c' ) {
/* char are converted to int then pushed on the stack */
scr[0] = (char)va_arg( args, int );
scr[1] = '\0';
pc += prints (out, scr, width, pad, buflimit);
continue;
}
}
else {
out:
printchar (out, *format, buflimit);
++pc;
}
}
if (out) **out = '\0';
va_end( args );
return pc;
}
int printf(const char *format, ...)
{
va_list args;
va_start( args, format );
return tiny_print( 0, format, args, 0 );
}
int sprintf(char *out, const char *format, ...)
{
va_list args;
va_start( args, format );
return tiny_print( &out, format, args, 0 );
}
int snprintf( char *buf, unsigned int count, const char *format, ... )
{
va_list args;
( void ) count;
va_start( args, format );
return tiny_print( &buf, format, args, count );
}
#ifdef TEST_PRINTF
int main(void)
{
char *ptr = "Hello world!";
char *np = 0;
int i = 5;
unsigned int bs = sizeof(int)*8;
int mi;
char buf[80];
mi = (1 << (bs-1)) + 1;
printf("%s\n", ptr);
printf("printf test\n");
printf("%s is null pointer\n", np);
printf("%d = 5\n", i);
printf("%d = - max int\n", mi);
printf("char %c = 'a'\n", 'a');
printf("hex %x = ff\n", 0xff);
printf("hex %02x = 00\n", 0);
printf("signed %d = unsigned %u = hex %x\n", -3, -3, -3);
printf("%d %s(s)%", 0, "message");
printf("\n");
printf("%d %s(s) with %%\n", 0, "message");
sprintf(buf, "justif: \"%-10s\"\n", "left"); printf("%s", buf);
sprintf(buf, "justif: \"%10s\"\n", "right"); printf("%s", buf);
sprintf(buf, " 3: %04d zero padded\n", 3); printf("%s", buf);
sprintf(buf, " 3: %-4d left justif.\n", 3); printf("%s", buf);
sprintf(buf, " 3: %4d right justif.\n", 3); printf("%s", buf);
sprintf(buf, "-3: %04d zero padded\n", -3); printf("%s", buf);
sprintf(buf, "-3: %-4d left justif.\n", -3); printf("%s", buf);
sprintf(buf, "-3: %4d right justif.\n", -3); printf("%s", buf);
return 0;
}
/*
* if you compile this file with
* gcc -Wall $(YOUR_C_OPTIONS) -DTEST_PRINTF -c printf.c
* you will get a normal warning:
* printf.c:214: warning: spurious trailing `%' in format
* this line is testing an invalid % at the end of the format string.
*
* this should display (on 32bit int machine) :
*
* Hello world!
* printf test
* (null) is null pointer
* 5 = 5
* -2147483647 = - max int
* char a = 'a'
* hex ff = ff
* hex 00 = 00
* signed -3 = unsigned 4294967293 = hex fffffffd
* 0 message(s)
* 0 message(s) with %
* justif: "left "
* justif: " right"
* 3: 0003 zero padded
* 3: 3 left justif.
* 3: 3 right justif.
* -3: -003 zero padded
* -3: -3 left justif.
* -3: -3 right justif.
*/
#endif
/* To keep linker happy. */
int write( int i, char* c, int n)
{
(void)i;
(void)n;
(void)c;
return 0;
}

@ -0,0 +1,168 @@
/*
* FreeRTOS V202111.00
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* http://www.FreeRTOS.org
* http://aws.amazon.com/freertos
*
* 1 tab == 4 spaces!
*/
#include <stdint.h>
#include <stdio.h>
/* UART peripheral register addresses and bits. */
#define UART0_ADDR ( ( UART_t * ) ( 0x40004000 ) )
#define UART_DR( baseaddr ) ( *( uint32_t * ) ( baseaddr ) )
#define UART_STATE( baseaddr ) ( *( uint32_t * ) ( baseaddr + 4 ) )
#define UART_STATE_TXFULL ( 1 << 0 )
typedef struct UART_t
{
volatile uint32_t DATA;
volatile uint32_t STATE;
volatile uint32_t CTRL;
volatile uint32_t INTSTATUS;
volatile uint32_t BAUDDIV;
} UART_t;
/* FreeRTOS interrupt handlers. */
extern void vPortSVCHandler( void );
extern void xPortPendSVHandler( void );
extern void xPortSysTickHandler( void );
extern void TIMER0_Handler( void );
extern void TIMER1_Handler( void );
/* Exception handlers. */
static void HardFault_Handler( void ) __attribute__( ( naked ) );
static void Default_Handler( void ) __attribute__( ( naked ) );
void Reset_Handler( void );
extern int main( void );
extern uint32_t _estack;
/* Vector table. */
const uint32_t* isr_vector[] __attribute__((section(".isr_vector"))) =
{
( uint32_t * ) &_estack,
( uint32_t * ) &Reset_Handler, // Reset -15
( uint32_t * ) &Default_Handler, // NMI_Handler -14
( uint32_t * ) &HardFault_Handler, // HardFault_Handler -13
( uint32_t * ) &Default_Handler, // MemManage_Handler -12
( uint32_t * ) &Default_Handler, // BusFault_Handler -11
( uint32_t * ) &Default_Handler, // UsageFault_Handler -10
0, // reserved
0, // reserved
0, // reserved
0, // reserved -6
( uint32_t * ) &vPortSVCHandler, // SVC_Handler -5
( uint32_t * ) &Default_Handler, // DebugMon_Handler -4
0, // reserved
( uint32_t * ) &xPortPendSVHandler, // PendSV handler -2
( uint32_t * ) &xPortSysTickHandler,// SysTick_Handler -1
0,
0,
0,
0,
0,
0,
0,
0,
( uint32_t * ) TIMER0_Handler, // Timer 0
( uint32_t * ) TIMER1_Handler, // Timer 1
0,
0,
0,
0, // Ethernet 13
};
void Reset_Handler( void )
{
main();
}
/* Variables used to store the value of registers at the time a hardfault
* occurs. These are volatile to try and prevent the compiler/linker optimising
* them away as the variables never actually get used. */
volatile uint32_t r0;
volatile uint32_t r1;
volatile uint32_t r2;
volatile uint32_t r3;
volatile uint32_t r12;
volatile uint32_t lr; /* Link register. */
volatile uint32_t pc; /* Program counter. */
volatile uint32_t psr;/* Program status register. */
/* Called from the hardfault handler to provide information on the processor
* state at the time of the fault.
*/
void prvGetRegistersFromStack( uint32_t *pulFaultStackAddress )
{
r0 = pulFaultStackAddress[ 0 ];
r1 = pulFaultStackAddress[ 1 ];
r2 = pulFaultStackAddress[ 2 ];
r3 = pulFaultStackAddress[ 3 ];
r12 = pulFaultStackAddress[ 4 ];
lr = pulFaultStackAddress[ 5 ];
pc = pulFaultStackAddress[ 6 ];
psr = pulFaultStackAddress[ 7 ];
printf( "Calling prvGetRegistersFromStack() from fault handler" );
fflush( stdout );
/* When the following line is hit, the variables contain the register values. */
for( ;; );
}
void Default_Handler( void )
{
__asm volatile
(
".align 8 \n"
" ldr r3, NVIC_INT_CTRL_CONST \n" /* Load the address of the interrupt control register into r3. */
" ldr r2, [r3, #0] \n" /* Load the value of the interrupt control register into r2. */
" uxtb r2, r2 \n" /* The interrupt number is in the least significant byte - clear all other bits. */
"Infinite_Loop: \n" /* Sit in an infinite loop - the number of the executing interrupt is held in r2. */
" b Infinite_Loop \n"
".align 4 \n"
"NVIC_INT_CTRL_CONST: .word 0xe000ed04 \n"
);
}
void HardFault_Handler( void )
{
__asm volatile
(
".align 8 \n"
" tst lr, #4 \n"
" ite eq \n"
" mrseq r0, msp \n"
" mrsne r0, psp \n"
" ldr r1, [r0, #24] \n"
" ldr r2, handler2_address_const \n"
" bx r2 \n"
" handler2_address_const: .word prvGetRegistersFromStack \n"
);
}

@ -88,7 +88,7 @@
</option>
<option>
<name>OCLastSavedByProductVersion</name>
<state>8.42.1.23869</state>
<state>9.10.2.39304</state>
</option>
<option>
<name>UseFlashLoader</name>
@ -498,7 +498,7 @@
<name>IJET_ID</name>
<archiveVersion>2</archiveVersion>
<data>
<version>8</version>
<version>9</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
@ -722,6 +722,58 @@
<name>CCIjetUsbSerialNoSelect</name>
<state>0</state>
</option>
<option>
<name>CatchV8ARReset</name>
<state>0</state>
</option>
<option>
<name>CatchV8AREREL1NS</name>
<state>0</state>
</option>
<option>
<name>CatchV8AREREL1S</name>
<state>0</state>
</option>
<option>
<name>CatchV8AREREL2NS</name>
<state>0</state>
</option>
<option>
<name>CatchV8AREREL3S</name>
<state>0</state>
</option>
<option>
<name>CatchV8AREEL1NS</name>
<state>0</state>
</option>
<option>
<name>CatchV8ARREL1NS</name>
<state>0</state>
</option>
<option>
<name>CatchV8AREEL1S</name>
<state>0</state>
</option>
<option>
<name>CatchV8ARREL1S</name>
<state>0</state>
</option>
<option>
<name>CatchV8AREEL2NS</name>
<state>0</state>
</option>
<option>
<name>CatchV8ARREL2NS</name>
<state>0</state>
</option>
<option>
<name>CatchV8AREEL3S</name>
<state>0</state>
</option>
<option>
<name>CatchV8ARREL3S</name>
<state>0</state>
</option>
</data>
</settings>
<settings>
@ -928,7 +980,7 @@
<name>LMIFTDI_ID</name>
<archiveVersion>2</archiveVersion>
<data>
<version>2</version>
<version>3</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
@ -955,6 +1007,19 @@
<name>CCLmiFtdiInterfaceCmdLine</name>
<state>0</state>
</option>
<option>
<name>CCLmiftdiUsbSerialNo</name>
<state></state>
</option>
<option>
<name>CCLmiftdiUsbSerialNoSelect</name>
<state>0</state>
</option>
<option>
<name>CCLmiftdiResetList</name>
<version>0</version>
<state>0</state>
</option>
</data>
</settings>
<settings>
@ -1007,7 +1072,7 @@
<name>STLINK_ID</name>
<archiveVersion>2</archiveVersion>
<data>
<version>6</version>
<version>7</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
@ -1420,10 +1485,6 @@
<file>$TOOLKIT_DIR$\plugins\rtos\FreeRtos\FreeRtosArmPlugin.ENU.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\HWRTOSplugin\HWRTOSplugin.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\Mbed\MbedArmPlugin.ENU.ewplugin</file>
<loadFlag>0</loadFlag>
@ -1436,42 +1497,22 @@
<file>$TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin</file>
<loadFlag>1</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\RemedyRtosViewer\RemedyRtosViewer.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\SMX\smxAwareIarArm8b.ewplugin</file>
<file>$TOOLKIT_DIR$\plugins\rtos\SMX\smxAwareIarArm9.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\SMX\smxAwareIarArm8bBE.ewplugin</file>
<file>$TOOLKIT_DIR$\plugins\rtos\SMX\smxAwareIarArm9BE.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin</file>
<loadFlag>0</loadFlag>

@ -11,9 +11,13 @@
<name>General</name>
<archiveVersion>3</archiveVersion>
<data>
<version>31</version>
<version>33</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
<name>BrowseInfoPath</name>
<state>Debug\BrowseInfo</state>
</option>
<option>
<name>OGProductVersion</name>
<state>4.41A</state>
@ -66,15 +70,7 @@
</option>
<option>
<name>OGLastSavedByProductVersion</name>
<state>8.42.1.23869</state>
</option>
<option>
<name>GeneralEnableMisra</name>
<state>0</state>
</option>
<option>
<name>GeneralMisraVerbose</name>
<state>0</state>
<state>9.10.2.39304</state>
</option>
<option>
<name>OGChipSelectEditMenu</name>
@ -96,27 +92,13 @@
<name>GenStdoutInterface</name>
<state>0</state>
</option>
<option>
<name>GeneralMisraRules98</name>
<version>0</version>
<state>1000111110110101101110011100111111101110011011000101110111101101100111111111111100110011111001110111001111111111111111111111111</state>
</option>
<option>
<name>GeneralMisraVer</name>
<state>0</state>
</option>
<option>
<name>GeneralMisraRules04</name>
<version>0</version>
<state>111101110010111111111000110111111111111111111111111110010111101111010101111111111111111111111111101111111011111001111011111011111111111111111</state>
</option>
<option>
<name>RTConfigPath2</name>
<state>$TOOLKIT_DIR$\inc\c\DLib_Config_Normal.h</state>
</option>
<option>
<name>GBECoreSlave</name>
<version>28</version>
<version>30</version>
<state>38</state>
</option>
<option>
@ -133,7 +115,7 @@
</option>
<option>
<name>CoreVariant</name>
<version>28</version>
<version>30</version>
<state>38</state>
</option>
<option>
@ -156,7 +138,7 @@
</option>
<option>
<name>GFPUCoreSlave2</name>
<version>28</version>
<version>30</version>
<state>38</state>
</option>
<option>
@ -209,13 +191,21 @@
<version>0</version>
<state>0</state>
</option>
<option>
<name>OGAarch64Abi</name>
<state>0</state>
</option>
<option>
<name>OG_32_64Device</name>
<state>0</state>
</option>
</data>
</settings>
<settings>
<name>ICCARM</name>
<archiveVersion>2</archiveVersion>
<data>
<version>36</version>
<version>37</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
@ -343,10 +333,6 @@
<name>PreInclude</name>
<state></state>
</option>
<option>
<name>CompilerMisraOverride</name>
<state>0</state>
</option>
<option>
<name>CCIncludePath2</name>
<state>$PROJ_DIR$\</state>
@ -380,16 +366,6 @@
<name>CCOptLevelSlave</name>
<state>3</state>
</option>
<option>
<name>CompilerMisraRules98</name>
<version>0</version>
<state>1000111110110101101110011100111111101110011011000101110111101101100111111111111100110011111001110111001111111111111111111111111</state>
</option>
<option>
<name>CompilerMisraRules04</name>
<version>0</version>
<state>111101110010111111111000110111111111111111111111111110010111101111010101111111111111111111111111101111111011111001111011111011111111111111111</state>
</option>
<option>
<name>CCPosIndRopi</name>
<state>0</state>
@ -481,7 +457,7 @@
<name>AARM</name>
<archiveVersion>2</archiveVersion>
<data>
<version>10</version>
<version>11</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
@ -637,6 +613,10 @@
<name>AsmNoLiteralPool</name>
<state>0</state>
</option>
<option>
<name>PreInclude</name>
<state></state>
</option>
</data>
</settings>
<settings>
@ -676,13 +656,9 @@
<extensions></extensions>
<cmdline></cmdline>
<hasPrio>0</hasPrio>
<buildSequence>inputOutputBased</buildSequence>
</data>
</settings>
<settings>
<name>BICOMP</name>
<archiveVersion>0</archiveVersion>
<data />
</settings>
<settings>
<name>BUILDACTION</name>
<archiveVersion>1</archiveVersion>
@ -695,17 +671,13 @@
<name>ILINK</name>
<archiveVersion>0</archiveVersion>
<data>
<version>23</version>
<version>25</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
<name>IlinkLibIOConfig</name>
<state>1</state>
</option>
<option>
<name>XLinkMisraHandler</name>
<state>0</state>
</option>
<option>
<name>IlinkInputFileSlave</name>
<state>0</state>
@ -1031,6 +1003,26 @@
<name>IlinkRawBinaryAlign2</name>
<state></state>
</option>
<option>
<name>IlinkLogCrtRoutineSelection</name>
<state>0</state>
</option>
<option>
<name>IlinkLogFragmentInfo</name>
<state>0</state>
</option>
<option>
<name>IlinkLogInlining</name>
<state>0</state>
</option>
<option>
<name>IlinkLogMerging</name>
<state>0</state>
</option>
<option>
<name>IlinkDemangle</name>
<state>0</state>
</option>
</data>
</settings>
<settings>
@ -1054,16 +1046,11 @@
</option>
</data>
</settings>
<settings>
<name>BILINK</name>
<archiveVersion>0</archiveVersion>
<data />
</settings>
</configuration>
<group>
<name>Blinky Demo</name>
<file>
<name>$PROJ_DIR$\main_blinky.c</name>
<name>$PROJ_DIR$\..\..\main_blinky.c</name>
</file>
</group>
<group>
@ -1071,25 +1058,25 @@
<group>
<name>include</name>
<file>
<name>$PROJ_DIR$\..\..\Source\include\event_groups.h</name>
<name>$PROJ_DIR$\..\..\..\..\Source\include\event_groups.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\include\message_buffer.h</name>
<name>$PROJ_DIR$\..\..\..\..\Source\include\message_buffer.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\include\queue.h</name>
<name>$PROJ_DIR$\..\..\..\..\Source\include\queue.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\include\semphr.h</name>
<name>$PROJ_DIR$\..\..\..\..\Source\include\semphr.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\include\stream_buffer.h</name>
<name>$PROJ_DIR$\..\..\..\..\Source\include\stream_buffer.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\include\task.h</name>
<name>$PROJ_DIR$\..\..\..\..\Source\include\task.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\include\timers.h</name>
<name>$PROJ_DIR$\..\..\..\..\Source\include\timers.h</name>
</file>
</group>
<group>
@ -1099,37 +1086,37 @@
<group>
<name>ARM_CM3</name>
<file>
<name>$PROJ_DIR$\..\..\Source\portable\IAR\ARM_CM3\port.c</name>
<name>$PROJ_DIR$\..\..\..\..\Source\portable\IAR\ARM_CM3\port.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\portable\IAR\ARM_CM3\portasm.s</name>
<name>$PROJ_DIR$\..\..\..\..\Source\portable\IAR\ARM_CM3\portasm.s</name>
</file>
</group>
</group>
<group>
<name>MemMang</name>
<file>
<name>$PROJ_DIR$\..\..\Source\portable\MemMang\heap_4.c</name>
<name>$PROJ_DIR$\..\..\..\..\Source\portable\MemMang\heap_4.c</name>
</file>
</group>
</group>
<file>
<name>$PROJ_DIR$\..\..\Source\event_groups.c</name>
<name>$PROJ_DIR$\..\..\..\..\Source\event_groups.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\list.c</name>
<name>$PROJ_DIR$\..\..\..\..\Source\list.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\queue.c</name>
<name>$PROJ_DIR$\..\..\..\..\Source\queue.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\stream_buffer.c</name>
<name>$PROJ_DIR$\..\..\..\..\Source\stream_buffer.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\tasks.c</name>
<name>$PROJ_DIR$\..\..\..\..\Source\tasks.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\timers.c</name>
<name>$PROJ_DIR$\..\..\..\..\Source\timers.c</name>
</file>
</group>
<group>
@ -1137,89 +1124,89 @@
<group>
<name>Standard Demo Tasks</name>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\AbortDelay.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\AbortDelay.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\BlockQ.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\BlockQ.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\blocktim.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\blocktim.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\countsem.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\countsem.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\death.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\death.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\dynamic.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\dynamic.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\EventGroupsDemo.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\EventGroupsDemo.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\GenQTest.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\GenQTest.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\integer.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\integer.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\IntQueue.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\IntQueue.c</name>
</file>
<file>
<name>$PROJ_DIR$\IntQueueTimer.c</name>
<name>$PROJ_DIR$\..\..\IntQueueTimer.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\IntSemTest.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\IntSemTest.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\MessageBufferAMP.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\MessageBufferAMP.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\MessageBufferDemo.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\MessageBufferDemo.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\PollQ.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\PollQ.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\QPeek.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\QPeek.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\QueueOverwrite.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\QueueOverwrite.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\QueueSet.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\QueueSet.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\QueueSetPolling.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\QueueSetPolling.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\recmutex.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\recmutex.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\semtest.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\semtest.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\StaticAllocation.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\StaticAllocation.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\StreamBufferDemo.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\StreamBufferDemo.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\StreamBufferInterrupt.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\StreamBufferInterrupt.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\TaskNotify.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\TaskNotify.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\TaskNotifyArray.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\TaskNotifyArray.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\TimerDemo.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\TimerDemo.c</name>
</file>
</group>
<file>
<name>$PROJ_DIR$\main_full.c</name>
<name>$PROJ_DIR$\..\..\main_full.c</name>
</file>
</group>
<group>
@ -1229,9 +1216,9 @@
</file>
</group>
<file>
<name>$PROJ_DIR$\FreeRTOSConfig.h</name>
<name>$PROJ_DIR$\..\..\FreeRTOSConfig.h</name>
</file>
<file>
<name>$PROJ_DIR$\main.c</name>
<name>$PROJ_DIR$\..\..\main.c</name>
</file>
</project>

@ -60,7 +60,6 @@ extern void __iar_program_start(void);
extern void xPortPendSVHandler(void);
extern void xPortSysTickHandler(void);
extern void vPortSVCHandler(void);
extern void vDualTimer1Handler( void );
extern void TIMER0_Handler( void );
extern void TIMER1_Handler( void );

@ -26,6 +26,9 @@
/******************************************************************************
* See https://www.freertos.org/freertos-on-qemu-mps2-an385-model.html for
* instructions.
*
* This project provides two demo applications. A simple blinky style project,
* and a more comprehensive test and demo application. The
* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY constant, defined in this file, is used to
@ -36,10 +39,11 @@
* This file implements the code that is not demo specific, including the
* hardware setup and FreeRTOS hook functions.
*
* Use the following command to start the application running in a way that
* enables the IAR IDE to connect and debug:
* Running in QEMU:
* Use the following commands to start the application running in a way that
* enables the debugger to connect, omit the "-s -S" to run the project without
* the debugger:
* qemu-system-arm -machine mps2-an385 -cpu cortex-m3 -kernel [path-to]/RTOSDemo.out -nographic -serial stdio -semihosting -semihosting-config enable=on,target=native -s -S
* and set IAR connect GDB server to "localhost,1234" in project debug options.
*/
/* FreeRTOS includes. */
@ -94,6 +98,10 @@ static void prvUARTInit( void );
void main( void )
{
/* See https://www.freertos.org/freertos-on-qemu-mps2-an385-model.html for
instructions. */
/* Hardware initialisation. printf() output uses the UART for IO. */
prvUARTInit();
@ -126,7 +134,9 @@ void vApplicationMallocFailedHook( void )
(although it does not provide information on how the remaining heap might be
fragmented). See http://www.freertos.org/a00111.html for more
information. */
vAssertCalled( __FILE__, __LINE__ );
printf( "\r\n\r\nMalloc failed\r\n" );
portDISABLE_INTERRUPTS();
for( ;; );
}
/*-----------------------------------------------------------*/
@ -152,7 +162,9 @@ void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName )
/* Run time stack overflow checking is performed if
configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook
function is called if a stack overflow is detected. */
vAssertCalled( __FILE__, __LINE__ );
printf( "\r\n\r\nStack overflow in %s\r\n", pcTaskName );
portDISABLE_INTERRUPTS();
for( ;; );
}
/*-----------------------------------------------------------*/
@ -266,13 +278,13 @@ static void prvUARTInit( void )
int __write( int iFile, char *pcString, int iStringLength )
{
uint32_t ulNextChar;
int iNextChar;
/* Avoid compiler warnings about unused parameters. */
( void ) iFile;
/* Output the formatted string to the UART. */
for( ulNextChar = 0; ulNextChar < iStringLength; ulNextChar++ )
for( iNextChar = 0; iNextChar < iStringLength; iNextChar++ )
{
while( ( UART0_STATE & TX_BUFFER_MASK ) != 0 );
UART0_DATA = *pcString;
@ -281,4 +293,20 @@ int __write( int iFile, char *pcString, int iStringLength )
return iStringLength;
}
/*-----------------------------------------------------------*/
void *malloc( size_t size )
{
( void ) size;
/* This project uses heap_4 so doesn't set up a heap for use by the C
library - but something is calling the C library malloc(). See
https://freertos.org/a00111.html for more information. */
printf( "\r\n\r\nUnexpected call to malloc() - should be usine pvPortMalloc()\r\n" );
portDISABLE_INTERRUPTS();
for( ;; );
}

@ -104,6 +104,11 @@
#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 )
#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY )
/* Stack sizes are defined relative to configMINIMAL_STACK_SIZE so they scale
across projects that have that constant set differently - in this case the
constant is different depending on the compiler in use. */
#define mainMESSAGE_BUFFER_STACK_SIZE ( configMINIMAL_STACK_SIZE + ( configMINIMAL_STACK_SIZE >> 1 ) )
#define mainCHECK_TASK_STACK_SIZE ( configMINIMAL_STACK_SIZE + ( configMINIMAL_STACK_SIZE >> 1 ) )
/*-----------------------------------------------------------*/
/* The task that checks the operation of all the other standard demo tasks, as
@ -124,7 +129,7 @@ void main_full( void )
vStartQueuePeekTasks();
vStartQueueSetTasks();
vStartEventGroupTasks();
vStartMessageBufferTasks( configMINIMAL_STACK_SIZE );
vStartMessageBufferTasks( mainMESSAGE_BUFFER_STACK_SIZE );
vStartStreamBufferTasks();
vCreateAbortDelayTasks();
vStartCountingSemaphoreTasks();
@ -144,7 +149,7 @@ void main_full( void )
or not the correct/expected number of tasks are running at any given time. */
vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );
xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
xTaskCreate( prvCheckTask, "Check", mainCHECK_TASK_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
/* Start the scheduler. */
vTaskStartScheduler();
@ -165,6 +170,9 @@ const TickType_t xTaskPeriod = pdMS_TO_TICKS( 5000UL );
TickType_t xPreviousWakeTime;
extern uint32_t ulNestCount;
/* Avoid warning about unused parameter. */
( void ) pvParameters;
xPreviousWakeTime = xTaskGetTickCount();
for( ;; )
@ -271,7 +279,7 @@ extern uint32_t ulNestCount;
/* It is normally not good to call printf() from an embedded system,
although it is ok in this simulated case. */
printf( "%s : %d (%d)\r\n", pcMessage, (int) xTaskGetTickCount(), ulNestCount );
printf( "%s : %d (%d)\r\n", pcMessage, (int) xTaskGetTickCount(), ( int ) ulNestCount );
}
}
/*-----------------------------------------------------------*/

@ -2937,6 +2937,7 @@ uxtaskgetsystemstate
uxtaskgettasknumber
uxtaskpriority
uxtaskpriorityget
uxtb
uxtick
uxtxstackbuffer
uxvariabletoincrement

Loading…
Cancel
Save