summaryrefslogtreecommitdiff
path: root/software
diff options
context:
space:
mode:
authorRoland Sahlsten <Roland.Sahlsten.ASE10@fh-joanneum.at>2011-10-24 21:09:29 +0000
committerRoland Sahlsten <Roland.Sahlsten.ASE10@fh-joanneum.at>2011-10-24 21:09:29 +0000
commit9976c747d7209b33e1a009f84539812366146cfb (patch)
tree7ff1439a0e61fb0aa7e8cc33827dbb611a511ecc /software
parentgit-svn-id: https://svn.spreadspace.org/mur.sat@179 7de4ea59-55d0-425e-a1af-a... (diff)
git-svn-id: https://svn.spreadspace.org/mur.sat@180 7de4ea59-55d0-425e-a1af-a3118ea81d4c
Diffstat (limited to 'software')
-rw-r--r--software/mpu/MurSatMPU Debug.launch19
-rw-r--r--software/mpu/MurSatMPU Release.launch17
-rw-r--r--software/mpu/inc/Types.h14
-rw-r--r--software/mpu/src/boot.c57
-rw-r--r--software/mpu/src/kernel.c67
-rw-r--r--software/mpu/src/main.c5
6 files changed, 131 insertions, 48 deletions
diff --git a/software/mpu/MurSatMPU Debug.launch b/software/mpu/MurSatMPU Debug.launch
index 1bbeecc..8f240df 100644
--- a/software/mpu/MurSatMPU Debug.launch
+++ b/software/mpu/MurSatMPU Debug.launch
@@ -1,17 +1,32 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="com.crt.ctrlcenter.idleNative2">
-<stringAttribute key="com.crt.ctrlcenter.targetbase" value="NXP LPC1300"/>
+<stringAttribute key=".gdbinit" value=""/>
+<stringAttribute key="com.crt.ctrlcenter.targetbase" value="NXP LPC1300 (*)"/>
<stringAttribute key="com.crt.ctrlcenter.targetconfig" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;config chipvendor=&quot;NXP&quot; genname=&quot;NXP LPC1300&quot; id=&quot;config.gdb.stub&quot;&gt;&lt;parameters&gt;&lt;params&gt;&lt;param description=&quot;Enter as XTAL[,PLL]. PLL is optional. Values are in kHz&quot; name=&quot;Crystal (XTAL) frequency and PLL value&quot; required=&quot;false&quot; type=&quot;nullString&quot; var=&quot;xtal.hz&quot;/&gt;&#13;&#10;&lt;/params&gt;&#13;&#10;&lt;initValue value=&quot;false&quot; var=&quot;vector.catch&quot;/&gt;&#13;&#10;&lt;params&gt;&lt;param default=&quot;true&quot; description=&quot;Vector catch&quot; name=&quot;Vector catch&quot; value=&quot;false&quot; var=&quot;vector.catch&quot;&gt;&lt;enum value=&quot;True&quot;/&gt;&#13;&#10;&lt;enum value=&quot;False&quot;/&gt;&#13;&#10;&lt;/param&gt;&#13;&#10;&lt;/params&gt;&#13;&#10;&lt;params&gt;&lt;param default=&quot;true&quot; description=&quot;Enable Red Trace&quot; name=&quot;Enable Red Trace &quot; value=&quot;true&quot; var=&quot;swv.enable&quot;&gt;&lt;enum value=&quot;true&quot;/&gt;&#13;&#10;&lt;enum value=&quot;false&quot;/&gt;&#13;&#10;&lt;/param&gt;&#13;&#10;&lt;/params&gt;&#13;&#10;&lt;params&gt;&lt;param default=&quot;Auto&quot; description=&quot;Enablement of semihosting support&quot; name=&quot;Semihosting support&quot; value=&quot;Auto&quot; var=&quot;internal.semihost&quot;&gt;&lt;enum value=&quot;On&quot;/&gt;&#13;&#10;&lt;enum value=&quot;Off&quot;/&gt;&#13;&#10;&lt;enum value=&quot;Auto&quot;/&gt;&#13;&#10;&lt;/param&gt;&#13;&#10;&lt;/params&gt;&#13;&#10;&lt;params&gt;&lt;param default=&quot;&quot; description=&quot;Switch debug interface between SWD and JTAG (leave blank for default [SWD])&quot; name=&quot;Debug interface&quot; option=&quot;&quot; value=&quot;&quot; var=&quot;internal.debug.interface&quot;&gt;&lt;enum value=&quot;&quot;/&gt;&#13;&#10;&lt;enum value=&quot;JTAG&quot;/&gt;&#13;&#10;&lt;enum value=&quot;SWD&quot;/&gt;&#13;&#10;&lt;/param&gt;&#13;&#10;&lt;/params&gt;&#13;&#10;&lt;params&gt;&lt;param default=&quot;&quot; description=&quot;Maximum wire speed in KHz (leave blank to Auto-detect). Not all values are supported by all targets&quot; name=&quot;Maximum wire speed&quot; type=&quot;nullString&quot; value=&quot;&quot; var=&quot;emu.speed&quot;&gt;&lt;enum value=&quot;&quot;/&gt;&#13;&#10;&lt;enum value=&quot;30000&quot;/&gt;&#13;&#10;&lt;enum value=&quot;15000&quot;/&gt;&#13;&#10;&lt;enum value=&quot;10000&quot;/&gt;&#13;&#10;&lt;enum value=&quot;7500&quot;/&gt;&#13;&#10;&lt;enum value=&quot;6000&quot;/&gt;&#13;&#10;&lt;enum value=&quot;5000&quot;/&gt;&#13;&#10;&lt;enum value=&quot;3750&quot;/&gt;&#13;&#10;&lt;enum value=&quot;3000&quot;/&gt;&#13;&#10;&lt;enum value=&quot;2500&quot;/&gt;&#13;&#10;&lt;enum value=&quot;2000&quot;/&gt;&#13;&#10;&lt;enum value=&quot;1500&quot;/&gt;&#13;&#10;&lt;enum value=&quot;1250&quot;/&gt;&#13;&#10;&lt;enum value=&quot;1200&quot;/&gt;&#13;&#10;&lt;enum value=&quot;1000&quot;/&gt;&#13;&#10;&lt;enum value=&quot;750&quot;/&gt;&#13;&#10;&lt;enum value=&quot;600&quot;/&gt;&#13;&#10;&lt;enum value=&quot;500&quot;/&gt;&#13;&#10;&lt;enum value=&quot;400&quot;/&gt;&#13;&#10;&lt;enum value=&quot;300&quot;/&gt;&#13;&#10;&lt;enum value=&quot;250&quot;/&gt;&#13;&#10;&lt;enum value=&quot;200&quot;/&gt;&#13;&#10;&lt;enum value=&quot;150&quot;/&gt;&#13;&#10;&lt;/param&gt;&#13;&#10;&lt;/params&gt;&#13;&#10;&lt;params&gt;&lt;param default=&quot;&quot; description=&quot;Additional options&quot; name=&quot;Additional options&quot; value=&quot;&quot; var=&quot;misc.options&quot;/&gt;&#13;&#10;&lt;param default=&quot;2&quot; description=&quot;Set stub debug level (1-4)&quot; name=&quot;Debug Level &quot; value=&quot;2&quot; var=&quot;debug.level&quot;/&gt;&#13;&#10;&lt;param default=&quot;True&quot; description=&quot;when True, executable image will be loaded into the target&quot; name=&quot;Load image&quot; type=&quot;boolean&quot; value=&quot;True&quot; var=&quot;load&quot;&gt;&lt;enum value=&quot;True&quot;/&gt;&#13;&#10;&lt;enum value=&quot;False&quot;/&gt;&#13;&#10;&lt;/param&gt;&#13;&#10;&lt;param default=&quot;cont&quot; description=&quot;Run, continue or (do nothing)&quot; name=&quot;Run/Continue image&quot; value=&quot;cont&quot; var=&quot;run&quot;&gt;&lt;enum value=&quot;run&quot;/&gt;&#13;&#10;&lt;enum value=&quot;cont&quot;/&gt;&#13;&#10;&lt;enum value=&quot;&quot;/&gt;&#13;&#10;&lt;/param&gt;&#13;&#10;&lt;param default=&quot;off&quot; description=&quot;If on is specified, make the debugger treat unknown memory as non-existent and refuse \naccesses to such memory. If off is specified, treat the memory as RAM&quot; name=&quot;Memory Access Checking&quot; value=&quot;off&quot; var=&quot;mem.access&quot;&gt;&lt;enum value=&quot;on&quot;/&gt;&#13;&#10;&lt;enum value=&quot;off&quot;/&gt;&#13;&#10;&lt;/param&gt;&#13;&#10;&lt;param default=&quot;cont&quot; description=&quot;choose the disconnect behavior for the target&quot; name=&quot;Disconnect behavior&quot; value=&quot;cont&quot; var=&quot;ondisconnect&quot;&gt;&lt;enum value=&quot;nochange&quot;/&gt;&#13;&#10;&lt;enum value=&quot;stop&quot;/&gt;&#13;&#10;&lt;enum value=&quot;cont&quot;/&gt;&#13;&#10;&lt;enum value=&quot;run_cont&quot;/&gt;&#13;&#10;&lt;/param&gt;&#13;&#10;&lt;/params&gt;&#13;&#10;&lt;/parameters&gt;&#13;&#10;&lt;script emulators=&quot;${gdb.stub} -mi -info-emu&quot; silent=&quot;false&quot; swv=&quot;true&quot; type=&quot;init&quot;&gt;set remotetimeout 60000&amp;#x0A;target extended-remote | ${gdb.stub} -g -mi -${debug.level:2} ${-c+speed:$null} ${-s+emu.speed:$null} ${-p+package:$null} ${-e+emulator:$null} ${vector.catch?-vc:} ${misc.options}&amp;#x0A;set mem inaccessible-by-default ${mem.access}&amp;#x0A;mon ondisconnect ${ondisconnect}&amp;#x0A;set arm force-mode thumb&amp;#x0A;${load}&lt;/script&gt;&#13;&#10;&lt;script silent=&quot;false&quot; type=&quot;run&quot;&gt;${run}&lt;/script&gt;&#13;&#10;&lt;/config&gt;&#10;"/>
<stringAttribute key="org.eclipse.cdt.debug.mi.core.DEBUG_NAME" value="arm-none-eabi-gdb"/>
<stringAttribute key="org.eclipse.cdt.debug.mi.core.GDB_INIT" value=""/>
+<booleanAttribute key="org.eclipse.cdt.debug.mi.core.breakpointsFullPath" value="false"/>
+<stringAttribute key="org.eclipse.cdt.debug.mi.core.commandFactory" value="com.crt.ctrlcenter.cmdfactory"/>
+<stringAttribute key="org.eclipse.cdt.debug.mi.core.protocol" value="mi"/>
+<booleanAttribute key="org.eclipse.cdt.debug.mi.core.verboseMode" value="false"/>
+<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_ID" value="com.crt.ctrlcenter.CRTEmbeddedCDebugger"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_REGISTER_GROUPS" value=""/>
+<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/>
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
-<stringAttribute key="org.eclipse.cdt.launch.FORMAT" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&lt;contentList&gt;&lt;content id=&quot;u-prvLoopBackTestTask-(format)&quot; val=&quot;1&quot;/&gt;&lt;/contentList&gt;"/>
+<booleanAttribute key="org.eclipse.cdt.launch.ENABLE_REGISTER_BOOKKEEPING" value="false"/>
+<booleanAttribute key="org.eclipse.cdt.launch.ENABLE_VARIABLE_BOOKKEEPING" value="false"/>
+<stringAttribute key="org.eclipse.cdt.launch.FORMAT" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&lt;contentList&gt;&lt;content id=&quot;pData-Msg-kernel_Process_Task-(cast)&quot; val=&quot;char*&quot;/&gt;&lt;content id=&quot;*pxQueue_Kernel-pxQueue_Kernel-boot_CreateQueues-(cast_to_array)&quot; val=&quot;0:1&quot;/&gt;&lt;content id=&quot;u-prvLoopBackTestTask-(format)&quot; val=&quot;1&quot;/&gt;&lt;/contentList&gt;"/>
<stringAttribute key="org.eclipse.cdt.launch.GLOBAL_VARIABLES" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;globalVariableList/&gt;&#13;&#10;"/>
<stringAttribute key="org.eclipse.cdt.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;memoryBlockExpressionList/&gt;&#13;&#10;"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="Debug\MurSatMPU.axf"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="MurSatMPU"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="com.crt.advproject.config.exe.debug.1738945474"/>
<booleanAttribute key="org.eclipse.cdt.launch.use_terminal" value="false"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/MurSatMPU"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="4"/>
+</listAttribute>
</launchConfiguration>
diff --git a/software/mpu/MurSatMPU Release.launch b/software/mpu/MurSatMPU Release.launch
index f7927bc..8183be3 100644
--- a/software/mpu/MurSatMPU Release.launch
+++ b/software/mpu/MurSatMPU Release.launch
@@ -1,13 +1,28 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="com.crt.ctrlcenter.idleNative2">
-<stringAttribute key="com.crt.ctrlcenter.targetbase" value="NXP LPC1300"/>
+<stringAttribute key=".gdbinit" value=""/>
+<stringAttribute key="com.crt.ctrlcenter.targetbase" value="NXP LPC1300 (*)"/>
<stringAttribute key="com.crt.ctrlcenter.targetconfig" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;config chipvendor=&quot;NXP&quot; genname=&quot;NXP LPC1300&quot; id=&quot;config.gdb.stub&quot;&gt;&lt;parameters&gt;&lt;params&gt;&lt;param description=&quot;Enter as XTAL[,PLL]. PLL is optional. Values are in kHz&quot; name=&quot;Crystal (XTAL) frequency and PLL value&quot; required=&quot;false&quot; type=&quot;nullString&quot; var=&quot;xtal.hz&quot;/&gt;&#13;&#10;&lt;/params&gt;&#13;&#10;&lt;initValue value=&quot;false&quot; var=&quot;vector.catch&quot;/&gt;&#13;&#10;&lt;params&gt;&lt;param default=&quot;true&quot; description=&quot;Vector catch&quot; name=&quot;Vector catch&quot; value=&quot;false&quot; var=&quot;vector.catch&quot;&gt;&lt;enum value=&quot;True&quot;/&gt;&#13;&#10;&lt;enum value=&quot;False&quot;/&gt;&#13;&#10;&lt;/param&gt;&#13;&#10;&lt;/params&gt;&#13;&#10;&lt;params&gt;&lt;param default=&quot;true&quot; description=&quot;Enable Red Trace&quot; name=&quot;Enable Red Trace &quot; value=&quot;true&quot; var=&quot;swv.enable&quot;&gt;&lt;enum value=&quot;true&quot;/&gt;&#13;&#10;&lt;enum value=&quot;false&quot;/&gt;&#13;&#10;&lt;/param&gt;&#13;&#10;&lt;/params&gt;&#13;&#10;&lt;params&gt;&lt;param default=&quot;Auto&quot; description=&quot;Enablement of semihosting support&quot; name=&quot;Semihosting support&quot; value=&quot;Auto&quot; var=&quot;internal.semihost&quot;&gt;&lt;enum value=&quot;On&quot;/&gt;&#13;&#10;&lt;enum value=&quot;Off&quot;/&gt;&#13;&#10;&lt;enum value=&quot;Auto&quot;/&gt;&#13;&#10;&lt;/param&gt;&#13;&#10;&lt;/params&gt;&#13;&#10;&lt;params&gt;&lt;param default=&quot;&quot; description=&quot;Switch debug interface between SWD and JTAG (leave blank for default [SWD])&quot; name=&quot;Debug interface&quot; option=&quot;&quot; value=&quot;&quot; var=&quot;internal.debug.interface&quot;&gt;&lt;enum value=&quot;&quot;/&gt;&#13;&#10;&lt;enum value=&quot;JTAG&quot;/&gt;&#13;&#10;&lt;enum value=&quot;SWD&quot;/&gt;&#13;&#10;&lt;/param&gt;&#13;&#10;&lt;/params&gt;&#13;&#10;&lt;params&gt;&lt;param default=&quot;&quot; description=&quot;Maximum wire speed in KHz (leave blank to Auto-detect). Not all values are supported by all targets&quot; name=&quot;Maximum wire speed&quot; type=&quot;nullString&quot; value=&quot;&quot; var=&quot;emu.speed&quot;&gt;&lt;enum value=&quot;&quot;/&gt;&#13;&#10;&lt;enum value=&quot;30000&quot;/&gt;&#13;&#10;&lt;enum value=&quot;15000&quot;/&gt;&#13;&#10;&lt;enum value=&quot;10000&quot;/&gt;&#13;&#10;&lt;enum value=&quot;7500&quot;/&gt;&#13;&#10;&lt;enum value=&quot;6000&quot;/&gt;&#13;&#10;&lt;enum value=&quot;5000&quot;/&gt;&#13;&#10;&lt;enum value=&quot;3750&quot;/&gt;&#13;&#10;&lt;enum value=&quot;3000&quot;/&gt;&#13;&#10;&lt;enum value=&quot;2500&quot;/&gt;&#13;&#10;&lt;enum value=&quot;2000&quot;/&gt;&#13;&#10;&lt;enum value=&quot;1500&quot;/&gt;&#13;&#10;&lt;enum value=&quot;1250&quot;/&gt;&#13;&#10;&lt;enum value=&quot;1200&quot;/&gt;&#13;&#10;&lt;enum value=&quot;1000&quot;/&gt;&#13;&#10;&lt;enum value=&quot;750&quot;/&gt;&#13;&#10;&lt;enum value=&quot;600&quot;/&gt;&#13;&#10;&lt;enum value=&quot;500&quot;/&gt;&#13;&#10;&lt;enum value=&quot;400&quot;/&gt;&#13;&#10;&lt;enum value=&quot;300&quot;/&gt;&#13;&#10;&lt;enum value=&quot;250&quot;/&gt;&#13;&#10;&lt;enum value=&quot;200&quot;/&gt;&#13;&#10;&lt;enum value=&quot;150&quot;/&gt;&#13;&#10;&lt;/param&gt;&#13;&#10;&lt;/params&gt;&#13;&#10;&lt;params&gt;&lt;param default=&quot;&quot; description=&quot;Additional options&quot; name=&quot;Additional options&quot; value=&quot;&quot; var=&quot;misc.options&quot;/&gt;&#13;&#10;&lt;param default=&quot;2&quot; description=&quot;Set stub debug level (1-4)&quot; name=&quot;Debug Level &quot; value=&quot;2&quot; var=&quot;debug.level&quot;/&gt;&#13;&#10;&lt;param default=&quot;True&quot; description=&quot;when True, executable image will be loaded into the target&quot; name=&quot;Load image&quot; type=&quot;boolean&quot; value=&quot;True&quot; var=&quot;load&quot;&gt;&lt;enum value=&quot;True&quot;/&gt;&#13;&#10;&lt;enum value=&quot;False&quot;/&gt;&#13;&#10;&lt;/param&gt;&#13;&#10;&lt;param default=&quot;cont&quot; description=&quot;Run, continue or (do nothing)&quot; name=&quot;Run/Continue image&quot; value=&quot;cont&quot; var=&quot;run&quot;&gt;&lt;enum value=&quot;run&quot;/&gt;&#13;&#10;&lt;enum value=&quot;cont&quot;/&gt;&#13;&#10;&lt;enum value=&quot;&quot;/&gt;&#13;&#10;&lt;/param&gt;&#13;&#10;&lt;param default=&quot;off&quot; description=&quot;If on is specified, make the debugger treat unknown memory as non-existent and refuse \naccesses to such memory. If off is specified, treat the memory as RAM&quot; name=&quot;Memory Access Checking&quot; value=&quot;off&quot; var=&quot;mem.access&quot;&gt;&lt;enum value=&quot;on&quot;/&gt;&#13;&#10;&lt;enum value=&quot;off&quot;/&gt;&#13;&#10;&lt;/param&gt;&#13;&#10;&lt;param default=&quot;cont&quot; description=&quot;choose the disconnect behavior for the target&quot; name=&quot;Disconnect behavior&quot; value=&quot;cont&quot; var=&quot;ondisconnect&quot;&gt;&lt;enum value=&quot;nochange&quot;/&gt;&#13;&#10;&lt;enum value=&quot;stop&quot;/&gt;&#13;&#10;&lt;enum value=&quot;cont&quot;/&gt;&#13;&#10;&lt;enum value=&quot;run_cont&quot;/&gt;&#13;&#10;&lt;/param&gt;&#13;&#10;&lt;/params&gt;&#13;&#10;&lt;/parameters&gt;&#13;&#10;&lt;script emulators=&quot;${gdb.stub} -mi -info-emu&quot; silent=&quot;false&quot; swv=&quot;true&quot; type=&quot;init&quot;&gt;set remotetimeout 60000&amp;#x0A;target extended-remote | ${gdb.stub} -g -mi -${debug.level:2} ${-c+speed:$null} ${-s+emu.speed:$null} ${-p+package:$null} ${-e+emulator:$null} ${vector.catch?-vc:} ${misc.options}&amp;#x0A;set mem inaccessible-by-default ${mem.access}&amp;#x0A;mon ondisconnect ${ondisconnect}&amp;#x0A;set arm force-mode thumb&amp;#x0A;${load}&lt;/script&gt;&#13;&#10;&lt;script silent=&quot;false&quot; type=&quot;run&quot;&gt;${run}&lt;/script&gt;&#13;&#10;&lt;/config&gt;&#10;"/>
<stringAttribute key="org.eclipse.cdt.debug.mi.core.DEBUG_NAME" value="arm-none-eabi-gdb"/>
<stringAttribute key="org.eclipse.cdt.debug.mi.core.GDB_INIT" value=""/>
+<booleanAttribute key="org.eclipse.cdt.debug.mi.core.breakpointsFullPath" value="false"/>
+<stringAttribute key="org.eclipse.cdt.debug.mi.core.commandFactory" value="com.crt.ctrlcenter.cmdfactory"/>
+<stringAttribute key="org.eclipse.cdt.debug.mi.core.protocol" value="mi"/>
+<booleanAttribute key="org.eclipse.cdt.debug.mi.core.verboseMode" value="false"/>
+<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_ID" value="com.crt.ctrlcenter.CRTEmbeddedCDebugger"/>
+<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/>
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
+<booleanAttribute key="org.eclipse.cdt.launch.ENABLE_REGISTER_BOOKKEEPING" value="false"/>
+<booleanAttribute key="org.eclipse.cdt.launch.ENABLE_VARIABLE_BOOKKEEPING" value="false"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="Release\MurSatMPU.axf"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="MurSatMPU"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="com.crt.advproject.config.exe.release.1384247445"/>
<booleanAttribute key="org.eclipse.cdt.launch.use_terminal" value="false"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/MurSatMPU"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="4"/>
+</listAttribute>
</launchConfiguration>
diff --git a/software/mpu/inc/Types.h b/software/mpu/inc/Types.h
index 501d359..1ceeaad 100644
--- a/software/mpu/inc/Types.h
+++ b/software/mpu/inc/Types.h
@@ -2,6 +2,8 @@
#include "task.h"
#include "queue.h"
+#define MS(ms) portTICK_RATE_MS * (ms)
+
typedef enum
{
STATUS_OK = 0x0U,
@@ -27,7 +29,13 @@ typedef struct
typedef struct
{
- xTaskHandle *pxTask_Lightsens;
- xQueueHandle *pxQueue;
-}Task_Param_t;
+ xQueueHandle hxq_Kernel;
+ xQueueHandle hxq_Camera;
+ xQueueHandle hxq_LightSens;
+}QH_t;
+typedef struct
+{
+ xTaskHandle hxTask_Self;
+ QH_t QueueHandles;
+}Task_Param_t;
diff --git a/software/mpu/src/boot.c b/software/mpu/src/boot.c
index 1f18918..d3b4d59 100644
--- a/software/mpu/src/boot.c
+++ b/software/mpu/src/boot.c
@@ -10,46 +10,63 @@
#include "task.h"
#include "queue.h"
-//static void kernel_Process_Task(void *Param);
-//static xTaskHandle *pkernel_TaskHandle;
-//static Task_Param_t kernel_Param;
+#define NUM_QUEUE_ITEMS_KERNEL ((unsigned long) 2)
+#define NUM_QUEUE_ITEMS_CAMERA ((unsigned long) 2)
+#define NUM_QUEUE_ITEMS_LIGHTSENS ((unsigned long) 2)
-Status_t kernel_Init_Kernel(xQueueHandle * pxQueue);
+Status_t kernel_Init_Kernel(QH_t xQueues);
+Status_t camera_Init_Camera(QH_t xQueues);
+Status_t lightsens_Init_LightSens(QH_t xQueues);
-Status_t boot_Init_Kernel(xQueueHandle * pxQueue)
+/*
+ * Globals */
+static QH_t qh;
+
+Status_t boot_Init_Kernel(QH_t xQueues)
{
- return kernel_Init_Kernel( pxQueue );
+ return kernel_Init_Kernel( xQueues );
}
-Status_t boot_Init_Camera(xQueueHandle * pxQueue)
+Status_t boot_Init_Camera(QH_t xQueues)
{
- return STATUS_OK;
+ return camera_Init_Camera( xQueues );
}
-Status_t boot_Init_LightSens(xQueueHandle * pxQueue)
+Status_t boot_Init_LightSens(QH_t xQueues)
{
- return STATUS_OK;
+ return lightsens_Init_LightSens( xQueues );
}
-Status_t boot_CreateQueues( xQueueHandle *pxQueue_Kernel,
- xQueueHandle *pxQueue_Camera,
- xQueueHandle *pxQueue_LightSens)
+Status_t boot_CreateQueues( xQueueHandle *phxQueue_Kernel,
+ xQueueHandle *phxQueue_Camera,
+ xQueueHandle *phxQueue_LightSens)
{
+ *phxQueue_Kernel = xQueueCreate(NUM_QUEUE_ITEMS_KERNEL, sizeof(Message_t));
+ *phxQueue_Camera = xQueueCreate(NUM_QUEUE_ITEMS_CAMERA, sizeof(Message_t));
+ *phxQueue_LightSens = xQueueCreate(NUM_QUEUE_ITEMS_LIGHTSENS, sizeof(Message_t));
+
return STATUS_OK;
+
}
void boot_Main(void)
{
/*
*
* */
+
+ xQueueHandle hxQueue_Kernel;
+ xQueueHandle hxQueue_Camera;
+ xQueueHandle hxQueue_LightSens;
+
Status_t Status;
- xQueueHandle * pxQueue_Kernel = NULL,
- * pxQueue_Camera = NULL,
- * pxQueue_LightSens = NULL;
- Status = boot_CreateQueues(pxQueue_Kernel, pxQueue_Camera, pxQueue_LightSens);
+ Status = boot_CreateQueues(&hxQueue_Kernel, &hxQueue_Camera, &hxQueue_LightSens);
+
+ qh.hxq_Kernel = hxQueue_Kernel;
+ qh.hxq_Camera = hxQueue_Camera;
+ qh.hxq_LightSens = hxQueue_LightSens;
- Status = boot_Init_Kernel(pxQueue_Kernel);
- Status = boot_Init_Camera(pxQueue_Camera);
- Status = boot_Init_LightSens(pxQueue_LightSens);
+ Status = boot_Init_Kernel(qh);
+ Status = boot_Init_Camera(qh);
+ Status = boot_Init_LightSens(qh);
/* Start the tasks. */
vTaskStartScheduler();
diff --git a/software/mpu/src/kernel.c b/software/mpu/src/kernel.c
index 71ef57f..d75f9dd 100644
--- a/software/mpu/src/kernel.c
+++ b/software/mpu/src/kernel.c
@@ -8,15 +8,11 @@
#include "FreeRTOS.h"
#include "queue.h"
-#define kernel_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
-#define kernel_TASK_STACK_SIZE ( ( unsigned short ) 32 )
+#define kernel_TASK_PRIORITY ( tskIDLE_PRIORITY + 5 )
+#define kernel_TASK_STACK_SIZE ( ( unsigned short ) 64 )
/* Globals */
-xQueueHandle * gpxQueue_Kernel;
-//static xTaskHandle *pkernel_TaskHandle;
-//static Task_Param_t kernel_Param;
-xTaskHandle *pkernel_TaskHandle;
-Task_Param_t kernel_Param;
+static Task_Param_t kernel_Param;
/*
* Wake up other tasks, send them messages telling what to do,
@@ -26,29 +22,56 @@ Task_Param_t kernel_Param;
static void kernel_Process_Task(void *Param)
{
Message_t Msg;
+ Message_t SndMsg;
+ portTickType tick;
+ portCHAR chBufCam[10] = "Seas Cam!";
+ portCHAR chBufLSen[10] = "Seas LSe!";
+ if(NULL == kernel_Param.QueueHandles.hxq_Kernel)
+ {
+ return;
+ }
+
+ tick = xTaskGetTickCount();
while(1)
{
- xQueueReceive( gpxQueue_Kernel, &Msg, portMAX_DELAY );
- /*TODO: execute desired command of message */
-
- /*
- * switch Msg.Sender
- *
- * case Sender_Kernel:
- * yeah, that's myself
- *
- */
+ vTaskDelayUntil(&tick, MS(3));
+
+ if( xQueueReceive( kernel_Param.QueueHandles.hxq_Kernel, &Msg, MS(5)))
+ {
+ /*
+ * switch Msg.Sender and act accordingly.
+ */
+ switch (Msg.Sender)
+ {
+ case Sender_Camera:
+ {
+ SndMsg.Sender = Sender_Kernel;
+ SndMsg.pData = chBufCam;
+ xQueueSend(kernel_Param.QueueHandles.hxq_Camera, &SndMsg, MS(10));
+ }
+
+ case Sender_LightSens:
+ {
+ SndMsg.Sender = Sender_Kernel;
+ SndMsg.pData = chBufLSen;
+ xQueueSend(kernel_Param.QueueHandles.hxq_LightSens, &SndMsg, MS(10));
+ }
+ default: {;}
+ }
+ }
}
}
-Status_t kernel_Init_Kernel(xQueueHandle * pxQueue)
+Status_t kernel_Init_Kernel(QH_t hxQueues)
{
- kernel_Param.pxQueue = pxQueue;
+portBASE_TYPE xResult;
+
+ xResult = xTaskCreate( kernel_Process_Task, (signed char *) "Kernel",
+ kernel_TASK_STACK_SIZE, &kernel_Param,
+ kernel_TASK_PRIORITY, &(kernel_Param.hxTask_Self) );
- xTaskCreate( kernel_Process_Task, (signed char *) "Kernel",
- kernel_TASK_STACK_SIZE, &kernel_Param,
- kernel_TASK_PRIORITY, pkernel_TaskHandle );
+ kernel_Param.QueueHandles = hxQueues;
/*TODO: check for success and pass it over to caller. */
return STATUS_OK;
diff --git a/software/mpu/src/main.c b/software/mpu/src/main.c
index e23c44b..e7f69f1 100644
--- a/software/mpu/src/main.c
+++ b/software/mpu/src/main.c
@@ -11,5 +11,10 @@ void boot_Main(void);
int main(void)
{
+#if 1
boot_Main();
+#endif
+
+ /* If we ever reach this point, then there is something very wrong. */
+ return -1;
}