aboutsummaryrefslogtreecommitdiffstats
path: root/docs/src/saveram.dox
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-01-19 15:10:41 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-01-19 15:10:41 +0000
commit79089d6352e01e1e7c6c3f0a88266abbc9af6abb (patch)
tree0ad16ec06bc8f671018a82fb2360f0eefac1ca24 /docs/src/saveram.dox
parent0810f1daac3c33d194d573d82ec436021e3e7255 (diff)
downloadChibiOS-79089d6352e01e1e7c6c3f0a88266abbc9af6abb.tar.gz
ChibiOS-79089d6352e01e1e7c6c3f0a88266abbc9af6abb.tar.bz2
ChibiOS-79089d6352e01e1e7c6c3f0a88266abbc9af6abb.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@644 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'docs/src/saveram.dox')
-rw-r--r--docs/src/saveram.dox25
1 files changed, 11 insertions, 14 deletions
diff --git a/docs/src/saveram.dox b/docs/src/saveram.dox
index fec810c81..324bdb9a3 100644
--- a/docs/src/saveram.dox
+++ b/docs/src/saveram.dox
@@ -9,23 +9,21 @@
* Consider the following code:
* @code
#include <ch.h>
-
+
static WORKING_AREA(waMyThread, 64);
-
+
static t_msg MyThread(void *arg) {
-
while (!chThdShoudTerminate()) {
/* Do thread inner work */
}
return 1;
}
-
+
main() {
chSysInit();
...
- chThdCreate(NORMALPRIO, 0, waMyThread, sizeof(waMyThread), MyThread, NULL);
+ chThdCreateStatic(waMyThread, sizeof(waMyThread), NORMALPRIO, MyThread, NULL);
...
- chSysPause();
}
* @endcode
* The resulting ASM code for the thread function would be something like this:
@@ -40,23 +38,22 @@ MyThread:
* saved by modifying the code as follow, using some advanced GCC extensions:
* @code
#include <ch.h>
-
-static BYTE8 waMyThread[UserStackSize(64)];
-
-__attribute__((noreturn)) void MyThread(void *arg) {
-
+
+static WORKING_AREA(waMyThread, 64);
+
+__attribute__((noreturn))
+static void MyThread(void *arg) {
while (!chThdShoudTerminate()) {
/* Do thread inner work */
}
chThdExit(1);
}
-
+
main() {
chSysInit();
...
- chThdCreate(NORMALPRIO, 0, waMyThread, sizeof(waMyThread), (t_tfunc)MyThread, NULL);
+ chThdCreateStatic(waMyThread, sizeof(waMyThread), NORMALPRIO, MyThread, NULL);
...
- chSysPause();
}
* @endcode
* This will make GCC believe that the function cannot return and there is no