tom@zni:~/darcs$ darcs convert papers papers-2 WARNING: the repository produced by this command is not understood by Darcs 1.x, and patches cannot be exchanged between repositories in darcs-1 and darcs-2 formats. Furthermore, darcs 2 repositories created by different invocations of this command SHOULD NOT exchange patches, unless those repositories had no patches in common when they were converted. (That is, within a set of repos that exchange patches, no patch should be converted more than once.) Please confirm that you have read and understood the above by typing `I understand the consequences of my action': I understand the consequences of my action lossy conversion of complicated conflict: merger 0.0 ( hunk ./dreams.tex 2091 - - - hunk ./dreams.tex 2094 + +\section{Fri Mar 24 11:26:50 CET 2006} + +Been a long while again\ldots Mostly interested in computer science +lately, with a focus on functional programming and concatenative +languages. ) lossy conversion of complicated conflict: merger 0.0 ( hunk ./dreams2.tex 633 -\end{itemize} + +\section{Thu Oct 19 22:21:22 CEST 2006} + +More about $\Sigma\Delta$ modulation (SDM). Previously i thought this +is equivalent to taking one of the output bits of a wrap around +accumulator. It's not. It is if you reset the bit after using it +though. [_$_] + +Think of an SDM as a bus stop where on each timestep (say 10 minutes) +a bus either leaves or not. A bus only leaves if it's full, and the +number of people that arrive in a single time step is never greater +than the capacity of the bus. This way, the bus stop never needs to +accommodate more than one bus worth of people. Once i got this picture +in my head i couldn't get rid of it any more. It clearly illustrates +the conservation properties of a bus stop, which implies the SDM +preserves averages and low frequency signals. hunk ./dreams2.tex 633 + +\section{Thu Jan 11 16:47:43 CET 2007} + +Long time. Been working on practical stuff. Cleared out a lot of PF +bugs and one very big conceptual problem with I/O and +multitasking. I'm still pondering BROOD a lot, and where to take the +ideas of lexical scope in a combinator language (instead of dynamic +scope combined with some weird persistent state approach) and how to +deal with state and transactions (why do i use a functional language +to do a clearly nonfuctional thing: updating the state of a +microcontroller's code.). + +But, i ran into an interesting geometrical/topological +problem. Working with $N$-simplexes to drive LED lights using a +minimal amount of electrical nodes. The problem I have is how to +associate an N-symplex with a circle in a natural way. For a +tetrahedron this is trivial, but what with higher dimensional things? + +It's an interesting problem, because it seems to make absolutely no +sense to do so. There should be no reason why a higher dimensional +polytope should be naturally projectable on a 2-sphere. But i can't +refute it just like that. + +To rephrase the problem in a more down--to--earth wording: I want to +create a 2-sphere covered with lights in a way that the lights are +normally distributed, and i have a certain pattern to access them. At +the same time, i'd like to do this with as little connections as +possible. + +Note that simplexes are easier to work with as they follow the +binomial expansion for vertices, edges, triangle faces, tetrahedral +volumes, etc\ldots. + +Trying the simple thing of projecting a $5$-plex on a sphere. Compared +to the $4$-plex (tetrahedron), there is one pair of crossing lines. + + + ) lossy conversion of complicated conflict: merger 0.0 ( hunk ./compsci.txt 2619 +Entry: Two kinds of optimizations +Date: Sun Jan 3 13:01:13 CET 2010 + +Let's see if I can find the quote again: There are only two kinds of +optimizations: + + * Not performing the work (yet), i.e. performing it lazily at + run-time, or eliminating it at compile-time. + + * Performing the work only once and reusing the result. + I.e. run-time memoization and compile-time evaluation. + +I think this was attributed to Mich Wand by Dave Herman, but I can't +find the reference. + + merger 0.0 ( hunk ./compsci.txt 2594 + +Entry: Scheme compilation +Date: Fri Dec 25 18:19:31 CET 2009 + +Before making any changes to the libprim/sc VM it might be best to +take a look at the basic source transformation techniques. + + +lambda lifting / closure conversion + +(define (f x) [_$_] + (define (g y) (+ x y)) + (g x)) + +-> + +(define (g x y) (+ x y)) +(define (f x y) (g x y)) + + + +defunctionalization +http://www.brics.dk/RS/01/23/BRICS-RS-01-23.pdf + + + hunk ./compsci.txt 2594 + + +Entry: Java and CPS vs callbacks. +Date: Tue Jan 5 10:45:52 CET 2010 + +I'm working on Android lately, which has a lot of asynchronous message +passing going on. Using this without anonymous classes is a pain: the +alternative is to extend the calling class with callbacks implementing +a particular callback interface. + +It's much easier to use anonymous object. This is essentially CPS: +call a function, and provide a context it needs to invoke whenever it +sends it reply. + +So, are callbacks goto? + ) ) lossy conversion of complicated conflict: merger 0.0 ( merger 0.0 ( hunk ./compsci.txt 2924 - hunk ./compsci.txt 2925 +Entry: Representing control: a study of the CPS transformation. +Date: Mon Jan 25 08:22:17 CET 2010 + +By Danvy and Filinsky[1]. This seems to be an important work to +understand where ANF and `shift' and `reset' come from. + +Main property of CPS term = independence of evaluation order. I.e. it +is a sequential program. + +[1] http://www.cs.tufts.edu/~nr/cs257/archive/olivier-danvy/danvy92representing.ps.gz ) hunk ./compsci.txt 2924 +Entry: Higher order functions in Java +Date: Mon Jan 25 10:17:12 CET 2010 + +The simplest approach seems to be to use a 'forEach' function for each +class that lifts a function. I.e. partially applied map/fold. + +Currently, my main concern is to abstract database queries in Android. +There are essentially 3 main strategies to do this: + + - Eagerly convert to concrete lists/arrays/... + + - Iterator + + - universal traversal function (left fold with termination) + [_$_] +For database traversal the Iterator abstraction isn't very good as it +doesn't have a close() method, which might leak resources. The other +two are fine. + +Inversion of control ala `shift' and `reset' doesn't seem to be +straightforward to emulate, so this leaves forEach and lists, which +can be generated from forEach. + + +Entry: Type aliases for Java Generics +Date: Mon Jan 25 10:33:33 CET 2010 + +[1] http://stackoverflow.com/questions/683533/type-aliases-for-java-generics + + +Entry: Indulge yourself: Scheme literature +Date: Mon Jan 25 16:04:13 CET 2010 + +From [1]: + + Indulge yourself: + + http://library.readscheme.org/ + + The must reads are Keny Dybvig's thesis, "Three Implementations of + Scheme". The original lambda papers can wait until you read the + Orbit paper, an optimizing compiler for T by Kranz, Rees et al. + + The Lisp implementation bibliography pretty much runs through PL + research like a vein. Some of the stuff you must read for Lisp are + typically in "books"; Christian Quinnec's Lisp in Small Pieces is + the most important work, but you will need a good foundation in + denotational semantics (you can get by with the one chapter in the + little book by Nielson and Nielson, "Semantics with Applications: A + Formal Introduction". + + Somewhere in there you will brush against various compilation + methods and IRs for the lambda calculus, most importantly + continuation passing style. Most semantics text introduce lambda + calculus and its three rules, but none go in depth into this like + the tall green book by Andrew Appel, "Compiling with Continuations", + a good chunk of which can be read in Appel's other papers. Appel's + work is MLish in nature, but don't let that stop you; most + optimizing Lisp compilers are MLish down underneath anyway. CMUCL + does very good type inference but gets short of implementing a full + Hindley-Milner. Felleisen et al's "The Essence of Compiling with + Continuations" might also come handy, though it's heavy on the + theory. Andrew Kennedy continues the saga with "Compiling with + Continuations Continued", this time CPS gives way to A-Normal Form, + another IR. He describes the techniques used by a compiler targeting + .NET. + + Most compiling "meat" can be found in the bits-and-bytes type + papers. Wilson's GC bibliography "Uniprocessor Garbage Collection + Techniques" is a must, it should have been called "What Every + Programmer Should Know About Garbage Collection". Not to be confused + with Richard Jones' "the Garbage Collection Bibliography". Boehm's + "Garbage Collection in an Uncooperative Environment" is sheer + hacking bravado, perhaps second only to "Pointer Swizzling at Page + Fault Time", which should introduce you to memory management for + disk-based heaps (i.e. object stores) among other things. + + Your start in hacking runtimes will probably be David Gudeman's + "Representing Type Information in Dynamically Typed Languages"; this + is where you learn how stuff looks inside the computer when you no + longer need to malloc and free. A previous hacking of a Pascal + dialect prepared me for this wonderful paper. + + Implementations of runtimes are documented by Appel, for SML/NJ, + Robert MacLaclahn's "Design of CMU Common Lisp" (also perhaps Scott + Fahlman's CMU report on CMUCL's precursor, "Internal Design of Spice + Lisp", but that confused the crap out of me as I don't know the + machine architecture they're talking about.) You will also enjoy the + Smalltalk research starting with L. Peter Deutsch's first optimizing + Smalltalk compiler, documented in "Efficient Implementation of + Smalltalk-80", follow the Smalltalk lineage btw, all they way up to + David Ungar's "The Design and Evaluation of a High Performance + Smalltalk System" making sure NOT to ignore Self and its literature, + also spearheaded by Ungar (Start your Smalltalk hacking career with + Timothy Budd's "A Little Smalltalk", should take you about a weekend + and will absolutely prepare you for dynamic languages; a similar + system is described by Griswold and Griswold, compiler, intermediate + representation and VM, but that one is for ICON.) + + Dynamic type inference and type-checking (TYPEP and SUBTYPEP, + CLASS-OF, INSTANCE-OF, etc) you can learn a good chunk of how CLOS + should look like to the runtime system from Justin Graver's + "Type-Checking and Type-Inference for Object Oriented Programming + Languages". He scratches the surface, and you should supplement this + with a selection from Smalltalk and Self, though neither will + prepare you for multiple-dispatch, for that peer into Stanley + Lippman's "Inside the C++ Object System". + + I have deliberately avoided "classics" on Lisp, compiler + construction, optimization, and other stuff. None of the books and + papers I have recommended are as popular as SICP, PAIP, or AMOP. Or + even the popular PL books, like EoPL, van Roy and Haridi, both of + which you should read by the way, but they're stuff that you need to + read and understand to be able to implement a practical Lisp + implementation, or at least satisfy your curiosity. + + +More here: http://www.reddit.com/r/programming/comments/9220o/ask_proggit_recommender_a_compsci_paper_for_me_to/ + +[1] http://news.ycombinator.com/item?id=835020 +[2] http://news.ycombinator.com/item?id=834175 + + +Entry: Scheme compilers +Date: Mon Jan 25 16:44:09 CET 2010 + +Slava Pestov[1]: + + If you compare performance on benchmarks, then Gambit-C and Ikarus + are closer to the performance of C, whereas PLT Scheme is a bit + faster or equal to Python. I prefer the design of Ikarus over + Gambit-C. Compiling to C seems like a big hack on the other + hand. Ikarus reminds me of SBCL in a lot of ways, and SBCL's + compiler is one of the best dynamic language compilers of all + time. Another nice Scheme compiler is Larceny[2]. The source is very + easy to read, and if you haven't seen a compiler that uses ANF as + intermediate representation its worth checking out. + +[1] http://www.reddit.com/r/programming/comments/9tek5/were_learning_scheme_in_our_introduction_to/ +[2] http://www.ccs.neu.edu/home/will/Larceny/overview.html +[3] http://ikarus-scheme.org ) lossy conversion of complicated conflict: merger 0.0 ( hunk ./compsci.txt 2903 + +Entry: Open, extensible object models +Date: Sat Jan 30 11:43:26 CET 2010 + +One thing I don't quite understand is why objects have their vtable +object at -1. ``To preserve pointer identity for objects that +encapsulate a foreign structure.'' + +All good and well if the allocation of that structure is not performed +by the external faculty. If it's done internally, calling into the +foreign code just requires adding an offset of an embedded structure. +I'd like to see an example of where this really matters. + +Caching at the call site: as long as the vtable doesn't change, the +result of `bind' can be reused. + + +[1] http://piumarta.com/software/cola/objmodel2.pdf +[2] http://piumarta.com/software/cola/ + hunk ./compsci.txt 2903 + + +Entry: How to encode all possible binary trees containing N unique objects? +Date: Wed Jan 27 17:28:59 CET 2010 + +A,B (A . B) (B . A) +A,B,C (A . (B . C)) ((A . B) . C) ... + +There are 2 degrees of freedom: the CONS structure, and the contained +elements. + + ) lossy conversion of complicated conflict: merger 0.0 ( hunk ./compsci.txt 2925 +Entry: Representing control: a study of the CPS transformation. +Date: Mon Jan 25 08:22:17 CET 2010 + +By Danvy and Filinsky[1]. This seems to be an important work to +understand where ANF and `shift' and `reset' come from. + +Main property of CPS term = independence of evaluation order. I.e. it +is a sequential program. + +[1] http://www.cs.tufts.edu/~nr/cs257/archive/olivier-danvy/danvy92representing.ps.gz hunk ./compsci.txt 2924 - ) lossy conversion of complicated conflict: merger 0.0 ( hunk ./ecos.txt 1 +Notes about using the eCos RTOS. + +Entry: Getting Started +Date: Sat Jul 10 10:22:03 CEST 2010 + +A little history[2]. To get started, follow[1]. +I'm using mirror: http://ftp.gwdg.de/pub/misc/sources.redhat.com/ecos +Installing arm-eabi and i386 + +Ecos is mainly setup as a single application running on the target. +GDB connects to the bootloader (RedBoot). + +The configtool gives library error: + +tom@zni:/opt/xc/ecos$ ecos-3.0/tools/bin/configtool [_$_] +ecos-3.0/tools/bin/configtool: error while loading shared libraries: libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory + +The library is in /usr/lib so probably some debian issue. Looks like +it's the dreaded 64-bit library problem again. This worked: + + apt-get install ia32-libs-gtk + +In the 32-bit chroot it needs: [_$_] + + apt-get install libstdc++5 + +Trying to build at91sam7x evaluation kit target following [3]. + + mkdir /tmp/ecos-arm + cd /tmp/ecos-arm + ecosconfig new at91sam7xek + ecosconfig tree + ecosconfig check + make + make tests + +This generates the file install/lib/libtarget.a + +Next: the hello world app[4]. hello.c: + +/* this is a simple hello world program */ +#include +int main(void) +{ + printf("Hello, eCos world!\n"); + return 0; +} + +To compile: + + arm-eabi-gcc -g \ + -I/tmp/ecos-arm/install/include \ + hello.c \ + -L/tmp/ecos-arm/install/lib \ + -Ttarget.ld -nostdlib + +Here `arm-eabi-gcc' is in the path after sourcing +/opt/xc/ecos/ecosenv.sh and the /tmp/ecos-arm directory is the +toplevel build dir used above. + +The applications all seem to hang in some kind of wait loop in +function: wait_pmc_sr_0 -- maybe simulating the target board doesn't +work like that, and ecosconfig needs a different target, i.e. linux +(Linux synthetic target). + +This gives the error: + +make[1]: Entering directory `/tmp/ecos-linux/services/memalloc/common/v3_0' +i686-pc-linux-gnu-gcc -finline-limit=7000 -Wall -Wpointer-arith -Wundef -Woverloaded-virtual -Wno-write-strings -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -I/tmp/ecos-linux/install/include -I/opt/xc/ecos/ecos-3.0/packages/services/memalloc/common/v3_0 -I/opt/xc/ecos/ecos-3.0/packages/services/memalloc/common/v3_0/src -I/opt/xc/ecos/ecos-3.0/packages/services/memalloc/common/v3_0/tests -I. -Wp,-MD,heapgen.tmp -E /opt/xc/ecos/ecos-3.0/packages/services/memalloc/common/v3_0/src/heapgen.cpp -o heapgeninc.tcl +make[1]: i686-pc-linux-gnu-gcc: Command not found + +See [5]: edit ecos.ecc and provide a user_value for +CYGBLD_GLOBAL_PREFIX of "", and then rerun ecosconfig tree. + +Then starts building but runs into 64bit assembler problems: + +gcc -c -I/tmp/ecos-linux/install/include -I/opt/xc/ecos/ecos-3.0/packages/hal/synth/i386linux/v3_0 -I/opt/xc/ecos/ecos-3.0/packages/hal/synth/i386linux/v3_0/src -I/opt/xc/ecos/ecos-3.0/packages/hal/synth/i386linux/v3_0/tests -I. -I/opt/xc/ecos/ecos-3.0/packages/hal/synth/i386linux/v3_0/src/ -finline-limit=7000 -Wall -Wpointer-arith -Wstrict-prototypes -Wundef -Wno-write-strings -g -O2 -ffunction-sections -fdata-sections -fno-exceptions -Wp,-MD,src/syscall-i386-linux-1.0.tmp -o src/hal_synth_i386linux_syscall-i386-linux-1.0.o /opt/xc/ecos/ecos-3.0/packages/hal/synth/i386linux/v3_0/src/syscall-i386-linux-1.0.S +/opt/xc/ecos/ecos-3.0/packages/hal/synth/i386linux/v3_0/src/syscall-i386-linux-1.0.S: Assembler messages: +/opt/xc/ecos/ecos-3.0/packages/hal/synth/i386linux/v3_0/src/syscall-i386-linux-1.0.S:386: Error: suffix or operands invalid for `push' + +So best to use 32bit chroot I guess. Ok, this works. + + mkdir /tmp/ecos-linux + cd /tmp/ecos-linux + ecosconfig new linux + ecosconfig tree + make + make tests + install/tests/kernel/v3_0/tests/bin_sem0 + +This gives: +PASS: +EXIT: + + +[1] http://ecos.sourceware.org/getstart.html +[2] http://en.wikipedia.org/wiki/ECos +[3] http://ecos.sourceware.org/docs-3.0/user-guide/using-ecosconfig-on-linux.html +[4] http://ecos.sourceware.org/docs-3.0/user-guide/building-and-running-sample-appliations.html +[5] http://sourceware.org/ml/ecos-discuss/2001-09/msg00146.html +[6] http://www.mail-archive.com/ecos-discuss@ecos.sourceware.org/msg09806.html + + +Entry: eCos C/C++ mixing +Date: Sat Jul 10 17:10:13 CEST 2010 + +packages/infra/v3_0/include/cyg_type.h: + +// __externC is used in mixed C/C++ headers to force C linkage on an external +// definition. It avoids having to put all sorts of ifdefs in. + +#ifdef __cplusplus +# define __externC extern "C" +#else +# define __externC extern +#endif +// Also define externC for now - but it is deprecated +#define externC __externC + + +Entry: Scheduler +Date: Sat Jul 10 17:13:28 CEST 2010 + +At (very brief) first sight, eCos architecture seems to be quite +straightforward monolithic C/C++ application. Code is grouped in +``packages'' that can be combined, checked by some dependency +management. Some compile-time options are implemented using CPP +macros. + +The more interesting questions are about events, tasks and state +machines. merger 0.0 ( addfile ./ecos.txt addfile ./ecos.txt ) ) lossy conversion of complicated conflict: merger 0.0 ( merger 0.0 ( merger 0.0 ( addfile ./ecos.txt addfile ./ecos.txt ) hunk ./ecos.txt 1 +Notes about using the eCos RTOS. + +Entry: Getting Started +Date: Sat Jul 10 10:22:03 CEST 2010 + +A little history[2]. To get started, follow[1]. +I'm using mirror: http://ftp.gwdg.de/pub/misc/sources.redhat.com/ecos +Installing arm-eabi and i386 + +Ecos is mainly setup as a single application running on the target. +GDB connects to the bootloader (RedBoot). + +The configtool gives library error: + +tom@zni:/opt/xc/ecos$ ecos-3.0/tools/bin/configtool [_$_] +ecos-3.0/tools/bin/configtool: error while loading shared libraries: libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory + +The library is in /usr/lib so probably some debian issue. Looks like +it's the dreaded 64-bit library problem again. This worked: + + apt-get install ia32-libs-gtk + +In the 32-bit chroot it needs: [_$_] + + apt-get install libstdc++5 + +Trying to build at91sam7x evaluation kit target following [3]. + + mkdir /tmp/ecos-arm + cd /tmp/ecos-arm + ecosconfig new at91sam7xek + ecosconfig tree + ecosconfig check + make + make tests + +This generates the file install/lib/libtarget.a + +Next: the hello world app[4]. hello.c: + +/* this is a simple hello world program */ +#include +int main(void) +{ + printf("Hello, eCos world!\n"); + return 0; +} + +To compile: + + arm-eabi-gcc -g \ + -I/tmp/ecos-arm/install/include \ + hello.c \ + -L/tmp/ecos-arm/install/lib \ + -Ttarget.ld -nostdlib + +Here `arm-eabi-gcc' is in the path after sourcing +/opt/xc/ecos/ecosenv.sh and the /tmp/ecos-arm directory is the +toplevel build dir used above. + +The applications all seem to hang in some kind of wait loop in +function: wait_pmc_sr_0 -- maybe simulating the target board doesn't +work like that, and ecosconfig needs a different target, i.e. linux +(Linux synthetic target). + +This gives the error: + +make[1]: Entering directory `/tmp/ecos-linux/services/memalloc/common/v3_0' +i686-pc-linux-gnu-gcc -finline-limit=7000 -Wall -Wpointer-arith -Wundef -Woverloaded-virtual -Wno-write-strings -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -I/tmp/ecos-linux/install/include -I/opt/xc/ecos/ecos-3.0/packages/services/memalloc/common/v3_0 -I/opt/xc/ecos/ecos-3.0/packages/services/memalloc/common/v3_0/src -I/opt/xc/ecos/ecos-3.0/packages/services/memalloc/common/v3_0/tests -I. -Wp,-MD,heapgen.tmp -E /opt/xc/ecos/ecos-3.0/packages/services/memalloc/common/v3_0/src/heapgen.cpp -o heapgeninc.tcl +make[1]: i686-pc-linux-gnu-gcc: Command not found + +See [5]: edit ecos.ecc and provide a user_value for +CYGBLD_GLOBAL_PREFIX of "", and then rerun ecosconfig tree. + +Then starts building but runs into 64bit assembler problems: + +gcc -c -I/tmp/ecos-linux/install/include -I/opt/xc/ecos/ecos-3.0/packages/hal/synth/i386linux/v3_0 -I/opt/xc/ecos/ecos-3.0/packages/hal/synth/i386linux/v3_0/src -I/opt/xc/ecos/ecos-3.0/packages/hal/synth/i386linux/v3_0/tests -I. -I/opt/xc/ecos/ecos-3.0/packages/hal/synth/i386linux/v3_0/src/ -finline-limit=7000 -Wall -Wpointer-arith -Wstrict-prototypes -Wundef -Wno-write-strings -g -O2 -ffunction-sections -fdata-sections -fno-exceptions -Wp,-MD,src/syscall-i386-linux-1.0.tmp -o src/hal_synth_i386linux_syscall-i386-linux-1.0.o /opt/xc/ecos/ecos-3.0/packages/hal/synth/i386linux/v3_0/src/syscall-i386-linux-1.0.S +/opt/xc/ecos/ecos-3.0/packages/hal/synth/i386linux/v3_0/src/syscall-i386-linux-1.0.S: Assembler messages: +/opt/xc/ecos/ecos-3.0/packages/hal/synth/i386linux/v3_0/src/syscall-i386-linux-1.0.S:386: Error: suffix or operands invalid for `push' + +So best to use 32bit chroot I guess. Ok, this works. + + mkdir /tmp/ecos-linux + cd /tmp/ecos-linux + ecosconfig new linux + ecosconfig tree + make + make tests + install/tests/kernel/v3_0/tests/bin_sem0 + +This gives: +PASS: +EXIT: + + +[1] http://ecos.sourceware.org/getstart.html +[2] http://en.wikipedia.org/wiki/ECos +[3] http://ecos.sourceware.org/docs-3.0/user-guide/using-ecosconfig-on-linux.html +[4] http://ecos.sourceware.org/docs-3.0/user-guide/building-and-running-sample-appliations.html +[5] http://sourceware.org/ml/ecos-discuss/2001-09/msg00146.html +[6] http://www.mail-archive.com/ecos-discuss@ecos.sourceware.org/msg09806.html + + +Entry: eCos C/C++ mixing +Date: Sat Jul 10 17:10:13 CEST 2010 + +packages/infra/v3_0/include/cyg_type.h: + +// __externC is used in mixed C/C++ headers to force C linkage on an external +// definition. It avoids having to put all sorts of ifdefs in. + +#ifdef __cplusplus +# define __externC extern "C" +#else +# define __externC extern +#endif +// Also define externC for now - but it is deprecated +#define externC __externC + + +Entry: Scheduler +Date: Sat Jul 10 17:13:28 CEST 2010 + +At (very brief) first sight, eCos architecture seems to be quite +straightforward monolithic C/C++ application. Code is grouped in +``packages'' that can be combined, checked by some dependency +management. Some compile-time options are implemented using CPP +macros. + +The more interesting questions are about events, tasks and state +machines. ) merger 0.0 ( merger 0.0 ( addfile ./ecos.txt addfile ./ecos.txt ) rmfile ./ecos.txt ) ) lossy conversion of complicated conflict: merger 0.0 ( hunk ./c.txt 1073 + +Entry: Makefile error: multiple target patterns +Date: Fri Sep 17 15:18:20 CEST 2010 + +Check for multiple colons[1]. + +[1] http://stackoverflow.com/questions/2100448/multiple-target-patterns-makefile-error + hunk ./c.txt 1073 + + +Entry: The meaning of `const' (.rodata section) +Date: Tue Sep 7 09:10:01 CEST 2010 + +One often hears that ``const is broken'' which means that it is +possible in C to get an unrestricted pointer to const data. + +However, on a more pragmatic side, the `const' qualifier does tell the +compiler that the data is _intended_ to be constant, and as such it +can be put in a separate linker section `.rodata'. + +This section can then be put in (p)ROM. I.e. for ARM uC it can go +into program Flash. + + + +Entry: Linker sections on AT91SAM7X512 (ARM7TDMI, 128k RAM, 512k Flash) +Date: Tue Sep 7 09:25:35 CEST 2010 + +The output of objdump (reformatted): + +tom@one:~/$ objdump -h app.elf [_$_] + +app.elf: file format elf32-little + +Sections: +Idx Name Size VMA LMA File off Algn + 0 .debug_aranges 000021f8 00000000 00000000 00030e30 2**3 CONTENTS, READONLY, DEBUGGING + 1 .debug_pubnames 00006976 00000000 00000000 00033028 2**0 CONTENTS, READONLY, DEBUGGING + 2 .debug_info 0007fbd5 00000000 00000000 0003999e 2**0 CONTENTS, READONLY, DEBUGGING + 3 .debug_abbrev 00014342 00000000 00000000 000b9573 2**0 CONTENTS, READONLY, DEBUGGING + 4 .debug_line 00017cc3 00000000 00000000 000cd8b5 2**0 CONTENTS, READONLY, DEBUGGING + 5 .debug_frame 000062f4 00000000 00000000 000e5578 2**2 CONTENTS, READONLY, DEBUGGING + 6 .debug_str 0000f462 00000000 00000000 000eb86c 2**0 CONTENTS, READONLY, DEBUGGING + 7 .debug_loc 0001b6ee 00000000 00000000 000facce 2**0 CONTENTS, READONLY, DEBUGGING + 8 .rom_vectors 00000040 00100000 00100000 00008000 2**0 CONTENTS, ALLOC, LOAD, READONLY, CODE + 9 .text 0001e790 00100040 00100040 00008040 2**2 CONTENTS, ALLOC, LOAD, READONLY, CODE + 10 .rodata 00002580 0011e7d0 0011e7d0 000267d0 2**3 CONTENTS, ALLOC, LOAD, READONLY, DATA + 11 .got 00000228 00120d50 00120d50 00028d50 2**2 CONTENTS, ALLOC, LOAD, DATA + 12 .fixed_vectors 00000140 00200040 00200040 001163c0 2**5 CONTENTS, READONLY + 13 .data 00000cac 00200180 00120f78 00030180 2**3 CONTENTS, ALLOC, LOAD, CODE + 14 .bss 0001140c 00200e2c 00121c24 00030e2c 2**4 ALLOC + 15 .ARM.attributes 0000002c 00000000 00000000 00116500 2**0 CONTENTS, READONLY + 16 .debug_ranges 000073e0 00000000 00000000 00116530 2**3 CONTENTS, READONLY, DEBUGGING + 17 .comment 00001784 00000000 00000000 0011d910 2**0 CONTENTS, READONLY + + +VMA = virtual memory area +LMA = ??? + +00100000 Flash +00200000 RAM + +00000000 Remappable Flash/RAM [_$_] + +Some sections start at 0 but this seems to be a dummy value, i.e. for DEBUGGING. + + +Entry: Reinventing linked lists +Date: Tue Sep 14 09:35:46 CEST 2010 + +Yes, I know i deserve to be slapped when implementing (sorted) linked +lists in C, but really, sometimes it's just easier to just write it +down. + +Trouble is, this is error prone. I _think_ I can just write it down +but there's always some bug in the code that's not caught by the type +system. Double pointers are notorious for this. See the following: + + struct timeout_list **tol = &a->timeouts; + while ((*tol) && ((*tol)->time < at)) { (*tol) = (*tol)->next; } + +What I really wanted to write is: + + struct timeout_list **tol = &a->timeouts; + while ((*tol) && ((*tol)->time < at)) { tol = &((*tol)->next); } + +The latter iterates, while the former removes elements! + + + +Entry: Emacs and parsing C +Date: Tue Sep 14 11:59:08 CEST 2010 + +There are some tools available, but they don't make the click to me +(i.e. CEDET). The one that cought my attention is [1]. + +The problem is quite simple: + + * build a database from your source code. + + * query the database + + * allow "replace", taking part of a syntax tree and replacing it + with something else. + + * integrate this with emacs + +The most complex part seems to be the C parser. I.e. to go from code +to (modifiable!) datastructure back to code. + + +[1] http://mike.struct.cn/blogs/entry/15/ + + +Entry: Embedding arbitrary data in ELF using objcopy +Date: Sat Sep 18 15:13:33 CEST 2010 + +Good hint from [1]: + +objcopy \ + -I binary -O elf32-i386 -B i386 \ + --rename-section .data=.rodata file.bin file.o + +Default secion is .data which is here renamed to .rodata for embedding +of const data that goes into program Flash. + +This creates 3 symbols: + +SYMBOL TABLE: +00000000 l d .rodata 00000000 .rodata +00000000 g .rodata 00000000 _binary_file_bin_start +00000007 g .rodata 00000000 _binary_file_bin_end +00000007 g *ABS* 00000000 _binary_file_bin_size + +To use different names, use something like: + -[_\e2_][_\80_][_\93_]redefine-sym _binary_file_bin_start=_my_bin_data + +[1] http://www.doof.me.uk/2010/05/07/cute-objcopy-hack/ + ) lossy conversion of complicated conflict: merger 0.0 ( hunk ./quack.txt 9101 +Entry: DLL hell, API versions, reusability and modularity +Date: Fri Sep 10 13:09:08 CEST 2010 + +I think the important element isn't really reusability - it's +modularity: being able to oversee a design by minimising coupling. + +Explicit interfaces are necessary for large projects, but they add a +positive feedback loop that leads to even larger projects. + +What is necessary is "global API optimization": some mechanism that +feeds back "global consequences" of APIs back into the APIs and +_forces everyone_ to use them. + +It's a bit like garbage collection and finalization: you need global +information (who has a reference but isn't using it) why you perform a +local operation (i want this resource now). + + +Let's call this the "global feedback problem" (GFP) and hold it +responsable for all problems in computer science. + +Yeah. GFP you suck. + + +From the other side: some local decisions have huge global impact, so +in order to make good local decisions, you need to know their impact +factor _before_ you make the decision. [_$_] + +Is there a way to somehow express this more formally? Dependency +graph of API decisions? + hunk ./quack.txt 9101 +Entry: int profile +Date: Tue Sep 7 16:22:29 CEST 2010 + +ubt orifuke + +(right hand misaligned) + ) lossy conversion of complicated conflict: merger 0.0 ( hunk ./rationalism.txt 1382 +An excerpt from [1]: + +Before I met my wife, dealing with non-rationality was never an issue. +All my friends are agnostic or atheists. Any remaining religious +feelings are closeted; I don't know about them, and can only infer +them because it's embarrasing to ask. + +All the religious people I knew where dogmatic and so easily dismissed +as "looney". I have the feeling that this polarization in early life +made me into a rationalist now. The catholic church and maybe more +its widespread cultural reverberation seems to breed atheist +scientists by pushing them away into the same cosy corner so they can +share their frustration. + +The only spiritualist I met before I met my wife is a religion +teacher. His non-dogmatic approach was the only thing that made me +even consider what he had to say. At that age (16-17) I was not a +scientist yet as I did not learn to distrust my own distorted +perception, but I knew something wasn't right. I did not have the +courage though to exclaim that I did not beleive in God. I still have +trouble saying that, with this fear installed that he might hear me +and slap me in the face. + +That fear seems to be a special case of a more general fear: the +insecurity of maybe missing other people's intent, which in the real +world means: being fooled. And a fear for oppressive authority. A +fear for people I mean no harm, but that have malevolence or +indifference towards me, allowed by their social position. + +It sounds so silly if I write it down, but it feels as if I fear that +I am being fooled by God that yes, indeed, he's very good at hiding +but really does exist after all against all odds, and will punish me +for not believing as I was told. + +Being a coward, I probably would believe under extreme torture. + +As a free man however, I do not. + + +[1] etnry://20110521-153451 merger 0.0 ( hunk ./rationalism.txt 1374 -Now, I know that for someone tending towards reductionism, I am -guillible and susceptable to beliefs that do not fit in my rational -world when the rational engine is off, so I can't rule out my own -distorted perception, but interactions with her have been strange -indeed, and very convincing. - merger 0.0 ( hunk ./rationalism.txt 1288 + + +Entry: But I just know because I saw! +Date: Sat Jun 11 11:24:51 CEST 2011 + + + +Entry: Self-describing +Date: Sat Jun 11 12:26:32 CEST 2011 + +Circular ideas. Since I'm rooted in a logic/axiomatic rational +approach, I try to see the circularity of story as a "memeplex" that +inhabits a brain. However, that theory is circular itself: it's a +nice meme that nests well. + +The really intersting question is not so much about why people believe +strange things (i.e. what is the exact point where they replace +intuition with rational understanding), but why does the circularity +seem to be essential in the first place? + +People have both circular and non-circular thought patterns. + +What are the Maxwell equations of the brain? [1] + + +Some more about my wife, who is a spiritualist. + +She speaks about the importance of story. How a collection of words +without concrete isolated meaning can give rise to meaning anyway. +The interesting part is that I think I can begin to understand how +this works. The frustrating part for me is that it is completely +incompatible with a bottom-up language as is used in science of +philosophy. + +This is what I came to understand: there is a different mode of +understanding, of harmonizing your environment, that is based on +de-rationalization. + +The main difference between the believer and the non-believer seems to +be about this different form of language: reductionist or holistic. + +If your mind has an affinity for holistic ideas and can gloss over +details to synthesize some form of "average meaning". If you have any +affinity for reductionism; If you like to open boxes instead of +keeping them closed, then there seems to be no way to keep such a +holistic picture in your head. + +For myself, with this huge affinity for decomposition, I simply cannot +step into spirit, the non-material, the acceptance of un-testable +knowledge, the acceptance of parabel as reality. And I really wonder +why she can. I can temporarily let go of the tendency to analyze and +meditate on these ideas, evaluating the story in a sandbox, but the +image doesn't stick. + +Shielded from rationality it is possible to see how these stories can +be compelling as long as they are not overly contradictory, waking up +my thinking side. Experiencing strong emotions helps the sandboxing +too. However, such sandboxing never lasts long: I can't accept these +stories as my reality. I always fall back into some form of +proto-rationality then then goes into its systematic deconstruction +trick. I cannot believe irrational ideas in the sense of knowing, +feeling they are true. + +To summarize: I can definitely understand my wife's view can be +meaningful, but I will always see these stories as part of how the +brain works, neatly embedded in natural reality. That story is just +too convincing. + +For myself, I did learn to find acceptance of not-knowing, of not +having to explain everything. For things that are simple enough to be +explained, I'll have one scientific method with cheese please. + + + + +[1] http://queue.acm.org/detail.cfm?id=1039523 + + + +Entry: Extrasensory Perception ESP +Date: Sat Jun 11 13:27:02 CEST 2011 + + +Entry: Opening up to the spiritual world +Date: Sat Jun 11 13:37:30 CEST 2011 + +Now, I know that for someone tending towards reductionism, I am +guillible and susceptable to beliefs that do not fit in my rational +world when the rational engine is off, so I can't rule out my own +distorted perception, but interactions with her have been strange +indeed, and very convincing. + +Bottom line: What I want to talk about is about what happens when you +open up for these things. I've found that in the right circumstances +I can be knocked out of my scientific plausable assumptions. + + +Entry: Fear and belief +Date: Sat Jun 11 14:26:16 CEST 2011 + merger 0.0 ( hunk ./rationalism.txt 1227 + + +Entry: Profound quiet +Date: Mon Jun 6 23:33:35 CEST 2011 + +Maybe it's about getting older (36 soon) but I'm starting to +experience moments of serene quiet that are not just about gloating in +accomplishment and truth, that are not just about me. + +Today I finished Dawkin's "The God Delusion", and I thought it would +be nice to follow it up with the book of Ecclesiastes. I can't help +but feel a bit relieved to read some old goat story as a change of +course from all that sexy young rationalism. + +I think I'm also starting to get a bit closer to accomodate both +"modes" of existence in a harmonious way, and have them move towards +each other: no longer treating science as a religion, and allowing +space for non-rational being without having it go off into silly +beliefs. + +The rationalist brain in the primate body. Both need their space. + + + +Entry: Is science just another story? +Date: Mon Jun 6 23:58:09 CEST 2011 + +I hear this a lot from non-rationalists. The strange thing is that +yes, for many people this is indeed the case. Science is a religion +for those that do not practice it. I have friends that are firmly in +that category. I don't think I understood science until I practiced +it myself (theorize, experiment, re-theorize, ...) and saw how easy I +was to be fooled by not looking carefully, and how wrong my theories +could be. There is no end to human gullibility and self-delusion. + +And that's the thing. That's what makes science not a religion: there +is a path from beliefs to facts, to reproducable experiment. It +equates truth with predictability. It's a very narrowed-down version +of truth - for practical reasons there are many beliefs or supposed +truths that cannot be recast in its language - but it is a language +that's standard. + + +Entry: It's about what you assume +Date: Tue Jun 7 14:56:31 CEST 2011 + +That's my brother's argument (a dyed-in-the-wool scientist). I think +it goes further than that: it's about how you think: not all thinking +is even axiomatic or non-cyclic! + +Funny note from Feynman[1]: [_$_] + + He used this in his lecture about the difference between physics + and mathematics: physics is not axiomatic, because it tries to find + out what's true first, meaning what is in accordance with + experience. Truth comes from nature. Then possibly, later, one + can recreate a logical tree to build that truth on top of axioms + and inference rules. Or, just leave it to the mathematicians as + they like that stuff! + +[1] http://www.youtube.com/watch?v=1SrHzSGn-I8 merger 0.0 ( hunk ./rationalism.txt 1206 + +Entry: Borders of rationality +Date: Sun Jun 5 19:31:52 CEST 2011 + +What I understand about religion is that it "makes sense" in some very +human way. As Dawkins put it: we are all born dualists. Rationality +is learned behaviour - a form of observational and mental hygiene: +rinse your eyes before you look, and cleanse your brain before you +think! + +What I do not understand is why people with a large amount of common +sense and knowledge about the modern world are not necessarily +"naturally rational". + +It is ironic that people I know who are spiritual, are so from +personal experience or intuition. From such a perspective, stories +about observation and experiment don't really work. First-hand +experience, in whatever noisy way, is a very strong glue for belief. +I've experienced this personally. Given the right circumstances, +things can get scary for a brain eager to believe and make up +theories. Both in the small and the large. + hunk ./rationalism.txt 1206 +Entry: Herstory +Date: Tue May 24 17:53:52 CEST 2011 + +Completely missing the point[1]. Story (superstition) versus +rationalism. That's the big jucy bone.. The point is not theism +within rationalism (which is, well a bit silly). The point is why is +rationalism not a universal way of thinking? And should a rationalist +respect that way? + +[1] http://en.wikipedia.org/wiki/The_God_Delusion + + + ) ) ) ) ) Finished converting.